Class DocumentTemplate
- java.lang.Object
-
- org.silverpeas.core.documenttemplate.DocumentTemplate
-
- All Implemented Interfaces:
Serializable
public class DocumentTemplate extends Object implements Serializable
This class is the representation of a document template.- Author:
- silveryocha
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DocumentTemplate()
Initializing a new instance ofDocumentTemplate
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
existDescriptionTranslationIn(String language)
Indicates if a description translation exists for the given language.boolean
existNameTranslationIn(String language)
Indicates if a name translation exists into the given language.String
getContentType()
Gets the content type of the physical file.String
getDescription(String language)
Gets the description of the document template.String
getExtension()
Gets the file extension of the document template.String
getId()
Gets the identifier of the document template.String
getName(String language)
Gets the name of the document template.int
getPosition()
Gets the position for collection sort processing.List<String>
getRestrictedToSpaceIds()
Gets the space identifiers the document template is restricted to.ViewerContext
getViewerContext(String language)
Gets the viewer context of the document template.boolean
isPersisted()
Indicates if the document template is persisted into Silverpeas's context.InputStream
openInputStream()
Opens anInputStream
over the content of the document template in order to copy it.void
setDescription(String description, String language)
Sets the description of the document template.void
setExtension(String extension)
Sets the file extension of the document template.void
setName(String name, String language)
Sets the name of the document template.void
setPosition(int position)
Sets the position for collection sort processing.void
setRestrictedToSpaceIds(List<String> spacesIds)
Sets the space identifiers the document template is restricted to.
-
-
-
Constructor Detail
-
DocumentTemplate
public DocumentTemplate()
Initializing a new instance ofDocumentTemplate
.
-
-
Method Detail
-
getId
public String getId()
Gets the identifier of the document template.The identifier is the file base name part of the file registered into repository.
- Returns:
- a string representing an id (UUID).
-
isPersisted
public boolean isPersisted()
Indicates if the document template is persisted into Silverpeas's context.- Returns:
- true is persisted, false otherwise.
-
getPosition
public int getPosition()
Gets the position for collection sort processing.- Returns:
- an integer representing the position into a sorted collection.
-
setPosition
public void setPosition(int position)
Sets the position for collection sort processing.- Parameters:
position
- an integer representing the position into a sorted collection.
-
existNameTranslationIn
public boolean existNameTranslationIn(String language)
Indicates if a name translation exists into the given language.- Parameters:
language
- the locale into which the name should be provided.- Returns:
- true of a translation exists, false otherwise.
-
getName
public String getName(String language)
Gets the name of the document template.- Parameters:
language
- the locale into which the name should be provided. A default one is provided if none retrieved with given language.- Returns:
- a string representing a name.
-
setName
public void setName(String name, String language)
Sets the name of the document template.- Parameters:
name
- a name.language
- the locale of the given name.
-
existDescriptionTranslationIn
public boolean existDescriptionTranslationIn(String language)
Indicates if a description translation exists for the given language.- Parameters:
language
- the locale into which the description should be provided.- Returns:
- true of a translation exists, false otherwise.
-
getDescription
public String getDescription(String language)
Gets the description of the document template.- Parameters:
language
- the locale into which the description should be provided. A default one is provided if none retrieved with given language.- Returns:
- a string representing a description.
-
setDescription
public void setDescription(String description, String language)
Sets the description of the document template.- Parameters:
description
- a description.language
- the locale of the given description.
-
getExtension
public String getExtension()
Gets the file extension of the document template.- Returns:
- a string (without the file extension separator).
-
setExtension
public void setExtension(String extension)
Sets the file extension of the document template.- Parameters:
extension
- a string (without the file extension separator).
-
setRestrictedToSpaceIds
public void setRestrictedToSpaceIds(List<String> spacesIds)
Sets the space identifiers the document template is restricted to.- Parameters:
spacesIds
- list of space identifier.
-
getRestrictedToSpaceIds
public List<String> getRestrictedToSpaceIds()
Gets the space identifiers the document template is restricted to.- Returns:
- list of space identifier.
-
getViewerContext
public ViewerContext getViewerContext(String language)
Gets the viewer context of the document template.Useful for
DocumentView
andPreview
services.- Parameters:
language
- the language into which theViewerContext
is expected.- Returns:
- a
ViewerContext
instance.
-
getContentType
public String getContentType()
Gets the content type of the physical file.- Returns:
- a string representing a mime type.
-
openInputStream
public InputStream openInputStream() throws IOException
Opens anInputStream
over the content of the document template in order to copy it.- Returns:
- an
InputStream
instance. - Throws:
IOException
- See FileNotFoundException above, FileNotFoundException is a subclass of IOException.
-
-