Package ghidra.framework.store

# Interface FolderItem

All Known Subinterfaces:
  `DatabaseItem`, `DataFileItem`, `TextDataItem`, `UnknownFolderItem`

All Known Implementing Classes:
  `LocalDatabaseItem`, `LocalDataFileItem`, `LocalFolderItem`, `LocalTextDataItem`, `LocalUnknownFolderItem`, `RemoteDatabaseItem`, `RemoteFolderItem`, `RemoteTextDataItem`, `RemoteUnknownFolderItem`

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`
  `DATABASE_FILE_TYPE`
  Underlying file is a Database
  `static final int`
  `DATAFILE_FILE_TYPE`
  Underlying file is serialized data file
  `static final long`
  `DEFAULT_CHECKOUT_ID`
  Default checkout ID used when a checkout is not applicable.
  `static final int`
  `LATEST_VERSION`
  Default file version number used to indicate the latest/current version.
  `static final int`
  `LINK_FILE_TYPE`
  Item type is associated with metadata only (e.g., URL)
  `static final int`
  `UNKNOWN_FILE_TYPE`
  Underlying file is an unknown/unsupported type.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `canRecover()`
  Returns true if unsaved file changes can be recovered.
  `ItemCheckoutStatus`
  `checkout(CheckoutType checkoutType, String user, String projectPath)`
  Checkout this folder item.
  `void`
  `clearCheckout()`
  Clears the checkout data associated with this non-shared file.
  `void`
  `delete(int version, String user)`
  Deletes the item or a specific version.
  `ItemCheckoutStatus`
  `getCheckout(long checkoutId)`
  Get the checkout status which corresponds to the specified checkout ID.
  `long`
  `getCheckoutId()`
  Returns the checkoutId for this file.
  `ItemCheckoutStatus[]`
  `getCheckouts()`
  Get all current checkouts for this item.
  `int`
  `getCheckoutVersion()`
  Returns the item version which was checked-out.
  `String`
  `getContentType()`
  Return The content type name for this item.
  `int`
  `getContentTypeVersion()`
  Returns the version of content type.
  `int`
  `getCurrentVersion()`
  Return the latest/current version.
  `String`
  `getFileID()`
  Return the file ID if one has been established or null
  `int`
  `getLocalCheckoutVersion()`
  Returns the local item version at the time the checkout was completed.
  `String`
  `getName()`
  Return The display name for this item.
  `String`
  `getParentPath()`
  Returns the path of the parent folder.
  `String`
  `getPathName()`
  Return The concatenation of the pathname and the basename which can be used to uniquely identify a folder item.
  `Version[]`
  `getVersions()`
  Returns list of all available versions or null if item is not versioned.
  `boolean`
  `hasCheckouts()`
  Returns true if this item is versioned and has one or more checkouts.
  `boolean`
  `isCheckedOut()`
  Returns true if this item is a checked-out copy from a versioned file system.
  `boolean`
  `isCheckedOutExclusive()`
  Returns true if this item is a checked-out copy with exclusive access from a versioned file system.
  `boolean`
  `isCheckinActive()`
  Returns true if this item is versioned and has a checkin in-progress.
  `boolean`
  `isReadOnly()`
  Returns true if item can be overwritten/deleted.
  `boolean`
  `isVersioned()`
  Return true if this is a versioned item, else false
  `long`
  `lastModified()`
  Return The time that this item was last modified.
  `long`
  `length()`
  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.
  `FolderItem`
  `refresh()`
  Returns this instance after refresh or null if item no longer exists
  `String`
  `resetFileID()`
  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:
      - Constant Field Values

  - ### DATABASE_FILE_TYPE

    static final int DATABASE_FILE_TYPE
    Underlying file is a Database
    See Also:
      - Constant Field Values

  - ### DATAFILE_FILE_TYPE

    static final int DATAFILE_FILE_TYPE
    Underlying file is serialized data file
    See Also:
      - Constant Field Values

  - ### LINK_FILE_TYPE

    static final int LINK_FILE_TYPE
    Item type is associated with metadata only (e.g., URL)
    See Also:
      - Constant Field Values

  - ### DEFAULT_CHECKOUT_ID

    static final long DEFAULT_CHECKOUT_ID
    Default checkout ID used when a checkout is not applicable.
    See Also:
      - Constant Field Values

  - ### LATEST_VERSION

    static final int LATEST_VERSION
    Default file version number used to indicate the latest/current version.
    See Also:
      - Constant Field Values

- ## 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`