Class LinkManager

  • All Implemented Interfaces:
    ItemLifecycleListener, java.io.Serializable

    public class LinkManager
    extends Manager
    The manager of the link package which offers methods to create and search Link items.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BEAN_NAME  
      static java.lang.String DISABLE_LINK_REMOVAL_NOTIFICATION
      Use this session context option upon item removal to disable marking all of its currently linked items as modified.
    • Constructor Summary

      Constructors 
      Constructor Description
      LinkManager()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addLinkedItems​(Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items)
      Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language.
      void addLinkedItems​(Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items, int position)
      Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language.
      void addLinkedItems​(Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items, int position, boolean shift)
      Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language.
      void addLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items)
      Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language.
      void addLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items, boolean markModified)  
      void addLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items, int position)
      Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language.
      void addLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items, int position, boolean shift)
      Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language.
      void addLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items, int position, boolean shift, boolean markModified)  
      void addLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items, int position, boolean shift, boolean sortSrc2Tgt, boolean sortTgt2Src)  
      void addLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List items, int position, boolean shift, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)  
      protected void checkBeforeItemRemoval​(SessionContext ctx, Item item)
      Superclass method overridden to avoid call to EJB layer
      Link createLink​(java.lang.String qualifier, Language language, PK sourcePK, PK targetPK, int sequenceNumber, int reverseSequenceNumber)
      Creates a new link using item PKs instead of real items as source and target.
      Link createLink​(java.lang.String qualifier, Language language, Item source, Item target, int sequenceNumber)
      Deprecated.
      since ages
      Link createLink​(java.lang.String qualifier, Language language, Item source, Item target, int sequenceNumber, int reverseSequenceNumber)
      Creates a new localized Link
      Link createLink​(java.lang.String qualifier, Item source, Item target, int sequenceNumber)
      Deprecated.
      since ages
      Link createLink​(java.lang.String qualifier, Item source, Item target, int sequenceNumber, int reverseSequenceNumber)
      Creates a new localized Link
      void createLinkNoWrap​(java.lang.String qualifier, Language language, PK sourcePK, PK targetPK, int sequenceNumber, int reverseSequenceNumber)
      Creates a new link just like createLink(String, Language, PK, PK, int, int) but without loading and wrapping the new link item.
      void createLinkNoWrap​(java.lang.String qualifier, Language language, Item source, Item target, int sequenceNumber, int reverseSequenceNumber)
      Creates a new link just like createLink(String, Language, Item, Item, int, int) but without loading and wrapping the new link item.
      protected boolean enableRelationRestrictions()  
      java.util.Map getAllLinkedItems​(Item item, boolean itemIsSource, java.lang.String qualifier)
      Returns a Map of all Items which are linked to the specified Item by localized Links with matching qualifier.
      java.util.Map getAllLinkedItems​(Item item, boolean itemIsSource, java.lang.String qualifier, boolean enableRestrictions)
      Returns a Map of all Items which are linked to the specified Item by localized Links with matching qualifier.
      java.util.Collection getAllLinkedItems​(SessionContext ctx, java.util.Collection items, boolean itemsAreSource, java.lang.String qualifier, Language lang)
      Returns all linked items belonging to any of the given source or target items.
      static LinkManager getInstance()  
      <T> SearchResult<T> getLinkedItems​(PK itemPk, boolean itemIsSource, java.lang.String qualifier, PK langPk, boolean enableRestrictions, int start, int count, boolean sortSrc2Tgt, boolean sortTgt2Src)  
      java.util.List getLinkedItems​(Item item, boolean itemIsSource, java.lang.String qualifier, Language lang)
      Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
      java.util.List getLinkedItems​(Item item, boolean itemIsSource, java.lang.String qualifier, Language lang, int start, int count)
      Returns a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
      java.util.List getLinkedItems​(SessionContext ctx, PK itemPk, boolean itemIsSource, PK langPk, java.lang.String relationTypeCode, java.lang.String relatedItemCode, int start, int count, boolean sortSrc2Tgt, boolean sortTgt2Src)  
      <T> SearchResult<T> getLinkedItems​(SessionContext ctx, PK itemPk, boolean itemIsSource, java.lang.String qualifier, PK langPk, boolean enableRestrictions, int start, int count, boolean sortSrc2Tgt, boolean sortTgt2Src)  
      java.util.List getLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language lang)
      Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
      java.util.List getLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language lang, boolean enableRestrictions)
      Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
      java.util.List getLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language lang, boolean enableRestrictions, int start, int count)
      Returns a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
      java.util.List getLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language lang, boolean enableRestrictions, int start, int count, boolean sortSrc2Tgt, boolean sortTgt2Src)  
      java.util.List getLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language lang, int start, int count)
      Returns a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
      java.util.List getLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language lang, int start, int count, boolean sortSrc2Tgt, boolean sortTgt2Src)  
      long getLinkedItemsCount​(Item item, boolean itemIsSource, java.lang.String qualifier, Language lang)
      Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
      long getLinkedItemsCount​(SessionContext ctx, PK itemPk, boolean itemIsSource, java.lang.String relationTypeCode, java.lang.String relatedItemCode, PK langPk)  
      long getLinkedItemsCount​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language lang)
      Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
      long getLinkedItemsCount​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language lang, boolean enableRestrictions)
      Returns the number of Items, which are linked to the specified Item by a Link, which matches the specified qualifier, Language.
      java.util.Collection<Link> getLinks​(java.lang.String qualifier, Language language, Item source, Item target)
      Returns a Collection of all Links with matching qualifier, Language, source and target Item.
      The usage of wildcards always searches on all link tables because no concrete Link type can be parsed from qualifier.
      java.util.Collection<Link> getLinks​(java.lang.String qualifier, Item source, Item target)
      Returns a Collection of all Links with matching qualifier, and source and target Item .
      The usage of wildcards always searches on all link tables because no concrete Link type can be parsed from qualifier.
      java.lang.Class getRemoteManagerClass()  
      void removeAllLinksFor​(SessionContext ctx, Item item)  
      void removeLinkedItems​(Item item, boolean itemIsSource, java.lang.String qualifier, Language lang, java.util.List itemsToUnlink)  
      void removeLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List<Item> items)
      Removes all specified Items, which are linked to the specified Item by links with matching qualifier and Language.
      void removeLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List<Item> items, boolean sortSrc2Tgt, boolean sortTgt2Src)  
      void removeLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List<Item> items, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)  
      void setAllLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, java.util.Map<Language,​java.util.List<Item>> items)
      Creates new localized Links between the specified Item and the specified Map of Language-Items mappings using the provided qualifier and deletes all old Links, which match the specified qualifier, Item and Language.
      void setAllLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, java.util.Map<Language,​java.util.List<Item>> items, boolean markMpdified)
      Markmodified variant.
      void setAllLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, java.util.Map<Language,​java.util.List<Item>> items, boolean sortSrc2Tgt, boolean sortTgt2Src)  
      void setAllLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, java.util.Map<Language,​java.util.List<Item>> items, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean preserveHiddenLanguages, boolean markModified)  
      void setAllLinkedItems​(SessionContext ctx, java.util.Collection<Item> itemColl, boolean itemsAreSource, java.lang.String qualifier, Language language, java.util.List<Item> items, boolean ordered)
      Mass-setter for linking a collection of items to a specified list of target items.
      void setAllLinkedItems​(SessionContext ctx, java.util.Collection<Item> itemColl, boolean itemsAreSource, java.lang.String qualifier, Language language, java.util.List<Item> items, boolean ordered, boolean markModified)
      Mass-setter for linking a collection of items to a specified list of target items.
      void setLinkedItems​(Item item, boolean itemIsSource, java.lang.String qualifier, Language lang, java.util.List itemsToLink)  
      void setLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.Collection<? extends Item> items)  
      void setLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.Collection<? extends Item> items, boolean markModified)  
      void setLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.Collection<? extends Item> items, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)  
      void setLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List<? extends Item> items)
      Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language and deletes all old Links, which match the specified qualifier, Item and Language.
      void setLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List<? extends Item> items, boolean sortSrc2Tgt, boolean sortTgt2Src)  
      void setLinkedItems​(SessionContext ctx, Item item, boolean itemIsSource, java.lang.String qualifier, Language language, java.util.List<? extends Item> items, boolean sortSrc2Tgt, boolean sortTgt2Src, boolean markModified)  
      protected boolean skipChangingExistingLinks​(SessionContext ctx)  
      java.lang.Object writeReplace()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DISABLE_LINK_REMOVAL_NOTIFICATION

        public static final java.lang.String DISABLE_LINK_REMOVAL_NOTIFICATION
        Use this session context option upon item removal to disable marking all of its currently linked items as modified.

                Item toRemove = ...
        
                SessionContext ctx = JaloSession.getCurrentSession().getSessionContext();
                ctx.setAttribute( LinkManager.DISABLE_LINK_REMOVAL_NOTIFICATION, Boolean.TRUE );
        
                toRemove.remove( ctx );
         
        See Also:
        Constant Field Values
    • Constructor Detail

      • LinkManager

        public LinkManager()
    • Method Detail

      • skipChangingExistingLinks

        protected boolean skipChangingExistingLinks​(SessionContext ctx)
      • getInstance

        public static LinkManager getInstance()
        Returns:
        instance of this manager
      • enableRelationRestrictions

        protected boolean enableRelationRestrictions()
      • getLinkedItems

        public java.util.List getLinkedItems​(Item item,
                                             boolean itemIsSource,
                                             java.lang.String qualifier,
                                             Language lang)
        Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language. If search restrictions are considered depends on the configuration of the property 'relation.restrictions.enabled' in the project|local.properties of the hybris Platform core. The default value is true.
        Parameters:
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        lang - the Language of the Link
        Returns:
        a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language
      • getLinkedItems

        public java.util.List getLinkedItems​(Item item,
                                             boolean itemIsSource,
                                             java.lang.String qualifier,
                                             Language lang,
                                             int start,
                                             int count)
        Returns a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language. If search restrictions are considered depends on the configuration of the property 'relation.restrictions.enabled' in the project|local.properties of the hybris Platform core. The default value is true.
        Parameters:
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        lang - the Language of the Link
        start - start index of the range
        count - number of Items in the range
        Returns:
        a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language
      • getLinkedItemsCount

        public long getLinkedItemsCount​(Item item,
                                        boolean itemIsSource,
                                        java.lang.String qualifier,
                                        Language lang)
        Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language. If search restrictions are considered depends on the configuration of the property 'relation.restrictions.enabled' in the project|local.properties of the hybris Platform core. The default value is true.
        Parameters:
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        lang - the Language of the Link
        Returns:
        a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language
      • getLinkedItems

        public java.util.List getLinkedItems​(SessionContext ctx,
                                             Item item,
                                             boolean itemIsSource,
                                             java.lang.String qualifier,
                                             Language lang)
        Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language. If search restrictions are considered depends on the configuration of the property 'relation.restrictions.enabled' in the project|local.properties of the hybris Platform core. The default value is true.
        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        lang - the Language of the Link
        Returns:
        a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language
      • getLinkedItems

        public java.util.List getLinkedItems​(SessionContext ctx,
                                             Item item,
                                             boolean itemIsSource,
                                             java.lang.String qualifier,
                                             Language lang,
                                             int start,
                                             int count)
        Returns a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language. If search restrictions are considered depends on the configuration of the property 'relation.restrictions.enabled' in the project|local.properties of the hybris Platform core. The default value is true.
        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        lang - the Language of the Link
        start - start index of the range
        count - number of Items in the range
        Returns:
        a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language
      • getLinkedItems

        public java.util.List getLinkedItems​(SessionContext ctx,
                                             Item item,
                                             boolean itemIsSource,
                                             java.lang.String qualifier,
                                             Language lang,
                                             int start,
                                             int count,
                                             boolean sortSrc2Tgt,
                                             boolean sortTgt2Src)
      • getLinkedItemsCount

        public long getLinkedItemsCount​(SessionContext ctx,
                                        Item item,
                                        boolean itemIsSource,
                                        java.lang.String qualifier,
                                        Language lang)
        Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language. If search restrictions are considered depends on the configuration of the property 'relation.restrictions.enabled' in the project|local.properties of the hybris Platform core. The default value is true.
        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        lang - the Language of the Link
        Returns:
        a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language
      • getLinkedItems

        public java.util.List getLinkedItems​(SessionContext ctx,
                                             Item item,
                                             boolean itemIsSource,
                                             java.lang.String qualifier,
                                             Language lang,
                                             boolean enableRestrictions)
        Returns a List of all Items, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        lang - the Language of the Link
        enableRestrictions - if true the all defined rescrictions will be considered
        Returns:
        a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language
      • getLinkedItems

        public java.util.List getLinkedItems​(SessionContext ctx,
                                             Item item,
                                             boolean itemIsSource,
                                             java.lang.String qualifier,
                                             Language lang,
                                             boolean enableRestrictions,
                                             int start,
                                             int count)
        Returns a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language.
        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        lang - the Language of the Link
        enableRestrictions - if true all defined rescrictions will be considered
        start - start index of the range
        count - number of Items in the range
        Returns:
        a List of all Items in the specified range, which are linked to the specified Item with a Link which matches the specified qualifier and Language
      • getLinkedItems

        public java.util.List getLinkedItems​(SessionContext ctx,
                                             Item item,
                                             boolean itemIsSource,
                                             java.lang.String qualifier,
                                             Language lang,
                                             boolean enableRestrictions,
                                             int start,
                                             int count,
                                             boolean sortSrc2Tgt,
                                             boolean sortTgt2Src)
      • getLinkedItems

        public <T> SearchResult<T> getLinkedItems​(PK itemPk,
                                                  boolean itemIsSource,
                                                  java.lang.String qualifier,
                                                  PK langPk,
                                                  boolean enableRestrictions,
                                                  int start,
                                                  int count,
                                                  boolean sortSrc2Tgt,
                                                  boolean sortTgt2Src)
      • getLinkedItems

        public <T> SearchResult<T> getLinkedItems​(SessionContext ctx,
                                                  PK itemPk,
                                                  boolean itemIsSource,
                                                  java.lang.String qualifier,
                                                  PK langPk,
                                                  boolean enableRestrictions,
                                                  int start,
                                                  int count,
                                                  boolean sortSrc2Tgt,
                                                  boolean sortTgt2Src)
      • getLinkedItems

        public java.util.List getLinkedItems​(SessionContext ctx,
                                             PK itemPk,
                                             boolean itemIsSource,
                                             PK langPk,
                                             java.lang.String relationTypeCode,
                                             java.lang.String relatedItemCode,
                                             int start,
                                             int count,
                                             boolean sortSrc2Tgt,
                                             boolean sortTgt2Src)
      • getAllLinkedItems

        public java.util.Collection getAllLinkedItems​(SessionContext ctx,
                                                      java.util.Collection items,
                                                      boolean itemsAreSource,
                                                      java.lang.String qualifier,
                                                      Language lang)
        Returns all linked items belonging to any of the given source or target items. Please note that the result set is not ordered but duplicates are eliminated.
        Since:
        2.20
      • getLinkedItemsCount

        public long getLinkedItemsCount​(SessionContext ctx,
                                        Item item,
                                        boolean itemIsSource,
                                        java.lang.String qualifier,
                                        Language lang,
                                        boolean enableRestrictions)
        Returns the number of Items, which are linked to the specified Item by a Link, which matches the specified qualifier, Language.
        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        lang - the Language of the Link
        enableRestrictions - if true all defined rescrictions will be considered
        Returns:
        the number of Items, which are linked to the specified Item by a Link, which matches the specified qualifier, Language
      • getLinkedItemsCount

        public long getLinkedItemsCount​(SessionContext ctx,
                                        PK itemPk,
                                        boolean itemIsSource,
                                        java.lang.String relationTypeCode,
                                        java.lang.String relatedItemCode,
                                        PK langPk)
      • getAllLinkedItems

        public java.util.Map getAllLinkedItems​(Item item,
                                               boolean itemIsSource,
                                               java.lang.String qualifier)
        Returns a Map of all Items which are linked to the specified Item by localized Links with matching qualifier. The map contains { Language -> [ Item+ ] } mappings.

        If search restrictions are considered depends on the configuration of the property 'relation.restrictions.enabled' in the project|local.properties of the hybris Platform core. The default value is true.

        Parameters:
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        Returns:
        a Map of all Items which are linked to the specified Item by localized Links with matching qualifier
      • getAllLinkedItems

        public java.util.Map getAllLinkedItems​(Item item,
                                               boolean itemIsSource,
                                               java.lang.String qualifier,
                                               boolean enableRestrictions)
        Returns a Map of all Items which are linked to the specified Item by localized Links with matching qualifier. The map contains { Language -> [ Item+ ] } mappings.

        If search restrictions are considered depends on the configuration of the property 'relation.restrictions.enabled' in the project|local.properties of the hybris Platform core. The default value is true.

        Parameters:
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        enableRestrictions - if true all defined rescrictions will be considered
        Returns:
        a Map of all Items which are linked to the specified Item by localized Links with matching qualifier
      • setLinkedItems

        public void setLinkedItems​(Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language lang,
                                   java.util.List itemsToLink)
      • setLinkedItems

        public void setLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.Collection<? extends Item> items)
      • setLinkedItems

        public void setLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.Collection<? extends Item> items,
                                   boolean markModified)
      • setLinkedItems

        public void setLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List<? extends Item> items)
        Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language and deletes all old Links, which match the specified qualifier, Item and Language. Depending on the value of itemIsSource the specified Item will be either the source or the target Item of the new Links.

        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        language - if null, unlocalized links will be created, otherwise localized links for the specified Language will be created
        items - the List of all Items, which should be linked to the specified Item
      • setLinkedItems

        public void setLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.Collection<? extends Item> items,
                                   boolean sortSrc2Tgt,
                                   boolean sortTgt2Src,
                                   boolean markModified)
      • setLinkedItems

        public void setLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List<? extends Item> items,
                                   boolean sortSrc2Tgt,
                                   boolean sortTgt2Src)
      • setLinkedItems

        public void setLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List<? extends Item> items,
                                   boolean sortSrc2Tgt,
                                   boolean sortTgt2Src,
                                   boolean markModified)
      • setAllLinkedItems

        public void setAllLinkedItems​(SessionContext ctx,
                                      java.util.Collection<Item> itemColl,
                                      boolean itemsAreSource,
                                      java.lang.String qualifier,
                                      Language language,
                                      java.util.List<Item> items,
                                      boolean ordered)
        Mass-setter for linking a collection of items to a specified list of target items. Please note that for localized relations this will affect links for the specified language only!
        Since:
        2.20
      • setAllLinkedItems

        public void setAllLinkedItems​(SessionContext ctx,
                                      java.util.Collection<Item> itemColl,
                                      boolean itemsAreSource,
                                      java.lang.String qualifier,
                                      Language language,
                                      java.util.List<Item> items,
                                      boolean ordered,
                                      boolean markModified)
        Mass-setter for linking a collection of items to a specified list of target items. Please note that for localized relations this will affect links for the specified language only!
        Since:
        5.00
      • setAllLinkedItems

        public void setAllLinkedItems​(SessionContext ctx,
                                      Item item,
                                      boolean itemIsSource,
                                      java.lang.String qualifier,
                                      java.util.Map<Language,​java.util.List<Item>> items)
        Creates new localized Links between the specified Item and the specified Map of Language-Items mappings using the provided qualifier and deletes all old Links, which match the specified qualifier, Item and Language. The Map must contains { Language -> [ Item+ ] } mappings.

        Depending on the value of itemIsSource the specified Item will be either the source or the target Item of the new Links.

        Parameters:
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        items - the Map of all Items, which should be linked to the specified Item
      • setAllLinkedItems

        public void setAllLinkedItems​(SessionContext ctx,
                                      Item item,
                                      boolean itemIsSource,
                                      java.lang.String qualifier,
                                      java.util.Map<Language,​java.util.List<Item>> items,
                                      boolean markMpdified)
        Markmodified variant.
      • setAllLinkedItems

        public void setAllLinkedItems​(SessionContext ctx,
                                      Item item,
                                      boolean itemIsSource,
                                      java.lang.String qualifier,
                                      java.util.Map<Language,​java.util.List<Item>> items,
                                      boolean sortSrc2Tgt,
                                      boolean sortTgt2Src)
      • setAllLinkedItems

        public void setAllLinkedItems​(SessionContext ctx,
                                      Item item,
                                      boolean itemIsSource,
                                      java.lang.String qualifier,
                                      java.util.Map<Language,​java.util.List<Item>> items,
                                      boolean sortSrc2Tgt,
                                      boolean sortTgt2Src,
                                      boolean preserveHiddenLanguages,
                                      boolean markModified)
      • addLinkedItems

        public void addLinkedItems​(Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items)
        Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language. Depending on the value of itemIsSource the specified Item will be either the source or the target Item of the new Links.

        Parameters:
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        language - if null, unlocalized links will be created, otherwise localized links for the specified Language will be created
        items - the List of all Items, which should be linked to the specified Item
      • addLinkedItems

        public void addLinkedItems​(Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items,
                                   int position)
        Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language. Depending on the value of itemIsSource the specified Item will be either the source or the target Item of the new Links.

        Parameters:
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        language - if null, unlocalized links will be created, otherwise localized links for the specified Language will be created
        items - the List of all Items, which should be linked to the specified Item
        position - the automatically increased sequence number of the new Links will start with this number
      • addLinkedItems

        public void addLinkedItems​(Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items,
                                   int position,
                                   boolean shift)
        Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language. Depending on the value of itemIsSource the specified Item will be either the source or the target Item of the new Links.

        Parameters:
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        language - if null, unlocalized links will be created, otherwise localized links for the specified Language will be created
        items - the List of all Items, which should be linked to the specified Item
        position - the automatically increased sequence number of the new Links will start with this number
        shift - if set to true, the sequence numbers all existing Links with higher sequence number and matching qualifier, source/target Item and Language will be raised by the number of Items in items
      • addLinkedItems

        public void addLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items)
        Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language. Depending on the value of itemIsSource the specified Item will be either the source or the target Item of the new Links.

        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        language - if null, unlocalized links will be created, otherwise localized links for the specified Language will be created
        items - the List of all Items, which should be linked to the specified Item
      • addLinkedItems

        public void addLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items,
                                   boolean markModified)
      • addLinkedItems

        public void addLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items,
                                   int position)
        Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language. Depending on the value of itemIsSource the specified Item will be either the source or the target Item of the new Links.

        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        language - if null, unlocalized links will be created, otherwise localized links for the specified Language will be created
        items - the List of all Items, which should be linked to the specified Item
        position - the automatically increased sequence number of the new Links will start with this number
      • addLinkedItems

        public void addLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items,
                                   int position,
                                   boolean shift)
        Creates new Links between the specified Item and the specified List of Items using the provided values for qualifier and Language. Depending on the value of itemIsSource the specified Item will be either the source or the target Item of the new Links.

        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Link
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Link
        language - if null, unlocalized links will be created, otherwise localized links for the specified Language will be created
        items - the List of all Items, which should be linked to the specified Item
        position - the automatically increased sequence number of the new Links will start with this number
        shift - if set to true, the sequence numbers all existing Links with higher sequence number and matching qualifier, source/target Item and Language will be raised by the number of Items in items
      • addLinkedItems

        public void addLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items,
                                   int position,
                                   boolean shift,
                                   boolean markModified)
      • addLinkedItems

        public void addLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items,
                                   int position,
                                   boolean shift,
                                   boolean sortSrc2Tgt,
                                   boolean sortTgt2Src)
      • addLinkedItems

        public void addLinkedItems​(SessionContext ctx,
                                   Item item,
                                   boolean itemIsSource,
                                   java.lang.String qualifier,
                                   Language language,
                                   java.util.List items,
                                   int position,
                                   boolean shift,
                                   boolean sortSrc2Tgt,
                                   boolean sortTgt2Src,
                                   boolean markModified)
      • removeLinkedItems

        public void removeLinkedItems​(Item item,
                                      boolean itemIsSource,
                                      java.lang.String qualifier,
                                      Language lang,
                                      java.util.List itemsToUnlink)
      • removeLinkedItems

        public void removeLinkedItems​(SessionContext ctx,
                                      Item item,
                                      boolean itemIsSource,
                                      java.lang.String qualifier,
                                      Language language,
                                      java.util.List<Item> items)
        Removes all specified Items, which are linked to the specified Item by links with matching qualifier and Language.
        Parameters:
        ctx - the SessionContext, which will be used
        item - Item on one end of the Links
        itemIsSource - is the specified Item the source (true) or the target Item ( false) of the Link
        qualifier - the qualifier of the Links
        language - the Language of the Links, null for unlocalized Links
        items - List of all Items which should be removed
      • removeLinkedItems

        public void removeLinkedItems​(SessionContext ctx,
                                      Item item,
                                      boolean itemIsSource,
                                      java.lang.String qualifier,
                                      Language language,
                                      java.util.List<Item> items,
                                      boolean sortSrc2Tgt,
                                      boolean sortTgt2Src)
      • removeLinkedItems

        public void removeLinkedItems​(SessionContext ctx,
                                      Item item,
                                      boolean itemIsSource,
                                      java.lang.String qualifier,
                                      Language language,
                                      java.util.List<Item> items,
                                      boolean sortSrc2Tgt,
                                      boolean sortTgt2Src,
                                      boolean markModified)
      • getLinks

        public java.util.Collection<Link> getLinks​(java.lang.String qualifier,
                                                   Language language,
                                                   Item source,
                                                   Item target)
        Returns a Collection of all Links with matching qualifier, Language, source and target Item.
        The usage of wildcards always searches on all link tables because no concrete Link type can be parsed from qualifier. So using wildcards is potential slower than giving the concrete qualifier without usage of wildcards.
        Parameters:
        qualifier - the qualifier, may contain SQL wildcards, e.g. "%"
        language - the Language, or Link.ANYLANGUAGE
        source - the source Item, or Link.ANYITEM
        target - the target Item, or Link.ANYITEM
        Returns:
        a Collection of all Links with matching qualifier, Language, source and target Item
      • createLink

        public Link createLink​(java.lang.String qualifier,
                               Language language,
                               Item source,
                               Item target,
                               int sequenceNumber,
                               int reverseSequenceNumber)
                        throws ConsistencyCheckException
        Creates a new localized Link
        Parameters:
        qualifier - the qualifier of the link (any String, for example a predefined constant like Media.PICTURE
        language - the language that defines the link's locale
        source - the source Item
        target - the target Item
        sequenceNumber - the sequence number of the new Link
        Returns:
        a new Link
        Throws:
        ConsistencyCheckException
      • createLink

        public Link createLink​(java.lang.String qualifier,
                               Language language,
                               PK sourcePK,
                               PK targetPK,
                               int sequenceNumber,
                               int reverseSequenceNumber)
                        throws ConsistencyCheckException
        Creates a new link using item PKs instead of real items as source and target. Please be aware that type safety cannot be guaranteed here so make sure the PKs really belong to the intended item type!
        Parameters:
        qualifier - the link qualifier
        language - optional: the language to qualify as localized link
        sourcePK - the pk of the source item
        targetPK - the pk of the target item
        sequenceNumber - the link position in source-target direction
        reverseSequenceNumber - the link position in target-source direction
        Returns:
        the new link
        Throws:
        ConsistencyCheckException
        Since:
        3.1-u8
      • getLinks

        public java.util.Collection<Link> getLinks​(java.lang.String qualifier,
                                                   Item source,
                                                   Item target)
        Returns a Collection of all Links with matching qualifier, and source and target Item .
        The usage of wildcards always searches on all link tables because no concrete Link type can be parsed from qualifier. So using wildcards is potential slower than giving the concrete qualifier without usage of wildcards.
        Parameters:
        qualifier - the qualifier, may contain SQL wildcards, e.g. "%"
        source - the source Item, or Link.ANYITEM
        target - the target Item, or Link.ANYITEM
        Returns:
        a Collection of all Links with matching qualifier, Language, source and target Item
      • createLink

        public Link createLink​(java.lang.String qualifier,
                               Item source,
                               Item target,
                               int sequenceNumber,
                               int reverseSequenceNumber)
                        throws ConsistencyCheckException
        Creates a new localized Link
        Parameters:
        qualifier - the qualifier of the link (any String, for example a predefined constant like Media.PICTURE
        source - the source Item
        target - the target Item
        sequenceNumber - the sequence number of the new Link
        Returns:
        a new Link
        Throws:
        ConsistencyCheckException
      • writeReplace

        public java.lang.Object writeReplace()
                                      throws java.io.ObjectStreamException
        Specified by:
        writeReplace in class Manager
        Throws:
        java.io.ObjectStreamException