Class ContextState

  • All Implemented Interfaces:
    Serializable

    public class ContextState
    extends Object
    implements Serializable
    A subset of information from Tracking placed on the business domain. Useful for API callers when making determinations regarding entity mutability, field-level overrides across catalogs and sandboxable field state.
    Author:
    Jeff Fischer
    See Also:
    ContextStateAware, Serialized Form
    • Constructor Detail

      • ContextState

        public ContextState​(@NonNull
                            ContextState contextState)
      • ContextState

        public ContextState()
    • Method Detail

      • getMutable

        public Boolean getMutable()
        Whether or not the entity is mutable given the requesting context. Generally, factors such as permissions and catalog mutability are considered.
        Returns:
        Whether or not the entity is mutable given the requesting context
      • getArchived

        public Boolean getArchived()
        Whether or not the entity is marked as archived. This would generally only be true when fetching entities with narrowing disabled.
        Returns:
        Whether or not the entity is marked as archived
      • getFieldChanges

        public List<FieldChange> getFieldChanges()
        Field information describing field-level changes that have been made to the entity. This can include overrides in catalog scenarios. It can also include sandbox changes for sandboxable domain.
        Returns:
        Field information describing field-level changes that have been made to the entity
      • getLevel

        public Integer getLevel()
        Used to determine whether or not a record is a user sandbox record, a higher level sandbox record, or a production record. See TrackingLevel.
        Returns:
        The current state of an item as it relates to sandbox or production status
      • getCatalog

        public ContextState.ContextCatalogInfo getCatalog()
        Information about the associated catalog if the business domain is catalog discriminated.
        Returns:
        information about the associated Catalog if the business domain is catalog discriminated
      • getSandbox

        public String getSandbox()
        The sandbox id if the business domain is a sandbox record.
        Returns:
        The sandbox id if the business domain is a sandbox record
      • getTenant

        public String getTenant()
        The ID of the associated tenant, if the business domain is tenant discriminated.
        Returns:
        ID of the associated tenant
      • getCustomerContextId

        public String getCustomerContextId()
        Returns the customer context id that is used to discriminate entities with TrackableBehavior.CUSTOMER_CONTEXT.
        Returns:
        the customer context id
      • getBaseCatalogId

        public String getBaseCatalogId()
        The id of the base catalog that the business domain is a member of.
        Returns:
        The base catalog id.
      • getOverrideCatalogId

        public String getOverrideCatalogId()
        The id of the catalog to which this entity belongs. This value will only be populated if this is an override entity. For example, an application level override of a product defined in a tenant level catalog.
        Returns:
        The override catalog id.
      • getSandboxChangeType

        @Nullable
        public String getSandboxChangeType()
        The sandbox change type associated with the entity.
        Returns:
        The sandbox change type.
        See Also:
        SandboxInfo.getChangeType()
      • setMutable

        public void setMutable​(Boolean mutable)
        Whether or not the entity is mutable given the requesting context. Generally, factors such as permissions and catalog mutability are considered.
        Parameters:
        mutable - Whether or not the entity is mutable given the requesting context
      • setArchived

        public void setArchived​(Boolean archived)
        Whether or not the entity is marked as archived. This would generally only be true when fetching entities with narrowing disabled.
        Parameters:
        archived - Whether or not the entity is marked as archived
      • setFieldChanges

        public void setFieldChanges​(List<FieldChange> fieldChanges)
        Field information describing field-level changes that have been made to the entity. This can include overrides in catalog scenarios. It can also include sandbox changes for sandboxable domain.
        Parameters:
        fieldChanges - Field information describing field-level changes that have been made to the entity
      • setLevel

        public void setLevel​(Integer level)
        Used to determine whether or not a record is a user sandbox record, a higher level sandbox record, or a production record. See TrackingLevel.
        Parameters:
        level - The current state of an item as it relates to sandbox or production status
      • setCatalog

        public void setCatalog​(ContextState.ContextCatalogInfo catalog)
        Information about the associated catalog if the business domain is catalog discriminated.
        Parameters:
        catalog - information about the associated Catalog if the business domain is catalog discriminated
      • setSandbox

        public void setSandbox​(String sandbox)
        The sandbox id if the business domain is a sandbox record.
        Parameters:
        sandbox - The sandbox id if the business domain is a sandbox record
      • setApplication

        public void setApplication​(ContextState.ContextApplicationInfo application)
        Information about the associated application if the business domain is application discriminated.
        Parameters:
        application - information about the associated Application if the business domain is application discriminated
      • setTenant

        public void setTenant​(String tenant)
        The ID of the associated tenant, if the business domain is tenant discriminated.
        Parameters:
        tenant - ID of the associated tenant
      • setCustomerContextId

        public void setCustomerContextId​(String customerContextId)
        Returns the customer context id that is used to discriminate entities with TrackableBehavior.CUSTOMER_CONTEXT.
        Parameters:
        customerContextId - the customer context id
      • setBaseCatalogId

        public void setBaseCatalogId​(String baseCatalogId)
        The id of the base catalog that the business domain is a member of.
        Parameters:
        baseCatalogId - The base catalog id.
      • setOverrideCatalogId

        public void setOverrideCatalogId​(String overrideCatalogId)
        The id of the catalog to which this entity belongs. This value will only be populated if this is an override entity. For example, an application level override of a product defined in a tenant level catalog.
        Parameters:
        overrideCatalogId - The override catalog id.
      • setSandboxChangeType

        public void setSandboxChangeType​(@Nullable
                                         String sandboxChangeType)
        The sandbox change type associated with the entity.
        Parameters:
        sandboxChangeType - The sandbox change type.
        See Also:
        SandboxInfo.getChangeType()
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object