Package de.hybris.platform.persistence
Class ItemEJB
- java.lang.Object
-
- de.hybris.platform.persistence.ItemEJB
-
- All Implemented Interfaces:
EntityInstance
,EntityProxy
,HomeProxy
,ItemHome
,ItemPermissionFacade
,ItemRemote
- Direct Known Subclasses:
ExtensibleItemEJB
public abstract class ItemEJB extends java.lang.Object implements EntityInstance, ItemRemote, ItemHome, ItemPermissionFacade
ItemEJB is responsible for- holding a primary key
- generating a new primary key
- having a typecode
-
-
Field Summary
Fields Modifier and Type Field Description protected EntityInstanceContext
entityContext
entity context accessible for subclasses if this is an entitybeanprotected static boolean
READ
protected static boolean
WRITE
-
Constructor Summary
Constructors Constructor Description ItemEJB()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
checkItemPermission(PK principalPK, PK permissionPK)
The return value for checkPermission(...) if no permission was set, or positive and negative settings were found.int
checkOwnGlobalPermission(PK permissionPK)
protected void
clearEntityCaches()
protected void
copyComposedTypeFromTemplate(ItemRemote template)
protected void
createFromTemplate(ItemRemote template)
sets data from template item.protected PK
doCreateInternal(PK pk, ComposedTypeRemote type, ItemRemote template)
is responsible for assigning Item with a unique primary key and a given type.protected void
doPostCreateInternal(PK pkBase, ComposedTypeRemote type, ItemRemote template)
java.lang.String
ejbHomeGetItemTableName()
home method impljava.lang.String
ejbHomeGetOwnJNDIName()
home method implvoid
ejbHomeLoadItemData(java.sql.ResultSet resultSet)
void
ejbLoad()
void
ejbRemove()
void
ejbStore()
abstract long
getACLTimestampInternal()
protected java.lang.Object
getCachedValueForModification(ItemCacheKey key)
protected java.lang.Object
getCachedValueForReading(ItemCacheKey key)
the returned cached value may be unmodifiableprotected java.lang.Object
getCachedValueForReadingIfAvailable(ItemCacheKey key)
will return the cached value if it has already been computed, or null otherwiseprotected java.util.Collection<java.lang.Object>
getCachedValuesStartingWith(java.lang.String qualifierPrefix)
protected ItemCacheKey
getCacheKey(java.lang.Object quali)
protected abstract java.util.Map<java.lang.Object,ItemCacheKey>
getCacheKeyMap()
ComposedTypeRemote
getComposedType()
java.util.Date
getCreationTime()
abstract java.util.Date
getCreationTimestampInternal()
protected ComposedTypeRemote
getDefaultType()
EntityInstanceContext
getEntityContext()
java.util.Collection<PK>
getGlobalPermissionPKs(boolean negative)
abstract long
getHJMPTS()
protected abstract java.lang.String
getItemTableNameImpl()
instance method impljava.util.Date
getModifiedTime()
abstract java.util.Date
getModifiedTimestampInternal()
protected ItemCacheKey
getOrAddCacheKey(ItemCacheKey key)
ItemRemote
getOwner()
abstract PK
getOwnerPkString()
abstract java.lang.String
getOwnJNDIName()
instance method impljava.util.Collection<PK>
getPermissionPKs(PK principalPK, boolean negative)
PK
getPK()
abstract PK
getPkString()
java.util.Map<ItemPropertyValue,java.util.List<java.lang.Boolean>>
getPrincipalToBooleanListMap(java.util.List<PK> rightPKs)
finds all restricted principals for a given list of user rights.java.util.Collection<PK>
getRestrictedPrincipalPKs()
PK
getTypeKey()
abstract PK
getTypePkString()
boolean
hasJNDIName(java.lang.String jndiName)
protected boolean
hasModifiedCaches()
Used by HJMP to optimize calls toejbStore()
.abstract boolean
isBeforeCreate()
Special method indicating that the entity instance is currently within its ejbCreate() state and has not been written to database yet.void
loadItemData(java.sql.ResultSet resultSet)
still experimental - dont useprotected void
logACLCacheChange(ACLCache aclChache)
boolean
needsStoring()
protected void
postCreateFromTemplate(ItemRemote template)
sets (postcreate - )data from template item.static java.lang.String
quoteSQLStringLiteralForQuery(java.lang.String str)
Doubles each occurence of a single quotation mark (').void
remove()
protected void
removeACLEntries()
called by HJMP only !!!boolean
removeGlobalPermission(PK permissionPK)
boolean
removeGlobalPermissions(java.util.Collection<PermissionContainer> permissions)
boolean
removePermission(PK principalPK, PK permissionPK)
boolean
removePermissions(java.util.Collection<PermissionContainer> permissions)
abstract void
setACLTimestampInternal(long timestamp)
void
setComposedType(ComposedTypeRemote type)
void
setCreationTime(java.util.Date date)
abstract void
setCreationTimestampInternal(java.util.Date time)
void
setEntityContext(EntityInstanceContext ctx)
Stores entityContext inentityContext
.boolean
setGlobalPermission(PK permissionPK, boolean negative)
boolean
setGlobalPermissions(java.util.Collection<PermissionContainer> permissions)
void
setModifiedTime(java.util.Date timestamp)
protected void
setModifiedTimestamp(java.util.Date timestamp)
abstract void
setModifiedTimestampInternal(java.util.Date time)
void
setNeedsStoring(boolean needsStoring)
void
setOwner(ItemRemote owner)
abstract void
setOwnerPkString(PK pk)
void
setOwnerRef(ItemPropertyValue ownerRef)
boolean
setPermission(PK principalPK, PK permissionPK, boolean negative)
boolean
setPermissions(java.util.Collection<PermissionContainer> permissions)
abstract void
setPkString(PK pk)
void
setPrincipalToBooleanListMap(java.util.List<PK> rightPKs, java.util.Map<PK,java.util.List<java.lang.Boolean>> principalPKToBooleanListMap)
changes restricted principals for a given list of user rights.abstract void
setTypePkString(PK pk)
protected boolean
skipRemovePermission(ACLCache acl, PK principalPK, PK permissionPK)
protected boolean
skipSetPermission(ACLCache acl, PK principalPK, PK permissionPK, boolean negative)
protected void
storeCaches()
override if you use own ItemCacheKeys which may contain changed data.protected void
typeChanged(PK oldTypePK, PK newTypePK)
protected abstract int
typeCode()
boolean
wasModifiedSince(java.util.Date time)
protected boolean
writeACLEntries()
called by HJMP only !!!-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.persistence.framework.EntityInstance
ejbFindByPrimaryKey
-
Methods inherited from interface de.hybris.platform.persistence.ItemHome
findAll, findByPKList, findByType, findChangedAfter
-
-
-
-
Field Detail
-
READ
protected static final boolean READ
- See Also:
- Constant Field Values
-
WRITE
protected static final boolean WRITE
- See Also:
- Constant Field Values
-
entityContext
protected EntityInstanceContext entityContext
entity context accessible for subclasses if this is an entitybean
-
-
Method Detail
-
getPkString
public abstract PK getPkString()
- Specified by:
getPkString
in interfaceItemRemote
-
setPkString
public abstract void setPkString(PK pk)
-
getCreationTimestampInternal
public abstract java.util.Date getCreationTimestampInternal()
-
setCreationTimestampInternal
public abstract void setCreationTimestampInternal(java.util.Date time)
-
getACLTimestampInternal
public abstract long getACLTimestampInternal()
-
setACLTimestampInternal
public abstract void setACLTimestampInternal(long timestamp)
-
getModifiedTimestampInternal
public abstract java.util.Date getModifiedTimestampInternal()
-
setModifiedTimestampInternal
public abstract void setModifiedTimestampInternal(java.util.Date time)
-
getTypePkString
public abstract PK getTypePkString()
-
setTypePkString
public abstract void setTypePkString(PK pk)
-
getOwnerPkString
public abstract PK getOwnerPkString()
-
setOwnerPkString
public abstract void setOwnerPkString(PK pk)
-
getHJMPTS
public abstract long getHJMPTS()
- Specified by:
getHJMPTS
in interfaceItemRemote
-
isBeforeCreate
public abstract boolean isBeforeCreate()
Special method indicating that the entity instance is currently within its ejbCreate() state and has not been written to database yet.
-
getPK
public PK getPK()
- Specified by:
getPK
in interfaceEntityProxy
-
getTypeKey
public PK getTypeKey()
- Specified by:
getTypeKey
in interfaceItemRemote
-
quoteSQLStringLiteralForQuery
public static java.lang.String quoteSQLStringLiteralForQuery(java.lang.String str)
Doubles each occurence of a single quotation mark (').- Parameters:
str
-- Returns:
- String
-
ejbHomeLoadItemData
public void ejbHomeLoadItemData(java.sql.ResultSet resultSet)
-
typeCode
protected abstract int typeCode()
- Returns:
- a unique typecode for this item type. Used for wrapping entity beans to the jalo layer.
-
doCreateInternal
protected PK doCreateInternal(PK pk, ComposedTypeRemote type, ItemRemote template)
is responsible for assigning Item with a unique primary key and a given type.
-
createFromTemplate
protected void createFromTemplate(ItemRemote template)
sets data from template item. override in all subclasses which define new fields!
-
copyComposedTypeFromTemplate
protected final void copyComposedTypeFromTemplate(ItemRemote template)
-
postCreateFromTemplate
protected void postCreateFromTemplate(ItemRemote template)
sets (postcreate - )data from template item. override in all subclasses which define new fields!
-
doPostCreateInternal
protected void doPostCreateInternal(PK pkBase, ComposedTypeRemote type, ItemRemote template)
-
removeACLEntries
protected void removeACLEntries()
called by HJMP only !!!
-
writeACLEntries
protected boolean writeACLEntries()
called by HJMP only !!!
-
setEntityContext
public void setEntityContext(EntityInstanceContext ctx)
Stores entityContext inentityContext
. Do not call method yourself!- Specified by:
setEntityContext
in interfaceEntityInstance
-
getEntityContext
public EntityInstanceContext getEntityContext()
- Specified by:
getEntityContext
in interfaceEntityInstance
-
ejbStore
public void ejbStore()
- Specified by:
ejbStore
in interfaceEntityInstance
-
ejbLoad
public void ejbLoad()
- Specified by:
ejbLoad
in interfaceEntityInstance
-
hasModifiedCaches
protected boolean hasModifiedCaches()
Used by HJMP to optimize calls toejbStore()
. Dont use elsewhere!This method just checks if a ACL cache is present and needs storing.
- Returns:
- true if this item instance owns modified caches which need to be stored
-
ejbRemove
public void ejbRemove()
- Specified by:
ejbRemove
in interfaceEntityInstance
-
clearEntityCaches
protected void clearEntityCaches()
-
getCreationTime
public java.util.Date getCreationTime()
- Specified by:
getCreationTime
in interfaceItemRemote
-
setCreationTime
public void setCreationTime(java.util.Date date)
- Specified by:
setCreationTime
in interfaceItemRemote
-
getModifiedTime
public java.util.Date getModifiedTime()
- Specified by:
getModifiedTime
in interfaceItemRemote
-
setModifiedTime
public void setModifiedTime(java.util.Date timestamp)
- Specified by:
setModifiedTime
in interfaceItemRemote
-
setModifiedTimestamp
protected void setModifiedTimestamp(java.util.Date timestamp)
-
wasModifiedSince
public boolean wasModifiedSince(java.util.Date time)
- Specified by:
wasModifiedSince
in interfaceItemRemote
-
getComposedType
public ComposedTypeRemote getComposedType()
- Specified by:
getComposedType
in interfaceItemRemote
-
setComposedType
public void setComposedType(ComposedTypeRemote type) throws EJBInvalidParameterException
- Specified by:
setComposedType
in interfaceItemRemote
- Throws:
EJBInvalidParameterException
-
getDefaultType
protected ComposedTypeRemote getDefaultType() throws EJBItemNotFoundException
- Throws:
EJBItemNotFoundException
-
getOwner
public ItemRemote getOwner()
- Specified by:
getOwner
in interfaceItemRemote
-
setOwner
public void setOwner(ItemRemote owner)
- Specified by:
setOwner
in interfaceItemRemote
-
setOwnerRef
public void setOwnerRef(ItemPropertyValue ownerRef)
- Specified by:
setOwnerRef
in interfaceItemRemote
-
storeCaches
protected void storeCaches()
override if you use own ItemCacheKeys which may contain changed data. Please not that at this time you MUST NOT write any CMP field since item data might already be stored! dont forget to call super.storeCaches() so that superclass caches are stored correctly.
-
getCacheKeyMap
protected abstract java.util.Map<java.lang.Object,ItemCacheKey> getCacheKeyMap()
-
getCachedValueForReading
protected java.lang.Object getCachedValueForReading(ItemCacheKey key)
the returned cached value may be unmodifiable
-
getCachedValueForModification
protected java.lang.Object getCachedValueForModification(ItemCacheKey key)
-
getCachedValueForReadingIfAvailable
protected java.lang.Object getCachedValueForReadingIfAvailable(ItemCacheKey key)
will return the cached value if it has already been computed, or null otherwise
-
getCachedValuesStartingWith
protected final java.util.Collection<java.lang.Object> getCachedValuesStartingWith(java.lang.String qualifierPrefix)
-
getCacheKey
protected final ItemCacheKey getCacheKey(java.lang.Object quali)
-
getOrAddCacheKey
protected final ItemCacheKey getOrAddCacheKey(ItemCacheKey key)
-
getRestrictedPrincipalPKs
public java.util.Collection<PK> getRestrictedPrincipalPKs()
- Specified by:
getRestrictedPrincipalPKs
in interfaceItemPermissionFacade
-
getPrincipalToBooleanListMap
public java.util.Map<ItemPropertyValue,java.util.List<java.lang.Boolean>> getPrincipalToBooleanListMap(java.util.List<PK> rightPKs)
Description copied from interface:ItemPermissionFacade
finds all restricted principals for a given list of user rights. further each principal is mapped to a row caontaining its setting regarding the user right at this position- Specified by:
getPrincipalToBooleanListMap
in interfaceItemPermissionFacade
- Parameters:
rightPKs
- the user right pks to get principals and permissions for- Returns:
- a map { principalPK -> [ Boolean.TRUE == negative | Boolean.FALSE == positive | null == not set]
-
setPrincipalToBooleanListMap
public void setPrincipalToBooleanListMap(java.util.List<PK> rightPKs, java.util.Map<PK,java.util.List<java.lang.Boolean>> principalPKToBooleanListMap) throws EJBSecurityException
Description copied from interface:ItemPermissionFacade
changes restricted principals for a given list of user rights.- Specified by:
setPrincipalToBooleanListMap
in interfaceItemPermissionFacade
- Parameters:
rightPKs
- the user right pks to get principals and permissions forprincipalPKToBooleanListMap
- a map { principalPK -> [ Boolean.TRUE | Boolean.FALSE | null ]- Throws:
EJBSecurityException
-
skipSetPermission
protected boolean skipSetPermission(ACLCache acl, PK principalPK, PK permissionPK, boolean negative)
-
setPermission
public boolean setPermission(PK principalPK, PK permissionPK, boolean negative) throws EJBSecurityException
- Specified by:
setPermission
in interfaceItemPermissionFacade
- Throws:
EJBSecurityException
-
setPermissions
public boolean setPermissions(java.util.Collection<PermissionContainer> permissions) throws EJBSecurityException
- Specified by:
setPermissions
in interfaceItemPermissionFacade
- Throws:
EJBSecurityException
-
skipRemovePermission
protected boolean skipRemovePermission(ACLCache acl, PK principalPK, PK permissionPK)
-
removePermission
public boolean removePermission(PK principalPK, PK permissionPK) throws EJBSecurityException
- Specified by:
removePermission
in interfaceItemPermissionFacade
- Throws:
EJBSecurityException
-
removePermissions
public boolean removePermissions(java.util.Collection<PermissionContainer> permissions) throws EJBSecurityException
- Specified by:
removePermissions
in interfaceItemPermissionFacade
- Throws:
EJBSecurityException
-
checkItemPermission
public int checkItemPermission(PK principalPK, PK permissionPK)
The return value for checkPermission(...) if no permission was set, or positive and negative settings were found.- Specified by:
checkItemPermission
in interfaceItemPermissionFacade
-
getPermissionPKs
public java.util.Collection<PK> getPermissionPKs(PK principalPK, boolean negative)
- Specified by:
getPermissionPKs
in interfaceItemPermissionFacade
-
logACLCacheChange
protected void logACLCacheChange(ACLCache aclChache)
-
ejbHomeGetItemTableName
public java.lang.String ejbHomeGetItemTableName()
home method impl
-
getItemTableNameImpl
protected abstract java.lang.String getItemTableNameImpl()
instance method impl
-
ejbHomeGetOwnJNDIName
public java.lang.String ejbHomeGetOwnJNDIName()
home method impl
-
hasJNDIName
public boolean hasJNDIName(java.lang.String jndiName)
- Specified by:
hasJNDIName
in interfaceItemRemote
-
getOwnJNDIName
public abstract java.lang.String getOwnJNDIName()
instance method impl- Specified by:
getOwnJNDIName
in interfaceItemHome
- Returns:
- the item's JNDI name
-
needsStoring
public boolean needsStoring()
- Specified by:
needsStoring
in interfaceEntityInstance
-
setNeedsStoring
public void setNeedsStoring(boolean needsStoring)
- Specified by:
setNeedsStoring
in interfaceEntityInstance
-
remove
public void remove() throws YEJBException, YRemoveException
- Specified by:
remove
in interfaceItemRemote
- Throws:
YEJBException
YRemoveException
-
loadItemData
public void loadItemData(java.sql.ResultSet resultSet)
Description copied from interface:ItemHome
still experimental - dont use- Specified by:
loadItemData
in interfaceItemHome
-
checkOwnGlobalPermission
public int checkOwnGlobalPermission(PK permissionPK)
- Specified by:
checkOwnGlobalPermission
in interfaceItemPermissionFacade
-
getGlobalPermissionPKs
public java.util.Collection<PK> getGlobalPermissionPKs(boolean negative)
- Specified by:
getGlobalPermissionPKs
in interfaceItemPermissionFacade
-
setGlobalPermission
public boolean setGlobalPermission(PK permissionPK, boolean negative) throws EJBSecurityException
- Specified by:
setGlobalPermission
in interfaceItemPermissionFacade
- Throws:
EJBSecurityException
-
setGlobalPermissions
public boolean setGlobalPermissions(java.util.Collection<PermissionContainer> permissions) throws EJBSecurityException
- Specified by:
setGlobalPermissions
in interfaceItemPermissionFacade
- Throws:
EJBSecurityException
-
removeGlobalPermission
public boolean removeGlobalPermission(PK permissionPK) throws EJBSecurityException
- Specified by:
removeGlobalPermission
in interfaceItemPermissionFacade
- Throws:
EJBSecurityException
-
removeGlobalPermissions
public boolean removeGlobalPermissions(java.util.Collection<PermissionContainer> permissions) throws EJBSecurityException
- Specified by:
removeGlobalPermissions
in interfaceItemPermissionFacade
- Throws:
EJBSecurityException
-
-