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
. ALink
can be either localized or unlocalized.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Link.LinkImpl
Interface 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 Item
ANYITEM
Used in Link Manager finder methods to express "any source" or "any target".static Language
ANYLANGUAGE
Used in Link Manager finder methods to express "any language".static java.lang.String
LANGUAGE
Constant identifier forlanguage
attribute of Link type.static java.lang.String
QUALIFIER
Constant identifier forqualifier
attribute of Link type.static java.lang.String
REVERSE_SEQUENCE_NUMBER
Constant identifier forreverseSequenceNumber
attribute of Link type.static java.lang.String
SEQUENCE_NUMBER
Constant identifier forsequenceNumber
attribute of Link type.static java.lang.String
SOURCE
Constant identifier forsource
attribute of Link type.static java.lang.String
TARGET
Constant identifier fortarget
attribute 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 Item
createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes)
Has to be implemented for each concrete subtype of item.Link.LinkImpl
getImplementation()
returns the implementation object of this jalo bridge abstractionLanguage
getLanguage()
Returns theLanguage
which is assigned to theLink
.protected Item.ItemAttributeMap
getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)
Defines all attributes which should be set after item creation.java.lang.String
getQualifier()
Returns the qualifier of theLink
.int
getReverseSequenceNumber()
Returns the reverse sequence number of theLink
.int
getSequenceNumber()
Returns the sequence number of theLink
.Item
getSource()
Returns the sourceItem
of theLink
.Item
getTarget()
Returns the targetItem
of theLink
.protected void
removeLinks()
Superclass method overridden to disable searching for links for links themselves.void
setAttribute(SessionContext ctx, java.lang.String qualifier, java.lang.Object value)
Overwritten to acceptpk instances
as value for source and target attribute too (perf).void
setLanguage(Language language)
Sets theLanguage
which is assigned to theLink
.void
setQualifier(java.lang.String qualifier)
Sets the new qualifier of theLink
.void
setReverseSequenceNumber(int number)
Sets the sequence number of theLink
.void
setSequenceNumber(int number)
Sets the sequence number of theLink
.void
setSource(Item source)
Sets the sourceItem
of theLink
.void
setSourcePK(PK sourcePK)
Changes source item PK directly.void
setTarget(Item target)
Sets the targetItem
of theLink
.void
setTargetPK(PK targetPK)
Changes target item PK directly.java.lang.String
toString()
Returns theString
representation 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, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, 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, 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 forqualifier
attribute of Link type.- See Also:
- Constant Field Values
-
SOURCE
public static final java.lang.String SOURCE
Constant identifier forsource
attribute of Link type.- See Also:
- Constant Field Values
-
TARGET
public static final java.lang.String TARGET
Constant identifier fortarget
attribute of Link type.- See Also:
- Constant Field Values
-
LANGUAGE
public static final java.lang.String LANGUAGE
Constant identifier forlanguage
attribute of Link type.- See Also:
- Constant Field Values
-
SEQUENCE_NUMBER
public static final java.lang.String SEQUENCE_NUMBER
Constant identifier forsequenceNumber
attribute of Link type.- See Also:
- Constant Field Values
-
REVERSE_SEQUENCE_NUMBER
public static final java.lang.String REVERSE_SEQUENCE_NUMBER
Constant identifier forreverseSequenceNumber
attribute of Link type.- See Also:
- Constant Field Values
-
-
Method Detail
-
getImplementation
public Link.LinkImpl getImplementation()
Description copied from class:BridgeAbstraction
returns the implementation object of this jalo bridge abstraction- Overrides:
getImplementation
in 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:Item
Has 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:
createItem
in 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:Item
Defines 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:
getNonInitialAttributes
in classItem
- Parameters:
ctx
- session context with language = NULLallAttributes
- aItemAttributeMap
contaning attribute values.- Returns:
- a
ItemAttributeMap
containing 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 instances
as value for source and target attribute too (perf).- Overrides:
setAttribute
in 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:
JaloInvalidParameterException
JaloSecurityException
JaloBusinessException
-
removeLinks
protected void removeLinks()
Superclass method overridden to disable searching for links for links themselves.- Overrides:
removeLinks
in classItem
-
getSource
public Item getSource()
Returns the sourceItem
of theLink
.- Returns:
- the source
Item
of theLink
-
setSource
public void setSource(Item source)
Sets the sourceItem
of theLink
.- Parameters:
source
- the new sourceItem
of theLink
-
setSourcePK
public void setSourcePK(PK sourcePK)
Changes source item PK directly.- Parameters:
sourcePK
-
-
getTarget
public Item getTarget()
Returns the targetItem
of theLink
.- Returns:
- the target
Item
of theLink
-
setTarget
public void setTarget(Item target)
Sets the targetItem
of theLink
.- Parameters:
target
- the new targetItem
of theLink
-
setTargetPK
public void setTargetPK(PK targetPK)
Changes target item PK directly.- Parameters:
targetPK
-
-
getLanguage
public Language getLanguage()
Returns theLanguage
which is assigned to theLink
. If theLink
is unlocalized,null
is returned.- Returns:
- the
Language
which is assigned to theLink
-
setLanguage
public void setLanguage(Language language)
Sets theLanguage
which 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 theString
representation 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 sourceItem
and qualifier. The sequence number is automatically set, if theLink
has 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 targetItem
and qualifier. The sequence number is automatically set, if theLink
has 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()
-
-