C
- as AbstractContent
CA
- as AbstractContentAttribute
CF
- as AbstractContentFacet
public class GenericHierarchyContentServiceImpl<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet> extends GenericContentServiceImpl<C,CA,CF> implements HierarchyService<C>
AbstractContent
(which is a HierarchialDomainObject
)00000
ChangeGenerator
; it will also generate Events of Type<Status, C>
}Locale
locale, Status
oldStatus, Status
newStatus}cache, cacheManager, contentSource, contentStatusCriticalForMove, mountPathReLoader, searchMap, templateService
CONTENT_LOOKUP_CACHE_NAME, CONTENT_PUBLISH_CACHE_NAME
Constructor and Description |
---|
GenericHierarchyContentServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener changeListener)
Allow Notify all
ChangeListener s about a change |
List<C> |
clone(C content)
clone a content across
Status & Locales (alter-egos) of this same content.The passed content is not persisted. |
protected List<C> |
clone(C content,
List<Status> statuses,
List<Locale> locales)
Ability to clone (create clones & persist) content across
AbstractContent.getStatus() and/or AbstractContent.getLocale() .The content should have a valid parentId and hierarchy code already set. This method will not save the passed input content but will create a new clone for the alter egos of the supplied content. All the cloned content will search for their respective parents (creating a parallel cloned hierarchy) |
void |
convert(IHierarchialReference entity,
Class to)
If we wish to transform an entity type we should perform the transformation and then the update.
|
C |
createNewContent(C content,
Integer sequence)
Saves content (new) & creates its clones (see
ContentService#clone() ). |
void |
deleteSubHierarchy(C rootNode)
Delete a root node and its children.
May throw an exception is there is a fault in the hierarchy or any node could not be deleted for some reason. |
protected C |
getContentProxyObject() |
HierarchyContentSource<C,CA,CF> |
getContentSource() |
List<CF> |
getFacets(Object contentNameorId,
String facetName,
Status status)
Convenient method for Scripts to call to get dynamic content
for a
AbstractContentFacet reference.. |
String |
getLastChildHierarchyCode(C parent)
Get the last existing/current child Hierarchy code
|
List |
getListeners()
Get list directly.
|
List |
loadHierarchy(C rootNode,
boolean loadLeaves) |
List<C> |
loadHierarchyFlat(C rootNode)
Load list of nodes under the root in order of hierarchy but does not to a structural hierarchial conversion (Homogeneous list)
|
String |
mount(C content,
Template template)
Mount a page so its accessible on the webite.
|
void |
move(C content,
C newParent,
Integer sequence)
Move a content under a parent.
|
protected void |
moveHierarchyOnly(C content,
C newParent,
Integer sequence,
String parentLastHCode) |
void |
notifyAllListeners(Object[] event)
Whenever a node is selected/updated, it also notifies its listeners.
|
C |
publish(C content)
Performs operations needed to publish the content and its related attributes, facets etc.
|
void |
setContentSource(HierarchyContentSource<C,CA,CF> contentSource) |
void |
setListeners(List listeners)
Set list directly.
|
void |
unPublish(C content)
It will remove the published version from the
ContentSource . |
clearCache, clearTemplates, deleteContent, getAdditionalCacheNames, getCache, getCacheManager, getContentStatusCriticalForMove, getMountPathReLoader, getRelatedNavigations, getSearchMap, getSearchService, getTemplateService, getURL, index, publish, save, saveFacet, search, searchCount, setAdditionalCacheNames, setCache, setCacheManager, setContentSource, setContentStatusCriticalForMove, setMountPathReLoader, setRelatedNavigations, setSearchMap, setTemplateService, sysAutoIndex, updateContentStatus, updateNav
public HierarchyContentSource<C,CA,CF> getContentSource()
getContentSource
in interface GenericContentService<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
getContentSource
in class GenericContentServiceImpl<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
public void setContentSource(HierarchyContentSource<C,CA,CF> contentSource)
public String getLastChildHierarchyCode(C parent)
HierarchyService
getLastChildHierarchyCode
in interface HierarchyService<C extends AbstractContent<CA,CF>>
protected void moveHierarchyOnly(C content, C newParent, Integer sequence, String parentLastHCode) throws Exception
Exception
public void move(C content, C newParent, Integer sequence) throws Exception
HierarchyService
IHierarchialReference.getParentId()
and IHierarchialReference.getHierarchy()
.move
in interface HierarchyService<C extends AbstractContent<CA,CF>>
newParent
- @nullable true (if IHierarchialReference.ROOT
sequence
- as Integer @nullable true (optional)Exception
public List loadHierarchy(C rootNode, boolean loadLeaves)
loadHierarchy
in interface HierarchyService<C extends AbstractContent<CA,CF>>
rootNode
- thispublic List<C> loadHierarchyFlat(C rootNode)
HierarchyService
loadHierarchyFlat
in interface HierarchyService<C extends AbstractContent<CA,CF>>
public void deleteSubHierarchy(C rootNode) throws Exception
HierarchyService
deleteSubHierarchy
in interface HierarchyService<C extends AbstractContent<CA,CF>>
Exception
public void convert(IHierarchialReference entity, Class to)
HierarchyService
InheritanceType.SINGLE_TABLE
or oen where there is a shared DiscriminatorValue
convert
in interface HierarchyService<C extends AbstractContent<CA,CF>>
protected List<C> clone(C content, List<Status> statuses, List<Locale> locales)
AbstractContent.getStatus()
and/or AbstractContent.getLocale()
.clone
in class GenericContentServiceImpl<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
public List<C> clone(C content)
Status
& Locales (alter-egos) of this same content.clone
in interface GenericContentService<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
clone
in class GenericContentServiceImpl<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
public String mount(C content, Template template)
mount
in interface GenericContentService<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
public C publish(C content) throws PartialTransactionException
Content
record (& related ContentFacet
s, attributes) to publishpublish
in interface GenericContentService<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
publish
in class GenericContentServiceImpl<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
content
- (this should be a record with Content.getStatus()
as Status.DRAFT
)PartialTransactionException
public void unPublish(C content) throws Exception
GenericContentService
ContentSource
. By default any paths etc are not mounted.unPublish
in interface GenericContentService<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
unPublish
in class GenericContentServiceImpl<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
Exception
public C createNewContent(C content, Integer sequence)
ContentService#clone()
).
The content being saved should be ideally a Status.DRAFT
version, if its not set then it will set it; and replicate
across other status. The content should also have its parent id set.
createNewContent
in interface GenericContentService<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
createNewContent
in class GenericContentServiceImpl<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
sequence
- is ignored in this implementationcontent
- @nullable false ;if Content#getParentId()
is null then it will assume rootprotected C getContentProxyObject()
public List<CF> getFacets(Object contentNameorId, String facetName, Status status)
GenericContentService
AbstractContentFacet
reference.. Useful when called via embedded scripts in content.getFacets
in interface GenericContentService<C extends AbstractContent<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
contentNameorId
- as String or LongfacetName
- as Stringstatus
- as Status
(optional)List
of AbstractContentFacet
public void addChangeListener(ChangeListener changeListener)
ChangeGenerator
ChangeListener
s about a changeaddChangeListener
in interface ChangeGenerator<Object[]>
public void notifyAllListeners(Object[] event)
ChangeGenerator
notifyAllListeners
in interface ChangeGenerator<Object[]>
public List getListeners()
ChangeGenerator
getListeners
in interface ChangeGenerator<Object[]>
public void setListeners(List listeners)
ChangeGenerator
setListeners
in interface ChangeGenerator<Object[]>
Copyright © 2018. All rights reserved.