Class Manifest

  • All Implemented Interfaces:
    Cloneable, IAnnotation

    public class Manifest
    extends Object
    implements IAnnotation
    Implements the writing and reading of a manifest document, commonly used in different types of translation packages.
    • Constructor Detail

      • Manifest

        public Manifest()
    • Method Detail

      • getLibVersion

        public String getLibVersion()
        Gets the library version used to create the manifest.
        Returns:
        the version of the library used to create this manifest. Can be empty if the manifest does not have such information, or if the code is not run from the JAR files.
      • getPackageId

        public String getPackageId()
      • getProjectId

        public String getProjectId()
      • getSourceLocale

        public LocaleId getSourceLocale()
      • getTargetLocale

        public LocaleId getTargetLocale()
      • getCreatorParameters

        public String getCreatorParameters()
      • getUseApprovedOnly

        public boolean getUseApprovedOnly()
      • setUseApprovedOnly

        public void setUseApprovedOnly​(boolean value)
      • getUpdateApprovedFlag

        public boolean getUpdateApprovedFlag()
      • setUpdateApprovedFlag

        public void setUpdateApprovedFlag​(boolean value)
      • getGenerateTIPManifest

        public boolean getGenerateTIPManifest()
      • setGenerateTIPManifest

        public void setGenerateTIPManifest​(boolean generateTIPManifest)
      • getInputRoot

        public String getInputRoot()
        Gets the input root (always with the terminal separator).
        Returns:
        the input root.
      • getPackageRoot

        public String getPackageRoot()
        Gets the package root (always with the terminal separator).
        Returns:
        the package root.
      • getTempPackageRoot

        public String getTempPackageRoot()
        Gets the temporary package root (always with the terminal separator).
        Returns:
        the temporary package root.
      • setSubDirectories

        public void setSubDirectories​(String originalSubDir,
                                      String sourceSubDir,
                                      String targetSubDir,
                                      String mergeSubDir,
                                      String tmSubDir,
                                      String skelSubDir,
                                      boolean overwrite)
        Sets the sub-directories used by the given package. All defaults to "" (same directory as the directory of the package itself.
        Parameters:
        originalSubDir - the sub-directory for the original document.
        sourceSubDir - the sub-directory for the source documents.
        targetSubDir - the sub-directory for the target documents.
        mergeSubDir - the sub-directory for the merged documents.
        tmSubDir - the sub-directory for TM-related data.
        skelSubDir - the sub-directory for the skeleton files (if needed)
        overwrite - true to overwrite existing settings (use null to not overwrite a given sub-directory). false to use the specified value (if the current is empty).
      • getTempOriginalDirectory

        public String getTempOriginalDirectory()
        Gets the temporary directory where to store the original files (always with a terminal separator).
        Returns:
        the temporary directory where to store the original files.
      • getTempSkelDirectory

        public String getTempSkelDirectory()
        Gets the temporary directory where to store the skeleton files (always with a terminal separator).
        Returns:
        the temporary directory where to store the skeleton files.
      • getTempSourceDirectory

        public String getTempSourceDirectory()
        Gets the full temporary directory where to store the prepared source files (always with a terminal separator).
        Returns:
        the temporary directory where to store the prepared source files.
      • getTempTargetDirectory

        public String getTempTargetDirectory()
        Get the temporary directory where to store the prepared target files (always with a terminal separator).
        Returns:
        the temporary directory where to store the prepared target files.
      • getOriginalDirectory

        public String getOriginalDirectory()
        Gets the directory where to store the original files (always with a terminal separator).
        Returns:
        the directory where to store the original files.
      • getSkeletonDirectory

        public String getSkeletonDirectory()
        Gets the directory where to store the skeleton files if there are any (always with a terminal separator).
        Returns:
        the directory where to store the skeleton files.
      • getMergeDirectory

        public String getMergeDirectory()
        Get the directory where to output the result of the merging process (always with a terminal separator).
        Returns:
        the directory where to store the prepared target files.
      • getTempTmDirectory

        public String getTempTmDirectory()
        Gets the temporary directory where to output TM-related information (always with a terminal separator).
        Returns:
        the temporary directory where to store TM-related information.
      • getDate

        public String getDate()
        Gets the date when the manifest was created (saved the first time).
        Returns:
        A string representation of the creation date, or null if the manifest file has not been saved yet.
      • addDocument

        public void addDocument​(int docId,
                                String extractionType,
                                String relativeInputPath,
                                String filterId,
                                String filterParameters,
                                String inputEncoding,
                                String relativeTargetPath,
                                String targetEncoding)
        Adds a document to the manifest.
        Parameters:
        docId - Key of the document. Must be unique within the manifest.
      • getPath

        public String getPath()
        Gets the full path of the manifest file.
        Returns:
        the full path of the manifest file.
      • save

        public void save​(String dir)
        Saves the manifest file. This method assumes the root is set.
        Parameters:
        dir - directory where to save the file, use null for the default.
      • saveTIPManifest

        public void saveTIPManifest​(String dir,
                                    List<String> tms)
      • load

        public void load​(File inputFile)
      • toString

        public String toString()
        Description copied from interface: IAnnotation
        Gets a human readable representation of this annotation.
        Specified by:
        toString in interface IAnnotation
        Overrides:
        toString in class Object
        Returns:
        a human readable representation of this annotation.