Class GraphQLTypeFactoryImpl
- java.lang.Object
-
- org.craftercms.engine.graphql.impl.type.GraphQLTypeFactoryImpl
-
- All Implemented Interfaces:
GraphQLTypeFactory
public class GraphQLTypeFactoryImpl extends Object implements GraphQLTypeFactory
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTENT_TYPE_REGEX_PAGE
protected String
contentTypeFieldIdXPath
protected String
contentTypeFieldsXPath
protected String
contentTypeFieldTitleXPath
protected String
contentTypeFieldTypeXPath
protected String
contentTypeNameXPath
XPath selectors for the content-type definition fileprotected String
contentTypeTitleXPath
protected Map<String,graphql.schema.DataFetcher>
customFetchers
CustomDataFetcher
s to use for specific fieldsprotected Map<String,GraphQLFieldFactory>
fieldFactories
All known field factories to use during type buildprotected String[]
ignoredFields
The list of fields that should not be added to theGraphQLSchema
protected String
rootQueryTypeName
The name for the root Query type
-
Constructor Summary
Constructors Constructor Description GraphQLTypeFactoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createField(org.dom4j.Document contentTypeDefinition, org.dom4j.Node contentTypeField, String parentGraphQLTypeName, graphql.schema.GraphQLObjectType.Builder parentGraphQLType)
Creates a GraphQL field for the given content-type field and adds it to the given GraphQL typevoid
createType(org.craftercms.core.service.Item formDefinition, graphql.schema.GraphQLObjectType.Builder rootGraphQLType, graphql.schema.GraphQLCodeRegistry.Builder codeRegistry, graphql.schema.DataFetcher<?> dataFetcher, Map<String,graphql.schema.GraphQLObjectType.Builder> siteTypes)
Creates a GraphQL type for the given content-type and adds a field in the root typevoid
setContentTypeFieldIdXPath(String contentTypeFieldIdXPath)
void
setContentTypeFieldsXPath(String contentTypeFieldsXPath)
void
setContentTypeFieldTitleXPath(String contentTypeFieldTitleXPath)
void
setContentTypeFieldTypeXPath(String contentTypeFieldTypeXPath)
void
setContentTypeNameXPath(String contentTypeNameXPath)
void
setContentTypeTitleXPath(String contentTypeTitleXPath)
void
setCustomFetchers(Map<String,graphql.schema.DataFetcher> customFetchers)
void
setFieldFactories(Map<String,GraphQLFieldFactory> fieldFactories)
void
setIgnoredFields(String[] ignoredFields)
void
setRootQueryTypeName(String rootQueryTypeName)
-
-
-
Field Detail
-
CONTENT_TYPE_REGEX_PAGE
public static final String CONTENT_TYPE_REGEX_PAGE
- See Also:
- Constant Field Values
-
rootQueryTypeName
protected String rootQueryTypeName
The name for the root Query type
-
ignoredFields
protected String[] ignoredFields
The list of fields that should not be added to theGraphQLSchema
-
contentTypeNameXPath
protected String contentTypeNameXPath
XPath selectors for the content-type definition file
-
contentTypeTitleXPath
protected String contentTypeTitleXPath
-
contentTypeFieldsXPath
protected String contentTypeFieldsXPath
-
contentTypeFieldIdXPath
protected String contentTypeFieldIdXPath
-
contentTypeFieldTypeXPath
protected String contentTypeFieldTypeXPath
-
contentTypeFieldTitleXPath
protected String contentTypeFieldTitleXPath
-
fieldFactories
protected Map<String,GraphQLFieldFactory> fieldFactories
All known field factories to use during type build
-
-
Method Detail
-
setCustomFetchers
public void setCustomFetchers(Map<String,graphql.schema.DataFetcher> customFetchers)
-
setRootQueryTypeName
public void setRootQueryTypeName(String rootQueryTypeName)
-
setIgnoredFields
public void setIgnoredFields(String[] ignoredFields)
-
setContentTypeNameXPath
public void setContentTypeNameXPath(String contentTypeNameXPath)
-
setContentTypeTitleXPath
public void setContentTypeTitleXPath(String contentTypeTitleXPath)
-
setContentTypeFieldsXPath
public void setContentTypeFieldsXPath(String contentTypeFieldsXPath)
-
setContentTypeFieldIdXPath
public void setContentTypeFieldIdXPath(String contentTypeFieldIdXPath)
-
setContentTypeFieldTypeXPath
public void setContentTypeFieldTypeXPath(String contentTypeFieldTypeXPath)
-
setContentTypeFieldTitleXPath
public void setContentTypeFieldTitleXPath(String contentTypeFieldTitleXPath)
-
setFieldFactories
public void setFieldFactories(Map<String,GraphQLFieldFactory> fieldFactories)
-
createType
public void createType(org.craftercms.core.service.Item formDefinition, graphql.schema.GraphQLObjectType.Builder rootGraphQLType, graphql.schema.GraphQLCodeRegistry.Builder codeRegistry, graphql.schema.DataFetcher<?> dataFetcher, Map<String,graphql.schema.GraphQLObjectType.Builder> siteTypes)
Creates a GraphQL type for the given content-type and adds a field in the root type- Specified by:
createType
in interfaceGraphQLTypeFactory
- Parameters:
formDefinition
- the XML definition of the content-typerootGraphQLType
- theGraphQLObjectType
for the root querycodeRegistry
- theGraphQLCodeRegistry
to addDataFetcher
for new fieldsdataFetcher
- theDataFetcher
to use for the new fieldssiteTypes
- all content-type related types
-
createField
public void createField(org.dom4j.Document contentTypeDefinition, org.dom4j.Node contentTypeField, String parentGraphQLTypeName, graphql.schema.GraphQLObjectType.Builder parentGraphQLType)
Creates a GraphQL field for the given content-type field and adds it to the given GraphQL type- Specified by:
createField
in interfaceGraphQLTypeFactory
- Parameters:
contentTypeDefinition
- the XML definition of the content-typecontentTypeField
- the XML node for the content-type fieldparentGraphQLTypeName
- the field's parent GraphQL type nameparentGraphQLType
- the field's parentGraphQLObjectType
-
-