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 Details

    • CONTENT_TYPE_REGEX_PAGE

      public static final String CONTENT_TYPE_REGEX_PAGE
      See Also:
    • 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 the GraphQLSchema
    • 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
    • customFetchers

      protected Map<String,graphql.schema.DataFetcher> customFetchers
      Custom DataFetchers 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

      @Autowired public void setFieldFactories(@Lazy 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 interface GraphQLTypeFactory
      Parameters:
      formDefinition - the XML definition of the content-type
      rootGraphQLType - the GraphQLObjectType for the root query
      codeRegistry - the GraphQLCodeRegistry to add DataFetcher for new fields
      dataFetcher - the DataFetcher to use for the new fields
      siteTypes - 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 interface GraphQLTypeFactory
      Parameters:
      contentTypeDefinition - the XML definition of the content-type
      contentTypeField - the XML node for the content-type field
      parentGraphQLTypeName - the field's parent GraphQL type name
      parentGraphQLType - the field's parent GraphQLObjectType