Class ViewerContext
- java.lang.Object
-
- org.silverpeas.core.viewer.service.ViewerContext
-
public class ViewerContext extends Object
The context of a conversion process.- Author:
- Yohann Chastagnier
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ViewerContextcopy()static ViewerContextfrom(SimpleDocument document)Initializes a context from an instance ofSimpleDocument.StringgetDocumentId()Gets the identifier of the document.StringgetDocumentType()Gets the type of the document.StringgetLanguage()Gets the language of the contentStringgetOriginalFileName()Gets the name of the original file.FilegetOriginalSourceFile()Gets the original file.StringgetViewId()Gets the identifier associated to the current conversion processes for viewing.
If an id has been explicitly set, then it is returned.
Otherwise, a unique id is computed.TemporaryWorkspaceTranslationgetWorkspace()Gets the workspace into which the processes will write the results.booleanisCacheRequired()Indicates if cache is required.booleanisProcessingCache()Indicates if the current process is the one which is in charge of performing the conversion tasks.voidprocessingCache()Sets into context that the current process is in charge of the conversion tasks.ViewerContextwithUniqueDocumentId(String uniqueDocumentId)Sets a unique identifier associated to the current document to convert.
This id is used bygetViewId()in order to compute the final unique identifier.
-
-
-
Method Detail
-
from
public static ViewerContext from(SimpleDocument document)
Initializes a context from an instance ofSimpleDocument.- Parameters:
document- theSimpleDocumentfor which the file must be converted.- Returns:
- an instance of
ViewerContextinitialized from the givenSimpleDocument.
-
getDocumentId
public String getDocumentId()
Gets the identifier of the document.- Returns:
- a string.
-
getDocumentType
public String getDocumentType()
Gets the type of the document.- Returns:
- a string.
-
getOriginalFileName
public String getOriginalFileName()
Gets the name of the original file.- Returns:
- the name as string.
-
getOriginalSourceFile
public File getOriginalSourceFile()
Gets the original file.- Returns:
- the
Filethat represents the original file.
-
getWorkspace
public TemporaryWorkspaceTranslation getWorkspace()
Gets the workspace into which the processes will write the results.- Returns:
- the
Filethat represents the workspace.
-
getViewId
public String getViewId()
Gets the identifier associated to the current conversion processes for viewing.
If an id has been explicitly set, then it is returned.
Otherwise, a unique id is computed.- Returns:
- a unique identifier as string.
-
withUniqueDocumentId
public ViewerContext withUniqueDocumentId(String uniqueDocumentId)
Sets a unique identifier associated to the current document to convert.
This id is used bygetViewId()in order to compute the final unique identifier.- Parameters:
uniqueDocumentId- a unique document identifier (please be careful about 'unique' word).- Returns:
- the current context instance.
-
isCacheRequired
public boolean isCacheRequired()
Indicates if cache is required.- Returns:
- true if required, false otherwise.
-
isProcessingCache
public boolean isProcessingCache()
Indicates if the current process is the one which is in charge of performing the conversion tasks.- Returns:
- true if the current process is in charge, false otherwise.
-
processingCache
public void processingCache()
Sets into context that the current process is in charge of the conversion tasks.
-
getLanguage
public String getLanguage()
Gets the language of the content- Returns:
- a string.
-
copy
protected ViewerContext copy()
-
-