C
- CA
- CF
- public abstract class GenericContentServiceImpl<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet> extends Object implements GenericContentService<C,CA,CF>
Modifier and Type | Field and Description |
---|---|
protected org.springframework.cache.Cache |
cache |
protected org.springframework.cache.CacheManager |
cacheManager |
protected ContentSource<C,CA,CF> |
contentSource |
protected Collection<Status> |
contentStatusCriticalForMove
While
#move(ContentDescriber, ContentDescriber, Integer) the service will move the content across all Status types. |
protected MountPathReLoader<org.apache.wicket.protocol.http.WebApplication> |
mountPathReLoader |
protected Map<String,com.neurosys.spider.indexer.service.AbstractIndexSearch<Identifiable<Long>>> |
searchMap
Map of Index Name to the
AbstractIndexSearch
Default AbstractIndexSearch is mapped to null key |
protected TemplateService |
templateService |
CONTENT_LOOKUP_CACHE_NAME, CONTENT_PUBLISH_CACHE_NAME
Constructor and Description |
---|
GenericContentServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clear all
Product related Cache |
void |
clearTemplates()
Clear cached HTML pages that serve as base templates
|
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) |
C |
createNewContent(C content,
Integer sequence)
Saves content (new) & creates its clones (see
ContentService#clone() ). |
int |
deleteContent(String name,
boolean deleteChildren)
HierarchyContentSource Override for event generationDelete a content and all associated content for all locales etc. |
List<String> |
getAdditionalCacheNames()
Register additional caches, so that on
clearCache() all registered caches can be cleared |
org.springframework.cache.Cache |
getCache() |
org.springframework.cache.CacheManager |
getCacheManager() |
ContentSource<C,CA,CF> |
getContentSource() |
Collection<Status> |
getContentStatusCriticalForMove()
While
#move(ContentDescriber, ContentDescriber, Integer) the service will move the content across all Status types. |
MountPathReLoader<org.apache.wicket.protocol.http.WebApplication> |
getMountPathReLoader() |
List<AutoGenMenuItem> |
getRelatedNavigations() |
Map<String,com.neurosys.spider.indexer.service.AbstractIndexSearch<Identifiable<Long>>> |
getSearchMap() |
com.neurosys.spider.indexer.service.AbstractIndexSearch<Identifiable<Long>> |
getSearchService(String indexName) |
TemplateService |
getTemplateService() |
String |
getURL(C content)
For the content get the URL
|
void |
index()
Re-Index all the Content using Spider
|
C |
publish(C content)
Performs operations needed to publish the content and its related attributes, facets etc.
|
void |
publish(Collection<C> contents)
Performs operations needed to publish content(s) and related attributes, facets etc.
|
C |
save(C content) |
CF |
saveFacet(CF cf)
|
List |
search(String indexName,
com.neurosys.spider.domain.SearchParams searchParams,
PageInfo pageInfo,
String... categoryNames)
Perform indexed/lucene based searches
|
int |
searchCount(String indexName,
com.neurosys.spider.domain.SearchParams searchParams,
String... categoryNames)
Perform indexed/lucene based searches
|
void |
setAdditionalCacheNames(List<String> additionalCacheNames)
Register additional caches, so that on
clearCache() all registered caches can be cleared |
void |
setCache(org.springframework.cache.Cache cache) |
void |
setCacheManager(org.springframework.cache.CacheManager cacheManager) |
void |
setContentSource(ContentSource<C,CA,CF> contentSource) |
void |
setContentStatusCriticalForMove(Collection<Status> contentStatusCriticalForMove)
While
#move(ContentDescriber, ContentDescriber, Integer) the service will move the content across all Status types. |
void |
setMountPathReLoader(MountPathReLoader<org.apache.wicket.protocol.http.WebApplication> mountPathReLoader) |
void |
setRelatedNavigations(List<AutoGenMenuItem> relatedNavigations) |
void |
setSearchMap(Map<String,com.neurosys.spider.indexer.service.AbstractIndexSearch<Identifiable<Long>>> searchMap) |
void |
setTemplateService(TemplateService templateService) |
protected void |
sysAutoIndex()
Based on a Scheduled job keep refreshing the Index
|
void |
unPublish(C content)
It will remove the published version from the
ContentSource . |
int |
updateContentStatus(String name,
Locale locale,
Status oldStatus,
Status newStatus)
HierarchyContentSource Override for event generationThis will cause an update to the Content state. |
void |
updateNav()
Ability to refresh Navigation linked to the content service; if any
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFacets, mount
protected ContentSource<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet> contentSource
@Autowired @Qualifier(value="cacheManager") protected org.springframework.cache.CacheManager cacheManager
protected org.springframework.cache.Cache cache
protected TemplateService templateService
protected MountPathReLoader<org.apache.wicket.protocol.http.WebApplication> mountPathReLoader
protected Map<String,com.neurosys.spider.indexer.service.AbstractIndexSearch<Identifiable<Long>>> searchMap
AbstractIndexSearch
Default AbstractIndexSearch
is mapped to null keyprotected Collection<Status> contentStatusCriticalForMove
#move(ContentDescriber, ContentDescriber, Integer)
the service will move the content across all Status types.
If the ones in this are not found it will break the process and not proceed.@Transactional(readOnly=false) public int updateContentStatus(String name, Locale locale, Status oldStatus, Status newStatus) throws Exception
HierarchyContentSource
Override for event generationStatus.DRAFT
, and is being updated to Status.PUBLISH
while another Status.PUBLISH
one already exists. Then it should update the PUBLISH record for the content and
mute the Status.DRAFT
one (in concept).updateContentStatus
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
name
- as identifier for the contentlocale
- as the Locale
oldStatus
- as the Status
newStatus
- as the Status
(replace the oldStatus with this value)Exception
@Transactional(readOnly=false) public C save(C content)
save
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
@Transactional(readOnly=false) public C publish(C content) throws PartialTransactionException
Content
record (& related ContentFacet
s, attributes) to publishpublish
in interface GenericContentService<C extends Content<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 Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
Exception
public void updateNav()
GenericContentService
updateNav
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
public void clearCache()
GenericContentService
Product
related CacheclearCache
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
public void publish(Collection<C> contents) throws Exception
Content
record (& related ContentFacet
s, attributes) to publishpublish
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
contents
- (these should be records with Content.getStatus()
as Status.DRAFT
)Exception
public List<AutoGenMenuItem> getRelatedNavigations()
public void setRelatedNavigations(List<AutoGenMenuItem> relatedNavigations)
protected List<C> clone(C content, List<Status> statuses, List<Locale> locales)
AbstractContent.getStatus()
and/or AbstractContent.getLocale()
.public List<C> clone(C content)
Status
& Locales (alter-egos) of this same content.clone
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
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 Content<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 rootpublic List search(String indexName, com.neurosys.spider.domain.SearchParams searchParams, PageInfo pageInfo, String... categoryNames) throws Exception
GenericContentService
search
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
indexName
- as String @Nuallble true implies the default index wilt be searchedsearchParams
- as SearchParams @nullable falsepageInfo
- as PageIngo @nullable truecategoryNames
- @nullable trueException
public int searchCount(String indexName, com.neurosys.spider.domain.SearchParams searchParams, String... categoryNames) throws Exception
GenericContentService
searchCount
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
indexName
- as String @Nuallble true implies the default index wilt be searchedsearchParams
- as SearchParams @nullable falsecategoryNames
- @nullable trueException
@Scheduled(cron="${search.indexer.content.cron}") protected void sysAutoIndex() throws Exception
Exception
public void index() throws Exception
GenericContentService
index
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
Exception
public Map<String,com.neurosys.spider.indexer.service.AbstractIndexSearch<Identifiable<Long>>> getSearchMap()
public void setSearchMap(Map<String,com.neurosys.spider.indexer.service.AbstractIndexSearch<Identifiable<Long>>> searchMap)
public com.neurosys.spider.indexer.service.AbstractIndexSearch<Identifiable<Long>> getSearchService(String indexName)
getSearchService
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
@Transactional(readOnly=false) public int deleteContent(String name, boolean deleteChildren)
GenericContentService
HierarchyContentSource
Override for event generationdeleteContent
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
name
- of Content as StringdeleteChildren
- as boolean; will delete sub-hierarchy to this contentContentAttribute
, ContentFacet
etc are not counted, just core content entity objects)@Transactional(readOnly=false) public CF saveFacet(CF cf)
GenericContentService
saveFacet
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
cf
- as ContentFacet
public org.springframework.cache.CacheManager getCacheManager()
public void setCacheManager(org.springframework.cache.CacheManager cacheManager)
public TemplateService getTemplateService()
public void setTemplateService(TemplateService templateService)
public MountPathReLoader<org.apache.wicket.protocol.http.WebApplication> getMountPathReLoader()
public void setMountPathReLoader(MountPathReLoader<org.apache.wicket.protocol.http.WebApplication> mountPathReLoader)
public void setCache(org.springframework.cache.Cache cache)
public Collection<Status> getContentStatusCriticalForMove()
#move(ContentDescriber, ContentDescriber, Integer)
the service will move the content across all Status types.
If the ones in this are not found it will break the process and not proceed.public void setContentStatusCriticalForMove(Collection<Status> contentStatusCriticalForMove)
#move(ContentDescriber, ContentDescriber, Integer)
the service will move the content across all Status types.
If the ones in this are not found it will break the process and not proceed.public String getURL(C content)
GenericContentService
getURL
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
content
- as Content
public List<String> getAdditionalCacheNames()
clearCache()
all registered caches can be clearedpublic void setAdditionalCacheNames(List<String> additionalCacheNames)
clearCache()
all registered caches can be clearedpublic org.springframework.cache.Cache getCache()
getCache
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
public void clearTemplates() throws Exception
GenericContentService
clearTemplates
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
Exception
public ContentSource<C,CA,CF> getContentSource()
getContentSource
in interface GenericContentService<C extends Content<CA,CF>,CA extends AbstractContentAttribute,CF extends AbstractContentFacet>
public void setContentSource(ContentSource<C,CA,CF> contentSource)
Copyright © 2018. All rights reserved.