Class GraphQLTypeFactoryImpl
java.lang.Object
org.craftercms.engine.graphql.impl.type.GraphQLTypeFactoryImpl
- All Implemented Interfaces:
GraphQLTypeFactory
- Author:
- joseross
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected StringXPath selectors for the content-type definition fileprotected StringCustomDataFetchers to use for specific fieldsprotected Map<String, GraphQLFieldFactory> All known field factories to use during type buildprotected String[]The list of fields that should not be added to theGraphQLSchemaprotected StringThe name for the root Query type -
Constructor Summary
ConstructorsConstructorDescriptionGraphQLTypeFactoryImpl(Map<String, graphql.schema.DataFetcher> customFetchers, String rootQueryTypeName, String[] ignoredFields, String contentTypeNameXPath, String contentTypeTitleXPath, String contentTypeFieldsXPath, String contentTypeFieldIdXPath, String contentTypeFieldTypeXPath, String contentTypeFieldTitleXPath) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateField(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 typevoidcreateType(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 typevoidsetFieldFactories(Map<String, GraphQLFieldFactory> fieldFactories)
-
Field Details
-
CONTENT_TYPE_REGEX_PAGE
- See Also:
-
rootQueryTypeName
The name for the root Query type -
ignoredFields
The list of fields that should not be added to theGraphQLSchema -
contentTypeNameXPath
XPath selectors for the content-type definition file -
contentTypeTitleXPath
-
contentTypeFieldsXPath
-
contentTypeFieldIdXPath
-
contentTypeFieldTypeXPath
-
contentTypeFieldTitleXPath
-
fieldFactories
All known field factories to use during type build -
customFetchers
CustomDataFetchers to use for specific fields
-
-
Constructor Details
-
GraphQLTypeFactoryImpl
public GraphQLTypeFactoryImpl(Map<String, graphql.schema.DataFetcher> customFetchers, String rootQueryTypeName, String[] ignoredFields, String contentTypeNameXPath, String contentTypeTitleXPath, String contentTypeFieldsXPath, String contentTypeFieldIdXPath, String contentTypeFieldTypeXPath, String contentTypeFieldTitleXPath)
-
-
Method Details
-
setFieldFactories
-
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:
createTypein interfaceGraphQLTypeFactory- Parameters:
formDefinition- the XML definition of the content-typerootGraphQLType- theGraphQLObjectTypefor the root querycodeRegistry- theGraphQLCodeRegistryto addDataFetcherfor new fieldsdataFetcher- theDataFetcherto 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:
createFieldin 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
-