Interface DomainMapperManager

All Superinterfaces:
DomainMapper, PostMapper
All Known Implementing Classes:
DefaultDomainMapperManager

public interface DomainMapperManager extends DomainMapper, PostMapper
Manages one or more DomainMapperMember instances as a transformation pipeline between domain types. Often used by CrudEntityService implementations to convert between repository domain class instances and their respective business domain instances (or vice versa).

DomainMapperManager may be used regardless of the backing repository plaform. It is agnostic to the backing domain class type (or backing repository). If not using out-of-the-box ModelMapper support, individual DomainMapperMember instances may be employed to handle repository specific mapping use cases.

An entity implementation will generally define a mapping approach between the repository domain class and the business domain class. See ModelMapperMappable, which should be implemented by top level repository domain class implementations when using the out-of-the-box support provided by ModelMapperDomainMapperMember. Different DomainMapperMember instances may be used to achieve transformation via a different mapping approach.

Author:
Jeff Fischer
  • Method Details

    • fromBusinessDomain

      @Nullable default <D> D fromBusinessDomain(Object businessDomain, Class<D> repositoryDomainType, @Nullable ContextInfo contextInfo)
      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).
      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

      @Nullable default <P> P fromRepositoryDomain(Object repositoryDomain, Class<P> businessDomainType, @Nullable ContextInfo contextInfo)
      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).
      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.
    • fromRepositoryDomainByExample

      @Nullable default <P> P fromRepositoryDomainByExample(Object repositoryDomain, P example, @Nullable ContextInfo contextInfo)
      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).
      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

      <P> P fromRepositoryDomain(BusinessTypeAware repositoryDomain, ContextInfo contextInfo)
      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).
      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.
    • process

      <P> P process(Object repositoryDomain, ContextInfo contextInfo)
      Type Parameters:
      P - The projection type
      Parameters:
      repositoryDomain - The originating repository 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 mapped and transformed projection
    • process

      <P> Stream<P> process(Stream<?> repositoryDomain, ContextInfo contextInfo)
      Type Parameters:
      P - The projection type
      Parameters:
      repositoryDomain - The originating repository domain instances in the form of a stream
      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 mapped and transformed stream of projection instances
    • process

      <P> List<P> process(List<?> repositoryDomain, ContextInfo contextInfo)
      Type Parameters:
      P - The projection type
      Parameters:
      repositoryDomain - The originating repository domain instances in the form of a list
      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 mapped and transformed list of projection instances
    • process

      <P> org.springframework.data.domain.Page<P> process(org.springframework.data.domain.Page<?> repositoryDomain, ContextInfo contextInfo)
      Type Parameters:
      P - The projection type
      Parameters:
      repositoryDomain - The originating repository domain instances in the form of a page of content.
      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 mapped and transformed page of projection instances
    • convertFromPersistentDomain

      @Nullable default <P> P convertFromPersistentDomain(Object domain, @Nullable ContextInfo contextInfo)
      Similar to fromRepositoryDomain(Object, Class, ContextInfo), but doesn't require the caller to know the business domain type. In effect, this call combines the DomainMapper.getBusinessDomainType(Object) and fromRepositoryDomain(Object, Class, ContextInfo) into a single call.
      Parameters:
      domain - The repository domain instance
      contextInfo - Optional context information. Useful if the domain param is Trackable.
      Returns:
      The converted business domain instance
    • getTypeFactory

      com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()