2.17.2: 2011-06-17

net.sf.basedb.core
Class FileType

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<FileTypeData>
      extended by net.sf.basedb.core.FileType
All Implemented Interfaces:
AccessControlled, Identifiable, Nameable, Registered, SystemItem

public class FileType
extends BasicItem<FileTypeData>
implements Nameable, SystemItem, Registered

This class is used to represent the type of File items in BASE.

Version:
2.0
Author:
enell, Nicklas
See Also:
File
Last modified
$Date: 2010-10-26 14:55:47 +0200 (Tue, 26 Oct 2010) $

Field Summary
static String EXTRAVALUE_DATA
          The id for the FileType item representing a file containing analysed extra value data.
static String IMAGE
          The id for the FileType item representing an image file.
static String PLATE
          The id for the FileType item representing a plate file.
static String PLATE_MAPPING
          The id for the FileType item representing a plate mapping file.
static String PRINT_MAP
          The id for the FileType item representing a print map file.
static String PROTOCOL
          The id for the FileType item representing a protocol.
static String RAW_DATA
          The id for the FileType item representing a raw data file.
static String REPORTER
          The id for the FileType item representing a reporter file.
static String REPORTER_MAP
          The id for the FileType item representing a reporter map file.
static String SPOT_DATA
          The id for the FileType item representing a file containing analysed spot data.
static String SPOT_IMAGES
          The id for the FileType item representing a spot images file.
static Item TYPE
          The type of item represented by this class.
 
Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
 
Fields inherited from interface net.sf.basedb.core.SystemItem
MAX_SYSTEM_ID_LENGTH
 
Constructor Summary
FileType(FileTypeData data)
          Creates a new filetype item from the given data.
 
Method Summary
static FileType getById(DbControl dc, int id)
          Get a FileType object when you know the ID.
 String getDescription()
          Get the description for the item.
 Date getEntryDate()
          Get the date that the item was registered in the database.
 String getName()
          Get the name of the item.
static PropertyFilter getPropertyFilter(String id)
          Create a PropertyFilter object that can be used to filter files by their file type: file.fileType = FileType
static PropertyFilter getPropertyFilter(String id, boolean temporary)
          Create a PropertyFilter object that can be used to filter files by their file type: file.fileType = FileType
static ItemQuery<FileType> getQuery()
          Get a query configured to retrieve FileType items.
 String getSystemId()
          Get the system id for the item.
 Item getType()
          Get the type of item represented by the object.
 Set<ItemProxy> getUsingItems()
          Get all: File:s of this type
(package private)  void initPermissions(int granted, int denied)
          Initialise the logged in user's permissions for this item.
 boolean isSystemItem()
          Check if the item is a system item or not.
 boolean isUsed()
          Check if: any file has been assigned this type
 void setDescription(String description)
          Set the description for the item.
 void setName(String name)
          Set the name of the item.
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
 
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
 

Field Detail

TYPE

public static final Item TYPE
The type of item represented by this class.

See Also:
Item.FILETYPE, getType()

PROTOCOL

public static final String PROTOCOL
The id for the FileType item representing a protocol.

See Also:
Constant Field Values

RAW_DATA

public static final String RAW_DATA
The id for the FileType item representing a raw data file.

See Also:
Constant Field Values

PLATE_MAPPING

public static final String PLATE_MAPPING
The id for the FileType item representing a plate mapping file.

See Also:
Constant Field Values

REPORTER_MAP

public static final String REPORTER_MAP
The id for the FileType item representing a reporter map file.

See Also:
Constant Field Values

PRINT_MAP

public static final String PRINT_MAP
The id for the FileType item representing a print map file.

See Also:
Constant Field Values

IMAGE

public static final String IMAGE
The id for the FileType item representing an image file.

See Also:
Constant Field Values

SPOT_IMAGES

public static final String SPOT_IMAGES
The id for the FileType item representing a spot images file.

See Also:
Constant Field Values

REPORTER

public static final String REPORTER
The id for the FileType item representing a reporter file.

See Also:
Constant Field Values

PLATE

public static final String PLATE
The id for the FileType item representing a plate file.

See Also:
Constant Field Values

SPOT_DATA

public static final String SPOT_DATA
The id for the FileType item representing a file containing analysed spot data.

Since:
2.8
See Also:
Constant Field Values

EXTRAVALUE_DATA

public static final String EXTRAVALUE_DATA
The id for the FileType item representing a file containing analysed extra value data.

Since:
2.8
See Also:
Constant Field Values
Constructor Detail

FileType

FileType(FileTypeData data)
Creates a new filetype item from the given data.

Parameters:
data - the data.
Method Detail

getById

public static FileType getById(DbControl dc,
                               int id)
                        throws ItemNotFoundException,
                               PermissionDeniedException,
                               BaseException
Get a FileType 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 FileType 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<FileType> getQuery()
                                    throws BaseException
Get a query configured to retrieve FileType items.

Returns:
An ItemQuery object
Throws:
BaseException - If getting the query fails.

getPropertyFilter

public static PropertyFilter getPropertyFilter(String id)
Create a PropertyFilter object that can be used to filter files by their file type: file.fileType = FileType

Parameters:
id - The id of the file type.
Returns:
A PropertyFilter object
See Also:
ItemContext.setPropertyFilter(PropertyFilter)

getPropertyFilter

public static PropertyFilter getPropertyFilter(String id,
                                               boolean temporary)
Create a PropertyFilter object that can be used to filter files by their file type: file.fileType = FileType

Parameters:
id - The id of the file type.
temporary - A flag indicating if the filter should be temporary or not
Returns:
A PropertyFilter object
Since:
2.16
See Also:
ItemContext.setPropertyFilter(PropertyFilter)

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.

Specified by:
getType in interface Identifiable
Returns:
A value indicating the type of item

getName

public String getName()
Description copied from interface: Nameable
Get the name of the item.

Specified by:
getName in interface Nameable
Returns:
A String with the name of the item

setName

public void setName(String name)
             throws PermissionDeniedException,
                    InvalidDataException
Description copied from interface: Nameable
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by the Nameable.MAX_NAME_LENGTH constant.

Specified by:
setName in interface Nameable
Parameters:
name - The new name for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the name is null or longer than specified by the Nameable.MAX_NAME_LENGTH constant

getDescription

public String getDescription()
Description copied from interface: Nameable
Get the description for the item.

Specified by:
getDescription in interface Nameable
Returns:
A String with a description of the item

setDescription

public void setDescription(String description)
                    throws PermissionDeniedException,
                           InvalidDataException
Description copied from interface: Nameable
Set the description for the item. The description can be null but mustn't be longer than the value specified by the Nameable.MAX_DESCRIPTION_LENGTH constant.

Specified by:
setDescription in interface Nameable
Parameters:
description - The new description for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the description longer than specified by the Nameable.MAX_DESCRIPTION_LENGTH constant

getSystemId

public String getSystemId()
Description copied from interface: SystemItem
Get the system id for the item.

Specified by:
getSystemId in interface SystemItem
Returns:
The id of the item or null if it is not a system item

isSystemItem

public boolean isSystemItem()
Description copied from interface: SystemItem
Check if the item is a system item or not. A system item have a non-null value for the system id.

Specified by:
isSystemItem in interface SystemItem
Returns:
TRUE if this item is a system item, FALSE otherwise

getEntryDate

public Date getEntryDate()
Description copied from interface: Registered
Get the date that the item was registered in the database.

Specified by:
getEntryDate in interface Registered
Returns:
A date or null if this is not known

isUsed

public boolean isUsed()
               throws BaseException
Check if:

Overrides:
isUsed in class BasicItem<FileTypeData>
Returns:
TRUE if this FileType is used.
Throws:
BaseException - If there is an error
See Also:
BasicItem.getUsingItems()

getUsingItems

public Set<ItemProxy> getUsingItems()
Get all:

initPermissions

void initPermissions(int granted,
                     int denied)
               throws BaseException
Description copied from class: BasicItem
Initialise the logged in user's permissions for this item. For items loaded from the database, the default implementation checks the role keys. For new items, write permission is added.

Subclasses that needs to check other keys or properties, such as the OwnedItem and SharedItem should override this method. The subclass should calculate additional permissions to be granted or denied, and combine those with whatever was passed as parameters. Use the binary OR operator ( | ) to combine the permissions. Finally the subclass must call super.initPermissions(granted, denied).

Overrides:
initPermissions in class BasicItem<FileTypeData>
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

2.17.2: 2011-06-17