Interface FolderItem

All Known Subinterfaces:
DatabaseItem, DataFileItem
All Known Implementing Classes:
LocalDatabaseItem, LocalDataFile, LocalFolderItem, RemoteDatabaseItem, RemoteFolderItem, UnknownFolderItem

public interface FolderItem
FolderItem represents an individual file contained within a FileSystem and is uniquely identified by a path string.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Underlying file is a Database
    static final int
    Underlying file is serialized data file
    static final long
    Default checkout ID used when a checkout is not applicable.
    static final int
    Default file version number used to indicate the latest/current version.
    static final int
    Underlying file is an unknown/unsupported type.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if unsaved file changes can be recovered.
    checkout(CheckoutType checkoutType, String user, String projectPath)
    Checkout this folder item.
    void
    Clears the checkout data associated with this non-shared file.
    void
    delete(int version, String user)
    Deletes the item or a specific version.
    getCheckout(long checkoutId)
    Get the checkout status which corresponds to the specified checkout ID.
    long
    Returns the checkoutId for this file.
    Get all current checkouts for this item.
    int
    Returns the item version which was checked-out.
    Return The content type name for this item.
    int
    Returns the version of content type.
    int
    Return the latest/current version.
    Return the file ID if one has been established or null
    int
    Returns the local item version at the time the checkout was completed.
    Return The display name for this item.
    Returns the path of the parent folder.
    Return The concatenation of the pathname and the basename which can be used to uniquely identify a folder item.
    Returns list of all available versions or null if item is not versioned.
    boolean
    Returns true if this item is versioned and has one or more checkouts.
    boolean
    Returns true if this item is a checked-out copy from a versioned file system.
    boolean
    Returns true if this item is a checked-out copy with exclusive access from a versioned file system.
    boolean
    Returns true if this item is versioned and has a checkin in-progress.
    boolean
    Returns true if item can be overwritten/deleted.
    boolean
    Return true if this is a versioned item, else false
    long
    Return The time that this item was last modified.
    long
    Returns the length of this domain file.
    void
    output(File outputFile, int version, TaskMonitor monitor)
    Serialize (i.e., pack) this item into the specified outputFile.
    Returns this instance after refresh or null if item no longer exists
    Assign a new file-ID to this local non-versioned file.
    void
    setCheckout(long checkoutId, boolean exclusive, int checkoutVersion, int localVersion)
    Set the checkout data associated with this non-shared file.
    void
    setContentTypeVersion(int version)
    Sets the version for the content type.
    void
    setReadOnly(boolean state)
    Set the state of the read-only indicator for this non-shared item.
    void
    terminateCheckout(long checkoutId, boolean notify)
    Terminates a checkout.
    void
    updateCheckoutVersion(long checkoutId, int checkoutVersion, String user)
    Update the checkout version associated with this versioned item.
  • Field Details

    • UNKNOWN_FILE_TYPE

      static final int UNKNOWN_FILE_TYPE
      Underlying file is an unknown/unsupported type.
      See Also:
    • DATABASE_FILE_TYPE

      static final int DATABASE_FILE_TYPE
      Underlying file is a Database
      See Also:
    • DATAFILE_FILE_TYPE

      static final int DATAFILE_FILE_TYPE
      Underlying file is serialized data file
      See Also:
    • DEFAULT_CHECKOUT_ID

      static final long DEFAULT_CHECKOUT_ID
      Default checkout ID used when a checkout is not applicable.
      See Also:
    • LATEST_VERSION

      static final int LATEST_VERSION
      Default file version number used to indicate the latest/current version.
      See Also:
  • Method Details

    • getName

      String getName()
      Return The display name for this item.
    • getFileID

      String getFileID()
      Return the file ID if one has been established or null
    • resetFileID

      String resetFileID() throws IOException
      Assign a new file-ID to this local non-versioned file. NOTE: This method is only valid for a local non-versioned file-system.
      Returns:
      new file-ID
      Throws:
      IOException - thrown if IO or access error occurs
    • length

      long length() throws IOException
      Returns the length of this domain file. This size is the minimum disk space used for storing this file, but does not account for additional storage space used to tracks changes, etc.
      Returns:
      file length
      Throws:
      IOException - thrown if IO or access error occurs
    • getContentType

      String getContentType()
      Return The content type name for this item.
    • getParentPath

      String getParentPath()
      Returns the path of the parent folder.
    • getPathName

      String getPathName()
      Return The concatenation of the pathname and the basename which can be used to uniquely identify a folder item.
    • isReadOnly

      boolean isReadOnly()
      Returns true if item can be overwritten/deleted.
    • setReadOnly

      void setReadOnly(boolean state) throws IOException
      Set the state of the read-only indicator for this non-shared item.
      Parameters:
      state - read-only state
      Throws:
      IOException - if an IO error occurs or item is stored on a shared file-system
    • getContentTypeVersion

      int getContentTypeVersion()
      Returns the version of content type. Note this is the version of the structure/storage for the content type, Not the users version of their data.
    • setContentTypeVersion

      void setContentTypeVersion(int version) throws IOException
      Sets the version for the content type. This will change whenever the domain objects are upgraded.
      Parameters:
      version - the new version for the content type.
      Throws:
      IOException - if an IO error occurs or item is stored on a shared file-system
    • lastModified

      long lastModified()
      Return The time that this item was last modified.
    • getCurrentVersion

      int getCurrentVersion()
      Return the latest/current version.
    • isCheckedOut

      boolean isCheckedOut()
      Returns true if this item is a checked-out copy from a versioned file system.
    • isCheckedOutExclusive

      boolean isCheckedOutExclusive()
      Returns true if this item is a checked-out copy with exclusive access from a versioned file system.
    • isVersioned

      boolean isVersioned() throws IOException
      Return true if this is a versioned item, else false
      Throws:
      IOException - thrown if an IO error occurs.
    • getCheckoutId

      long getCheckoutId() throws IOException
      Returns the checkoutId for this file. A value of -1 indicates a private item. NOTE: This method is only valid for a local non-versioned file-system.
      Throws:
      IOException - if an IO error occurs
    • getCheckoutVersion

      int getCheckoutVersion() throws IOException
      Returns the item version which was checked-out. A value of -1 indicates a private item. NOTE: This method is only valid for a local non-versioned file-system.
      Throws:
      IOException
    • getLocalCheckoutVersion

      int getLocalCheckoutVersion()
      Returns the local item version at the time the checkout was completed. A value of -1 indicates a private item. NOTE: This method is only valid for a local non-versioned file-system.
    • setCheckout

      void setCheckout(long checkoutId, boolean exclusive, int checkoutVersion, int localVersion) throws IOException
      Set the checkout data associated with this non-shared file. NOTE: This method is only valid for a local non-versioned file-system.
      Parameters:
      checkoutId - checkout ID (provided by ItemCheckoutStatus).
      exclusive - true if checkout is exclusive
      checkoutVersion - the item version which was checked-out (provided by ItemCheckoutStatus).
      localVersion - the local item version at the time the checkout was completed.
      Throws:
      IOException - if an IO error occurs or item is stored on a shared file-system
    • clearCheckout

      void clearCheckout() throws IOException
      Clears the checkout data associated with this non-shared file. NOTE: This method is only valid for a local non-versioned file-system.
      Throws:
      IOException
    • delete

      void delete(int version, String user) throws IOException
      Deletes the item or a specific version. If a specific version is specified, it must either be the oldest or latest (i.e., current).
      Parameters:
      version - specific version to be deleted, or -1 to remove all versions.
      user - user name
      Throws:
      IOException - if an IO error occurs, including the inability to delete a version because this item is checked-out, the user does not have permission, or the specified version is not the oldest or latest.
    • getVersions

      Version[] getVersions() throws IOException
      Returns list of all available versions or null if item is not versioned.
      Throws:
      IOException - thrown if an IO error occurs.
    • checkout

      ItemCheckoutStatus checkout(CheckoutType checkoutType, String user, String projectPath) throws IOException
      Checkout this folder item.
      Parameters:
      checkoutType - type of checkout
      user - user requesting checkout
      projectPath - path of project where checkout was made
      Returns:
      checkout status or null if exclusive checkout request failed
      Throws:
      IOException - if an IO error occurs or this item is not versioned
    • terminateCheckout

      void terminateCheckout(long checkoutId, boolean notify) throws IOException
      Terminates a checkout. The checkout ID becomes invalid, therefore the associated checkout copy should either be removed or converted to a private file.
      Parameters:
      checkoutId - checkout ID
      notify - if true item change notification will be sent
      Throws:
      IOException - if an IO error occurs or this item is not versioned
    • hasCheckouts

      boolean hasCheckouts() throws IOException
      Returns true if this item is versioned and has one or more checkouts.
      Throws:
      IOException - if an IO error occurs
    • canRecover

      boolean canRecover()
      Returns true if unsaved file changes can be recovered.
    • getCheckout

      ItemCheckoutStatus getCheckout(long checkoutId) throws IOException
      Get the checkout status which corresponds to the specified checkout ID.
      Parameters:
      checkoutId - checkout ID
      Returns:
      checkout status or null if checkout ID not found.
      Throws:
      IOException - if an IO error occurs or this item is not versioned
    • getCheckouts

      ItemCheckoutStatus[] getCheckouts() throws IOException
      Get all current checkouts for this item.
      Returns:
      array of checkouts
      Throws:
      IOException - if an IO error occurs or this item is not versioned
    • isCheckinActive

      boolean isCheckinActive() throws IOException
      Returns true if this item is versioned and has a checkin in-progress.
      Throws:
      IOException - if an IO error occurs
    • updateCheckoutVersion

      void updateCheckoutVersion(long checkoutId, int checkoutVersion, String user) throws IOException
      Update the checkout version associated with this versioned item.
      Parameters:
      checkoutId - id corresponding to an existing checkout
      checkoutVersion -
      user -
      Throws:
      IOException - if an IO error occurs.
    • output

      void output(File outputFile, int version, TaskMonitor monitor) throws IOException, CancelledException
      Serialize (i.e., pack) this item into the specified outputFile.
      Parameters:
      outputFile - packed output file to be created
      version - if this item is versioned, specifies the version to be output, otherwise -1 should be specified.
      monitor - progress monitor
      Throws:
      IOException
      CancelledException - if monitor cancels operation
    • refresh

      FolderItem refresh() throws IOException
      Returns this instance after refresh or null if item no longer exists
      Throws:
      IOException