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:
java.io.Serializable,java.lang.Comparable
public class Link extends ExtensibleItem
Represents a link between two arbitraryItems. ALinkcan be either localized or unlocalized.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLink.LinkImplInterface to persistence layer.-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImpl
-
Nested 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
Fields Modifier and Type Field Description static ItemANYITEMUsed in Link Manager finder methods to express "any source" or "any target".static LanguageANYLANGUAGEUsed in Link Manager finder methods to express "any language".static java.lang.StringLANGUAGEConstant identifier forlanguageattribute of Link type.static java.lang.StringQUALIFIERConstant identifier forqualifierattribute of Link type.static java.lang.StringREVERSE_SEQUENCE_NUMBERConstant identifier forreverseSequenceNumberattribute of Link type.static java.lang.StringSEQUENCE_NUMBERConstant identifier forsequenceNumberattribute of Link type.static java.lang.StringSOURCEConstant identifier forsourceattribute of Link type.static java.lang.StringTARGETConstant 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, TYPE
-
Fields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant
-
-
Constructor Summary
Constructors Constructor Description Link()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ItemcreateItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes)Has to be implemented for each concrete subtype of item.Link.LinkImplgetImplementation()returns the implementation object of this jalo bridge abstractionLanguagegetLanguage()Returns theLanguagewhich is assigned to theLink.protected Item.ItemAttributeMapgetNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)Defines all attributes which should be set after item creation.java.lang.StringgetQualifier()Returns the qualifier of theLink.intgetReverseSequenceNumber()Returns the reverse sequence number of theLink.intgetSequenceNumber()Returns the sequence number of theLink.ItemgetSource()Returns the sourceItemof theLink.ItemgetTarget()Returns the targetItemof theLink.protected voidremoveLinks()Superclass method overridden to disable searching for links for links themselves.voidsetAttribute(SessionContext ctx, java.lang.String qualifier, java.lang.Object value)Overwritten to acceptpk instancesas value for source and target attribute too (perf).voidsetLanguage(Language language)Sets theLanguagewhich is assigned to theLink.voidsetQualifier(java.lang.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.voidsetSource(Item source)Sets the sourceItemof theLink.voidsetSourcePK(PK sourcePK)Changes source item PK directly.voidsetTarget(Item target)Sets the targetItemof theLink.voidsetTargetPK(PK targetPK)Changes target item PK directly.java.lang.StringtoString()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, setProperty
-
Methods 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, writeReplace
-
Methods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
-
-
-
Field Detail
-
ANYITEM
public static final Item ANYITEM
Used in Link Manager finder methods to express "any source" or "any target".
-
ANYLANGUAGE
public static final Language ANYLANGUAGE
Used in Link Manager finder methods to express "any language".
-
QUALIFIER
public static final java.lang.String QUALIFIER
Constant identifier forqualifierattribute of Link type.- See Also:
- Constant Field Values
-
SOURCE
public static final java.lang.String SOURCE
Constant identifier forsourceattribute of Link type.- See Also:
- Constant Field Values
-
TARGET
public static final java.lang.String TARGET
Constant identifier fortargetattribute of Link type.- See Also:
- Constant Field Values
-
LANGUAGE
public static final java.lang.String LANGUAGE
Constant identifier forlanguageattribute of Link type.- See Also:
- Constant Field Values
-
SEQUENCE_NUMBER
public static final java.lang.String SEQUENCE_NUMBER
Constant identifier forsequenceNumberattribute of Link type.- See Also:
- Constant Field Values
-
REVERSE_SEQUENCE_NUMBER
public static final java.lang.String REVERSE_SEQUENCE_NUMBER
Constant identifier forreverseSequenceNumberattribute of Link type.- See Also:
- Constant Field Values
-
-
Method Detail
-
getImplementation
public Link.LinkImpl 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, java.lang.String qualifier, java.lang.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
public Item getSource()
Returns the sourceItemof theLink.- Returns:
- the source
Itemof theLink
-
setSource
public void setSource(Item source)
Sets the sourceItemof theLink.- Parameters:
source- the new sourceItemof theLink
-
setSourcePK
public void setSourcePK(PK sourcePK)
Changes source item PK directly.- Parameters:
sourcePK-
-
getTarget
public Item getTarget()
Returns the targetItemof theLink.- Returns:
- the target
Itemof theLink
-
setTarget
public void setTarget(Item target)
Sets the targetItemof theLink.- Parameters:
target- the new targetItemof theLink
-
setTargetPK
public void setTargetPK(PK targetPK)
Changes target item PK directly.- Parameters:
targetPK-
-
getLanguage
public Language getLanguage()
Returns theLanguagewhich is assigned to theLink. If theLinkis unlocalized,nullis returned.- Returns:
- the
Languagewhich is assigned to theLink
-
setLanguage
public void setLanguage(Language language)
Sets theLanguagewhich is assigned to theLink.- Parameters:
language- the newLanguage
-
getQualifier
public java.lang.String getQualifier()
Returns the qualifier of theLink.- Returns:
- the qualifier of the
Link
-
setQualifier
public void setQualifier(java.lang.String qualifier)
Sets the new qualifier of theLink.- Parameters:
qualifier- the new qualifier
-
toString
public java.lang.String 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(int)
-
setSequenceNumber
public void setSequenceNumber(int number)
Sets the sequence number of theLink.- Parameters:
number- the new sequence number- See Also:
getSequenceNumber()
-
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(int)
-
setReverseSequenceNumber
public void setReverseSequenceNumber(int number)
Sets the sequence number of theLink.- Parameters:
number- the new sequence number- See Also:
getReverseSequenceNumber()
-
-