Class SandboxApplicationContextMutabilityDomainMapperMember

java.lang.Object
com.broadleafcommerce.sandbox.service.mapping.SandboxApplicationContextMutabilityDomainMapperMember
All Implemented Interfaces:
com.broadleafcommerce.common.extension.data.DataRoutePartitionAware, com.broadleafcommerce.data.tracking.core.mapping.DomainMapper, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember, org.springframework.core.Ordered

public class SandboxApplicationContextMutabilityDomainMapperMember extends Object implements com.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember
Since the persisted-domain counterpart of Sandbox is tenant-trackable, the default context state mutability of a sandbox from an application context will be false. However, in SandboxEndpoint, we do support mutating sandboxes from an application context if it matches the application of the sandbox. Thus, this mapper member will override the value.
Author:
Samarth Dhruva (samarthd)
  • Constructor Details

    • SandboxApplicationContextMutabilityDomainMapperMember

      public SandboxApplicationContextMutabilityDomainMapperMember()
  • Method Details

    • getDataRoutePartition

      public String getDataRoutePartition()
      Specified by:
      getDataRoutePartition in interface com.broadleafcommerce.common.extension.data.DataRoutePartitionAware
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface com.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • fromRepositoryDomain

      public <P> P fromRepositoryDomain(Object repositoryDomain, P businessDomain, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Specified by:
      fromRepositoryDomain in interface com.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember
    • markContextStateMutableIfContextAppMatchesSandbox

      @Nullable protected Sandbox markContextStateMutableIfContextAppMatchesSandbox(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Sandbox sandbox)
      Sets the Sandbox.getContextState() as ContextState.getMutable() if the ContextRequest.getApplication() matches the Sandbox.getApplication().
      Parameters:
      contextInfo - context information surrounding multitenant state
      sandbox - the sandbox whose context state should be set as mutable
      Returns:
      the given sandbox if its context state mutability was successfully set, null if nothing was changed