Class ViewerContext

  • All Implemented Interfaces:
    Cloneable

    public class ViewerContext
    extends Object
    implements Cloneable
    This class permits to handled a context during the conversion processes.
    Author:
    Yohann Chastagnier
    • Constructor Detail

      • ViewerContext

        protected ViewerContext​(String documentId,
                                String originalFileName,
                                File originalSourceFile,
                                String language)
    • Method Detail

      • getDocumentId

        public String getDocumentId()
        Gets the identifier of the SimpleDocument.
        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 by getViewId() 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.