Class Item

All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
ConfigProxyItem, ExtensibleItem, ViewResultItem

public abstract class Item extends BridgeAbstraction implements Comparable
The superclass of all the hybris platform persistent data-objects.

Important:
To retrieve any object by its PK you just have to use

(class)JaloSession.getItem(PK)
where class is the Class of the Object you want to retrieve and JaloSession is an active 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) .

See Also:
  • Field Details

    • accessorLog

      public static final org.apache.log4j.Logger accessorLog
    • FEATURE_ACCESSMAP_QUALIFIER

      public static final String FEATURE_ACCESSMAP_QUALIFIER
    • SAVE_FROM_SERVICE_LAYER

      public static final String SAVE_FROM_SERVICE_LAYER
      SessionContext attribute flag providing information if the save operation was triggered from Service Layer. If enabled - the allowed principals should not be copied into related categories.
      See Also:
    • DISABLE_ITEMCHECK_BEFORE_REMOVABLE

      public static final String DISABLE_ITEMCHECK_BEFORE_REMOVABLE
      SessionContext Flag. If this Flag is in the ctx set to true the check before Item removable is disabled.
      See Also:
    • isJaloOnly

      protected final boolean isJaloOnly
    • staticTransientObjects

      protected static final ConcurrentMap<PK,Map<String,Object>> staticTransientObjects
      The transient object cache. Since this is implemented as Guava Cache with maximum capacity, transient objects can disappear when not used for a longer time.
    • PK

      public static final String PK
      The PK attribute constant.
    • _CREATION_TIME_INTERNAL

      public static final String _CREATION_TIME_INTERNAL
      The _CREATION_TIME_INTERNAL attribute constant.
    • _MODIFIED_TIME_INTERNAL

      public static final String _MODIFIED_TIME_INTERNAL
      The _MODIFIED_TIME_INTERNAL attribute constant.
    • TYPE

      public static final String TYPE
      The TYPE attribute constant.
    • CREATION_TIME

      public static final String CREATION_TIME
      The CREATION_TIME attribute constant.
    • MODIFIED_TIME

      public static final String MODIFIED_TIME
      The MODIFIED_TIME attribute constant.
    • OWNER

      public static final String OWNER
      The OWNER attribute constant.
    • NOT_FOUND

      public static final int NOT_FOUND
      The internal security check result constant NOT_FOUND. Dont use.
      See Also:
    • POSITIVE

      public static final int POSITIVE
      The internal security check result constant POSITIVE. Dont use.
      See Also:
    • NEGATIVE

      public static final int NEGATIVE
      The internal security check result constant NEGATIVE. Dont use.
      See Also:
    • EVEN

      public static final int EVEN
      The internal security check result constant EVEN. Dont use.
      See Also:
    • HJMPTS

      public static final String HJMPTS
      The MODIFIED_TIME attribute constant.
    • INITIAL_CREATION_FLAG

      public static final String INITIAL_CREATION_FLAG
      This flag indicates the creation phase of an item. The flag will be set to the session context and can be tested using the isInCreate(SessionContext) method.
      See Also:
    • DISABLE_ATTRIBUTE_CHECK

      public static final String DISABLE_ATTRIBUTE_CHECK
      See Also:
  • Constructor Details

    • Item

      public Item()
      The default no-arg constructor which every Jalo Item must provide.

      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).

  • Method Details

    • registerJaloInvalidationListeners

      public static void registerJaloInvalidationListeners(InvalidationManager invMan, Cache cache)
    • isMarkModifiedDisabled

      @Deprecated(since="2011", forRemoval=true) public boolean isMarkModifiedDisabled(Item refenrecedItem)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getImplementation

      public Item.ItemImpl getImplementation()
      Description copied from class: BridgeAbstraction
      returns the implementation object of this jalo bridge abstraction
      Overrides:
      getImplementation in class BridgeAbstraction
      Returns:
      the implementation object of this jalo bridge abstraction
    • registerAccessFor

      public static void registerAccessFor(Class clazz, String qualifier, AttributeAccess access)
      Registers an attribute access for a given item class and qualifier.

      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.

      Parameters:
      clazz - the item class
      qualifier - the attribute qualifier
      access - the access object
    • registerAccessFor

      public static void registerAccessFor(String extensionName, Class clazz, String qualifier, AttributeAccess access)
    • internal_registerNonClassAccessorFor

      protected static final void internal_registerNonClassAccessorFor(Tenant tenant, AttributeDescriptor attributeDescriptor, AttributeAccess access)
    • internal_registerClassAccessorFor

      protected static final void internal_registerClassAccessorFor(Tenant tenant, Class clazz, String qualifier, AttributeAccess access)
    • hasRegisteredClassAccessorFor

      public static boolean hasRegisteredClassAccessorFor(Tenant tenant, Class clazz, String qualifier)
    • getAccessorFor

      protected final 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.

      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 !

      Parameters:
      qualifier - the attribute qualifier to find an access object for
      myClass - the class to search within
      Returns:
      the matching access object or null if none exists
    • createNonClassAccessor

      protected AttributeAccess createNonClassAccessor(AttributeDescriptor fieldDescriptor)
    • assureExtensionsLoaded

      protected void assureExtensionsLoaded()
    • removeItemCollection

      public static void removeItemCollection(Collection collection) throws ConsistencyCheckException
      Removes a collection of Items's.

      This method iterates through the bean collection and calls remove() on each item.

      Parameters:
      collection - The collection of items, which will be removed.
      Throws:
      ConsistencyCheckException - if an error occurs during the remove process.
    • removeItemCollection

      public static void removeItemCollection(SessionContext ctx, Collection collection) throws ConsistencyCheckException
      Removes a collection of Items's.

      This method iterates through the bean collection and calls remove() on each item.

      Parameters:
      ctx - the session context to perform removal within
      collection - The collection of items, which will be removed.
      Throws:
      ConsistencyCheckException - if an error occurs during the remove process.
    • getTenant

      public Tenant getTenant()
      Overrides:
      getTenant in class BridgeAbstraction
    • setImplementation

      public void setImplementation(BridgeInterface impl)
      Assigns the persistence implementation object to this Item instance.

      Do not use directly. This is part of the Item creation and retrieval process.

      Overrides:
      setImplementation in class BridgeAbstraction
      Parameters:
      impl - the BridgeInterface object
    • getPK

      public PK getPK()
      Returns the primary key of this item.

      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.

      Returns:
      the primary key of this item
    • getCreationTime

      public Date getCreationTime()
      Returns the time when this Item was created. Please note that the result describes the time of the application server and is not translated into the possibly different client timezone.
    • setCreationTime

      protected void setCreationTime(Date creationTime)
    • getModificationTime

      public Date getModificationTime()
      Returns the time when this Item was modifed the last time. Please note that the result describes the time of the application server and is not translated into the possibly different client timezone.
    • getPersistenceVersion

      public long getPersistenceVersion()
    • setModificationTime

      public void setModificationTime(Date date)
    • getSession

      public JaloSession getSession()
      Returns the session which is responsible for managing this item.

      When no session instance is available otherwise always use this to access any Jalo Manager:

       UserManager um = myItem.getSession().getUserManager();
       
      Returns:
      the JaloSession object
    • ctx

      protected SessionContext ctx()
      A shortcut for getSession().getSessionContext().
    • getComposedTypePK

      public PK getComposedTypePK()
      Directly returns the PK of this item's composed type.
    • getComposedType

      public ComposedType getComposedType()
      Returns this Item's type.
    • isInstanceOf

      public boolean isInstanceOf(ComposedType type)
      Tells whether this Item is instance of a given type or not. This is just a shortcut for ComposedType.isInstance(Object).
      Parameters:
      type - the ComposedType
      Returns:
      true if this Item is an instance of the specified ComposedType
    • setComposedType

      public Item setComposedType(ComposedType type) throws JaloInvalidParameterException
      Changes the type of an item.

      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
       
      Parameters:
      type - the new type of the item
      Returns:
      the new version of this item - the new type may require a new jalo class type !!!
      Throws:
      JaloInvalidParameterException - 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 one
    • getOwner

      public Item getOwner()
    • setOwner

      public void setOwner(Item item) throws ConsistencyCheckException
      Throws:
      ConsistencyCheckException
    • getAttribute

      public Object getAttribute(String qualifier) throws JaloInvalidParameterException, JaloSecurityException
      Returns the attribute value for a single item attribute using the current session context.
      Parameters:
      qualifier - the attribute qualifier (case insensitive)
      Returns:
      Object the value of the attribute
      Throws:
      JaloInvalidParameterException - in case the attribute cannot be read
      JaloSecurityException - in case it is not allowed to read this attribute
    • getAttribute

      public Object getAttribute(SessionContext ctx, String qualifier) throws JaloInvalidParameterException, JaloSecurityException
      Returns the attribute value for a single item attribute with a specified session context.
      Parameters:
      qualifier - the attribute qualifier (case insensitive)
      ctx - the session context defining the language to fetch the value for (applies for to localized attributes only )
      Throws:
      JaloInvalidParameterException - in case the attribute cannot be read
      JaloSecurityException - in case it is not allowed to read this attribute
    • setAttributeFromString

      public void setAttributeFromString(String qualifier, String value) throws JaloInvalidParameterException, JaloBusinessException
      Still experimental! This method changes the attribute value by parsing a string value representation.
      Parameters:
      qualifier - the attribute qualifier
      value - the string value representation
      Throws:
      JaloInvalidParameterException - in case the attribute cannot be read or is not string-representable
      JaloBusinessException - if an error occurs during setting the value
      Since:
      2.10
    • setAttributeFromString

      public void setAttributeFromString(SessionContext ctx, String qualifier, String value) throws JaloInvalidParameterException, JaloBusinessException
      Still experimental! This method changes the attribute value by parsing a string value representation.
      Parameters:
      ctx - the session context
      qualifier - the attribute qualifier
      value - the string value representation
      Throws:
      JaloInvalidParameterException - in case the attribute cannot be read or is not string-representable
      JaloBusinessException - if an error occurs during setting the value
      Since:
      2.10
    • getAllAttributes

      public Map getAllAttributes() throws JaloInvalidParameterException, JaloSecurityException
      Reads all (readable) attribute values of this item using the current session context. Please note that only non-private attributes are fetched. To read them as well use getAllAttributes(SessionContext, Set) instead.
      Throws:
      JaloInvalidParameterException - in case one attribute cannot be read
      JaloSecurityException - in case one attribute is not allowed to be read
    • getAllAttributes

      Reads all (readable) attribute values of this item using a specific session context. Please note that only non-private attributes are fetched. To read them as well use getAllAttributes(SessionContext, Set) instead.
      Parameters:
      ctx - the session context defining the language to fetch the value for (applies for to localized attributes only )
      Throws:
      JaloInvalidParameterException - in case one attribute cannot be read
      JaloSecurityException - in case one attribute is not allowed to be read
    • getAllAttributes

      Reads all attribute values of this item which pass a given attribute filter. Please note that only non-private attributes are fetched. To read them as well use getAllAttributes(SessionContext, Set) instead.
      Parameters:
      ctx - the session context to read values for
      filter - the attribute filter to specify which attributes should be read and which should be skipped
      Throws:
      JaloInvalidParameterException - in case one attribute cannot be read
      JaloSecurityException - in case one attribute is not allowed to be read
    • setUseTA

      protected void setUseTA(SessionContext ctx, boolean use)
    • useTA

      protected boolean useTA(SessionContext ctx, boolean def)
    • getAllAttributes

      public Map getAllAttributes(SessionContext ctx, Set<String> qualfiers) throws JaloInvalidParameterException, JaloSecurityException
      Reads all values of specified attributes for this item.
      Parameters:
      ctx - the session context to read values for
      qualfiers - the qualifiers of all attributes to read values form
      Throws:
      JaloInvalidParameterException - in case one attribute cannot be read
      JaloSecurityException - in case one attribute is not allowed to be read
    • getAllAttributesInternal

      protected Map<String,Object> getAllAttributesInternal(SessionContext ctx, Set<String> qualfiers) throws JaloInvalidParameterException, JaloSecurityException
      Throws:
      JaloInvalidParameterException
      JaloSecurityException
    • setAllAttributes

      public void setAllAttributes(Map values) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
      Sets multiple attributes at once using the default session context.
      Parameters:
      values - a map containing mapping from attribute qualifier to its new value
      Throws:
      JaloInvalidParameterException - in case a wrong value was provided or a attribute could not be found at all
      JaloSecurityException - in case a attribute could not be written
      JaloBusinessException - on misc application errors during attribute writing
    • setAllAttributes

      public void setAllAttributes(SessionContext ctx, Map values) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
      Sets multiple attributes at once using a specific session context.
      Parameters:
      values - a map containing mapping from attribute qualifier to its new value
      ctx - the session context defining the language to fetch the value for (applies for to localized attributes only )
      Throws:
      JaloInvalidParameterException - in case a wrong value was provided or a attribute could not be found at all
      JaloSecurityException - in case a attribute could not be written
      JaloBusinessException - on misc application errors during attribute writing
    • setAllAttributesInternal

      protected void setAllAttributesInternal(SessionContext ctx, Map values) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
      Throws:
      JaloInvalidParameterException
      JaloSecurityException
      JaloBusinessException
    • checkConstraint

      protected void checkConstraint(Item.ItemConstraint constr) throws ConsistencyCheckException
      Allows to implement transaction safe consistency checking code. Please refer to Item.ItemConstraint for more detail.
      Parameters:
      constr - the consistency checking code object
      Throws:
      ConsistencyCheckException - in case the constraint is violated
    • isInCreate

      public static boolean isInCreate(SessionContext ctx)
    • setAttribute

      public void setAttribute(String qualifier, Object value) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
      Sets the value of the attribute specified by the attribute qualifier.
      Parameters:
      qualifier - 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
    • setAttribute

      public void setAttribute(SessionContext ctx, String qualifier, Object value) throws JaloInvalidParameterException, JaloSecurityException, JaloBusinessException
      Sets the value of the attribute specified by the attribute qualifier.
      Parameters:
      ctx - the session context
      qualifier - 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
    • getLinkedItems

      public List getLinkedItems(boolean itemIsSource, String qualifier, Language lang)
      Finds items linked to this item for a given link qualifier. The result list is ordered either
      • by the link sequence number in case this item is link source, or
      • by the link creation time if this item is link target.
      Parameters:
      itemIsSource - tells whether this item is source or target of the links to find
      qualifier - the link qualifier
      lang - optional: the language for localized links
    • getLinkedItems

      public 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. The result list is ordered either
      • by the link sequence number in case this item is link source, or
      • by the link creation time if this item is link target.
      Parameters:
      itemIsSource - tells whether this item is source or target of the links to find
      qualifier - the link qualifier
      lang - optional: the language for localized links
      start - the start index of the item range
      count - the amount of items to fetch, use -1 for unlimited amount
    • getLinkedItemsCount

      public long getLinkedItemsCount(boolean itemIsSource, String qualifier, Language lang)
      Parameters:
      itemIsSource - tells whether this item is source or target of the links to count
      qualifier - the link qualifier
      lang - optional: the link language for localized links
      Returns:
      the amount of existing links or localized links for the given qualifier
    • getLinkedItems

      public List getLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang)
      Finds items linked to this item for a given link qualifier. The result list is ordered either
      • by the link sequence number in case this item is link source, or
      • by the link creation time if this item is link target.
      Parameters:
      itemIsSource - tells whether this item is source or target of the links to find
      qualifier - the link qualifier
      lang - optional: the language for localized links
      ctx - the session context to execute this method within
    • getLinkedItems

      public List getLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, boolean sortSrc2Tgt, boolean sortTgt2Src)
    • getLinkedItems

      public List getLinkedItems(SessionContext ctx, boolean itemIsSource, String relationCode, String relatedItemCode, Language lang, boolean sortSrc2Tgt, boolean sortTgt2Src)
    • isEmptyRelationValue

      protected boolean isEmptyRelationValue(SessionContext ctx, String name, List value)
      Override this method to implement different language fallback behaviour. As default only 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);
       }
       
      Parameters:
      ctx - the session context while getting the property
      name - the property name
      value - the actual stored value
      Returns:
      true if the value should be treated as empty - in this case values for fallback languages are fetched
    • isRelationLocalizationFallbackEnabled

      protected boolean isRelationLocalizationFallbackEnabled(SessionContext ctx)
    • getLinkedItems

      public 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. The result list is ordered either
      • by the link sequence number in case this item is link source, or
      • by the link creation time if this item is link target.
      Parameters:
      itemIsSource - tells whether this item is source or target of the links to find
      qualifier - the link qualifier
      lang - optional: the language for localized links
      start - the start index of the item range
      count - the amount of items to fetch, use -1 for unlimited amount
      ctx - the session context to execute this method within
    • getLinkedItems

      public List getLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, int start, int count, boolean sortSrc2Tgt, boolean sortTgt2Src)
    • getLinkedItemsCount

      public long getLinkedItemsCount(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang)
      Parameters:
      itemIsSource - tells whether this item is source or target of the links to count
      qualifier - the link qualifier
      lang - optional: the link language for localized links
      ctx - the session context to execute this method within
      Returns:
      the amount of existing links or localized links for the given qualifier
    • getLinkedItemsCount

      public long getLinkedItemsCount(SessionContext ctx, boolean itemIsSource, String relationTypeCode, String relatedItemCode, Language lang)
      Parameters:
      ctx - the session context to execute this method within
      itemIsSource - tells whether this item is source or target of the links to count
      relationTypeCode - the link qualifier
      relatedItemCode - the related item qualifier
      lang - optional: the link language for localized links
      Returns:
      the amount of existing links or localized links for the given qualifier
    • getAllLinkedItems

      public Map getAllLinkedItems(boolean itemIsSource, String qualifier)
      Returns all localized linked items for a given qualifier. The map contains { Language -> [ Item+] } mappings. The item lists are ordered as described in getLinkedItems(boolean, String, Language).
      Parameters:
      itemIsSource - tells whether this item is source or target of the links to evaluate
      qualifier - the link qualifier
    • setLinkedItems

      public 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. If this item becomes the links source the order of this list is preserved by setting according sequence numbers within the links. Otherwise all existing links keep their sequence numbers ( in case the item has been linked before ) and new links are put at top having 0 as sequence number.
      Parameters:
      itemIsSource - tells whether this item is link source or target
      qualifier - the link qualifier
      lang - optional: the language if the links should be localized
      itemsToLink - the new collection of items to link to
    • setLinkedItems

      public 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. If this item becomes the links source the order of this list is preserved by setting according sequence numbers within the links. Otherwise all existing links keep their sequence numbers ( in case the item has been linked before ) and new links are put at top having 0 as sequence number.
      Parameters:
      itemIsSource - tells whether this item is link source or target
      qualifier - the link qualifier
      lang - optional: the language if the links should be localized
      itemsToLink - the new collection of items to link to
      ctx - the session context to execute this method within
    • setLinkedItems

      public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, Collection<? extends Item> itemsToLink)
    • setLinkedItems

      public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, Collection<? extends Item> itemsToLink, boolean markModified)
    • setLinkedItems

      public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List<? extends Item> itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src)
    • setLinkedItems

      public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List<? extends Item> itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)
    • setLinkedItems

      public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, Collection<? extends Item> itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src)
    • setLinkedItems

      public void setLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, Collection<? extends Item> itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)
    • setAllLinkedItems

      public void setAllLinkedItems(boolean itemIsSource, String qualifier, Map languageToItemListMap)
      Replaces the items currently being linked via localized links to this item for the given qualifier. These items have to be provided within a map containing 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.
      Parameters:
      itemIsSource - tells whether this item is link source or target
      qualifier - the link qualifier
      languageToItemListMap - the new items to link as Language -> [Item] map
    • setAllLinkedItems

      public 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. These items have to be provided within a map containing 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.
      Parameters:
      itemIsSource - tells whether this item is link source or target
      qualifier - the link qualifier
      languageToItemListMap - the new items to link as Language -> [Item] map
    • setAllLinkedItems

      public 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. These items have to be provided within a map containing 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.
      Parameters:
      itemIsSource - tells whether this item is link source or target
      qualifier - the link qualifier
      languageToItemListMap - the new items to link as Language -> [Item] map
    • setAllLinkedItems

      public void setAllLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Map languageToItemListMap, boolean markModified)
    • addLinkedItems

      public void addLinkedItems(boolean itemIsSource, String qualifier, Language lang, List itemsToLink)
      Creates new links between this item and a given list of items. These links will be appended to existing links.
      Parameters:
      itemIsSource - tells whether this item is source or target of the new links
      qualifier - specifies the link qualifier
      lang - optional: the language to create localized links for
      itemsToLink - the items which will be linked with this item
    • addLinkedItems

      public void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink)
      Creates new links between this item and a given list of items. These links will be appended to existing links.
      Parameters:
      itemIsSource - tells whether this item is source or target of the new links
      qualifier - specifies the link qualifier
      lang - optional: the language to create localized links for
      itemsToLink - the items which will be linked with this item
      ctx - the session context to execute this method within
    • addLinkedItems

      public void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink, boolean markModified)
    • addLinkedItems

      public void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src)
    • addLinkedItems

      public void addLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToLink, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)
    • addLinkedItems

      public 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. All preceding (existing) links will be shifted.
      Parameters:
      itemIsSource - tells whether this item is source or target of the new links
      qualifier - specifies the link qualifier
      lang - optional: the language to create localized links for
      itemsToLink - the items which will be linked with this item
      position - the position where to insert the new links ( -1 means append at the end )
    • addLinkedItems

      public 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. All succeeding (existing) links will be shifted.
      Parameters:
      itemIsSource - tells whether this item is source or target of the new links
      qualifier - specifies the link qualifier
      lang - optional: the language to create localized links for
      itemsToLink - the items which will be linked with this item
      position - the position where to insert the new links ( -1 means append at the end )
      ctx - the session context to execute this method within
    • addLinkedItems

      public 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. Optionally the succeeding (existing) links can be shifted or not. If not they keep their position.

      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 );
       
      Parameters:
      itemIsSource - tells whether this item is source or target of the new links
      qualifier - specifies the link qualifier
      lang - optional: the language to create localized links for
      itemsToLink - the items which will be linked with this item
      position - 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 not
    • addLinkedItems

      public 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. Optionally the succeeding (existing) links can be shifted or not. If not they keep their position.

      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 );
       
      Parameters:
      itemIsSource - tells whether this item is source or target of the new links
      qualifier - specifies the link qualifier
      lang - optional: the language to create localized links for
      itemsToLink - the items which will be linked with this item
      position - 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 not
      ctx - the session context to execute this method within
    • removeLinkedItems

      public void removeLinkedItems(boolean itemIsSource, String qualifier, Language lang, List itemsToUnlink)
      Removes all links between this item and the given item list.
      Parameters:
      itemIsSource - tells whether this item is source or target of the links to remove
      qualifier - the qualifier of the links
      lang - optional: the language of the localized links
      itemsToUnlink - the items to unlink (non-existing links will be ignored)
    • removeLinkedItems

      public void removeLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToUnlink)
      Removes all links between this item and the given item list.
      Parameters:
      itemIsSource - tells whether this item is source or target of the links to remove
      qualifier - the qualifier of the links
      lang - optional: the language of the localized links
      itemsToUnlink - the items to unlink (non-existing links will be ignored)
      ctx - the session context to execute this method within
    • removeLinkedItems

      public void removeLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToUnlink, boolean sortSrc2Tgt, boolean sortTgt2Src)
    • removeLinkedItems

      public void removeLinkedItems(SessionContext ctx, boolean itemIsSource, String qualifier, Language lang, List itemsToUnlink, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)
    • remove

      public void remove() throws ConsistencyCheckException
      Removes this item.

      This method calls remove(SessionContext) with the current session's SessionContext object. See this method for more details.

      Throws:
      ConsistencyCheckException - if this item could not be removed for some reason
    • remove

      public void remove(SessionContext ctx) throws ConsistencyCheckException
      Removes this item.

      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


      Parameters:
      ctx - A SessionContext object
      Throws:
      ConsistencyCheckException - if this item could not be removed for some reason
    • doBeforeRemove

      protected void doBeforeRemove(SessionContext ctx, Map removalCtx)
      Hook method to perform removal logic just before this item is being deleted from database. Please prefer this to overriding remove(SessionContext) because this method is guaranteed to be called in synchronized context.
    • doAfterRemove

      protected void doAfterRemove(SessionContext ctx, Map removalCtx)
      Hook method to perform removal logic just after this item is being deleted from database. Please prefer this to overriding remove(SessionContext) because this method is guaranteed to be called in synchronized context.
    • isCurrentlyRemoving

      public static boolean isCurrentlyRemoving(Item item)
    • isCurrentlyRemoving

      public static boolean isCurrentlyRemoving(PK pk)
    • getCurrentlyRemovingCount

      public static int getCurrentlyRemovingCount()
    • removePartOfItems

      protected void removePartOfItems(SessionContext ctx) throws ConsistencyCheckException
      Removes all partOf items. Override to add customized partOf removal logic.
      Parameters:
      ctx -
      Throws:
      ConsistencyCheckException
    • suppressRelation

      protected boolean suppressRelation(String relationQualifier, String type)
    • getPartOfRemovedSessionMarker

      protected boolean getPartOfRemovedSessionMarker(SessionContext ctx)
    • removePartOfItems

      protected void removePartOfItems(SessionContext ctx, Map<String,Object> emptyValuesMap) throws ConsistencyCheckException
      Throws:
      ConsistencyCheckException
    • removeLinks

      protected void removeLinks()
    • checkRemovable

      protected void checkRemovable(SessionContext ctx) throws ConsistencyCheckException
      Checks whether or not this it may be removed or not. Called before the actual removal process.
      Parameters:
      ctx -
      Throws:
      ConsistencyCheckException - to indicate that the item cannot be removed
    • notifyItemRemoval

      protected void notifyItemRemoval(SessionContext ctx)
      Notifies all managers (including all extensions) about this item being removed soon. This method will not throw any exception even if one of the managers raised one. These exceptions will be logged only!
      Parameters:
      ctx -
    • notifyManagerAboutItemRemoval

      protected void notifyManagerAboutItemRemoval(Manager manager, SessionContext ctx)
    • equals

      public final boolean equals(Object object)
      Two items are equal, if their primary keys are equals.

      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.

      Overrides:
      equals in class Object
      Parameters:
      object - the object that should be tested for equality.
      Returns:
      true if the two objects are equal, false otherwise
    • compareTo

      public int compareTo(Object object)
      Implements item comparison by PK. Subclasses may override this.
      Specified by:
      compareTo in interface Comparable
      Parameters:
      object - which will be compared to this item.
      Returns:
      the value 0 if the argument item pk is equal to this item pk; a value less than 0 if this item pk is lexicographically less than the argument item pk; and a value greater than 0 if this item pk is lexicographically greater than the argument item pk.
    • hashCode

      public final int hashCode()
      Returns the hashcode of this item.

      The hashcode of an item is defined as the hashcode of its primary key object.

      Overrides:
      hashCode in class Object
      Returns:
      the hashcode of this item.
    • toString

      public String toString()
      Returns the String representation of this item. This is by default the representation of the primary key of this item.
      Overrides:
      toString in class Object
      Returns:
      the String representation of this item.
    • getRestrictedPrincipals

      public Set getRestrictedPrincipals()
      Returns:
      a set of all principals which own a restriction upon this item
    • getPermissions

      public Set getPermissions(Principal principal, boolean negative)
      Finds all positive or negative permissions upon this item and the given Principal.
      Parameters:
      principal - the Principal whos permissions will be returned
      negative - if set to true, all negative permissions will be returned, if set to false, all positive permission will be returned.
      Returns:
      a set of UserRight
    • getPermissionMap

      public Map getPermissionMap(List userRights)
      Finds the all permission settings for a given list of user rights. The result is a map { 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 )
       
      Parameters:
      userRights - a list of UserRights
      Returns:
      the permission map.
    • setPermissionsByMap

      public void setPermissionsByMap(List userRights, Map permissionMap) throws JaloSecurityException
      Changes permission settings for a given list of user rights. This is done by a map 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 )
       
      Parameters:
      userRights - a list of UserRight, <code> null </code> is not allowed
      permissionMap - a map containing the user to permission information.
      Throws:
      JaloSecurityException
    • getPositivePermissions

      public Set getPositivePermissions(Principal principal)
      Finds all positive permissions for the item and the given Principal.
      Parameters:
      principal - all returned permissions belong to.
      Returns:
      a set of UserRight
    • getNegativePermissions

      public Set getNegativePermissions(Principal principal)
      Finds all negative permissions for the item and the given Principal.
      Parameters:
      principal - all returned permissions belong to.
      Returns:
      a set of UserRight
    • addPermission

      public void addPermission(Principal principal, UserRight right, boolean negative)
      Add a permission for the Principal and the UserRight on the Item.
      Parameters:
      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 permission
    • clearPermission

      public void clearPermission(Principal principal, UserRight right)
      Remove any permission for the Principal and the UserRight on the Item.
      Parameters:
      principal - the Principal the removed permission belongs to.
      right - the UserRight the removed permission belongs to.
    • addPositivePermission

      public void addPositivePermission(Principal principal, UserRight right)
      Add a positive permission for the Principal and the UserRight on the Item.
      Parameters:
      principal - the Principal the positive permission belongs to.
      right - the UserRight the positive permission belongs to.
    • addNegativePermission

      public void addNegativePermission(Principal principal, UserRight right)
      Add a negative permission for the Principal and the UserRight on the Item.
      Parameters:
      principal - the Principal the negative permission belongs to.
      right - the UserRight the negative permission belongs to.
    • checkPermission

      public boolean checkPermission(UserRight right)
      Checks if the current session user has the given UserRight on the Item.
      Parameters:
      right - the UserRight the permission should be checked for
      Returns:
      true if the current session user has the UserRight for this Item
    • checkPermission

      public boolean checkPermission(Principal principal, UserRight right)
      Checks if the Principal has the given UserRight on the Item.
      Parameters:
      principal - the Principal the permission should be checked for
      right - the UserRight the permission should be checked for
      Returns:
      true if the Principal has the UserRight for this Item
    • checkItemPermission

      protected int checkItemPermission(Principal principal, UserRight right)
    • setTransientObject

      public void setTransientObject(String key, Object value)
      Sets a transient object.

      the value will be mapped to this object until

      • it will be removed with setTransientObject(key,null)
      • or the garbage collector will remove this BridgeAbstraction.
      .
      Specified by:
      setTransientObject in class BridgeAbstraction
      Parameters:
      key - the key
      value - may be null; this will remove the transient object mapping
    • getTransientObject

      public Object getTransientObject(String key)
      Get a transient object.

      null is returned if no transient object is mapped to the given key.

      Specified by:
      getTransientObject in class BridgeAbstraction
      Parameters:
      key - the key of the transient object which should be returned.
      Returns:
      the transient object
    • getTransientObjectMap

      @Deprecated(since="18.08", forRemoval=false) public Map<String,Object> getTransientObjectMap()
      Deprecated.
      since 18.08 - don't operate on transient object map directly. Use setTransientObject(String, Object) and getTransientObject(String)
      Returns the complete 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.

      Specified by:
      getTransientObjectMap in class BridgeAbstraction
      Returns:
      a Map of all transient objects.
    • isAlive

      public boolean isAlive()
      Is true if this item is still valid.
      Returns:
      true if this item is still valid.
    • getCacheBoundItem

      public <T extends Item> T getCacheBoundItem()
      NOTE: hybris internal method, do not use
      Returns:
      the Item that is in the cache (either THIS or a new instance which is put in the cache
    • getAndCheckCacheBoundItem

      public <T extends Item> T getAndCheckCacheBoundItem()
    • setCacheBound

      public void setCacheBound(boolean bound)
    • isCacheBound

      public boolean isCacheBound()
    • invalidateLocalCaches

      public void invalidateLocalCaches()
    • newInstance

      public final Item newInstance(SessionContext ctx, ComposedType type, Map attributeAssignment) throws JaloBusinessException
      Creates a new Item using the specified parameters.
      Parameters:
      ctx - the session context which the new item should be created within
      type - the ComposedType of the newly created Item
      attributeAssignment - a map containing the attribute values of the newly created Item
      Returns:
      the created Item
      Throws:
      JaloBusinessException
    • notifyExtensionsBeforeItemCreation

      protected void notifyExtensionsBeforeItemCreation(SessionContext ctx, ComposedType type, Item.ItemAttributeMap attributes) throws JaloBusinessException
      Throws:
      JaloBusinessException
    • notifyExtensionsAfterItemCreation

      protected void notifyExtensionsAfterItemCreation(SessionContext ctx, ComposedType type, Item createdItem, Item.ItemAttributeMap attributes) throws JaloBusinessException
      Throws:
      JaloBusinessException
    • changeTypeAfterCreation

      protected Item changeTypeAfterCreation(Item newOne, ComposedType requestedType) throws JaloInvalidParameterException
      Changes the item type in case 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.

      Parameters:
      newOne - the newly created item
      requestedType - the type which triggered this items creation
      Returns:
      the item with the correct type which possibly has to be re-wrapped ( if the requested type declares a jalo class differently from the current items instance class )
      Throws:
      JaloInvalidParameterException
    • setNonInitialAttributes

      public void setNonInitialAttributes(SessionContext ctx, Item item, Item.ItemAttributeMap nonInitialAttributes) throws JaloBusinessException
      Sets all attributes which could not be set during createItem(SessionContext, ComposedType, ItemAttributeMap). as default this method just iterates over all attribute mappings and sets the value by invoking setAttribute(SessionContext, String, Object).
      Parameters:
      ctx - session context with language = NULL
      item - the newly created item
      nonInitialAttributes - the non-initial attributed obtained via getNonInitialAttributes(SessionContext, ItemAttributeMap)
      Throws:
      JaloBusinessException
    • getNonInitialAttributes

      protected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)
      Defines all attributes which should be set after item creation. this is done be removing all attributes which are already set by 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!
      Parameters:
      ctx - session context with language = NULL
      allAttributes - a ItemAttributeMap contaning attribute values.
      Returns:
      a ItemAttributeMap containing all attribute values, which belong to non-initial attributes.
    • checkMandatoryAttribute

      protected static boolean checkMandatoryAttribute(String qualifier, Item.ItemAttributeMap allAttributes, Set missingSet)
      Checks if the attributes map contains a given qualifier. if the qualifier is mapped to a null value it is treated as missing.
      Parameters:
      qualifier - the qualifier to check
      allAttributes - the creation attributes map
      missingSet - the container to add a missing qualifier to
      Returns:
      true if the qualifier is present
    • checkMandatoryAttribute

      protected static boolean checkMandatoryAttribute(String qualifier, Item.ItemAttributeMap allAttributes, Set missingSet, boolean nullAllowed)
      Checks if the attributes map contains a given qualifier. It may be specified if qualifiers mapped to null values are allowed or not.
      Parameters:
      qualifier - the qualifier to check
      allAttributes - the creation attributes map
      missingSet - the container to add a missing qualifier to
      nullAllowed - tells whether null values are allowed or such qualifiers are treated as missing ones
      Returns:
      true if the qualifier is present
    • createItem

      protected abstract Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
      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. ) during 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; }
      
       
      Parameters:
      ctx - the current session context which this item is created within
      type - 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 -
      Returns:
      the new item instance
      Throws:
      JaloBusinessException - indicates an error during creation - any changes will be rollbacked
    • getSyncObject

      public Object getSyncObject()
      returns an object that can be used for synchronization on the current item pk. e.g. synchronized( getSyncObject() ) { ... }. Please do not use the item or PK object for itself, because they might be subject of garbage-collection.
      Returns:
      the syncobject
    • writeReplace

      public Object writeReplace() throws ObjectStreamException
      Takes care of serialization of items. We don't write the real item instances but new instance of the same class just holding its PK and its removal flag.

      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() ).

      Throws:
      ObjectStreamException
    • readResolve

      public Object readResolve() throws ObjectStreamException
      Takes care of the de-serialization of items because we cannot have several instances of one item per PK. So the actual item is always tried to fetch via JaloSession.getItem(PK).
      Throws:
      ObjectStreamException
    • isItemCheckBeforeRemoveableDisabled

      protected boolean isItemCheckBeforeRemoveableDisabled(SessionContext ctx)
      Parameters:
      ctx - the sessioncontext
      Returns:
      true if in the given SessionContext the attribute DISABLE_SUBCATEGORY_REMOVALCHECK exists AND the value of this attribute is true
    • getDefaultAttributeModes

      protected Map<String,Item.AttributeMode> getDefaultAttributeModes()
    • getRelatedItems

      public <T extends Item> Collection<T> getRelatedItems(String relationQualifier)
      Internal method to directly return related items linked by the One To Many relation. Its purpose is to allow the underlying persistence to intercept this call and handle it in a more efficient way.
      Parameters:
      relationQualifier - name of the attribute seen from the One end of the relation.
      Returns:
      the collection of related items or null if direct access is not supported by the underlying persistence layer.
    • getRelatedItems

      public <T extends Item> Collection<T> getRelatedItems(RelationsInfo relationsInfo)
      Internal method to directly return related items linked by the One To Many relation. Its purpose is to allow the underlying persistence to intercept this call and handle it in a more efficient way.
      Parameters:
      relationsInfo - consists of relation-related objects
      Returns:
      the collection of related items or null if direct access is not supported by the underlying persistence layer.
    • setRelatedItems

      public <T extends Item> boolean setRelatedItems(String relationQualifier, Collection<T> values)
      Internal method to directly set related items linked by the One To Many relation. Its purpose is to allow the underlying persistence to intercept this call and handle it in a more efficient way.
      Parameters:
      relationQualifier - name of the attribute seen from the One end of the relation.
      values - collection of Items to be set.
      Returns:
      false if operation is not supported by the underlying persistence layer.