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-Requestheader. This header value is expressed as a json string and conversion is generally performed automatically by Spring in any MVC Controller implementations using theContextRequestConverterand included inside ofContextInfobyContextInfoHandlerMethodArgumentResolver. 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 SummaryConstructors Constructor Description ContextRequest()ContextRequest(ContextRequest contextRequest)Create a copy of an existing ContextRequest.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)booleanequals(Object o)StringgetAccountId()If in an account context, this represents the current account ID.ApplicationgetApplication()Context instance of the Application entity related to this applicationId.StringgetApplicationId()A multitenant concept, the id for the current application.CataloggetCatalog()Context instance of the Catalog entity related to this catalogId.InheritanceLinesgetCatalogHierarchy()Each level within the explicit catalog hierarchy made from resolving a catalog via thecatalogId.StringgetCatalogId()A multitenant concept, the id for the current catalog.LonggetCatalogLevel()If thecatalogIdis set, catalogLevel represents the sorting level of that catalog in the overall hierarchy.ChangeContainergetChangeContainer()Metadata used to populate anyChangeEventcreated from this request.StringgetCustomerContextId()Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT.StringgetSandboxId()The id for the current user sandbox.StringgetSandboxName()The friendly name for the current user sandbox.StringgetTenantId()A multitenant concept, the id for the current tenant.inthashCode()booleanisForceCatalogForFetch()Whether or not agetCatalogId()is filtered on during a fetch operation.voidsetAccountId(String accountId)If in an account context, this represents the current account ID.voidsetApplication(Application application)Context instance of the Application entity related to this applicationId.voidsetApplicationId(String applicationId)A multitenant concept, the id for the current application.voidsetCatalog(Catalog catalog)Context instance of the Catalog entity related to this catalogId.voidsetCatalogHierarchy(InheritanceLines catalogHierarchy)Each level within the explicit catalog hierarchy made from resolving a catalog via thecatalogId.voidsetCatalogId(String catalogId)A multitenant concept, the id for the current catalog.voidsetCatalogLevel(Long catalogLevel)If thecatalogIdis set, catalogLevel represents the sorting level of that catalog in the overall hierarchy.voidsetChangeContainer(ChangeContainer changeContainer)Metadata used to populate anyChangeEventcreated from this request.voidsetCustomerContextId(String customerContextId)Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT.voidsetForceCatalogForFetch(boolean forceCatalogForFetch)Whether or not agetCatalogId()is filtered on during a fetch operation.voidsetSandboxId(String sandboxId)The id for the current user sandbox.voidsetSandboxName(String sandboxName)The friendly name for the current user sandbox.voidsetTenantId(String tenantId)A multitenant concept, the id for the current tenant.StringtoString()ContextRequestwithAccountId(String accountId)ContextRequestwithApplication(Application application)ContextRequestwithApplicationId(String applicationId)ContextRequestwithCatalog(Catalog catalog)ContextRequestwithCatalogHierarchy(InheritanceLines catalogHierarchy)ContextRequestwithCatalogId(String catalogId)ContextRequestwithCatalogLevel(Long catalogLevel)ContextRequestwithCustomerContextId(String customerContextId)ContextRequestwithSandBoxId(String sandBoxId)ContextRequestwithSandBoxName(String sandBoxName)ContextRequestwithTenantId(String tenantId)
 
- 
- 
- 
Constructor Detail- 
ContextRequestpublic ContextRequest(@NonNull ContextRequest contextRequest)Create a copy of an existing ContextRequest.Note that catalogandapplicationare not deep copies.- Parameters:
- contextRequest- The ContextRequest to copy from.
 
 - 
ContextRequestpublic ContextRequest() 
 
- 
 - 
Method Detail- 
withSandBoxNamepublic ContextRequest withSandBoxName(String sandBoxName) 
 - 
withSandBoxIdpublic ContextRequest withSandBoxId(String sandBoxId) 
 - 
withCatalogIdpublic ContextRequest withCatalogId(String catalogId) 
 - 
withApplicationIdpublic ContextRequest withApplicationId(String applicationId) 
 - 
withCustomerContextIdpublic ContextRequest withCustomerContextId(String customerContextId) 
 - 
withApplicationpublic ContextRequest withApplication(Application application) 
 - 
withCatalogpublic ContextRequest withCatalog(Catalog catalog) 
 - 
withCatalogHierarchypublic ContextRequest withCatalogHierarchy(InheritanceLines catalogHierarchy) 
 - 
withCatalogLevelpublic ContextRequest withCatalogLevel(Long catalogLevel) 
 - 
withTenantIdpublic ContextRequest withTenantId(String tenantId) 
 - 
withAccountIdpublic ContextRequest withAccountId(String accountId) 
 - 
getSandboxIdpublic 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
 
 - 
getSandboxNamepublic String getSandboxName() The friendly name for the current user sandbox.- Returns:
- The friendly name for the current user sandbox
 
 - 
getCatalogIdpublic 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
 
 - 
isForceCatalogForFetchpublic 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
 
 - 
getApplicationIdpublic 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
 
 - 
getTenantIdpublic 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
 
 - 
getCustomerContextIdpublic String getCustomerContextId() Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT.- Returns:
- the customer context id
 
 - 
getAccountIdpublic String getAccountId() If in an account context, this represents the current account ID.- Returns:
- the account id
 
 - 
getChangeContainerpublic ChangeContainer getChangeContainer() Metadata used to populate anyChangeEventcreated from this request.- Returns:
- Metadata used to populate any ChangeEventcreated from this request
 
 - 
getApplicationpublic 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
 
 - 
getCatalogpublic 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
 
 - 
getCatalogHierarchypublic 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
 
 - 
getCatalogLevelpublic Long getCatalogLevel() If thecatalogIdis 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
 
 - 
setSandboxIdpublic 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
 
 - 
setSandboxNamepublic void setSandboxName(String sandboxName) The friendly name for the current user sandbox.- Parameters:
- sandboxName- The friendly name for the current user sandbox
 
 - 
setCatalogIdpublic 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
 
 - 
setForceCatalogForFetchpublic 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 a- getCatalogId()is filtered on during a fetch operation
 
 - 
setApplicationIdpublic 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
 
 - 
setTenantIdpublic 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
 
 - 
setCustomerContextIdpublic void setCustomerContextId(String customerContextId) Returns the customer context id that is used to discriminate entities withTrackableBehavior.CUSTOMER_CONTEXT.- Parameters:
- customerContextId- the customer context id
 
 - 
setAccountIdpublic void setAccountId(String accountId) If in an account context, this represents the current account ID.- Parameters:
- accountId- the account id
 
 - 
setChangeContainerpublic void setChangeContainer(ChangeContainer changeContainer) Metadata used to populate anyChangeEventcreated from this request.- Parameters:
- changeContainer- Metadata used to populate any- ChangeEventcreated from this request
 
 - 
setApplicationpublic 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
 
 - 
setCatalogpublic 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
 
 - 
setCatalogHierarchypublic 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 the- catalogId
 
 - 
setCatalogLevelpublic void setCatalogLevel(Long catalogLevel) If thecatalogIdis 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
 
 - 
canEqualprotected boolean canEqual(Object other) 
 
- 
 
-