@Component(value="blSandBoxHelper") public class DefaultSandBoxHelper extends Object implements SandBoxHelper
SandBoxHelper
SandBoxHelper.OriginalIdResponse, SandBoxHelper.QueryHints
Constructor and Description |
---|
DefaultSandBoxHelper() |
Modifier and Type | Method and Description |
---|---|
void |
archiveObject(Object start,
javax.persistence.EntityManager em)
Archive an object so that it is no longer recognized
by the sandbox support
|
SandBoxHelper.OriginalIdResponse |
getOriginalId(javax.persistence.EntityManager em,
Class<?> type,
Long id)
Return the original id for the requested id.
|
String[] |
getSandBoxDiscriminatorFieldList()
Retrieve the field names related to sandbox support
|
com.google.common.collect.BiMap<Long,Long> |
getSandBoxToOriginalMap(javax.persistence.EntityManager em,
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(javax.persistence.EntityManager entityManager,
Class<?> linkedObjectType,
Long requestedParent)
Return the sandbox version id for the requested original id.
|
Long |
getSandBoxVersionId(javax.persistence.EntityManager entityManager,
Class<?> linkedObjectType,
Long requestedParent,
Boolean includeSandBoxInheritance)
Return the sandbox version id for the requested original id.
|
boolean |
isPromote()
Is the current thread involved in a promote operation?
|
boolean |
isReject()
Is the current thread involved in a reject operation?
|
boolean |
isSandBoxable(String className)
Whether or not the class is sandboxable
|
List<Long> |
mergeCloneIds(javax.persistence.EntityManager em,
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.
|
void |
setupSandBoxState(Object clone,
javax.persistence.EntityManager em)
Setup basic required fields for sandbox support
|
public Long getSandBoxVersionId(javax.persistence.EntityManager entityManager, Class<?> linkedObjectType, Long requestedParent)
SandBoxHelper
getSandBoxVersionId
in interface SandBoxHelper
entityManager
- the Entity ManagerlinkedObjectType
- the type of the entity in questionrequestedParent
- the id to checkpublic Long getSandBoxVersionId(javax.persistence.EntityManager entityManager, Class<?> linkedObjectType, Long requestedParent, Boolean includeSandBoxInheritance)
SandBoxHelper
getSandBoxVersionId
in interface SandBoxHelper
entityManager
- the Entity ManagerlinkedObjectType
- the type of the entity in questionrequestedParent
- the id to checkincludeSandBoxInheritance
- override whether or not parent sandbox ids should be included in the query. Can be null - True by default.public List<Long> mergeCloneIds(javax.persistence.EntityManager em, Class<?> type, Long... originalIds)
SandBoxHelper
mergeCloneIds
in interface SandBoxHelper
em
- the Entity Managertype
- 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(javax.persistence.EntityManager em, Class<?> type, Long... originalIds)
SandBoxHelper
getSandBoxToOriginalMap
in interface SandBoxHelper
em
- the Entity Managertype
- the type of the entity in questionoriginalIds
- list of ids to checkpublic SandBoxHelper.OriginalIdResponse getOriginalId(javax.persistence.EntityManager em, Class<?> type, Long id)
SandBoxHelper
getOriginalId
in interface SandBoxHelper
em
- the Entity Managertype
- the type of the entity in questionid
- the id to checkpublic void setupSandBoxState(Object clone, javax.persistence.EntityManager em)
SandBoxHelper
setupSandBoxState
in interface SandBoxHelper
clone
- the entity instance to setupem
- the Entity Managerpublic void archiveObject(Object start, javax.persistence.EntityManager em)
SandBoxHelper
archiveObject
in interface SandBoxHelper
start
- the object to archiveem
- the Entity Managerpublic String[] getSandBoxDiscriminatorFieldList()
SandBoxHelper
getSandBoxDiscriminatorFieldList
in interface SandBoxHelper
public boolean isSandBoxable(String className)
SandBoxHelper
isSandBoxable
in interface SandBoxHelper
className
- the classname to checkpublic boolean isPromote()
SandBoxHelper
isPromote
in interface SandBoxHelper
public boolean isReject()
SandBoxHelper
isReject
in interface SandBoxHelper
public void optionallyIncludeDeletedItemsInQueriesAndCollections(Runnable runnable, boolean includeDeleted)
SandBoxHelper
optionallyIncludeDeletedItemsInQueriesAndCollections
in interface SandBoxHelper
runnable
- the block of code for which this setting should be in effectincludeDeleted
- whether or not to include deleted sandbox itemsCopyright © 2014. All rights reserved.