Class PublicationTemplateManager
- java.lang.Object
-
- org.silverpeas.core.contribution.template.publication.PublicationTemplateManager
-
- All Implemented Interfaces:
ComponentInstanceDeletion
@Service @Singleton public class PublicationTemplateManager extends Object implements ComponentInstanceDeletion
The PublicationTemplateManager manages all the PublicationTemplate for all the Job'Peas. It is a singleton.
-
-
Constructor Summary
Constructors Constructor Description PublicationTemplateManager()
-
Method Summary
-
-
-
Method Detail
-
getInstance
public static PublicationTemplateManager getInstance()
Gets the single instance of this manager.- Returns:
- the single instance of PublicationTemplateManager.
-
makePath
public String makePath(String fileName)
Makes the path denoted by the specified file name relative to the template directory.- Parameters:
fileName
- the path of a file or a directory- Returns:
- the absolute path of the specified file name in the template directory.
-
getTemplateDirectoryPath
public String getTemplateDirectoryPath()
-
addDynamicPublicationTemplate
public GenericRecordSet addDynamicPublicationTemplate(String externalId, String templateFileName) throws PublicationTemplateException
- Throws:
PublicationTemplateException
-
getPublicationTemplate
public PublicationTemplate getPublicationTemplate(String externalId) throws PublicationTemplateException
- Throws:
PublicationTemplateException
-
getPublicationTemplate
public PublicationTemplate getPublicationTemplate(String externalId, String templateFileName) throws PublicationTemplateException
Returns the PublicationTemplate having the given externalId.- Parameters:
externalId
-templateFileName
-- Returns:
- Throws:
PublicationTemplateException
-
removePublicationTemplate
public void removePublicationTemplate(String externalId) throws PublicationTemplateException
Removes the PublicationTemplate having the given externalId.- Parameters:
externalId
-- Throws:
PublicationTemplateException
-
delete
public void delete(String componentInstanceId)
Description copied from interface:ComponentInstanceDeletion
Deletes the resources belonging to the specified component instance. This method is invoked by Silverpeas when a component instance is being deleted.- Specified by:
delete
in interfaceComponentInstanceDeletion
- Parameters:
componentInstanceId
- the unique identifier of a component instance.
-
loadPublicationTemplate
public PublicationTemplate loadPublicationTemplate(String xmlFileName) throws PublicationTemplateException
load a publicationTemplate definition from xml file to java objects- Parameters:
xmlFileName
- the xml file name that contains publication template definition- Returns:
- a PublicationTemplate object
- Throws:
PublicationTemplateException
-
savePublicationTemplate
public void savePublicationTemplate(PublicationTemplate template) throws PublicationTemplateException, CryptoException
Save a publicationTemplate definition from java objects to xml file- Parameters:
template
- the PublicationTemplate to save- Throws:
PublicationTemplateException
CryptoException
-
getPublicationTemplates
public List<PublicationTemplate> getPublicationTemplates(boolean onlyVisible) throws PublicationTemplateException
Retrieve Publication Templates- Parameters:
onlyVisible
- only visible templates boolean- Returns:
- only visible PublicationTemplates if onlyVisible is true, all the publication templates else if
- Throws:
PublicationTemplateException
-
getPublicationTemplates
public List<PublicationTemplate> getPublicationTemplates() throws PublicationTemplateException
- Returns:
- only the visible PublicationTemplates
- Throws:
PublicationTemplateException
-
getPublicationTemplates
public List<PublicationTemplate> getPublicationTemplates(GlobalContext globalContext) throws PublicationTemplateException
- Parameters:
globalContext
- componentName It can be null. It is usefull when componentId is not defined.- Returns:
- Throws:
PublicationTemplateException
-
getDirectoryTemplates
public List<PublicationTemplate> getDirectoryTemplates()
-
isPublicationTemplateVisible
public boolean isPublicationTemplateVisible(String templateName, GlobalContext globalContext) throws PublicationTemplateException
- Throws:
PublicationTemplateException
-
getSearchablePublicationTemplates
public List<PublicationTemplate> getSearchablePublicationTemplates() throws PublicationTemplateException
- Returns:
- the list of PublicationTemplate which contains a search form
- Throws:
PublicationTemplateException
-
getCryptedPublicationTemplates
public List<PublicationTemplate> getCryptedPublicationTemplates() throws PublicationTemplateException
- Returns:
- the list of PublicationTemplate which are crypted
- Throws:
PublicationTemplateException
-
removePublicationTemplateFromCaches
public void removePublicationTemplateFromCaches(String fileName)
- Parameters:
fileName
- the file name of the template to remove from cache
-
registerForRenewingContentCipher
protected void registerForRenewingContentCipher()
-
saveData
public void saveData(String xmlFormName, PagesContext context, List<org.apache.commons.fileupload.FileItem> items) throws org.silverpeas.kernel.SilverpeasException
- Throws:
org.silverpeas.kernel.SilverpeasException
-
getFormAndData
public Form getFormAndData(String xmlFormName, PagesContext context, boolean readOnly) throws org.silverpeas.kernel.SilverpeasException
- Throws:
org.silverpeas.kernel.SilverpeasException
-
setDataIntoIndex
public void setDataIntoIndex(String xmlFormName, String componentId, String userId, FullIndexEntry indexEntry)
-
getDirectoryTemplate
public PublicationTemplate getDirectoryTemplate()
-
getDirectoryTemplate
public PublicationTemplate getDirectoryTemplate(PagesContext context)
-
getDirectoryForm
public Form getDirectoryForm(PagesContext context, boolean viewMode)
-
deleteDirectoryData
public void deleteDirectoryData(String userId)
-
getDirectoryFormValues
public Map<String,String> getDirectoryFormValues(String userId, String domainId, String language)
-
getDirectoryFormLabels
public Map<String,String> getDirectoryFormLabels(String userId, String domainId, String language)
-
getNumberOfRecordsByTemplateAndComponents
public Map<String,Integer> getNumberOfRecordsByTemplateAndComponents(String templateName) throws FormException
- Throws:
FormException
-
-