Class ContextState
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
-
- All Implemented Interfaces:
Serializable
public class ContextState extends Object implements Serializable
A subset of information fromTracking
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ContextState.CatalogLevelView
Intended to be used within aJsonView
to demarcate requests which should include Catalog level inContextState.ContextCatalogInfo
responses.static class
ContextState.ContextApplicationInfo
A subset of the information inApplicationInfo
for usage inContextState
.static class
ContextState.ContextCatalogInfo
A subset of the information fromCatalogInfo
for usage inContextState
.
-
Constructor Summary
Constructors Constructor Description ContextState()
ContextState(ContextState contextState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
ContextState.ContextApplicationInfo
getApplication()
Information about the associatedapplication
if the business domain is application discriminated.Boolean
getArchived()
Whether or not the entity is marked as archived.String
getBaseCatalogId()
The id of the base catalog that the business domain is a member of.ContextState.ContextCatalogInfo
getCatalog()
Information about the associatedcatalog
if the business domain is catalog discriminated.String
getCustomerContextId()
Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT
.List<FieldChange>
getFieldChanges()
Field information describing field-level changes that have been made to the entity.Integer
getLevel()
Used to determine whether or not a record is a user sandbox record, a higher level sandbox record, or a production record.Boolean
getMutable()
Whether or not the entity is mutable given the requesting context.String
getOverrideCatalogId()
The id of the catalog to which this entity belongs.String
getSandbox()
Thesandbox id
if the business domain is a sandbox record.String
getSandboxChangeType()
The sandbox change type associated with the entity.String
getTenant()
The ID of the associated tenant, if the business domain is tenant discriminated.int
hashCode()
void
setApplication(ContextState.ContextApplicationInfo application)
Information about the associatedapplication
if the business domain is application discriminated.void
setArchived(Boolean archived)
Whether or not the entity is marked as archived.void
setBaseCatalogId(String baseCatalogId)
The id of the base catalog that the business domain is a member of.void
setCatalog(ContextState.ContextCatalogInfo catalog)
Information about the associatedcatalog
if the business domain is catalog discriminated.void
setCustomerContextId(String customerContextId)
Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT
.void
setFieldChanges(List<FieldChange> fieldChanges)
Field information describing field-level changes that have been made to the entity.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.void
setMutable(Boolean mutable)
Whether or not the entity is mutable given the requesting context.void
setOverrideCatalogId(String overrideCatalogId)
The id of the catalog to which this entity belongs.void
setSandbox(String sandbox)
Thesandbox id
if the business domain is a sandbox record.void
setSandboxChangeType(String sandboxChangeType)
The sandbox change type associated with the entity.void
setTenant(String tenant)
The ID of the associated tenant, if the business domain is tenant discriminated.String
toString()
-
-
-
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. SeeTrackingLevel
.- Returns:
- The current state of an item as it relates to sandbox or production status
-
getCatalog
public ContextState.ContextCatalogInfo getCatalog()
Information about the associatedcatalog
if the business domain is catalog discriminated.- Returns:
- information about the associated
Catalog
if the business domain is catalog discriminated
-
getSandbox
public String getSandbox()
Thesandbox id
if the business domain is a sandbox record.- Returns:
- The
sandbox id
if the business domain is a sandbox record
-
getApplication
public ContextState.ContextApplicationInfo getApplication()
Information about the associatedapplication
if the business domain is application discriminated.- Returns:
- information about the associated
Application
if the business domain is application discriminated
-
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 withTrackableBehavior.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. SeeTrackingLevel
.- 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 associatedcatalog
if the business domain is catalog discriminated.- Parameters:
catalog
- information about the associatedCatalog
if the business domain is catalog discriminated
-
setSandbox
public void setSandbox(String sandbox)
Thesandbox id
if the business domain is a sandbox record.- Parameters:
sandbox
- Thesandbox id
if the business domain is a sandbox record
-
setApplication
public void setApplication(ContextState.ContextApplicationInfo application)
Information about the associatedapplication
if the business domain is application discriminated.- Parameters:
application
- information about the associatedApplication
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 withTrackableBehavior.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)
-
-