Class PartialFileHistory


  • public class PartialFileHistory
    extends java.lang.Object
    A PartialFileHistory represents a single file in a repository over a certain period of time/versions. Whenever a file is updated or deleted, a new FileVersion is added to the file history.

    A file history is identified by a unique random identifier and holds a sorted list of file versions.

    Due to cleanup mechanisms and the delta database concept, the list of file versions is not always complete. The class hence represents a part of the file history.

    See Also:
    FileVersion
    • Method Detail

      • getFileVersions

        public java.util.Map<java.lang.Long,​FileVersiongetFileVersions()
        Returns an unmodifiable map of the FileVersions, keyed by the version number of the corresponding file version.
      • getFileVersion

        public FileVersion getFileVersion​(long version)
        Returns the file version with the given file version number, or null if a version with this number does not exist in this file history.
      • getLastVersion

        public FileVersion getLastVersion()
        Returns the last file version in this instance of the partial file history, or null if there are no file versions.

        Note that this method does not necessarily return the actual overall last file version, only the last of this object instance.

        Returns:
        Returns the last file version, or null
      • addFileVersion

        public void addFileVersion​(FileVersion fileVersion)
        Adds a new file version of the file history. The given file version is added to an internal tree map, sorted by the attribute FileVersion.getVersion(). If a file version version with the same version already exists, it is replaced by the given file version.
        Parameters:
        fileVersion - File version to be added to the file history
        Throws:
        java.lang.IllegalArgumentException - If fileVersion or its version number is null
      • clone

        public PartialFileHistory clone()
        Clones the file history, including its file versions. Note that file versions are not cloned, but copied by reference.
        Overrides:
        clone in class java.lang.Object
        Returns:
        Returns cloned file history
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object