Class ContextRequest
java.lang.Object
com.broadleafcommerce.data.tracking.core.context.ContextRequest
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 the
X-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 the
ContextRequestConverter
and included inside of ContextInfo
by
ContextInfoHandlerMethodArgumentResolver
. 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
ConstructorDescriptionContextRequest
(ContextRequest contextRequest) Create a copy of an existing ContextRequest. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
If in an account context, this represents the current account ID.Context instance of the Application entity related to this applicationId.A multitenant concept, the id for the current application.Context instance of the Catalog entity related to this catalogId.Each level within the explicit catalog hierarchy made from resolving a catalog via thecatalogId
.A multitenant concept, the id for the current catalog.If thecatalogId
is set, catalogLevel represents the sorting level of that catalog in the overall hierarchy.Metadata used to populate anyChangeEvent
created from this request.Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT
.The id for the current user sandbox.The friendly name for the current user sandbox.A multitenant concept, the id for the current tenant.int
hashCode()
boolean
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.toString()
withAccountId
(String accountId) withApplication
(Application application) withApplicationId
(String applicationId) withCatalog
(Catalog catalog) withCatalogHierarchy
(InheritanceLines catalogHierarchy) withCatalogId
(String catalogId) withCatalogLevel
(Long catalogLevel) withChangeContainer
(ChangeContainer changeContainer) withCustomerContextId
(String customerContextId) withSandBoxId
(String sandBoxId) withSandBoxName
(String sandBoxName) withTenantId
(String tenantId)
-
Constructor Details
-
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 Details
-
withSandBoxName
-
withSandBoxId
-
withCatalogId
-
withApplicationId
-
withCustomerContextId
-
withApplication
-
withCatalog
-
withCatalogHierarchy
-
withCatalogLevel
-
withTenantId
-
withAccountId
-
withChangeContainer
-
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
The friendly name for the current user sandbox.- Returns:
- The friendly name for the current user sandbox
-
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
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
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
Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT
.- Returns:
- the customer context id
-
getAccountId
If in an account context, this represents the current account ID.- Returns:
- the account id
-
getChangeContainer
Metadata used to populate anyChangeEvent
created from this request.- Returns:
- Metadata used to populate any
ChangeEvent
created from this request
-
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
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
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
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
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
The friendly name for the current user sandbox.- Parameters:
sandboxName
- The friendly name for the current user sandbox
-
setCatalogId
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
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
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
Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT
.- Parameters:
customerContextId
- the customer context id
-
setAccountId
If in an account context, this represents the current account ID.- Parameters:
accountId
- the account id
-
setChangeContainer
Metadata used to populate anyChangeEvent
created from this request.- Parameters:
changeContainer
- Metadata used to populate anyChangeEvent
created from this request
-
setApplication
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
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
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
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
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-