Package de.hybris.platform.jalo.link
Class Link
java.lang.Object
de.hybris.platform.util.BridgeAbstraction
de.hybris.platform.jalo.Item
de.hybris.platform.jalo.ExtensibleItem
de.hybris.platform.jalo.link.Link
- All Implemented Interfaces:
Serializable,Comparable
Represents a link between two arbitrary
Items. A Link can be either localized or
unlocalized.- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImplNested classes/interfaces inherited from class de.hybris.platform.jalo.Item
Item.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ItemUsed in Link Manager finder methods to express "any source" or "any target".static final LanguageUsed in Link Manager finder methods to express "any language".static final StringConstant identifier forlanguageattribute of Link type.static final StringConstant identifier forqualifierattribute of Link type.static final StringConstant identifier forreverseSequenceNumberattribute of Link type.static final StringConstant identifier forsequenceNumberattribute of Link type.static final StringConstant identifier forsourceattribute of Link type.static final StringConstant identifier fortargetattribute of Link type.Fields inherited from class de.hybris.platform.jalo.Item
_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, HJMPTS, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPEFields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ItemcreateItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) Has to be implemented for each concrete subtype of item.returns the implementation object of this jalo bridge abstractionReturns theLanguagewhich is assigned to theLink.protected Item.ItemAttributeMapgetNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) Defines all attributes which should be set after item creation.Returns the qualifier of theLink.intReturns the reverse sequence number of theLink.intReturns the sequence number of theLink.Returns the sourceItemof theLink.Returns the targetItemof theLink.protected voidSuperclass method overridden to disable searching for links for links themselves.voidsetAttribute(SessionContext ctx, String qualifier, Object value) Overwritten to acceptpk instancesas value for source and target attribute too (perf).voidsetLanguage(Language language) Sets theLanguagewhich is assigned to theLink.voidsetQualifier(String qualifier) Sets the new qualifier of theLink.voidsetReverseSequenceNumber(int number) Sets the sequence number of theLink.voidsetSequenceNumber(int number) Sets the sequence number of theLink.voidSets the sourceItemof theLink.voidsetSourcePK(PK sourcePK) Changes source item PK directly.voidSets the targetItemof theLink.voidsetTargetPK(PK targetPK) Changes target item PK directly.toString()Returns theStringrepresentation of theLink.
Link[Qualifier: null|Link.QUALIFIER, Language: null|Link.LANGUAGE, Source: null|Link.SOURCE -> Target: null|Link.TARGET]Methods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setPropertyMethods inherited from class de.hybris.platform.jalo.Item
addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addNegativePermission, addPermission, addPositivePermission, assureExtensionsLoaded, changeTypeAfterCreation, checkConstraint, checkItemPermission, checkMandatoryAttribute, checkMandatoryAttribute, checkPermission, checkPermission, checkRemovable, clearPermission, compareTo, ctx, doAfterRemove, doBeforeRemove, equals, getAccessorFor, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributesInternal, getAllLinkedItems, getAndCheckCacheBoundItem, getAttribute, getAttribute, getCacheBoundItem, getComposedType, getComposedTypePK, getCreationTime, getCurrentlyRemovingCount, getDefaultAttributeModes, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItemsCount, getLinkedItemsCount, getLinkedItemsCount, getModificationTime, getNegativePermissions, getOwner, getPartOfRemovedSessionMarker, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, getRelatedItems, getRelatedItems, getRestrictedPrincipals, getSession, getSyncObject, getTenant, getTransientObject, getTransientObjectMap, hashCode, hasRegisteredClassAccessorFor, internal_registerClassAccessorFor, internal_registerNonClassAccessorFor, invalidateLocalCaches, isAlive, isCacheBound, isCurrentlyRemoving, isCurrentlyRemoving, isEmptyRelationValue, isInCreate, isInstanceOf, isItemCheckBeforeRemoveableDisabled, isMarkModifiedDisabled, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, notifyManagerAboutItemRemoval, readResolve, registerAccessFor, registerAccessFor, registerJaloInvalidationListeners, remove, remove, removeItemCollection, removeItemCollection, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinkedItems, removePartOfItems, removePartOfItems, setAllAttributes, setAllAttributes, setAllAttributesInternal, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAttribute, setAttributeFromString, setAttributeFromString, setCacheBound, setComposedType, setCreationTime, setImplementation, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setModificationTime, setNonInitialAttributes, setOwner, setPermissionsByMap, setRelatedItems, setTransientObject, setUseTA, suppressRelation, useTA, writeReplaceMethods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
Field Details
-
ANYITEM
Used in Link Manager finder methods to express "any source" or "any target". -
ANYLANGUAGE
Used in Link Manager finder methods to express "any language". -
QUALIFIER
Constant identifier forqualifierattribute of Link type.- See Also:
-
SOURCE
Constant identifier forsourceattribute of Link type.- See Also:
-
TARGET
Constant identifier fortargetattribute of Link type.- See Also:
-
LANGUAGE
Constant identifier forlanguageattribute of Link type.- See Also:
-
SEQUENCE_NUMBER
Constant identifier forsequenceNumberattribute of Link type.- See Also:
-
REVERSE_SEQUENCE_NUMBER
Constant identifier forreverseSequenceNumberattribute of Link type.- See Also:
-
-
Constructor Details
-
Link
public Link()
-
-
Method Details
-
getImplementation
Description copied from class:BridgeAbstractionreturns the implementation object of this jalo bridge abstraction- Overrides:
getImplementationin classExtensibleItem- Returns:
- the implementation object of this jalo bridge abstraction
-
createItem
protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException Description copied from class:ItemHas to be implemented for each concrete subtype of item. This method is responsible for creating a new item instance ( by calling managers, ejb homes, etc. ) duringComposedType.newInstance(Map).In case this method uses any of the attribute values during creation it is required to override
Item.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; }- Specified by:
createItemin classItem- Parameters:
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 )- Returns:
- the new item instance
- Throws:
JaloBusinessException- indicates an error during creation - any changes will be rollbacked
-
getNonInitialAttributes
protected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) Description copied from class:ItemDefines all attributes which should be set after item creation. this is done be removing all attributes which are already set byItem.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!- Overrides:
getNonInitialAttributesin classItem- Parameters:
ctx- session context with language = NULLallAttributes- aItemAttributeMapcontaning attribute values.- Returns:
- a
ItemAttributeMapcontaining all attribute values, which belong to non-initial attributes.
-
setAttribute
public void setAttribute(SessionContext ctx, String qualifier, Object value) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException Overwritten to acceptpk instancesas value for source and target attribute too (perf).- Overrides:
setAttributein classItem- Parameters:
ctx- the session contextqualifier- the attribute qualifier of the attribute, of which the value will be set.value- the attribute value which will be set- Throws:
JaloInvalidParameterExceptionJaloSecurityExceptionJaloBusinessException
-
removeLinks
protected void removeLinks()Superclass method overridden to disable searching for links for links themselves.- Overrides:
removeLinksin classItem
-
getSource
Returns the sourceItemof theLink.- Returns:
- the source
Itemof theLink
-
setSource
Sets the sourceItemof theLink.- Parameters:
source- the new sourceItemof theLink
-
setSourcePK
Changes source item PK directly.- Parameters:
sourcePK-
-
getTarget
Returns the targetItemof theLink.- Returns:
- the target
Itemof theLink
-
setTarget
Sets the targetItemof theLink.- Parameters:
target- the new targetItemof theLink
-
setTargetPK
Changes target item PK directly.- Parameters:
targetPK-
-
getLanguage
Returns theLanguagewhich is assigned to theLink. If theLinkis unlocalized,nullis returned.- Returns:
- the
Languagewhich is assigned to theLink
-
setLanguage
Sets theLanguagewhich is assigned to theLink.- Parameters:
language- the newLanguage
-
getQualifier
Returns the qualifier of theLink.- Returns:
- the qualifier of the
Link
-
setQualifier
Sets the new qualifier of theLink.- Parameters:
qualifier- the new qualifier
-
toString
Returns theStringrepresentation of theLink.
Link[Qualifier: null|Link.QUALIFIER, Language: null|Link.LANGUAGE, Source: null|Link.SOURCE -> Target: null|Link.TARGET] -
getSequenceNumber
public int getSequenceNumber()Returns the sequence number of theLink. The sequence number is used to define a order over all links with the same sourceItemand qualifier. The sequence number is automatically set, if theLinkhas been created withItem.addLinkedItems(boolean, String, Language, java.util.List)Item.addLinkedItems(boolean, String, Language, java.util.List, int)Item.addLinkedItems(boolean, String, Language, java.util.List, int, boolean)Item.addLinkedItems(SessionContext, boolean, String, Language, java.util.List)Item.addLinkedItems(SessionContext, boolean, String, Language, java.util.List, int)Item.addLinkedItems(SessionContext, boolean, String, Language, java.util.List, int, boolean)
- Returns:
- the sequence number of the
Link - See Also:
-
setSequenceNumber
public void setSequenceNumber(int number) Sets the sequence number of theLink.- Parameters:
number- the new sequence number- See Also:
-
getReverseSequenceNumber
public int getReverseSequenceNumber()Returns the reverse sequence number of theLink. The number is used to define an order over all links with the same targetItemand qualifier. The sequence number is automatically set, if theLinkhas been created withItem.addLinkedItems(boolean, String, Language, java.util.List)Item.addLinkedItems(boolean, String, Language, java.util.List, int)Item.addLinkedItems(boolean, String, Language, java.util.List, int, boolean)Item.addLinkedItems(SessionContext, boolean, String, Language, java.util.List)Item.addLinkedItems(SessionContext, boolean, String, Language, java.util.List, int)Item.addLinkedItems(SessionContext, boolean, String, Language, java.util.List, int, boolean)
- Returns:
- the sequence number of the
Link - See Also:
-
setReverseSequenceNumber
public void setReverseSequenceNumber(int number) Sets the sequence number of theLink.- Parameters:
number- the new sequence number- See Also:
-