Package com.sas.lsaf.content.repository

## Class RepositoryFile

- java.lang.Object
- - com.sas.lsaf.core.AbstractIdentifiable
  - - com.sas.lsaf.content.repository.RepositoryItem
    - - com.sas.lsaf.content.repository.RepositoryFile

- All Implemented Interfaces:
    `Identifiable`, `java.io.Serializable`
  Direct Known Subclasses:
    `RepositoryExecutableFile`

      public class RepositoryFile
      extends RepositoryItem

  The class that represents a file that is stored in the repository.
  Since:
    1.1
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `RepositoryFile.SigningStatus` | Describes the overall signature status of the file.

    - ### Nested classes/interfaces inherited from class com.sas.lsaf.content.repository.RepositoryItem

      `RepositoryItem.State, RepositoryItem.Syncable`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RepositoryFile​(java.lang.String typeId, java.lang.String id, java.lang.String name, java.lang.String path, long revision, RepositoryItem.State state, java.lang.String createdBy, java.util.Date created, java.lang.String lastModifiedBy, java.util.Date lastModified, java.lang.String propertiesLastModifiedBy, java.util.Date propertiesLastModified, java.lang.String description, RepositoryItem.Syncable syncable, java.util.List<Attribute> attributes, long size, boolean checkedOut, java.lang.String checkedOutBy, java.util.Date checkedOutDate, boolean versioned, java.lang.String version, java.lang.String comment, boolean locked, RepositoryFile.SigningStatus signingStatus, VersionLimits versionLimits, java.lang.String digest)` | It is not intended or recommended that the consumer of the API construct these objects.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(java.lang.Object obj)` |
    `java.lang.String` | `getCheckedOutBy()` | Gets the user who has the file checked out, if it is checked out.
    `java.util.Date` | `getCheckedOutDate()` | Gets the date on which the file was checked out, if it is checked out.
    `java.lang.String` | `getComment()` | Gets the comment that was specified when the content was created.
    `java.lang.String` | `getDigest()` | Gets the digest value of the file based on the MD5 algorithm.
    `java.lang.Integer` | `getMajorLimit()` | Gets the limit of major versions to retain for a file.
    `java.lang.Integer` | `getMinorLimit()` | Gets the limit of minor versions to retain for a file.
    `RepositoryFile.SigningStatus` | `getSigningStatus()` | Gets the signature status of the file.
    `long` | `getSize()` | Gets the size (in bytes) of the repository file.
    `java.lang.String` | `getVersion()` | Gets the current version of the file, if it is versioned.
    `VersionLimits` | `getVersionLimits()` | Gets the version retention limits of the file.
    `int` | `hashCode()` |
    `boolean` | `isCheckedOut()` | Indicates whether the file is checked out or not.
    `boolean` | `isLocked()` | Indicates whether the file is locked.
    `boolean` | `isVersioned()` | Indicates whether the file is versioned or not.
    `void` | `setVersionLimits​(VersionLimits versionLimits)` | Sets the major and minor versions to retain for a versioned file.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class com.sas.lsaf.content.repository.RepositoryItem

      `getAttributes, getCreated, getCreatedBy, getDescription, getLastModified, getLastModifiedBy, getName, getPath, getPropertiesLastModified, getPropertiesLastModifiedBy, getRevision, getState, getSyncable, setAttributes, setDescription, setSyncable`

    - ### Methods inherited from class com.sas.lsaf.core.AbstractIdentifiable

      `getId, getTypeId`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### RepositoryFile

          public RepositoryFile​(java.lang.String typeId,
                                java.lang.String id,
                                java.lang.String name,
                                java.lang.String path,
                                long revision,
                                RepositoryItem.State state,
                                java.lang.String createdBy,
                                java.util.Date created,
                                java.lang.String lastModifiedBy,
                                java.util.Date lastModified,
                                java.lang.String propertiesLastModifiedBy,
                                java.util.Date propertiesLastModified,
                                java.lang.String description,
                                RepositoryItem.Syncable syncable,
                                java.util.List<Attribute> attributes,
                                long size,
                                boolean checkedOut,
                                java.lang.String checkedOutBy,
                                java.util.Date checkedOutDate,
                                boolean versioned,
                                java.lang.String version,
                                java.lang.String comment,
                                boolean locked,
                                RepositoryFile.SigningStatus signingStatus,
                                VersionLimits versionLimits,
                                java.lang.String digest)

      It is not intended or recommended that the consumer of the API construct these objects. They should only deal with the repository file objects returned by the API.
      Parameters:
        `typeId` - The object type identifier of the repository file.
        `id` - The unique identifier of the repository file.
        `name` - The name of the file.
        `path` - The full path to the file in the repository, which includes the name.
        `revision` - The internally managed revision number of the repository file.
        `state` - The current state of the repository file.
        `createdBy` - The user who created the repository file.
        `created` - The date on which the repository file was created.
        `lastModifiedBy` - The user who last modified the repository file's content.
        `lastModified` - The date on which the repository file's content was last modified.
        `propertiesLastModifiedBy` - the user who last modified the repository file's properties.
        `propertiesLastModified` - the date on which the repository file's properties were last modified.
        `description` - The description of the file.
        `syncable` - Indicates whether the file can be copied to the user's workspace.
        `attributes` - The extended attributes that are defined on the repository file.
        `size` - The size (in bytes) of the file.
        `checkedOut` - Indicates whether the file is currently checked out.
        `checkedOutBy` - The user who has the file checked out (if it is checked out).
        `checkedOutDate` - The date on which the file was checked out (if it is checked out).
        `versioned` - Indicates whether the file is versioned.
        `version` - The current version of the file (if it is versioned).
        `comment` - The comment specified when the content was created.
        `locked` - Indicates whether the file is locked.
        `signingStatus` - The signature status of the file.
        `versionLimits` - The version retention limits of the file.
        `digest` - The digest value of the file based on the MD5 algorithm.

  - ### Method Detail

    - #### getSize

          public long getSize()

      Gets the size (in bytes) of the repository file.
      Returns:
        The size (in bytes) of the repository file.

    - #### isCheckedOut

          public boolean isCheckedOut()

      Indicates whether the file is checked out or not.
      Returns:
        `true` if the repository file is checked out, `false` otherwise.

    - #### getCheckedOutBy

          public java.lang.String getCheckedOutBy()

      Gets the user who has the file checked out, if it is checked out.
      Returns:
        The user who has the file checked out, if it is checked out.

    - #### getCheckedOutDate

          public java.util.Date getCheckedOutDate()

      Gets the date on which the file was checked out, if it is checked out.
      Returns:
        The date the on which file was checked out, if it is checked out.

    - #### isVersioned

          public boolean isVersioned()

      Indicates whether the file is versioned or not.
      Returns:
        `true` if the repository file is versioned, `false` otherwise.

    - #### getVersion

          public java.lang.String getVersion()

      Gets the current version of the file, if it is versioned.
      Returns:
        The current version of the file, if it is versioned.

    - #### getComment

          public java.lang.String getComment()

      Gets the comment that was specified when the content was created.
      Returns:
        The comment that was specified when the content was created.

    - #### getDigest

          public java.lang.String getDigest()

      Gets the digest value of the file based on the MD5 algorithm.

      Here is sample java code to generate the digest value for a local file. If the value from the code below is equal to the value returned from this method, the files are the same.

      >       import java.io.File;
      >       import java.io.FileInputStream;
      >       import java.io.InputStream;
      >       import java.security.MessageDigest;
      >       import org.apache.commons.codec.binary.Hex;

      >       private String getLocalFileDigest(InputStream in, MessageDigest md5) throws Exception {
      >           byte[] byteArray = new byte[1024];
      >           int bytesCount = 0;

      >           //Read file data and update in message digest
      >           while ((bytesCount = in.read(byteArray)) != -1) {
      >               md5.update(byteArray, 0, bytesCount);
      >           }

      >           return new String(Hex.encodeHex(md5.digest())).toUpperCase();
      >       }

      Returns:
        The digest value of the file based on the MD5 algorithm.

    - #### getSigningStatus

          public RepositoryFile.SigningStatus getSigningStatus()

      Gets the signature status of the file.
      Returns:
        The signature status of the file.

    - #### getVersionLimits

          public VersionLimits getVersionLimits()

      Gets the version retention limits of the file.
      Returns:
        The version retention limits of the file.

    - #### setVersionLimits

          public void setVersionLimits​(VersionLimits versionLimits)

      Sets the major and minor versions to retain for a versioned file. The default limit is null, which means that there is no limit. If version limits are applied, the value must be in the range of 1 to 10.
      Parameters:
        `versionLimits` - The limit of major and minor versions to retain for a versioned file.

    - #### getMajorLimit

          public java.lang.Integer getMajorLimit()

      Gets the limit of major versions to retain for a file. The default limit is null, which means that there is no limit. If version limits are applied, the value must be in the range of 1 to 10.
      Returns:
        The limit of major versions to retain for a file

    - #### getMinorLimit

          public java.lang.Integer getMinorLimit()

      Gets the limit of minor versions to retain for a file. The default limit is null which means there is no limit. If version limits are applied, the value must be in the range of 1 to 10.
      Returns:
        The limit of minor versions to retain for a file.

    - #### isLocked

          public boolean isLocked()

      Indicates whether the file is locked.
      Returns:
        `true` if the repository file is locked, `false` otherwise.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `RepositoryItem`

    - #### equals

          public boolean equals​(java.lang.Object obj)

      Overrides:
        `equals` in class `RepositoryItem`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `RepositoryItem`