@Component(value="blSandBoxHelper") public class DefaultSandBoxHelper extends Object implements SandBoxHelper
SandBoxHelperSandBoxHelper.OriginalIdResponse| Constructor and Description |
|---|
DefaultSandBoxHelper() |
| Modifier and Type | Method and Description |
|---|---|
Long |
getCascadedProductionStateId(Class<?> linkedObjectType,
Long requestedParent)
Find the production sandbox clone, if any, in the current site for the supplied type and primary key value.
|
SandBoxHelper.OriginalIdResponse |
getOriginalId(Class<?> type,
Long id)
Return the original id for the requested id.
|
Long |
getOriginalId(Object test) |
SandBoxHelper.OriginalIdResponse |
getProductionOriginalId(Class<?> type,
Long id)
Return the original id for the requested id as if this was a production request.
|
Long |
getProductionRecordIdIfApplicable(javax.persistence.EntityManager em,
Object startFieldValue) |
com.google.common.collect.BiMap<Long,Long> |
getSandBoxToOriginalMap(Class<?> type,
Long... originalIds)
Retrieve a map keyed by sandbox id, with the value being the matching original
item id for that sandbox item.
|
Long |
getSandBoxVersionId(Class<?> linkedObjectType,
Long requestedParent)
Return the sandbox version id for the requested original id.
|
<T> T |
getTopMostOriginalRecord(T record)
If record is sandboxable, check to see if an original version of the passed in record exists.
|
Long |
getTopmostProductionOriginalId(Class<?> type,
Long id)
Returns the topmost production id for the given type.
|
void |
ignoreCloneCache(boolean ignoreCache)
Set when you want to override caching behavior related to finding sandbox versions.
|
boolean |
isPromote()
Is the current thread involved in a promote operation?
|
boolean |
isReject()
Is the current thread involved in a reject operation?
|
boolean |
isRelatedToParentCatalogIds(Object entity,
Long... candidateRelatedIds)
Determine if the current entity is related via propagation inheritance to any of the candidate primary key
values.
|
boolean |
isReplayOperation()
Is the current thread involved in a replay operation (i.e.
|
boolean |
isSandBoxable(String className)
Whether or not the class is sandboxable
|
List<Long> |
mergeCloneIds(Class<?> type,
Long... originalIds)
Retrieve a list of values that includes the the original ids passed in and any
sandbox versions of those ids, if available.
|
void |
optionallyIncludeDeletedItemsInQueriesAndCollections(Runnable runnable,
boolean includeDeleted)
For the passed in code block (Runnable), whether or not sandbox entities marked
as deleted should be included in any results from queries or lazy collection
retrievals.
|
Long |
retrieveCascadedState(Class<?> ceilingImpl,
Long requestedParent,
javax.persistence.EntityManager em)
Find the production version of an entity in the current catalog.
|
public Long getSandBoxVersionId(Class<?> linkedObjectType, Long requestedParent)
SandBoxHelpergetSandBoxVersionId in interface SandBoxHelperlinkedObjectType - the type of the entity in questionrequestedParent - the id to checkpublic Long getCascadedProductionStateId(Class<?> linkedObjectType, Long requestedParent)
SandBoxHelpergetCascadedProductionStateId in interface SandBoxHelperpublic Long retrieveCascadedState(Class<?> ceilingImpl, Long requestedParent, javax.persistence.EntityManager em)
SandBoxHelperSandBoxHelper.getCascadedProductionStateId(Class, Long)
in that the other is only targeting the production state existing as an override in a standard site. However, in contrast,
this method will find the current production version in the current catalog related to a parent catalog version id, regardless
if the current catalog belongs to a standard site or a template site.retrieveCascadedState in interface SandBoxHelperpublic boolean isRelatedToParentCatalogIds(Object entity, Long... candidateRelatedIds)
SandBoxHelperisRelatedToParentCatalogIds in interface SandBoxHelperpublic List<Long> mergeCloneIds(Class<?> type, Long... originalIds)
SandBoxHelpermergeCloneIds in interface SandBoxHelpertype - the type of the entity in questionoriginalIds - one or more ids values for which sandbox versions should be includedpublic com.google.common.collect.BiMap<Long,Long> getSandBoxToOriginalMap(Class<?> type, Long... originalIds)
SandBoxHelpergetSandBoxToOriginalMap in interface SandBoxHelpertype - the type of the entity in questionoriginalIds - list of ids to checkpublic Long getTopmostProductionOriginalId(Class<?> type, Long id)
SandBoxHelperReturns the topmost production id for the given type. The given id can exist anywhere in the hierarchy of production clones. The most hiearchies that can exist is this:
Production versions of entities can thus exist in 3 places: catalog1, catalog2, and the STANDARD site overrides. This supports IDs at all levels in the hierarchy, and will always return the production id from catalog1:
If no results are found for the given type and id (or the id is already the topmost production id) then id is returned.
While the example given was for catalog hierarchies, this method also supports PROFILE hierarchies for CMS data
getTopmostProductionOriginalId in interface SandBoxHelpertype - the class name of the entity type to get the clone forid - a primary key anywhere in the hiearchy of overridespublic SandBoxHelper.OriginalIdResponse getOriginalId(Class<?> type, Long id)
SandBoxHelpergetOriginalId in interface SandBoxHelpertype - the type of the entity in questionid - the id to checkpublic Long getOriginalId(Object test)
getOriginalId in interface SandBoxHelperpublic SandBoxHelper.OriginalIdResponse getProductionOriginalId(Class<?> type, Long id)
SandBoxHelpergetProductionOriginalId in interface SandBoxHelperpublic boolean isSandBoxable(String className)
SandBoxHelperisSandBoxable in interface SandBoxHelperclassName - the classname to checkpublic boolean isPromote()
SandBoxHelperisPromote in interface SandBoxHelperpublic boolean isReject()
SandBoxHelperisReject in interface SandBoxHelperpublic boolean isReplayOperation()
SandBoxHelperisReplayOperation in interface SandBoxHelperpublic void optionallyIncludeDeletedItemsInQueriesAndCollections(Runnable runnable, boolean includeDeleted)
SandBoxHelperoptionallyIncludeDeletedItemsInQueriesAndCollections in interface SandBoxHelperrunnable - the block of code for which this setting should be in effectincludeDeleted - whether or not to include deleted sandbox itemspublic Long getProductionRecordIdIfApplicable(javax.persistence.EntityManager em, Object startFieldValue)
getProductionRecordIdIfApplicable in interface SandBoxHelperpublic <T> T getTopMostOriginalRecord(T record)
SandBoxHelpergetTopMostOriginalRecord in interface SandBoxHelperrecord - the entity instance to checkpublic void ignoreCloneCache(boolean ignoreCache)
SandBoxHelperignoreCloneCache in interface SandBoxHelperCopyright © 2022. All rights reserved.