2.17.2: 2011-06-17

net.sf.basedb.core
Class PlatformFileType

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.BasicChildItem<PlatformFileTypeData>
          extended by net.sf.basedb.core.PlatformFileType
All Implemented Interfaces:
AccessControlled, Identifiable

public class PlatformFileType
extends BasicChildItem<PlatformFileTypeData>

This class represents a specific DataFileType that is part of a platform.

Version:
2.5
Author:
Nicklas
Last modified
$Date: 2008-09-11 22:11:02 +0200 (Thu, 11 Sep 2008) $

Field Summary
private static QueryRuntimeFilter RUNTIME_FILTER
          This filter will only return items if the logged in user has generic read permission to platforms.
static Item TYPE
          The type of item represented by this class.
 
Constructor Summary
PlatformFileType(PlatformFileTypeData data)
          Creates a new member item from the given data.
 
Method Summary
static PlatformFileType getById(DbControl dc, int id)
          Get a PlatformFileType object when you know the ID.
 DataFileType getDataFileType()
          Get the type of the file.
(package private) static PlatformFileType getNew(DbControl dc, Platform platform, PlatformVariant variant, DataFileType fileType, boolean required)
          Create a new item linking a file type to a platform/variant.
(package private)  Item getParentType()
          Get the type of item that is the parent of this item.
 Platform getPlatform()
          Get the platform.
static ItemQuery<PlatformFileType> getQuery(Platform platform, PlatformVariant variant, boolean restrict)
          Get the file types that have been registered for a specific platform and variant.
 Item getType()
          Get the type of item represented by the object.
 PlatformVariant getVariant()
          Get the platform variant.
 boolean isRequired()
          Check if a file of this type is required or not.
 
Methods inherited from class net.sf.basedb.core.BasicChildItem
getPermissionForWriteDeleteAndCreate, getPluginPermissions, initPermissions
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

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

See Also:
Item.PLATFORMFILETYPE, getType()

RUNTIME_FILTER

private static final QueryRuntimeFilter RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to platforms.

Constructor Detail

PlatformFileType

PlatformFileType(PlatformFileTypeData data)
Creates a new member item from the given data.

Parameters:
data - the data.
Method Detail

getNew

static PlatformFileType getNew(DbControl dc,
                               Platform platform,
                               PlatformVariant variant,
                               DataFileType fileType,
                               boolean required)
Create a new item linking a file type to a platform/variant.

Parameters:
dc -
platform - The platform
variant - The variant (optional)
fileType - The file type
required - If files of this type are required when using the platform or no

getById

public static PlatformFileType getById(DbControl dc,
                                       int id)
                                throws ItemNotFoundException,
                                       PermissionDeniedException,
                                       BaseException
Get a PlatformFileType 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 PlatformFileType 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 item
BaseException - If there is another error

getQuery

public static ItemQuery<PlatformFileType> getQuery(Platform platform,
                                                   PlatformVariant variant,
                                                   boolean restrict)
Get the file types that have been registered for a specific platform and variant. If the restrict parameter is TRUE the query will be restricted to return fewer items. It works like this: Note! If a variant is given but no platform, the platform will automatically be set from the variant.

Parameters:
platform - A platform object or null to return items for all platforms
variant - A platform variant or null to return items for all variants
restrict - Indicates if the query should be restricted to inlcude fewer items
Returns:
A query returning PlatformFileType items

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

getParentType

Item getParentType()
Description copied from class: BasicChildItem
Get the type of item that is the parent of this item.

Specified by:
getParentType in class BasicChildItem<PlatformFileTypeData>
Returns:
The item type of the parent item

getPlatform

public Platform getPlatform()
Get the platform.

Returns:
A platform item

getVariant

public PlatformVariant getVariant()
Get the platform variant.

Returns:
A platform variant item, or null if this file type is associated with all variants of the platform

getDataFileType

public DataFileType getDataFileType()
Get the type of the file.

Returns:
A file set member type item

isRequired

public boolean isRequired()
Check if a file of this type is required or not. Note! The requirement is not enforced by the core. It should be used as a hint to client applications so they can create a proper GUI. To check if a FileSet contains all files that have been marked as required use FileSet.hasAllRequiredFiles().


2.17.2: 2011-06-17