Package de.hybris.platform.jalo.link
Class LinkOperationHandler
java.lang.Object
de.hybris.platform.jalo.link.LinkOperationHandler
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLinkOperationHandler(Item item, List<Item> toBeLinked, boolean isSource, String qualifier) Unlocalized single item links operation.LinkOperationHandler(Item item, List<Item> toBeLinked, boolean isSource, String qualifier, Language lang) Localizable single item links operation for just one languageLinkOperationHandler(Item item, List<Item> toBeLinked, boolean isSource, String qualifier, Language lang, boolean markModified) LinkOperationHandler(Item item, Map<Language, List<Item>> toBeLinked, boolean isSource, String qualifier) Localized single item links operation for multiple languages at once.Unlocalized multi-items links operation.LinkOperationHandler(List<Item> items, List<Item> toBeLinked, boolean isSource, String qualifier, Language lang) Localizable multi-items links operation for just one language.LinkOperationHandler(List<Item> items, List<Item> toBeLinked, boolean isSource, String qualifier, Language lang, boolean markModified) LinkOperationHandler(List<Item> items, Map<Language, List<Item>> toBeLinked, boolean isSource, String qualifier, boolean localized) Localized multi-items links operation for multiple languages.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. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData>protected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData>protected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData>Queries existing links together with the max position of each linked item in reverse order.protected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData>protected List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData>getItems()The item to add/set linked items to.protected StringgetLinkTypeCode(String qualifier) intReturns the insert position for all non-replace operations.The link qualifier/relation name.protected Collection<Item>getToBeLinked(PK langPK) getToBeLinked(Language lang) The items to be linked belonging to a given language scope.booleanbooleanbooleanTells whether or not the given item is placed at the source or target end of the underlying relation.booleanTells whether or not the operation will run in localized mode.booleanbooleanbooleanReturns true if the operation will set the complete link set of the given item at once.booleanisShift()booleanbooleanbooleanisUnlink()booleanperform(SessionContext ctx) Performs all changes at once.queryExistingLinks4ReplaceAll(SessionContext ctx, boolean sort, boolean sortReverse) voidsetAllowDuplicates(boolean allowDuplicates) protected voidsetGatheredData(List<de.hybris.platform.jalo.link.LinkOperationHandler.LinkData> data) voidsetMarkItemsModified(boolean markItemsModified) voidsetPosition(int position) Changes the insert position for this link operation.voidsetPreserveHiddenLanguages(boolean preserveHiddenLanguages) voidsetReplace(boolean replace) Defines whether or not the operation will set the complete link set of the given item at once.voidsetShift(boolean shift) voidsetSkipQueryExistingLinks(boolean skip) voidsetSortSrcEnd(boolean sortSrcEnd) voidsetSortTgtEnd(boolean sortTgtEnd) voidsetUnlink(boolean unlink)
-
Field Details
-
done
protected boolean done
-
-
Constructor Details
-
LinkOperationHandler
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
-
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
-
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
The item to add/set linked items to. -
getToBeLinked
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
-
getAllToBeLinked
-
hasItemsToLink
public boolean hasItemsToLink() -
getUnlikedItems
-
perform
Performs all changes at once. -
getLinkTypeCode
-
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
The link qualifier/relation name. -
isLocalized
public boolean isLocalized()Tells whether or not the operation will run in localized mode. -
getLanguages
-
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
-