Class GraphQLTypeFactoryImpl

    • Field Detail

      • 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
      • customFetchers

        protected Map<String,​graphql.schema.DataFetcher> customFetchers
        Custom DataFetchers to use for specific fields
    • Constructor Detail

      • GraphQLTypeFactoryImpl

        public GraphQLTypeFactoryImpl()
    • 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)
      • 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