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 ViewerContext
copy()
static ViewerContext
from(SimpleDocument document)
Initializes a context from an instance ofSimpleDocument
.String
getDocumentId()
Gets the identifier of the document.String
getDocumentType()
Gets the type of the document.String
getLanguage()
Gets the language of the contentString
getOriginalFileName()
Gets the name of the original file.File
getOriginalSourceFile()
Gets the original file.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.TemporaryWorkspaceTranslation
getWorkspace()
Gets the workspace into which the processes will write the results.boolean
isCacheRequired()
Indicates if cache is required.boolean
isProcessingCache()
Indicates if the current process is the one which is in charge of performing the conversion tasks.void
processingCache()
Sets into context that the current process is in charge of the conversion tasks.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.
-
-
-
Method Detail
-
from
public static ViewerContext from(SimpleDocument document)
Initializes a context from an instance ofSimpleDocument
.- Parameters:
document
- theSimpleDocument
for which the file must be converted.- Returns:
- an instance of
ViewerContext
initialized 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
File
that represents the original file.
-
getWorkspace
public TemporaryWorkspaceTranslation getWorkspace()
Gets the workspace into which the processes will write the results.- Returns:
- the
File
that 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()
-
-