Class FileSetMember

java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.FileSetMember
All Implemented Interfaces:
AccessControlled, Identifiable

public class FileSetMember extends BasicItem
This class represents a file that is member of a file set.
Version:
2.5
Author:
Nicklas
Last modified
$Date: 2015-04-20 11:08:18 +0200 (må, 20 apr 2015) $
  • Field Details

    • TYPE

      public static final Item TYPE
      The type of item represented by this class.
      See Also:
    • RUNTIME_FILTER

      private static final QueryRuntimeFilter RUNTIME_FILTER
      This filter gives everybody read permission to file set members.
  • Constructor Details

    • FileSetMember

      FileSetMember(FileSetMemberData data)
      Creates a new member item from the given data.
      Parameters:
      data - the data.
  • Method Details

    • getNew

      static FileSetMember getNew(DbControl dc, FileSet fileSet, File file, DataFileType type)
      Create a new member in a file set.
      See Also:
    • getById

      Get a FileSetMember object when you know the ID.
      Parameters:
      dc - The DbControl which will be used for permission checking and database access.
      id - The ID of the item to load
      Returns:
      The FileSetMember item
      Throws:
      ItemNotFoundException - If an item with the specified ID is not found
      PermissionDeniedException - If the logged in user doesn't have Permission.READ permission to the items
      BaseException - If there is another error
    • getQuery

      public static ItemQuery<FileSetMember> getQuery(FileSet fileSet) throws BaseException
      Get a query configured to retrieve FileSetMember items. Note that the query can only retreive files for a single file set at a time. If fileSet==null when this method is called the client code must call AbstractHqlQuery.setEntityParameter(String, BasicItem) with a "fileSet" parameter before the query is executed.
      Parameters:
      fileSet - The file set to get members for (can be null)
      Returns:
      An ItemQuery object
      Throws:
      InvalidUseOfNullException - If required argument is null.
      BaseException - If there is another error.
    • getData

      Description copied from class: BasicItem
      Get the BasicData object that holds all data for this item.
      Specified by:
      getData in class BasicItem
    • getType

      public Item getType()
      Description copied from interface: Identifiable
      Get the type of item represented by the object. The returned value is one of the values defined in the Item enumeration.
      Returns:
      A value indicating the type of item
    • initPermissions

      void initPermissions(int granted, int denied) throws BaseException
      READ permission is granted to all users. CREATE, WRITE and DELETE permissions are granted if the logged in user has WRITE permission on the associated file set.
      Overrides:
      initPermissions in class BasicItem
      Parameters:
      granted - Permissions that have been granted by the subclass
      denied - Permissions that have been denied by the subclass
      Throws:
      BaseException - If the permissions couldn't be initialised
    • getPluginPermissions

      PluginPermission getPluginPermissions()
      Overrides:
      getPluginPermissions in class BasicItem
    • getFileSet

      public FileSet getFileSet()
      Get the file set the file is a member of.
      Returns:
      A file set item
    • getFile

      public File getFile()
      Get the file this item is representing in the file set.
      Returns:
      A file item
    • getDataFileType

      public DataFileType getDataFileType()
      Get the type of the file.
      Returns:
      A file set member type item
    • isValid

      public Boolean isValid()
      Check if the file has been validated and if it passed or not.
      Returns:
      NULL if the file hasn't been validated, TRUE or FALSE to indicate the result of the validation
    • setValid

      public void setValid(Boolean valid, String errorMessage)
      Set the validation status of this member.
      Parameters:
      valid - If the member file is valid or not, use null to indicate that no validation has been performed
      errorMessage - The error message if the validation failes
    • getErrorMessage

      public String getErrorMessage()
      Get the error message if the validation failed.
      Returns:
      The error message or null if the file is valid or if it hasn't been validated
    • isPlatformFile

      public boolean isPlatformFile()
      Checks if this file is part of the platform/variant the parent item belongs to.
      Returns:
      TRUE if the file is part of the platform, FALSE otherwise
      Since:
      2.10