Class LinkOperationHandler

java.lang.Object
de.hybris.platform.jalo.link.LinkOperationHandler

public class LinkOperationHandler extends Object
  • Field Details

    • done

      protected boolean done
  • Constructor Details

    • LinkOperationHandler

      public LinkOperationHandler(Item item, List<Item> toBeLinked, boolean isSource, String qualifier)
      Unlocalized single item links operation.
      Parameters:
      item -
      toBeLinked -
      isSource -
      qualifier -
    • LinkOperationHandler

      public LinkOperationHandler(Item item, List<Item> toBeLinked, boolean isSource, String qualifier, Language lang)
      Localizable single item links operation for just one language
      Parameters:
      item -
      toBeLinked -
      isSource -
      qualifier -
      lang -
    • LinkOperationHandler

      public LinkOperationHandler(Item item, List<Item> toBeLinked, boolean isSource, String qualifier, Language lang, boolean markModified)
    • LinkOperationHandler

      public LinkOperationHandler(Item item, Map<Language,List<Item>> toBeLinked, boolean isSource, String qualifier)
      Localized single item links operation for multiple languages at once.
      Parameters:
      item -
      toBeLinked -
      isSource -
      qualifier -
    • LinkOperationHandler

      public LinkOperationHandler(List<Item> items, List<Item> toBeLinked, boolean isSource, String qualifier)
      Unlocalized multi-items links operation.
      Parameters:
      items -
      toBeLinked -
      isSource -
      qualifier -
    • LinkOperationHandler

      public LinkOperationHandler(List<Item> items, List<Item> toBeLinked, boolean isSource, String qualifier, Language lang)
      Localizable multi-items links operation for just one language.
      Parameters:
      items -
      toBeLinked -
      isSource -
      qualifier -
      lang -
    • LinkOperationHandler

      public LinkOperationHandler(List<Item> items, List<Item> toBeLinked, boolean isSource, String qualifier, Language lang, boolean markModified)
    • LinkOperationHandler

      public LinkOperationHandler(List<Item> items, Map<Language,List<Item>> toBeLinked, boolean isSource, String qualifier, boolean localized)
      Localized multi-items links operation for multiple languages.
      Parameters:
      items -
      toBeLinked -
      isSource -
      qualifier -
    • LinkOperationHandler

      public LinkOperationHandler(List<Item> items, Map<Language,List<Item>> toBeLinked, boolean isSource, String qualifier, boolean localized, boolean markModified)
      Localized multi-items links operation for multiple languages.
      Parameters:
      items -
      toBeLinked -
      isSource -
      qualifier -
  • Method Details

    • checkForInvalidItems

      protected void checkForInvalidItems()
    • getItems

      public List<Item> getItems()
      The item to add/set linked items to.
    • getToBeLinked

      public Collection<Item> getToBeLinked(Language lang)
      The items to be linked belonging to a given language scope.
      Parameters:
      lang - the language to get linked items for or null for unlocalized mode
    • getToBeLinked

      protected Collection<Item> getToBeLinked(PK langPK)
    • getAllToBeLinked

      protected Set<Item> getAllToBeLinked()
    • hasItemsToLink

      public boolean hasItemsToLink()
    • getUnlikedItems

      protected Set<Item> getUnlikedItems()
    • perform

      public boolean perform(SessionContext ctx)
      Performs all changes at once.
    • getLinkTypeCode

      protected String getLinkTypeCode(String qualifier)
    • isReplace

      public boolean isReplace()
      Returns true if the operation will set the complete link set of the given item at once. This means that (logically) all previously existing links are beeing replaced.

      Of course existing links are reused whenever possible.

    • setReplace

      public void setReplace(boolean replace)
      Defines whether or not the operation will set the complete link set of the given item at once. This means that (logically) all previously existing links are beeing replaced.

      Of course existing links are reused whenever possible.

    • getPosition

      public int getPosition()
      Returns the insert position for all non-replace operations. Otherwise ignored.
    • setPosition

      public void setPosition(int position)
      Changes the insert position for this link operation. This affects non-replace operations only! Setting a position < 0 will append all items at the end of the existing linked items collection.
    • isItemSource

      public boolean isItemSource()
      Tells whether or not the given item is placed at the source or target end of the underlying relation.
    • getQualifier

      public String getQualifier()
      The link qualifier/relation name.
    • isLocalized

      public boolean isLocalized()
      Tells whether or not the operation will run in localized mode.
    • getLanguages

      public Set<Language> getLanguages()
    • getGatheredData

      protected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData> getGatheredData()
      Returns:
      the gatheredData
    • setGatheredData

      protected void setGatheredData(List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData> data)
    • gatherUnlinkData

      protected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData> gatherUnlinkData(SessionContext ctx)
    • queryExistingLinks4ReplaceAll

      protected List<List<?>> queryExistingLinks4ReplaceAll(SessionContext ctx, boolean sort, boolean sortReverse)
    • gatherReplaceAllData

      protected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData> gatherReplaceAllData(SessionContext ctx)
      Queries existing links together with the max position of each linked item in reverse order.

      This method issues just one db query to minimize db overhead.

    • gatherInsertData

      protected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData> gatherInsertData(SessionContext ctx)
    • gatherAppendOnlyData

      protected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData> gatherAppendOnlyData(SessionContext ctx)
    • isMarkItemsModified

      public boolean isMarkItemsModified()
    • setMarkItemsModified

      public void setMarkItemsModified(boolean markItemsModified)
    • isUnlink

      public boolean isUnlink()
    • setUnlink

      public void setUnlink(boolean unlink)
    • isShift

      public boolean isShift()
    • setShift

      public void setShift(boolean shift)
    • setSkipQueryExistingLinks

      public void setSkipQueryExistingLinks(boolean skip)
    • isPreserveHiddenLanguages

      public boolean isPreserveHiddenLanguages()
      Returns:
      the preserveHiddenLanguages
    • setPreserveHiddenLanguages

      public void setPreserveHiddenLanguages(boolean preserveHiddenLanguages)
      Parameters:
      preserveHiddenLanguages - the preserveHiddenLanguages to set
    • isSortTgtEnd

      public boolean isSortTgtEnd()
      Returns:
      the sortTgtEnd
    • setSortTgtEnd

      public void setSortTgtEnd(boolean sortTgtEnd)
      Parameters:
      sortTgtEnd - the sortTgtEnd to set
    • isSortSrcEnd

      public boolean isSortSrcEnd()
      Returns:
      the sortSrcEnd
    • setSortSrcEnd

      public void setSortSrcEnd(boolean sortSrcEnd)
      Parameters:
      sortSrcEnd - the sortSrcEnd to set
    • isAllowDuplicates

      public boolean isAllowDuplicates()
      Returns:
      the allowDuplicates
    • setAllowDuplicates

      public void setAllowDuplicates(boolean allowDuplicates)
      Parameters:
      allowDuplicates - the allowDuplicates to set