Class ContextRequest
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.context.ContextRequest
-
public class ContextRequest extends Object
Specific context information related to sandbox and/or multitenant state. This information is generally harvested from an API request over HTTP in the form of theX-Context-Request
header. This header value is expressed as a json string and conversion is generally performed automatically by Spring in any MVC Controller implementations using theContextRequestConverter
and included inside ofContextInfo
byContextInfoHandlerMethodArgumentResolver
. Therefore, you can simply include ContextInfo as a parameter to method in your request mapping method Spring will construct a valid instance for you.- Author:
- Jeff Fischer
-
-
Constructor Summary
Constructors Constructor Description ContextRequest()
ContextRequest(ContextRequest contextRequest)
Create a copy of an existing ContextRequest.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
String
getAccountId()
If in an account context, this represents the current account ID.Application
getApplication()
Context instance of the Application entity related to this applicationId.String
getApplicationId()
A multitenant concept, the id for the current application.Catalog
getCatalog()
Context instance of the Catalog entity related to this catalogId.InheritanceLines
getCatalogHierarchy()
Each level within the explicit catalog hierarchy made from resolving a catalog via thecatalogId
.String
getCatalogId()
A multitenant concept, the id for the current catalog.Long
getCatalogLevel()
If thecatalogId
is set, catalogLevel represents the sorting level of that catalog in the overall hierarchy.ChangeContainer
getChangeContainer()
Metadata used to populate anyChangeEvent
created from this request.String
getCustomerContextId()
Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT
.String
getSandboxId()
The id for the current user sandbox.String
getSandboxName()
The friendly name for the current user sandbox.String
getTenantId()
A multitenant concept, the id for the current tenant.int
hashCode()
boolean
isForceCatalogForFetch()
Whether or not agetCatalogId()
is filtered on during a fetch operation.void
setAccountId(String accountId)
If in an account context, this represents the current account ID.void
setApplication(Application application)
Context instance of the Application entity related to this applicationId.void
setApplicationId(String applicationId)
A multitenant concept, the id for the current application.void
setCatalog(Catalog catalog)
Context instance of the Catalog entity related to this catalogId.void
setCatalogHierarchy(InheritanceLines catalogHierarchy)
Each level within the explicit catalog hierarchy made from resolving a catalog via thecatalogId
.void
setCatalogId(String catalogId)
A multitenant concept, the id for the current catalog.void
setCatalogLevel(Long catalogLevel)
If thecatalogId
is set, catalogLevel represents the sorting level of that catalog in the overall hierarchy.void
setChangeContainer(ChangeContainer changeContainer)
Metadata used to populate anyChangeEvent
created from this request.void
setCustomerContextId(String customerContextId)
Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT
.void
setForceCatalogForFetch(boolean forceCatalogForFetch)
Whether or not agetCatalogId()
is filtered on during a fetch operation.void
setSandboxId(String sandboxId)
The id for the current user sandbox.void
setSandboxName(String sandboxName)
The friendly name for the current user sandbox.void
setTenantId(String tenantId)
A multitenant concept, the id for the current tenant.String
toString()
ContextRequest
withAccountId(String accountId)
ContextRequest
withApplication(Application application)
ContextRequest
withApplicationId(String applicationId)
ContextRequest
withCatalog(Catalog catalog)
ContextRequest
withCatalogHierarchy(InheritanceLines catalogHierarchy)
ContextRequest
withCatalogId(String catalogId)
ContextRequest
withCatalogLevel(Long catalogLevel)
ContextRequest
withCustomerContextId(String customerContextId)
ContextRequest
withSandBoxId(String sandBoxId)
ContextRequest
withSandBoxName(String sandBoxName)
ContextRequest
withTenantId(String tenantId)
-
-
-
Constructor Detail
-
ContextRequest
public ContextRequest(@NonNull ContextRequest contextRequest)
Create a copy of an existing ContextRequest.Note that
catalog
andapplication
are not deep copies.- Parameters:
contextRequest
- The ContextRequest to copy from.
-
ContextRequest
public ContextRequest()
-
-
Method Detail
-
withSandBoxName
public ContextRequest withSandBoxName(String sandBoxName)
-
withSandBoxId
public ContextRequest withSandBoxId(String sandBoxId)
-
withCatalogId
public ContextRequest withCatalogId(String catalogId)
-
withApplicationId
public ContextRequest withApplicationId(String applicationId)
-
withCustomerContextId
public ContextRequest withCustomerContextId(String customerContextId)
-
withApplication
public ContextRequest withApplication(Application application)
-
withCatalog
public ContextRequest withCatalog(Catalog catalog)
-
withCatalogHierarchy
public ContextRequest withCatalogHierarchy(InheritanceLines catalogHierarchy)
-
withCatalogLevel
public ContextRequest withCatalogLevel(Long catalogLevel)
-
withTenantId
public ContextRequest withTenantId(String tenantId)
-
withAccountId
public ContextRequest withAccountId(String accountId)
-
getSandboxId
public String getSandboxId()
The id for the current user sandbox. This is used to discriminate results in order to make sure CRUD operations are executed against the right version of an entity. Multiple versions will share the same context id.- Returns:
- The id for the current user sandbox
-
getSandboxName
public String getSandboxName()
The friendly name for the current user sandbox.- Returns:
- The friendly name for the current user sandbox
-
getCatalogId
public String getCatalogId()
A multitenant concept, the id for the current catalog. This is used to discriminate results in order to make sure CRUD operations are executed against the right version of an entity.- Returns:
- The id for the current catalog
-
isForceCatalogForFetch
public boolean isForceCatalogForFetch()
Whether or not agetCatalogId()
is filtered on during a fetch operation. When false, any catalogs visible to the current application are used to filter instead. Setting this to true is useful when you want limit results to a specific catalog visible to the current application, regardless of whether or not the current application has visibility into more catalogs.- Returns:
- Whether or not a
getCatalogId()
is filtered on during a fetch operation
-
getApplicationId
public String getApplicationId()
A multitenant concept, the id for the current application. Catalogs are generally associated with applications. This is used to discriminate results in order to make sure CRUD operations are executed against the right version of an entity.- Returns:
- The id for the current application
-
getTenantId
public String getTenantId()
A multitenant concept, the id for the current tenant. Represents the distinct, completely independent contexts, for example owned by separate companies. Applications always belong to a tenant.- Returns:
- The id for the current tenant
-
getCustomerContextId
public String getCustomerContextId()
Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT
.- Returns:
- the customer context id
-
getAccountId
public String getAccountId()
If in an account context, this represents the current account ID.- Returns:
- the account id
-
getChangeContainer
public ChangeContainer getChangeContainer()
Metadata used to populate anyChangeEvent
created from this request.- Returns:
- Metadata used to populate any
ChangeEvent
created from this request
-
getApplication
public Application getApplication()
Context instance of the Application entity related to this applicationId. This is not a value that is generally populated via JSON. Rather, this variable is generally calculated via lookup of application using applicationId in theContextRequestConverter
.- Returns:
- Context instance of the Application entity related to this applicationId
-
getCatalog
public Catalog getCatalog()
Context instance of the Catalog entity related to this catalogId. This is not a value that is generally populated via JSON. Rather, this variable is generally calculated via lookup of catalog using catalogId in theContextRequestHydrator
.- Returns:
- Context instance of the Catalog entity related to this catalogId or null if there was no catalogId given
-
getCatalogHierarchy
public InheritanceLines getCatalogHierarchy()
Each level within the explicit catalog hierarchy made from resolving a catalog via thecatalogId
. This can be used to obtain the a list of the contextIds for the deep catalog tree parents. This is not a value that is generally populated via JSON. Rather, this variable is generally calculated via lookup of catalog using catalogId in theContextRequestHydrator
.- Returns:
- the deep catalog tree parenting the
catalogId
-
getCatalogLevel
public Long getCatalogLevel()
If thecatalogId
is set, catalogLevel represents the sorting level of that catalog in the overall hierarchy. This is not a value that is generally populated via JSON. Rather, this variable is generally calculated via lookup of application using applicationId in theContextRequestHydrator
.- Returns:
- Represents the sorting level of that catalog in the overall hierarchy
-
setSandboxId
public void setSandboxId(String sandboxId)
The id for the current user sandbox. This is used to discriminate results in order to make sure CRUD operations are executed against the right version of an entity. Multiple versions will share the same context id.- Parameters:
sandboxId
- The id for the current user sandbox
-
setSandboxName
public void setSandboxName(String sandboxName)
The friendly name for the current user sandbox.- Parameters:
sandboxName
- The friendly name for the current user sandbox
-
setCatalogId
public void setCatalogId(String catalogId)
A multitenant concept, the id for the current catalog. This is used to discriminate results in order to make sure CRUD operations are executed against the right version of an entity.- Parameters:
catalogId
- The id for the current catalog
-
setForceCatalogForFetch
public void setForceCatalogForFetch(boolean forceCatalogForFetch)
Whether or not agetCatalogId()
is filtered on during a fetch operation. When false, any catalogs visible to the current application are used to filter instead. Setting this to true is useful when you want limit results to a specific catalog visible to the current application, regardless of whether or not the current application has visibility into more catalogs.- Parameters:
forceCatalogForFetch
- Whether or not agetCatalogId()
is filtered on during a fetch operation
-
setApplicationId
public void setApplicationId(String applicationId)
A multitenant concept, the id for the current application. Catalogs are generally associated with applications. This is used to discriminate results in order to make sure CRUD operations are executed against the right version of an entity.- Parameters:
applicationId
- The id for the current application
-
setTenantId
public void setTenantId(String tenantId)
A multitenant concept, the id for the current tenant. Represents the distinct, completely independent contexts, for example owned by separate companies. Applications always belong to a tenant.- Parameters:
tenantId
- The id for the current 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
-
setAccountId
public void setAccountId(String accountId)
If in an account context, this represents the current account ID.- Parameters:
accountId
- the account id
-
setChangeContainer
public void setChangeContainer(ChangeContainer changeContainer)
Metadata used to populate anyChangeEvent
created from this request.- Parameters:
changeContainer
- Metadata used to populate anyChangeEvent
created from this request
-
setApplication
public void setApplication(Application application)
Context instance of the Application entity related to this applicationId. This is not a value that is generally populated via JSON. Rather, this variable is generally calculated via lookup of application using applicationId in theContextRequestConverter
.- Parameters:
application
- Context instance of the Application entity related to this applicationId
-
setCatalog
public void setCatalog(Catalog catalog)
Context instance of the Catalog entity related to this catalogId. This is not a value that is generally populated via JSON. Rather, this variable is generally calculated via lookup of catalog using catalogId in theContextRequestHydrator
.- Parameters:
catalog
- Context instance of the Catalog entity related to this catalogId
-
setCatalogHierarchy
public void setCatalogHierarchy(InheritanceLines catalogHierarchy)
Each level within the explicit catalog hierarchy made from resolving a catalog via thecatalogId
. This can be used to obtain the a list of the contextIds for the deep catalog tree parents. This is not a value that is generally populated via JSON. Rather, this variable is generally calculated via lookup of catalog using catalogId in theContextRequestHydrator
.- Parameters:
catalogHierarchy
- the deep catalog tree parenting thecatalogId
-
setCatalogLevel
public void setCatalogLevel(Long catalogLevel)
If thecatalogId
is set, catalogLevel represents the sorting level of that catalog in the overall hierarchy. This is not a value that is generally populated via JSON. Rather, this variable is generally calculated via lookup of application using applicationId in theContextRequestHydrator
.- Parameters:
catalogLevel
- Represents the sorting level of that catalog in the overall hierarchy
-
canEqual
protected boolean canEqual(Object other)
-
-