public abstract class Item extends BridgeAbstraction implements Comparable
PK you just have to use where class is the Class of the Object you want to retrieve and JaloSession is an active(class)JaloSession.getItem(PK)
JaloSession .
each item is typed by a ComposedType which defines its class, datbase table,
jndi name and all attributes. besides composed types can be used to create new item instances a generic way (
opposite to creating them by their managers ) - see
ComposedType.newInstance(Map) .
each concrete subclass of item has to implement
createItem(SessionContext,ComposedType,de.hybris.platform.jalo.Item.ItemAttributeMap) which is responsible
for creating a new instance of this item. please note that the instance which this method is called on is
not assoziated with an exiting item, so any access to attributes will fail!
in addition it is intented that each jalo class implementing
createItem(SessionContext,ComposedType,de.hybris.platform.jalo.Item.ItemAttributeMap) should also override
getNonInitialAttributes(SessionContext, de.hybris.platform.jalo.Item.ItemAttributeMap) to avoid setting
initial attribute twice.
another method which subclasses may override is
setNonInitialAttributes(SessionContext, Item, de.hybris.platform.jalo.Item.ItemAttributeMap). it is called
after item creation and sets all additional (non-initial) attributes.
each declared attribute (see items.xml) which is not backed by a property or a relation requires a
AttributeAccess to allow generic value handling. to do so use
registerAccessFor(Class,String,AttributeAccess) .
| Modifier and Type | Class and Description |
|---|---|
static interface |
Item.AttributeFilter
Describes an
AttributeFilterInternal use only! |
static class |
Item.AttributeMode |
class |
Item.CachedGetter |
class |
Item.CachedSetter |
static class |
Item.ItemAttributeMap
internal use only!
|
static interface |
Item.ItemConstraint
Interface for implementing transaction aware consistency checks using the item method
checkConstraint(ItemConstraint). |
static interface |
Item.ItemImpl
object used by getSyncObject()
|
static class |
Item.JaloCachedComputationException
Thrown by
Item.CachedGetter.get(SessionContext) and Item.CachedSetter.set(SessionContext) whenever
the executed code throws an exception. |
| Modifier and Type | Field and Description |
|---|---|
static String |
_CREATION_TIME_INTERNAL
The
_CREATION_TIME_INTERNAL attribute constant. |
static String |
_MODIFIED_TIME_INTERNAL
The
_MODIFIED_TIME_INTERNAL attribute constant. |
static Logger |
accessorLog |
static String |
CREATION_TIME
The
CREATION_TIME attribute constant. |
static String |
DISABLE_ATTRIBUTE_CHECK |
static String |
DISABLE_ITEMCHECK_BEFORE_REMOVABLE
SessionContext Flag.
|
static int |
EVEN
The internal security check result constant
EVEN. |
static String |
FEATURE_ACCESSMAP_QUALIFIER |
static String |
INITIAL_CREATION_FLAG
This flag indicates the creation phase of an item.
|
protected boolean |
isJaloOnly |
static String |
MODIFIED_TIME
The
MODIFIED_TIME attribute constant. |
static int |
NEGATIVE
The internal security check result constant
NEGATIVE. |
static int |
NOT_FOUND
The internal security check result constant
NOT_FOUND. |
static String |
OWNER
The
OWNER attribute constant. |
static String |
PK
The
PK attribute constant. |
static int |
POSITIVE
The internal security check result constant
POSITIVE. |
static String |
SAVE_FROM_SERVICE_LAYER
SessionContext attribute flag providing information if the save operation was triggered from Service Layer.
|
protected static Map |
staticTransientObjects
The transient object cache.
|
static String |
TYPE
The
TYPE attribute constant. |
impl, tenant| Constructor and Description |
|---|
Item()
The default no-arg constructor which every Jalo Item must provide.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink)
Creates new links between this item and a given list of items.
|
void |
addLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink,
int position)
Creates new links between this item and a given list of items at a speciic position among this items link list.
|
void |
addLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink,
int position,
boolean shift)
Creates new links between this item and a given list of items at a speciic position among this items link list.
|
void |
addLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink)
Creates new links between this item and a given list of items.
|
void |
addLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink,
boolean markModified) |
void |
addLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink,
boolean sortSrc2Tgt,
boolean sortTgt2Src) |
void |
addLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink,
boolean sortSrc2Tgt,
boolean sortTgt2Src,
boolean markModified) |
void |
addLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink,
int position)
Creates new links between this item and a given list of items at a speciic position among this items link list.
|
void |
addLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink,
int position,
boolean shift)
Creates new links between this item and a given list of items at a speciic position among this items link list.
|
void |
addNegativePermission(Principal principal,
UserRight right)
Add a negative permission for the
Principal and the UserRight on the Item. |
void |
addPermission(Principal principal,
UserRight right,
boolean negative)
Add a permission for the
Principal and the UserRight on the Item. |
void |
addPositivePermission(Principal principal,
UserRight right)
Add a positive permission for the
Principal and the UserRight on the Item. |
protected void |
assureExtensionsLoaded() |
protected Item |
changeTypeAfterCreation(Item newOne,
ComposedType requestedType)
Changes the item type in case
createItem(SessionContext, ComposedType, ItemAttributeMap) did not set the
requested type directly. |
protected void |
checkConstraint(Item.ItemConstraint constr)
Allows to implement transaction safe consistency checking code.
|
protected int |
checkItemPermission(Principal principal,
UserRight right) |
protected static boolean |
checkMandatoryAttribute(String qualifier,
Item.ItemAttributeMap allAttributes,
Set missingSet)
Checks if the attributes map contains a given qualifier.
|
protected static boolean |
checkMandatoryAttribute(String qualifier,
Item.ItemAttributeMap allAttributes,
Set missingSet,
boolean nullAllowed)
Checks if the attributes map contains a given qualifier.
|
boolean |
checkPermission(Principal principal,
UserRight right)
Checks if the
Principal has the given UserRight on the Item. |
boolean |
checkPermission(UserRight right)
Checks if the current session user has the given
UserRight on the Item. |
protected void |
checkRemovable(SessionContext ctx)
Checks whether or not this it may be removed or not.
|
void |
clearPermission(Principal principal,
UserRight right)
Remove any permission for the
Principal and the UserRight on the Item. |
int |
compareTo(Object object)
Implements item comparison by PK.
|
protected abstract Item |
createItem(SessionContext ctx,
ComposedType type,
Item.ItemAttributeMap allAttributes)
Has to be implemented for each concrete subtype of item.
|
protected AttributeAccess |
createNonClassAccessor(AttributeDescriptor fieldDescriptor) |
protected SessionContext |
ctx()
A shortcut for
getSession().getSessionContext(). |
protected void |
doAfterRemove(SessionContext ctx,
Map removalCtx)
Hook method to perform removal logic just after this item is being deleted from database.
|
protected void |
doBeforeRemove(SessionContext ctx,
Map removalCtx)
Hook method to perform removal logic just before this item is being deleted from database.
|
boolean |
equals(Object object)
Two items are equal, if their primary keys are equals.
|
protected AttributeAccess |
getAccessorFor(String qualifier,
Class myClass)
Tries to find a static AttributeAccess member with
_AD_ + {attribute qualifier} as name within this
item's class and its super classes. |
Map |
getAllAttributes()
Reads all (readable) attribute values of this item using the current session context.
|
Map |
getAllAttributes(SessionContext ctx)
Reads all (readable) attribute values of this item using a specific session context.
|
Map |
getAllAttributes(SessionContext ctx,
Item.AttributeFilter filter)
Reads all attribute values of this item which pass a given attribute filter.
|
Map |
getAllAttributes(SessionContext ctx,
Set<String> qualfiers)
Reads all values of specified attributes for this item.
|
protected Map<String,Object> |
getAllAttributesInternal(SessionContext ctx,
Set<String> qualfiers) |
Map |
getAllLinkedItems(boolean itemIsSource,
String qualifier)
Returns all localized linked items for a given qualifier.
|
<T extends Item> |
getAndCheckCacheBoundItem() |
Object |
getAttribute(SessionContext ctx,
String qualifier)
Returns the attribute value for a single item attribute with a specified session context.
|
Object |
getAttribute(String qualifier)
Returns the attribute value for a single item attribute using the current session context.
|
<T extends Item> |
getCacheBoundItem()
NOTE: hybris internal method, do not use
|
ComposedType |
getComposedType()
Returns this Item's type.
|
PK |
getComposedTypePK()
Directly returns the PK of this item's composed type.
|
Date |
getCreationTime()
Returns the time when this Item was created.
|
static int |
getCurrentlyRemovingCount() |
protected Map<String,Item.AttributeMode> |
getDefaultAttributeModes() |
List |
getLinkedItems(boolean itemIsSource,
String qualifier,
Language lang)
Finds items linked to this item for a given link qualifier.
|
List |
getLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
int start,
int count)
Finds a range of items linked to this item for a given link qualifier.
|
List |
getLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang)
Finds items linked to this item for a given link qualifier.
|
List |
getLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
boolean sortSrc2Tgt,
boolean sortTgt2Src) |
List |
getLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
int start,
int count)
Finds a range of items linked to this item for a given link qualifier.
|
List |
getLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
int start,
int count,
boolean sortSrc2Tgt,
boolean sortTgt2Src) |
List |
getLinkedItems(SessionContext ctx,
boolean itemIsSource,
String relationCode,
String relatedItemCode,
Language lang,
boolean sortSrc2Tgt,
boolean sortTgt2Src) |
long |
getLinkedItemsCount(boolean itemIsSource,
String qualifier,
Language lang) |
long |
getLinkedItemsCount(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang) |
long |
getLinkedItemsCount(SessionContext ctx,
boolean itemIsSource,
String relationTypeCode,
String relatedItemCode,
Language lang) |
Date |
getModificationTime()
Returns the time when this Item was modifed the last time.
|
Set |
getNegativePermissions(Principal principal)
Finds all negative permissions for the item and the given
Principal. |
protected Item.ItemAttributeMap |
getNonInitialAttributes(SessionContext ctx,
Item.ItemAttributeMap allAttributes)
Defines all attributes which should be set after item creation.
|
Item |
getOwner() |
Map |
getPermissionMap(List userRights)
Finds the all permission settings for a given list of user rights.
|
Set |
getPermissions(Principal principal,
boolean negative)
Finds all positive or negative permissions upon this item and the given
Principal. |
long |
getPersistenceVersion() |
PK |
getPK()
Returns the primary key of this item.
|
Set |
getPositivePermissions(Principal principal)
Finds all positive permissions for the item and the given
Principal. |
Set |
getRestrictedPrincipals() |
JaloSession |
getSession()
Returns the session which is responsible for managing this item.
|
Object |
getSyncObject()
returns an object that can be used for synchronization on the current item pk.
|
Tenant |
getTenant() |
Object |
getTransientObject(String key)
Get a transient object.
|
Map |
getTransientObjectMap()
Returns the complete
Map of transient objects. |
int |
hashCode()
Returns the hashcode of this item.
|
static boolean |
hasRegisteredClassAccessorFor(Tenant tenant,
Class clazz,
String qualifier) |
protected static void |
internal_registerClassAccessorFor(Tenant tenant,
Class clazz,
String qualifier,
AttributeAccess access) |
protected static void |
internal_registerNonClassAccessorFor(Tenant tenant,
AttributeDescriptor attributeDescriptor,
AttributeAccess access) |
void |
invalidateLocalCaches() |
boolean |
isAlive()
Is
true if this item is still valid. |
boolean |
isCacheBound() |
static boolean |
isCurrentlyRemoving(Item item) |
static boolean |
isCurrentlyRemoving(PK pk) |
protected boolean |
isEmptyRelationValue(SessionContext ctx,
String name,
List value)
Override this method to implement different language fallback behaviour.
|
static boolean |
isInCreate(SessionContext ctx) |
boolean |
isInstanceOf(ComposedType type)
Tells whether this Item is instance of a given type or not.
|
protected boolean |
isItemCheckBeforeRemoveableDisabled(SessionContext ctx) |
protected boolean |
isRelationLocalizationFallbackEnabled(SessionContext ctx) |
Item |
newInstance(SessionContext ctx,
ComposedType type,
Map attributeAssignment)
Creates a new
Item using the specified parameters. |
protected void |
notifyExtensionsAfterItemCreation(SessionContext ctx,
ComposedType type,
Item createdItem,
Item.ItemAttributeMap attributes) |
protected void |
notifyExtensionsBeforeItemCreation(SessionContext ctx,
ComposedType type,
Item.ItemAttributeMap attributes) |
protected void |
notifyItemRemoval(SessionContext ctx)
Notifies all managers (including all extensions) about this item being removed soon.
|
Object |
readResolve()
Takes care of the de-serialization of items because we cannot have several instances of one item per PK.
|
void |
refreshRemote() |
static void |
registerAccessFor(Class clazz,
String qualifier,
AttributeAccess access)
Registers an attribute access for a given item class and qualifier.
|
static void |
registerAccessFor(String extensionName,
Class clazz,
String qualifier,
AttributeAccess access) |
static void |
registerJaloInvalidationListeners(InvalidationManager invMan,
Cache cache) |
void |
remove()
Removes this item.
|
void |
remove(SessionContext ctx)
Removes this item.
|
static void |
removeItemCollection(Collection collection)
Removes a collection of Items's.
|
static void |
removeItemCollection(SessionContext ctx,
Collection collection)
Removes a collection of Items's.
|
void |
removeLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List itemsToUnlink)
Removes all links between this item and the given item list.
|
void |
removeLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List itemsToUnlink)
Removes all links between this item and the given item list.
|
void |
removeLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List itemsToUnlink,
boolean sortSrc2Tgt,
boolean sortTgt2Src) |
void |
removeLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List itemsToUnlink,
boolean sortSrc2Tgt,
boolean sortTgt2Src,
boolean markModified) |
protected void |
removeLinks() |
protected void |
removePartOfItems(SessionContext ctx)
Removes all partOf items.
|
protected void |
removePartOfItems(SessionContext ctx,
Map<String,Object> emptyValuesMap) |
void |
setAllAttributes(Map values)
Sets multiple attributes at once using the default session context.
|
void |
setAllAttributes(SessionContext ctx,
Map values)
Sets multiple attributes at once using a specific session context.
|
protected void |
setAllAttributesInternal(SessionContext ctx,
Map values) |
void |
setAllLinkedItems(boolean itemIsSource,
String qualifier,
Map languageToItemListMap)
Replaces the items currently being linked via localized links to this item for the given qualifier.
|
void |
setAllLinkedItems(boolean itemIsSource,
String qualifier,
Map languageToItemListMap,
boolean markModified)
Replaces the items currently being linked via localized links to this item for the given qualifier.
|
void |
setAllLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Map languageToItemListMap)
Replaces the items currently being linked via localized links to this item for the given qualifier.
|
void |
setAllLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Map languageToItemListMap,
boolean markModified) |
void |
setAttribute(SessionContext ctx,
String qualifier,
Object value)
Sets the value of the attribute specified by the attribute qualifier.
|
void |
setAttribute(String qualifier,
Object value)
Sets the value of the attribute specified by the attribute qualifier.
|
void |
setAttributeFromString(SessionContext ctx,
String qualifier,
String value)
Still experimental! This method changes the attribute value by parsing a string value representation.
|
void |
setAttributeFromString(String qualifier,
String value)
Still experimental! This method changes the attribute value by parsing a string value representation.
|
void |
setCacheBound(boolean bound) |
Item |
setComposedType(ComposedType type)
Changes the type of an item.
|
protected void |
setCreationTime(Date creationTime) |
void |
setImplementation(BridgeInterface impl)
Assigns the persistence implementation object to this Item instance.
|
void |
setLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List<? extends Item> itemsToLink)
Replaces the items currently linked to this item for the given qualifier by the new item list.
|
void |
setLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
Collection<? extends Item> itemsToLink) |
void |
setLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
Collection<? extends Item> itemsToLink,
boolean markModified) |
void |
setLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
Collection<? extends Item> itemsToLink,
boolean sortSrc2Tgt,
boolean sortTgt2Src) |
void |
setLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
Collection<? extends Item> itemsToLink,
boolean sortSrc2Tgt,
boolean sortTgt2Src,
boolean markModified) |
void |
setLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List<? extends Item> itemsToLink)
Replaces the items currently linked to this item for the given qualifier by the new item list.
|
void |
setLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List<? extends Item> itemsToLink,
boolean sortSrc2Tgt,
boolean sortTgt2Src) |
void |
setLinkedItems(SessionContext ctx,
boolean itemIsSource,
String qualifier,
Language lang,
List<? extends Item> itemsToLink,
boolean sortSrc2Tgt,
boolean sortTgt2Src,
boolean markModified) |
void |
setModificationTime(Date date) |
void |
setNonInitialAttributes(SessionContext ctx,
Item item,
Item.ItemAttributeMap nonInitialAttributes)
Sets all attributes which could not be set during
createItem(SessionContext, ComposedType, ItemAttributeMap). |
void |
setOwner(Item item) |
void |
setPermissionsByMap(List userRights,
Map permissionMap)
Changes permission settings for a given list of user rights.
|
void |
setTransientObject(String key,
Object value)
Sets a transient object.
|
protected void |
setUseTA(SessionContext ctx,
boolean use) |
String |
toString()
Returns the
String representation of this item. |
protected boolean |
useTA(SessionContext ctx,
boolean def) |
Object |
writeReplace()
Takes care of serialization of items.
|
getImplementation, setTenantpublic static final Logger accessorLog
public static final String FEATURE_ACCESSMAP_QUALIFIER
public static final String SAVE_FROM_SERVICE_LAYER
public static final String DISABLE_ITEMCHECK_BEFORE_REMOVABLE
true the check before Item removable is
disabled.protected final boolean isJaloOnly
protected static final Map staticTransientObjects
public static final String PK
PK attribute constant.public static final String _CREATION_TIME_INTERNAL
_CREATION_TIME_INTERNAL attribute constant.public static final String _MODIFIED_TIME_INTERNAL
_MODIFIED_TIME_INTERNAL attribute constant.public static final String TYPE
TYPE attribute constant.public static final String CREATION_TIME
CREATION_TIME attribute constant.public static final String MODIFIED_TIME
MODIFIED_TIME attribute constant.public static final String OWNER
OWNER attribute constant.public static final int NOT_FOUND
NOT_FOUND. Dont use.public static final int POSITIVE
POSITIVE. Dont use.public static final int NEGATIVE
NEGATIVE. Dont use.public static final int EVEN
EVEN. Dont use.public static final String INITIAL_CREATION_FLAG
isInCreate(SessionContext) method.public static final String DISABLE_ATTRIBUTE_CHECK
public Item()
Do not use it directly since Item creation and Item retrieval e.g. via FlexibleSearch requires a process
within creating the Item object is one part besides several others. For creating Item instances always use the
appopriate Manager methods or ComposedType.newInstance(Map).
public static void registerJaloInvalidationListeners(InvalidationManager invMan, Cache cache)
public static void registerAccessFor(Class clazz, String qualifier, AttributeAccess access)
use it in your items as follows:
public class MyJaloItem extends ...
{
...
public static final String THE_QUALIFIER_CONSTANT = "qualifier";
...
static
{
registerAccessFor(
MyJaloItem.class,
THE_QUALIFIER_CONSTANT,
new AttributeAccess()
{
public void setValue(SessionContext ctx, Item item, Object value) throws JaloTypeException,
JaloInvalidParameterException, JaloSecurityException
{
// set the value here
}
public Object getValue(SessionContext ctx, Item item ) throws JaloTypeException, JaloInvalidParameterException,
JaloSecurityException
{
// get the value here
}
}
);
}
...
}
if there is no attribute access registered for a jalo class all superclasses are processed to find an access.
this way you may even register attribute accesses outside the actual item class which the attribute belongs to. especially useful for extension programming when adding attributes to core items is required.
clazz - the item classqualifier - the attribute qualifieraccess - the access objectpublic static void registerAccessFor(String extensionName, Class clazz, String qualifier, AttributeAccess access)
protected static final void internal_registerNonClassAccessorFor(Tenant tenant, AttributeDescriptor attributeDescriptor, AttributeAccess access)
protected static final void internal_registerClassAccessorFor(Tenant tenant, Class clazz, String qualifier, AttributeAccess access)
public static boolean hasRegisteredClassAccessorFor(Tenant tenant, Class clazz, String qualifier)
protected final AttributeAccess getAccessorFor(String qualifier, Class myClass)
_AD_ + {attribute qualifier} as name within this
item's class and its super classes.
this method may be overridden if you need to return access objects which cannot be static members of this item's class for some reason. Never forget to call super.getAccessorFor() for all other attributes !
qualifier - the attribute qualifier to find an access object formyClass - the class to search withinprotected AttributeAccess createNonClassAccessor(AttributeDescriptor fieldDescriptor)
protected void assureExtensionsLoaded()
public static void removeItemCollection(Collection collection) throws ConsistencyCheckException
This method iterates through the bean collection and calls remove() on each item.
collection - The collection of items, which will be removed.ConsistencyCheckException - if an error occurs during the remove process.public static void removeItemCollection(SessionContext ctx, Collection collection) throws ConsistencyCheckException
This method iterates through the bean collection and calls remove() on each item.
ctx - the session context to perform removal withincollection - The collection of items, which will be removed.ConsistencyCheckException - if an error occurs during the remove process.public Tenant getTenant()
getTenant in class BridgeAbstractionpublic void setImplementation(BridgeInterface impl)
Do not use directly. This is part of the Item creation and retrieval process.
setImplementation in class BridgeAbstractionimpl - the BridgeInterface objectpublic PK getPK()
This is used to get a serializable reference to this Item which can be transfered for example through HTTP POST/GET requests. This PK does not change in the lifetime of an item, so the PK can definitely always be cached. You can be sure that no exception is thrown if the underlaying EJB is no longer valid.
getPK() is a simple Java method invocation which NEVER will hit the network.
public Date getCreationTime()
protected void setCreationTime(Date creationTime)
public Date getModificationTime()
public long getPersistenceVersion()
public void setModificationTime(Date date)
public JaloSession getSession()
When no session instance is available otherwise always use this to access any Jalo Manager:
UserManager um = myItem.getSession().getUserManager();
protected SessionContext ctx()
getSession().getSessionContext().public PK getComposedTypePK()
public ComposedType getComposedType()
public boolean isInstanceOf(ComposedType type)
ComposedType.isInstance(Object).type - the ComposedTypetrue if this Item is an instance of the specified ComposedTypepublic Item setComposedType(ComposedType type) throws JaloInvalidParameterException
Please note that the Item instance class may have changed! The safes way changing the type is as follows:
Item myItem = ...
myItem = myItem.setComposedType( someType ); // directly assign new instance here
type - the new type of the itemJaloInvalidParameterException - in case the new type is not compatible with the current type. this happens a) if the type is abstract,
b) the new type's class is not compatible with the current class, or c) if the new type has a different
deployment (JNDI name, Table) than the current onepublic Item getOwner()
public void setOwner(Item item) throws ConsistencyCheckException
ConsistencyCheckExceptionpublic Object getAttribute(String qualifier) throws JaloInvalidParameterException, JaloSecurityException
qualifier - the attribute qualifier (case insensitive)JaloInvalidParameterException - in case the attribute cannot be readJaloSecurityException - in case it is not allowed to read this attributepublic Object getAttribute(SessionContext ctx, String qualifier) throws JaloInvalidParameterException, JaloSecurityException
qualifier - the attribute qualifier (case insensitive)ctx - the session context defining the language to fetch the value for (applies for to localized attributes
only )JaloInvalidParameterException - in case the attribute cannot be readJaloSecurityException - in case it is not allowed to read this attributepublic void setAttributeFromString(String qualifier, String value) throws JaloInvalidParameterException, JaloBusinessException
qualifier - the attribute qualifiervalue - the string value representationJaloInvalidParameterException - in case the attribute cannot be read or is not string-representableJaloBusinessException - if an error occurs during setting the valuepublic void setAttributeFromString(SessionContext ctx, String qualifier, String value) throws JaloInvalidParameterException, JaloBusinessException
ctx - the session contextqualifier - the attribute qualifiervalue - the string value representationJaloInvalidParameterException - in case the attribute cannot be read or is not string-representableJaloBusinessException - if an error occurs during setting the valuepublic Map getAllAttributes() throws JaloInvalidParameterException, JaloSecurityException
getAllAttributes(SessionContext, Set)
instead.JaloInvalidParameterException - in case one attribute cannot be readJaloSecurityException - in case one attribute is not allowed to be readpublic Map getAllAttributes(SessionContext ctx) throws JaloInvalidParameterException, JaloSecurityException
getAllAttributes(SessionContext, Set)
instead.ctx - the session context defining the language to fetch the value for (applies for to localized attributes
only )JaloInvalidParameterException - in case one attribute cannot be readJaloSecurityException - in case one attribute is not allowed to be readpublic Map getAllAttributes(SessionContext ctx, Item.AttributeFilter filter) throws JaloInvalidParameterException, JaloSecurityException
getAllAttributes(SessionContext, Set) instead.ctx - the session context to read values forfilter - the attribute filter to specify which attributes should be read and which should be skippedJaloInvalidParameterException - in case one attribute cannot be readJaloSecurityException - in case one attribute is not allowed to be readprotected void setUseTA(SessionContext ctx, boolean use)
protected boolean useTA(SessionContext ctx, boolean def)
public Map getAllAttributes(SessionContext ctx, Set<String> qualfiers) throws JaloInvalidParameterException, JaloSecurityException
ctx - the session context to read values forqualfiers - the qualifiers of all attributes to read values formJaloInvalidParameterException - in case one attribute cannot be readJaloSecurityException - in case one attribute is not allowed to be readprotected Map<String,Object> getAllAttributesInternal(SessionContext ctx, Set<String> qualfiers) throws JaloInvalidParameterException, JaloSecurityException
public void setAllAttributes(Map values) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
values - a map containing mapping from attribute qualifier to its new valueJaloInvalidParameterException - in case a wrong value was provided or a attribute could not be found at allJaloSecurityException - in case a attribute could not be writtenJaloBusinessException - on misc application errors during attribute writingpublic void setAllAttributes(SessionContext ctx, Map values) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
values - a map containing mapping from attribute qualifier to its new valuectx - the session context defining the language to fetch the value for (applies for to localized attributes
only )JaloInvalidParameterException - in case a wrong value was provided or a attribute could not be found at allJaloSecurityException - in case a attribute could not be writtenJaloBusinessException - on misc application errors during attribute writingprotected void setAllAttributesInternal(SessionContext ctx, Map values) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
protected void checkConstraint(Item.ItemConstraint constr) throws ConsistencyCheckException
Item.ItemConstraint for more
detail.constr - the consistency checking code objectConsistencyCheckException - in case the constraint is violatedpublic static boolean isInCreate(SessionContext ctx)
public void setAttribute(String qualifier, Object value) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
qualifier - the attribute qualifier of the attribute, of which the value will be set.value - the attribute value which will be setJaloInvalidParameterExceptionJaloSecurityExceptionJaloBusinessExceptionpublic void setAttribute(SessionContext ctx, String qualifier, Object value) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
ctx - the session contextqualifier - the attribute qualifier of the attribute, of which the value will be set.value - the attribute value which will be setJaloInvalidParameterExceptionJaloSecurityExceptionJaloBusinessExceptionpublic List getLinkedItems(boolean itemIsSource, String qualifier, Language lang)
itemIsSource - tells whether this item is source or target of the links to findqualifier - the link qualifierlang - optional: the language for localized linkspublic List getLinkedItems(boolean itemIsSource, String qualifier, Language lang, int start, int count)
itemIsSource - tells whether this item is source or target of the links to findqualifier - the link qualifierlang - optional: the language for localized linksstart - the start index of the item rangecount - the amount of items to fetch, use -1 for unlimited amountpublic long getLinkedItemsCount(boolean itemIsSource,
String qualifier,
Language lang)
itemIsSource - tells whether this item is source or target of the links to countqualifier - the link qualifierlang - optional: the link language for localized linkspublic List getLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang)
itemIsSource - tells whether this item is source or target of the links to findqualifier - the link qualifierlang - optional: the language for localized linksctx - the session context to execute this method withinpublic List getLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, boolean sortSrc2Tgt, boolean sortTgt2Src)
public List getLinkedItems(SessionContext ctx, boolean itemIsSource, String relationCode, String relatedItemCode, Language lang, boolean sortSrc2Tgt, boolean sortTgt2Src)
protected boolean isEmptyRelationValue(SessionContext ctx, String name, List value)
null values
are considered as empty. Example:
@Override
protected boolean isEmptyRelationValue(SessionContext ctx, String name, Object value)
{
return super.isEmptyValue(ctx, name, value) || ("myAttr".equals(name) && ((String) value).trim().length() == 0);
}
ctx - the session context while getting the propertyname - the property namevalue - the actual stored valueprotected boolean isRelationLocalizationFallbackEnabled(SessionContext ctx)
public List getLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, int start, int count)
itemIsSource - tells whether this item is source or target of the links to findqualifier - the link qualifierlang - optional: the language for localized linksstart - the start index of the item rangecount - the amount of items to fetch, use -1 for unlimited amountctx - the session context to execute this method withinpublic List getLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, int start, int count, boolean sortSrc2Tgt, boolean sortTgt2Src)
public long getLinkedItemsCount(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang)
itemIsSource - tells whether this item is source or target of the links to countqualifier - the link qualifierlang - optional: the link language for localized linksctx - the session context to execute this method withinpublic long getLinkedItemsCount(SessionContext ctx, boolean itemIsSource, String relationTypeCode, String relatedItemCode, Language lang)
ctx - the session context to execute this method withinitemIsSource - tells whether this item is source or target of the links to countrelationTypeCode - the link qualifierrelatedItemCode - the related item qualifierlang - optional: the link language for localized linkspublic Map getAllLinkedItems(boolean itemIsSource, String qualifier)
{ Language -> [ Item+] }
mappings. The item lists are ordered as described in getLinkedItems(boolean, String, Language).itemIsSource - tells whether this item is source or target of the links to evaluatequalifier - the link qualifierpublic void setLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List<? extends Item> itemsToLink)
itemIsSource - tells whether this item is link source or targetqualifier - the link qualifierlang - optional: the language if the links should be localizeditemsToLink - the new collection of items to link topublic void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List<? extends Item> itemsToLink)
itemIsSource - tells whether this item is link source or targetqualifier - the link qualifierlang - optional: the language if the links should be localizeditemsToLink - the new collection of items to link toctx - the session context to execute this method withinpublic void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, Collection<? extends Item> itemsToLink)
public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, Collection<? extends Item> itemsToLink, boolean markModified)
public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List<? extends Item> itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src)
public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List<? extends Item> itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)
public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, Collection<? extends Item> itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src)
public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, Collection<? extends Item> itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)
public void setAllLinkedItems(boolean itemIsSource,
String qualifier,
Map languageToItemListMap)
Languages as keys and lists
of items as values. The order within these lists is preserved if this item is the source item of these links.itemIsSource - tells whether this item is link source or targetqualifier - the link qualifierlanguageToItemListMap - the new items to link as Language -> [Item] mappublic void setAllLinkedItems(boolean itemIsSource,
String qualifier,
Map languageToItemListMap,
boolean markModified)
Languages as keys and lists
of items as values. The order within these lists is preserved if this item is the source item of these links.itemIsSource - tells whether this item is link source or targetqualifier - the link qualifierlanguageToItemListMap - the new items to link as Language -> [Item] mappublic void setAllLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Map languageToItemListMap)
Languages as keys and lists
of items as values. The order within these lists is preserved if this item is the source item of these links.itemIsSource - tells whether this item is link source or targetqualifier - the link qualifierlanguageToItemListMap - the new items to link as Language -> [Item] mappublic void setAllLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Map languageToItemListMap, boolean markModified)
public void addLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink)
itemIsSource - tells whether this item is source or target of the new linksqualifier - specifies the link qualifierlang - optional: the language to create localized links foritemsToLink - the items which will be linked with this itempublic void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink)
itemIsSource - tells whether this item is source or target of the new linksqualifier - specifies the link qualifierlang - optional: the language to create localized links foritemsToLink - the items which will be linked with this itemctx - the session context to execute this method withinpublic void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink, boolean markModified)
public void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src)
public void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)
public void addLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink,
int position)
itemIsSource - tells whether this item is source or target of the new linksqualifier - specifies the link qualifierlang - optional: the language to create localized links foritemsToLink - the items which will be linked with this itemposition - the position where to insert the new links ( -1 means append at the end )public void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink, int position)
itemIsSource - tells whether this item is source or target of the new linksqualifier - specifies the link qualifierlang - optional: the language to create localized links foritemsToLink - the items which will be linked with this itemposition - the position where to insert the new links ( -1 means append at the end )ctx - the session context to execute this method withinpublic void addLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List itemsToLink,
int position,
boolean shift)
Use this to add links at specific positions like this:
Item myItem = ...
Item[] toLink = ...
// add at 3
myItem.addLinkedItems( myItem, true, "myRel", null, Collections.singletonList(toLink[0]), 3, false );
// add at 1 *and* avoid shifting the previous link from 3 to 4 !
myItem.addLinkedItems( myItem, true, "myRel", null, Collections.singletonList(toLink[1]), 1, false );
// add at 7
myItem.addLinkedItems( myItem, true, "myRel", null, Collections.singletonList(toLink[2]), 7, false );
itemIsSource - tells whether this item is source or target of the new linksqualifier - specifies the link qualifierlang - optional: the language to create localized links foritemsToLink - the items which will be linked with this itemposition - the position where to insert the new links ( -1 means append at the end )shift - thells whether succeeding links should shift their positions accoding to new links size or notpublic void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink, int position, boolean shift)
Use this to add links at specific positions like this:
Item myItem = ...
Item[] toLink = ...
// add at 3
myItem.addLinkedItems( myItem, true, "myRel", null, Collections.singletonList(toLink[0]), 3, false );
// add at 1 *and* avoid shifting the previous link from 3 to 4 !
myItem.addLinkedItems( myItem, true, "myRel", null, Collections.singletonList(toLink[1]), 1, false );
// add at 7
myItem.addLinkedItems( myItem, true, "myRel", null, Collections.singletonList(toLink[2]), 7, false );
itemIsSource - tells whether this item is source or target of the new linksqualifier - specifies the link qualifierlang - optional: the language to create localized links foritemsToLink - the items which will be linked with this itemposition - the position where to insert the new links ( -1 means append at the end )shift - thells whether succeeding links should shift their positions accoding to new links size or notctx - the session context to execute this method withinpublic void removeLinkedItems(boolean itemIsSource,
String qualifier,
Language lang,
List itemsToUnlink)
itemIsSource - tells whether this item is source or target of the links to removequalifier - the qualifier of the linkslang - optional: the language of the localized linksitemsToUnlink - the items to unlink (non-existing links will be ignored)public void removeLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToUnlink)
itemIsSource - tells whether this item is source or target of the links to removequalifier - the qualifier of the linkslang - optional: the language of the localized linksitemsToUnlink - the items to unlink (non-existing links will be ignored)ctx - the session context to execute this method withinpublic void removeLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToUnlink, boolean sortSrc2Tgt, boolean sortTgt2Src)
public void removeLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToUnlink, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)
public void remove()
throws ConsistencyCheckException
This method calls remove(SessionContext) with the current session's SessionContext object. See this
method for more details.
ConsistencyCheckException - if this item could not be removed for some reasonpublic void remove(SessionContext ctx) throws ConsistencyCheckException
This method is using the following attributes of the given SessionContext:
| CacheUsage | Language | StagingMethod | ||
|---|---|---|---|---|
| n/a (this is a setter method) | no, language doesn't matter for removal | yes if called on a StageableItem, no otherwise |
ctx - A SessionContext objectConsistencyCheckException - if this item could not be removed for some reasonprotected void doBeforeRemove(SessionContext ctx, Map removalCtx)
remove(SessionContext) because this method is guaranteed to be called in synchronized context.protected void doAfterRemove(SessionContext ctx, Map removalCtx)
remove(SessionContext) because this method is guaranteed to be called in synchronized context.public static boolean isCurrentlyRemoving(Item item)
public static boolean isCurrentlyRemoving(PK pk)
public static int getCurrentlyRemovingCount()
protected void removePartOfItems(SessionContext ctx) throws ConsistencyCheckException
ctx - ConsistencyCheckExceptionprotected void removePartOfItems(SessionContext ctx, Map<String,Object> emptyValuesMap) throws ConsistencyCheckException
ConsistencyCheckExceptionprotected void removeLinks()
protected void checkRemovable(SessionContext ctx) throws ConsistencyCheckException
ctx - ConsistencyCheckException - to indicate that the item cannot be removedprotected void notifyItemRemoval(SessionContext ctx)
ctx - public final boolean equals(Object object)
Thus, performing a item.getPK().equals(item2.getPK() ) produces the same result, but this method can
use optimized code so you should use item.equals(item2) whenever you want to compare two items for
equality.
public int compareTo(Object object)
compareTo in interface Comparableobject - which will be compared to this item.public final int hashCode()
The hashcode of an item is defined as the hashcode of its primary key object.
public String toString()
String representation of this item. This is by default the representation of the primary
key of this item.public Set getRestrictedPrincipals()
public Set getPermissions(Principal principal, boolean negative)
Principal.principal - the Principal whos permissions will be returnednegative - if set to true, all negative permissions will be returned, if set to false,
all positive permission will be returned.UserRightpublic Map getPermissionMap(List userRights)
{ Principal -> [ Boolean.TRUE == negative | Boolean.FALSE == positive | null == not set ] }.
an example:
rights = [ r1 , r2 , r3 ]
result = { user1 -> [ T , F , F ]
user2 -> [ null, null, T ]
}
which means:
user1 is denied r1, allowed r2 and r3
user2 is denied r3, others are not set ( default or derived permission is take )
userRights - a list of UserRightspublic void setPermissionsByMap(List userRights, Map permissionMap) throws JaloSecurityException
Principal -> [
Boolean.TRUE == negative || Boolean.FALSE == positive || null == not set }.
An example:
rights = [ r1 , r2 , r3 ] permissionMap = { user1 -> [ T , F , F ] user2 -> [ null, null, T ] } which means:
user1 is denied r1, allowed r2 and r3 user2 is denied r3, others are not set ( default or derived permission is
take )
userRights - a list of UserRight, <code> null </code> is not
allowedpermissionMap - a map containing the user to permission information.JaloSecurityExceptionpublic Set getPositivePermissions(Principal principal)
Principal.principal - all returned permissions belong to.UserRightpublic Set getNegativePermissions(Principal principal)
Principal.principal - all returned permissions belong to.UserRightpublic void addPermission(Principal principal, UserRight right, boolean negative)
Principal and the UserRight on the Item.principal - the Principal the permission belongs to.right - the UserRight the permission belongs to.negative - true if the permission should be negative, otherwise a positive permissionpublic void clearPermission(Principal principal, UserRight right)
Principal and the UserRight on the Item.principal - the Principal the removed permission belongs to.right - the UserRight the removed permission belongs to.public void addPositivePermission(Principal principal, UserRight right)
Principal and the UserRight on the Item.principal - the Principal the positive permission belongs to.right - the UserRight the positive permission belongs to.public void addNegativePermission(Principal principal, UserRight right)
Principal and the UserRight on the Item.principal - the Principal the negative permission belongs to.right - the UserRight the negative permission belongs to.public boolean checkPermission(UserRight right)
UserRight on the Item.right - the UserRight the permission should be checked fortrue if the current session user has the UserRight for this Itempublic boolean checkPermission(Principal principal, UserRight right)
Principal has the given UserRight on the Item.principal - the Principal the permission should be checked forright - the UserRight the permission should be checked fortrue if the Principal has the UserRight for this Itempublic void setTransientObject(String key, Object value)
the value will be mapped to this object until
setTransientObject(key,null)
setTransientObject in class BridgeAbstractionkey - the keyvalue - may be null; this will remove the transient object mappingpublic Object getTransientObject(String key)
null is returned if no transient object is mapped to the given key.
getTransientObject in class BridgeAbstractionkey - the key of the transient object which should be returned.public Map getTransientObjectMap()
Map of transient objects.
Note: Changes are directly reflected to the BridgeAbstraction object. The returned map is bound to the object. So be careful when modifying the map.
getTransientObjectMap in class BridgeAbstractionMap of all transient objects.public void refreshRemote()
throws JaloObjectNoLongerValidException
JaloObjectNoLongerValidExceptionpublic boolean isAlive()
true if this item is still valid.true if this item is still valid.public <T extends Item> T getCacheBoundItem()
public <T extends Item> T getAndCheckCacheBoundItem()
public void setCacheBound(boolean bound)
public boolean isCacheBound()
public void invalidateLocalCaches()
public final Item newInstance(SessionContext ctx, ComposedType type, Map attributeAssignment) throws JaloBusinessException
Item using the specified parameters.ctx - the session context which the new item should be created withintype - the ComposedType of the newly created ItemattributeAssignment - a map containing the attribute values of the newly created ItemItemJaloBusinessExceptionprotected void notifyExtensionsBeforeItemCreation(SessionContext ctx, ComposedType type, Item.ItemAttributeMap attributes) throws JaloBusinessException
JaloBusinessExceptionprotected void notifyExtensionsAfterItemCreation(SessionContext ctx, ComposedType type, Item createdItem, Item.ItemAttributeMap attributes) throws JaloBusinessException
JaloBusinessExceptionprotected Item changeTypeAfterCreation(Item newOne, ComposedType requestedType) throws JaloInvalidParameterException
createItem(SessionContext, ComposedType, ItemAttributeMap) did not set the
requested type directly.
overriding this method should hardly be necessary - common case might be disallowing the type to be changed at all.
newOne - the newly created itemrequestedType - the type which triggered this items creationJaloInvalidParameterExceptionpublic void setNonInitialAttributes(SessionContext ctx, Item item, Item.ItemAttributeMap nonInitialAttributes) throws JaloBusinessException
createItem(SessionContext, ComposedType, ItemAttributeMap). as default this method just iterates over all
attribute mappings and sets the value by invoking setAttribute(SessionContext, String, Object).ctx - session context with language = NULLitem - the newly created itemnonInitialAttributes - the non-initial attributed obtained via
getNonInitialAttributes(SessionContext, ItemAttributeMap)JaloBusinessExceptionprotected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)
createItem(SessionContext, ComposedType, ItemAttributeMap).
use it like this:
protected ItemAttributeMap getNonInitialAttributes( SessionContext ctx, ItemAttributeMap allAttributes ) {
// let all superclasses remove their intial attributes too final ItemAttributeMap attributes =
super.getNonInitialAttributes( ctx, allAttributes ); // remove own initial attributes here attributes.remove(
MyItem.MY_INITIAL_ATTR ); return ret; }
it is vital to optain the map via super.getNonInitialAttributes and pass it on as such since this
ensures that attribute qualifiers are treated case insensitive!ctx - session context with language = NULLallAttributes - a ItemAttributeMap contaning attribute values.ItemAttributeMap containing all attribute values, which belong to non-initial attributes.protected static boolean checkMandatoryAttribute(String qualifier, Item.ItemAttributeMap allAttributes, Set missingSet)
qualifier - the qualifier to checkallAttributes - the creation attributes mapmissingSet - the container to add a missing qualifier toprotected static boolean checkMandatoryAttribute(String qualifier, Item.ItemAttributeMap allAttributes, Set missingSet, boolean nullAllowed)
qualifier - the qualifier to checkallAttributes - the creation attributes mapmissingSet - the container to add a missing qualifier tonullAllowed - tells whether null values are allowed or such qualifiers are treated as missing onesprotected abstract Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
ComposedType.newInstance(Map).
In case this method uses any of the attribute values during creation it is required to override
getNonInitialAttributes(SessionContext, ItemAttributeMap) too.
Sn example:
public static final String MY_ATTRIBUTE = "someAttribute"; ... protected Item createItem(SessionContext
ctx, ComposedType type, Map allAttributes ) throws JaloBusinessException { MyManager man = ... return
man.createMyItem( (String)allAttributes.get(MY_ATTRIBUTE) );
// here MY_ATTRIBUTE is used for creation, so it must not be set again } protected Map getNonInitialAttributes(
SessionContext ctx, Map allAttributes ) { // let superclass remove its own initial attributes Map ret =
super.getNonInitialAttributes( ctx, allAttributes );
// remove MY_ATTRIBUTE from all attributes since if has already been set ret.remove(MY_ATTRIBUTE); return ret; }
ctx - the current session context which this item is created withintype - the actual item type ( since subtypes may not provide a own jalo class this may be different from the
type which this method was implemented for )allAttributes - JaloBusinessException - indicates an error during creation - any changes will be rollbackedpublic Object getSyncObject()
public Object writeReplace() throws ObjectStreamException
This is sufficient because reading items is also handled specially by fetching it via PK instead of using the
object from the stream ( see readResolve() ).
ObjectStreamExceptionpublic Object readResolve() throws ObjectStreamException
JaloSession.getItem(PK).ObjectStreamExceptionprotected boolean isItemCheckBeforeRemoveableDisabled(SessionContext ctx)
ctx - the sessioncontextDISABLE_SUBCATEGORY_REMOVALCHECK exists AND
the value of this attribute is trueprotected Map<String,Item.AttributeMode> getDefaultAttributeModes()
Copyright © 2017 SAP SE. All Rights Reserved.