Class DefaultDomainMapperManager

    • Constructor Detail

      • DefaultDomainMapperManager

        public DefaultDomainMapperManager​(List<DomainMapperMember> members,
                                          com.broadleafcommerce.common.extension.TypeFactory typeFactory,
                                          com.broadleafcommerce.common.extension.data.DataRouteReference reference)
      • DefaultDomainMapperManager

        public DefaultDomainMapperManager​(List<DomainMapperMember> members,
                                          List<PostMapperMember> postMembers,
                                          com.broadleafcommerce.common.extension.TypeFactory typeFactory,
                                          com.broadleafcommerce.common.extension.data.DataRouteReference reference)
    • Method Detail

      • fromBusinessDomain

        public <D> D fromBusinessDomain​(Object businessDomain,
                                        Class<D> repositoryDomainType,
                                        ContextInfo contextInfo)
        Description copied from interface: DomainMapperManager
        Map and return a populated repository domain class instance, based on information provided in a business domain instance. Usually delegates to DomainMapperMember.fromBusinessDomain(Object, Object, ContextInfo).
        Specified by:
        fromBusinessDomain in interface DomainMapperManager
        Type Parameters:
        D - The repository domain type
        Parameters:
        businessDomain - The business instance containing the relevant property information
        repositoryDomainType - The class defining the persisted domain type to return
        contextInfo - The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. See TrackableRepository for more info on persistence behavior based on context.
        Returns:
        The populated repository domain instance. Should return null if no action taken.
      • fromRepositoryDomain

        public <P> P fromRepositoryDomain​(Object repositoryDomain,
                                          Class<P> businessDomainType,
                                          ContextInfo contextInfo)
        Description copied from interface: DomainMapperManager
        Map and return a populated business domain instance, based on information provided in a repository domain instance. Usually delegates to DomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo).
        Specified by:
        fromRepositoryDomain in interface DomainMapperManager
        Type Parameters:
        P - The business domain type
        Parameters:
        repositoryDomain - The persistence-based domain instance containing the relevant property information
        businessDomainType - The class defining the business domain type to return
        contextInfo - The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. See TrackableRepository for more info on persistence behavior based on context.
        Returns:
        The populated business domain instance. Should return null if no action taken.
      • transform

        public <P,​D> void transform​(List<P> projections,
                                          @Nullable
                                          List<D> entities,
                                          @Nullable
                                          ContextInfo contextInfo)
        Description copied from interface: PostMapper
        Perform any required modifications to the list of projections. This represents an opportunity to transform the entire list of projections in bulk, or perform bulk related queries.
        Specified by:
        transform in interface PostMapper
        Type Parameters:
        P - The projection type
        D - The repository instance type
        Parameters:
        projections - List of projections to transform.
        entities - The original list of repository entities from which the projection list was derived.
        contextInfo - The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. See TrackableRepository for more info on persistence behavior based on context.
      • fromRepositoryDomainByExample

        public <P> P fromRepositoryDomainByExample​(Object repositoryDomain,
                                                   P example,
                                                   ContextInfo contextInfo)
        Description copied from interface: DomainMapperManager
        Map and return a populated business domain instance, based on information provided in a repository domain instance. Usually delegates to DomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo).
        Specified by:
        fromRepositoryDomainByExample in interface DomainMapperManager
        Type Parameters:
        P - The business domain type
        Parameters:
        repositoryDomain - The persistence-based domain instance containing the relevant property information
        example - The business domain instance
        contextInfo - The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. See TrackableRepository for more info on persistence behavior based on context.
        Returns:
        The populated business domain instance. Should return null if no action taken.
      • fromRepositoryDomain

        public <P> P fromRepositoryDomain​(BusinessTypeAware repositoryDomain,
                                          ContextInfo contextInfo)
        Description copied from interface: DomainMapperManager
        Map and return a populated business domain instance, based on information provided in a repository domain instance. Usually delegates to DomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo).
        Specified by:
        fromRepositoryDomain in interface DomainMapperManager
        Type Parameters:
        P - The business domain type
        Parameters:
        repositoryDomain - The persistence-based domain instance containing the relevant property information. This instance can produce the business domain type.
        contextInfo - The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. See TrackableRepository for more info on persistence behavior based on context.
        Returns:
        The populated business domain instance. Should return null if no action taken.
      • modifyMap

        public <D,​P> D modifyMap​(D repositoryDomain,
                                       P businessDomain,
                                       ContextInfo contextInfo,
                                       boolean allowNull)
        Description copied from interface: DomainMapper
        Perform a mapping operation from business domain instance to persistence specific instance, presumably modifying the state of the persistence specific instance.
        Specified by:
        modifyMap in interface DomainMapper
        Type Parameters:
        D - The repository domain type
        P - The business domain type
        Parameters:
        repositoryDomain - The persistence domain instance to modify
        businessDomain - The business instance containing changes to map to the repository domain
        contextInfo - The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. See TrackableRepository for more info on persistence behavior based on context.
        allowNull - Whether or not null values in properties in the payload instance should be ignored during the mapping operation.
        Returns:
        The modified repository domain instance. Return null if no action taken.
      • deleteMap

        public <D> D deleteMap​(D repositoryDomain,
                               ContextInfo contextInfo)
        Description copied from interface: DomainMapper
        In cases where deletion actually results in a modified state to persist (e.g. archived soft delete), this method will modify the state appropriately toward that end.
        Specified by:
        deleteMap in interface DomainMapper
        Type Parameters:
        D - The repository domain type
        Parameters:
        repositoryDomain - The persistence domain instance to inactivate
        contextInfo - The context information used to make tracking determinations relevant to sandboxing and multitenant concerns.
        Returns:
        The repository domain state resulting from the delete operation. Return null if no action taken.
      • getBusinessDomainType

        public <P> Class<P> getBusinessDomainType​(Object repositoryDomain)
        Description copied from interface: DomainMapper
        Ascertain the correct business domain type based on an instance of the repository domain
        Specified by:
        getBusinessDomainType in interface DomainMapper
        Parameters:
        repositoryDomain - The persistence domain instance to inspect
        Returns:
        The type of the associated business domain. Return null is not supported.