Class DefaultDocumentTemplateRepository
- java.lang.Object
-
- org.silverpeas.core.documenttemplate.DefaultDocumentTemplateRepository
-
- All Implemented Interfaces:
DocumentTemplateRepository
@Repository public class DefaultDocumentTemplateRepository extends Object implements DocumentTemplateRepository
ThisDocumentTemplateRepository
implementation registers the document templates into $SILVERPEAS_HOME_DATA/documentTemplateRepository folder.Data about a document template are registered using JSON structure.
A document template is registered with two files :
- One file is representing the template content. The base name part of file is the identifier (an UUID) and the extension part is corresponding to the extension of the file to create
- An other file (a descriptor), a JSON one, contains additional data such as the name into different user languages. The base name part of file is the identifier (an UUID) and the extension is '.json'
- Author:
- silveryocha
-
-
Constructor Summary
Constructors Constructor Description DefaultDocumentTemplateRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentTemplate
create(DocumentTemplate documentTemplate, InputStream content)
Creates the given document template into the repository.void
delete(DocumentTemplate documentTemplate)
Deletes the given document template from the repository.Optional<DocumentTemplate>
getById(String id)
Gets the document template from given identifier.Stream<DocumentTemplate>
streamAll()
Lists all document template registered into repository.DocumentTemplate
update(DocumentTemplate documentTemplate, InputStream content)
Updates the given document template into the repository.
-
-
-
Method Detail
-
getById
public Optional<DocumentTemplate> getById(String id)
Description copied from interface:DocumentTemplateRepository
Gets the document template from given identifier.- Specified by:
getById
in interfaceDocumentTemplateRepository
- Returns:
- an optional
DocumentTemplate
instance
-
streamAll
public Stream<DocumentTemplate> streamAll()
Description copied from interface:DocumentTemplateRepository
Lists all document template registered into repository.- Specified by:
streamAll
in interfaceDocumentTemplateRepository
- Returns:
- a list of
DocumentTemplate
instance. The list is not sorted.
-
create
public DocumentTemplate create(DocumentTemplate documentTemplate, InputStream content)
Description copied from interface:DocumentTemplateRepository
Creates the given document template into the repository.- Specified by:
create
in interfaceDocumentTemplateRepository
- Parameters:
documentTemplate
- theDocumentTemplate
instance to take into account.content
- the content of the document template.- Returns:
- the document template created into Silverpeas's context.
-
update
public DocumentTemplate update(DocumentTemplate documentTemplate, InputStream content)
Description copied from interface:DocumentTemplateRepository
Updates the given document template into the repository.- Specified by:
update
in interfaceDocumentTemplateRepository
- Parameters:
documentTemplate
- theDocumentTemplate
instance to take into account.content
- the content of the document template.- Returns:
- the document template updated into Silverpeas's context.
-
delete
public void delete(DocumentTemplate documentTemplate)
Description copied from interface:DocumentTemplateRepository
Deletes the given document template from the repository.- Specified by:
delete
in interfaceDocumentTemplateRepository
- Parameters:
documentTemplate
- theDocumentTemplate
instance to take into account.
-
-