Class DefaultCMSNavigationService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSService
-
- de.hybris.platform.cms2.servicelayer.services.impl.DefaultCMSNavigationService
-
- All Implemented Interfaces:
CMSNavigationService
,java.io.Serializable
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
public class DefaultCMSNavigationService extends AbstractCMSService implements CMSNavigationService
Default implementation ofCMSNavigationService
interface.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSService
CURRENTCATALOGVERSION, CURRENTSITE
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultCMSNavigationService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
appendRelatedItems(CMSNavigationNodeModel cmsNavigationNode, java.util.Collection<ItemModel> items)
Adds selected items to specificCMSNavigationNodeModel
navigation node.CMSNavigationEntryModel
createCmsNavigationEntry(CatalogVersionModel catalogVersion, ItemModel item)
Creates an orphan entry for a givenitem
.CMSNavigationEntryModel
createCmsNavigationEntry(CMSNavigationNodeModel node, java.lang.String entryName, ItemModel entryContent)
Adds aitem
to givencmsNavigationNode
navigation node.protected CMSNavigationEntryModel
createCmsNavigationEntry(ItemModel entryContent, CatalogVersionModel catalogVersionModel)
CMSNavigationNodeModel
createNavigationNode(ItemModel parentNode, java.lang.String navigationNodeName, boolean visible, java.util.Collection<ItemModel> relatedItems)
Creates a navigation node accordingly to specified attributes.CMSNavigationNodeModel
createSuperRootNavigationNode(CatalogVersionModel catalogVersion)
Creates super root navigation node for given catalog version.void
delete(CMSNavigationNodeModel cmsNavigationNode)
Deprecated.since 1811, no longer needed.protected void
deleteRecursively(CMSNavigationNodeModel cmsNavigationNode)
Deletes all children all way down to leafs.protected java.util.List<ItemModel>
extractCmsNavigationEntries(CMSNavigationNodeModel navigatioNode)
Extracts items from given navigation node.protected CatalogVersionService
getCatalogVersionService()
protected CMSAdminSiteService
getCmsAdminSiteService()
protected CMSNavigationDao
getCmsNavigationDao()
protected CMSPageService
getCmsPageService()
java.util.List<CMSNavigationEntryModel>
getNavigationEntriesByPage(AbstractPageModel page)
Finds allCMSNavigationEntryModel
associated with aAbstractPageModel
.java.util.Optional<CMSNavigationEntryModel>
getNavigationEntryForId(java.lang.String id, CatalogVersionModel catalogVersion)
Returns a Navigation Entry identified via its id and the given catalog versionCMSNavigationNodeModel
getNavigationNodeForId(java.lang.String id)
Returns a Navigation Node identified via its idprotected java.util.List<CMSNavigationNodeModel>
getNavigationNodesByContentPage(ContentPageModel page)
java.util.List<CMSNavigationNodeModel>
getNavigationNodesForContentPage(ContentPageModel page)
Returns a list of all Navigation Nodes which contain the given pagejava.util.List<CMSNavigationNodeModel>
getNavigationNodesForContentPageId(java.lang.String pageId)
Returns a list of all Navigation Nodes which contain the given pageprotected KeyGenerator
getProcessCodeGenerator()
java.util.List<CMSNavigationNodeModel>
getRootNavigationNodes()
java.util.List<CMSNavigationNodeModel>
getRootNavigationNodes(CatalogVersionModel catVer)
Returns all root navigation nodes for given catalog version.protected java.util.List<CMSNavigationNodeModel>
getRootNavigationNodesByContentPage(ContentPageModel page)
java.util.List<CMSNavigationNodeModel>
getRootNavigationNodesForContentPage(ContentPageModel page)
Returns a list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assignedjava.util.List<CMSNavigationNodeModel>
getRootNavigationNodesForContentPageId(java.lang.String pageId)
Returns a list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assignedCMSNavigationNodeModel
getSuperRootNavigationNode(CatalogVersionModel catalogVersionModel)
Returns super root navigation node for given catalog version.boolean
isSuperRootNavigationNode(CMSNavigationNodeModel navigationNodeModel)
Tests if a navigation node is a super root node.void
move(CMSNavigationNodeModel sourceNode, CMSNavigationNodeModel targetModel)
Moves given nodeModel at last position of the child nodes list of targetModel.void
move(CMSNavigationNodeModel sourceNode, CMSNavigationNodeModel targetModel, boolean asChild, boolean append)
Moves source nod to targert node.void
move(CMSNavigationNodeModel cmsNavigationNode, ItemModel sourceEntry, ItemModel targetnEntry)
Moves given items within given navigation node.void
move(ItemModel item, CMSNavigationNodeModel sourceNode, CMSNavigationNodeModel targetNode)
Moves given item from sourceNode to targetNode.void
remove(CMSNavigationNodeModel cmsNavigationNode, ItemModel item)
Removes given item from given navigation node.boolean
removeNavigationEntryByUid(CMSNavigationNodeModel cmsNavigationNode, java.lang.String navigationEntryUid)
Deprecated.since 1811, no longer needed.void
setCatalogVersionService(CatalogVersionService catalogVersionService)
void
setCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService)
void
setCmsNavigationDao(CMSNavigationDao cmsNavigationDao)
void
setCmsPageService(CMSPageService cmsPageService)
void
setProcessCodeGenerator(KeyGenerator keyGenerator)
CMSNavigationNodeModel
setSuperRootNodeOnNavigationNode(CMSNavigationNodeModel navigationNodeModel, CatalogVersionModel catalogVersionModel)
Sets the super root node onto the passed CMS navigation node model.protected java.util.List<CMSNavigationEntryModel>
wrapItemModel(java.util.Collection<ItemModel> items, CatalogVersionModel catalogVersionModel)
Wrap given items to become aCMSNavigationEntryModel
.-
Methods inherited from class de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSService
getBaseSiteService, getCurrentCatalogVersion, getCurrentSite, getSearchRestrictionService, getUserService, setBaseSiteService, setSearchRestrictionService, setUserService
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
getNavigationNodeForId
public CMSNavigationNodeModel getNavigationNodeForId(java.lang.String id) throws CMSItemNotFoundException
Returns a Navigation Node identified via its id- Specified by:
getNavigationNodeForId
in interfaceCMSNavigationService
- Parameters:
id
- id of the Navigation Node- Returns:
- The Navigation Node model with the given id
- Throws:
CMSItemNotFoundException
- if no Navigation Node with the given id could be found
-
getNavigationNodesByContentPage
protected java.util.List<CMSNavigationNodeModel> getNavigationNodesByContentPage(ContentPageModel page)
-
getNavigationNodesForContentPage
public java.util.List<CMSNavigationNodeModel> getNavigationNodesForContentPage(ContentPageModel page)
Returns a list of all Navigation Nodes which contain the given page- Specified by:
getNavigationNodesForContentPage
in interfaceCMSNavigationService
- Parameters:
page
- Page to lookup- Returns:
- list of all Navigation Nodes which have the page assigned
-
getNavigationNodesForContentPageId
public java.util.List<CMSNavigationNodeModel> getNavigationNodesForContentPageId(java.lang.String pageId) throws CMSItemNotFoundException
Returns a list of all Navigation Nodes which contain the given page- Specified by:
getNavigationNodesForContentPageId
in interfaceCMSNavigationService
- Parameters:
pageId
- id of the page- Returns:
- list of all Navigation Nodes which have the page assigned
- Throws:
CMSItemNotFoundException
- if the page with the given id could not be found
-
getRootNavigationNodes
public java.util.List<CMSNavigationNodeModel> getRootNavigationNodes()
- Specified by:
getRootNavigationNodes
in interfaceCMSNavigationService
- Returns:
- A list of all root navigation nodes in the active catalog version. A root navigation node is defined by not having a parent.
-
getRootNavigationNodesByContentPage
protected java.util.List<CMSNavigationNodeModel> getRootNavigationNodesByContentPage(ContentPageModel page)
-
getRootNavigationNodesForContentPage
public java.util.List<CMSNavigationNodeModel> getRootNavigationNodesForContentPage(ContentPageModel page)
Returns a list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assigned- Specified by:
getRootNavigationNodesForContentPage
in interfaceCMSNavigationService
- Parameters:
page
- page to lookup- Returns:
- list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assigned
-
getRootNavigationNodesForContentPageId
public java.util.List<CMSNavigationNodeModel> getRootNavigationNodesForContentPageId(java.lang.String pageId) throws CMSItemNotFoundException
Returns a list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assigned- Specified by:
getRootNavigationNodesForContentPageId
in interfaceCMSNavigationService
- Parameters:
pageId
- id of the page- Returns:
- list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assigned
- Throws:
CMSItemNotFoundException
- if the page with the given id could not be found
-
getNavigationEntriesByPage
public java.util.List<CMSNavigationEntryModel> getNavigationEntriesByPage(AbstractPageModel page)
Description copied from interface:CMSNavigationService
Finds allCMSNavigationEntryModel
associated with aAbstractPageModel
.- Specified by:
getNavigationEntriesByPage
in interfaceCMSNavigationService
- Parameters:
page
- theAbstractPageModel
- Returns:
- a List of
CMSNavigationEntryModel
, or an empty List if not found
-
getNavigationEntryForId
public java.util.Optional<CMSNavigationEntryModel> getNavigationEntryForId(java.lang.String id, CatalogVersionModel catalogVersion)
Description copied from interface:CMSNavigationService
Returns a Navigation Entry identified via its id and the given catalog version- Specified by:
getNavigationEntryForId
in interfaceCMSNavigationService
- Parameters:
id
- id of the Navigation EntrycatalogVersion
- catalog version- Returns:
- The Navigation Entry model
-
createCmsNavigationEntry
public CMSNavigationEntryModel createCmsNavigationEntry(CMSNavigationNodeModel node, java.lang.String entryName, ItemModel entryContent)
Adds aitem
to givencmsNavigationNode
navigation node. Note:
This method save all modified models i.e.cmsNavigationNode
is saved!- Specified by:
createCmsNavigationEntry
in interfaceCMSNavigationService
- Parameters:
node
- given navigation nodeentryName
- the navigation entry nameentryContent
- item that will be added- Returns:
- the navigation entry model created for the item and navigationNodeModel
-
createCmsNavigationEntry
public CMSNavigationEntryModel createCmsNavigationEntry(CatalogVersionModel catalogVersion, ItemModel item)
Description copied from interface:CMSNavigationService
Creates an orphan entry for a givenitem
. Note:
This method does not save the entry created.- Specified by:
createCmsNavigationEntry
in interfaceCMSNavigationService
- Parameters:
catalogVersion
- catalog versionitem
- item that will be added- Returns:
- the navigation entry model created
-
deleteRecursively
protected void deleteRecursively(CMSNavigationNodeModel cmsNavigationNode)
Deletes all children all way down to leafs.- Parameters:
cmsNavigationNode
- navigation node
-
extractCmsNavigationEntries
protected java.util.List<ItemModel> extractCmsNavigationEntries(CMSNavigationNodeModel navigatioNode)
Extracts items from given navigation node.- Parameters:
navigatioNode
- given navigation node
-
wrapItemModel
protected java.util.List<CMSNavigationEntryModel> wrapItemModel(java.util.Collection<ItemModel> items, CatalogVersionModel catalogVersionModel)
Wrap given items to become aCMSNavigationEntryModel
.
-
getRootNavigationNodes
public java.util.List<CMSNavigationNodeModel> getRootNavigationNodes(CatalogVersionModel catVer)
Returns all root navigation nodes for given catalog version.- Specified by:
getRootNavigationNodes
in interfaceCMSNavigationService
- Parameters:
catVer
- catalog version- Returns:
- founded root navigation nodes
-
move
public void move(CMSNavigationNodeModel sourceNode, CMSNavigationNodeModel targetModel)
Moves given nodeModel at last position of the child nodes list of targetModel. It is removed from current parent node list of children. Note:
This method save all modified models i.e.nodeModel
andtargetModel
are saved!- Specified by:
move
in interfaceCMSNavigationService
- Parameters:
sourceNode
- node that will be movedtargetModel
- a new target node
-
move
public void move(CMSNavigationNodeModel cmsNavigationNode, ItemModel sourceEntry, ItemModel targetnEntry)
Moves given items within given navigation node. Precisely: Moves given source item to place of target item (target item is moved one position further). Note:
This method save all modified models i.e.naviNode
is saved with new items order!- Specified by:
move
in interfaceCMSNavigationService
- Parameters:
cmsNavigationNode
- current navigation nodesourceEntry
- a source nodetargetnEntry
- a new target node
-
move
public void move(ItemModel item, CMSNavigationNodeModel sourceNode, CMSNavigationNodeModel targetNode)
Moves given item from sourceNode to targetNode. Which means soureNode will have one child less, targetNode on the other hand one more. Note:
This method save all modified models i.e.sourceNode
and
is saved with new item order!targetNode
- Specified by:
move
in interfaceCMSNavigationService
- Parameters:
item
- item that will be movedsourceNode
- a source nodetargetNode
- a new target node
-
delete
@Deprecated public void delete(CMSNavigationNodeModel cmsNavigationNode)
Deprecated.since 1811, no longer needed.Deletes given node and all it' child nodes. Note:
This method save all modified models!. This method removes only the given navigation node with its child - without other references i.e. pages won't be removed.- Specified by:
delete
in interfaceCMSNavigationService
- Parameters:
cmsNavigationNode
- navigation node to remove
-
remove
public void remove(CMSNavigationNodeModel cmsNavigationNode, ItemModel item)
Removes given item from given navigation node. The item itself is not deleted. Note:
This method save all modified models! i.e.cmsNavigationNode
is saved!- Specified by:
remove
in interfaceCMSNavigationService
- Parameters:
cmsNavigationNode
- given navigation nodeitem
- given item to remove from cmsNavigationNode
-
removeNavigationEntryByUid
@Deprecated public boolean removeNavigationEntryByUid(CMSNavigationNodeModel cmsNavigationNode, java.lang.String navigationEntryUid)
Deprecated.since 1811, no longer needed.Removes a given entry from a given navigation node. The Navigation Entry is deleted, but not the ItemModel in the entry. Note:
This method save all modified models, i.e.cmsNavigationNode
is saved.- Specified by:
removeNavigationEntryByUid
in interfaceCMSNavigationService
- Parameters:
cmsNavigationNode
- given navigation nodenavigationEntryUid
- given navigation entry uid.- Returns:
- true if the entry was removed or false otherwise.
-
createNavigationNode
public CMSNavigationNodeModel createNavigationNode(ItemModel parentNode, java.lang.String navigationNodeName, boolean visible, java.util.Collection<ItemModel> relatedItems)
Description copied from interface:CMSNavigationService
Creates a navigation node accordingly to specified attributes. Note:
ReturnedCMSNavigationNodeModel
is not saved!- Specified by:
createNavigationNode
in interfaceCMSNavigationService
- Parameters:
parentNode
- parent for created navigation nodenavigationNodeName
- given navigation node namevisible
- flag determines navigation node visibilityrelatedItems
- given related items- Returns:
- a new navigation node
-
isSuperRootNavigationNode
public boolean isSuperRootNavigationNode(CMSNavigationNodeModel navigationNodeModel)
Description copied from interface:CMSNavigationService
Tests if a navigation node is a super root node.- Specified by:
isSuperRootNavigationNode
in interfaceCMSNavigationService
- Parameters:
navigationNodeModel
- node model to test if it's a super root node- Returns:
- returns true if it is a super root node
-
setSuperRootNodeOnNavigationNode
public CMSNavigationNodeModel setSuperRootNodeOnNavigationNode(CMSNavigationNodeModel navigationNodeModel, CatalogVersionModel catalogVersionModel)
Description copied from interface:CMSNavigationService
Sets the super root node onto the passed CMS navigation node model.- Specified by:
setSuperRootNodeOnNavigationNode
in interfaceCMSNavigationService
- Parameters:
navigationNodeModel
- node model to set the super root node oncatalogVersionModel
- the belonging catalog version model of the super root node- Returns:
- navigation node with a parent super root node
-
createSuperRootNavigationNode
public CMSNavigationNodeModel createSuperRootNavigationNode(CatalogVersionModel catalogVersion)
Creates super root navigation node for given catalog version.- Specified by:
createSuperRootNavigationNode
in interfaceCMSNavigationService
- Parameters:
catalogVersion
- catalog version for which the super root node will be created- Returns:
- a new super root navigation node
-
appendRelatedItems
public void appendRelatedItems(CMSNavigationNodeModel cmsNavigationNode, java.util.Collection<ItemModel> items)
Description copied from interface:CMSNavigationService
Adds selected items to specificCMSNavigationNodeModel
navigation node.- Specified by:
appendRelatedItems
in interfaceCMSNavigationService
- Parameters:
cmsNavigationNode
- given navigation nodeitems
- that will be added
-
move
public void move(CMSNavigationNodeModel sourceNode, CMSNavigationNodeModel targetModel, boolean asChild, boolean append)
Description copied from interface:CMSNavigationService
Moves source nod to targert node.- Specified by:
move
in interfaceCMSNavigationService
- Parameters:
sourceNode
- node to be movedtargetModel
- node to be dropped atasChild
- if true source node will be come target node's child otherwise source will become target's siblingappend
- if true source will be added as last (child node)/next(sibling) else as first/previous
-
createCmsNavigationEntry
protected CMSNavigationEntryModel createCmsNavigationEntry(ItemModel entryContent, CatalogVersionModel catalogVersionModel)
-
getSuperRootNavigationNode
public CMSNavigationNodeModel getSuperRootNavigationNode(CatalogVersionModel catalogVersionModel)
Description copied from interface:CMSNavigationService
Returns super root navigation node for given catalog version.- Specified by:
getSuperRootNavigationNode
in interfaceCMSNavigationService
- Parameters:
catalogVersionModel
- current catalog version- Returns:
- a super root navigation node
-
getCatalogVersionService
protected CatalogVersionService getCatalogVersionService()
-
setCatalogVersionService
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
-
getCmsNavigationDao
protected CMSNavigationDao getCmsNavigationDao()
-
setCmsNavigationDao
public void setCmsNavigationDao(CMSNavigationDao cmsNavigationDao)
-
getCmsPageService
protected CMSPageService getCmsPageService()
-
setCmsPageService
public void setCmsPageService(CMSPageService cmsPageService)
-
getProcessCodeGenerator
protected KeyGenerator getProcessCodeGenerator()
-
setProcessCodeGenerator
public void setProcessCodeGenerator(KeyGenerator keyGenerator)
-
getCmsAdminSiteService
protected CMSAdminSiteService getCmsAdminSiteService()
-
setCmsAdminSiteService
public void setCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService)
-
-