Package net.sf.basedb.core
Class PlatformFileType
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.BasicChildItem
net.sf.basedb.core.PlatformFileType
- All Implemented Interfaces:
AccessControlled
,Identifiable
,UsableDataFileType
This class represents a specific
DataFileType
that is part of a platform.- Version:
- 2.5
- Author:
- Nicklas
- Last modified
- $Date: 2015-05-12 11:27:08 +0200 (ti, 12 maj 2015) $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final QueryRuntimeFilter
This filter will only return items if the logged in user has generic read permission to platforms.static final Item
The type of item represented by this class. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new member item from the given data. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if more than one file of this type is allowed in a file set or not.static PlatformFileType
Get aPlatformFileType
object when you know the ID.(package private) PlatformFileTypeData
getData()
Get theBasicData
object that holds all data for this item.Get the type of the file.(package private) static PlatformFileType
getNew
(DbControl dc, Platform platform, PlatformVariant variant, DataFileType fileType) Create a new item linking a file type to a platform/variant.(package private) Item
Get the type of item that is the parent of this item.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.getType()
Get the type of item represented by the object.Get the platform variant.boolean
Check if a file of this type is required or not.void
setAllowMultiple
(boolean multiple) Allow or disallow multiple files of this file type in a file set.void
setRequired
(boolean required) Set the required flag for this file type.Methods inherited from class net.sf.basedb.core.BasicChildItem
getPermissionForWriteDeleteAndCreate, getPluginPermissions, initPermissions
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, validate
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to platforms.
-
-
Constructor Details
-
PlatformFileType
PlatformFileType(PlatformFileTypeData data) Creates a new member item from the given data.- Parameters:
data
- the data.
-
-
Method Details
-
getNew
static PlatformFileType getNew(DbControl dc, Platform platform, PlatformVariant variant, DataFileType fileType) Create a new item linking a file type to a platform/variant.- Parameters:
platform
- The platformvariant
- The variant (optional)fileType
- The file type
-
getById
public static PlatformFileType getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aPlatformFileType
object when you know the ID.- Parameters:
dc
- TheDbControl
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 foundPermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission to the itemBaseException
- 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 therestrict
parameter is TRUE the query will be restricted to return fewer items. It works like this:- It has no meaning if both
platform
andvariant
is null - If
variant
is null, the query will return file types the platform and all variants ifrestrict=false
. Ifrestrict=true
the query will only return items registered directly with the platform - If
variant
isn't null, the query will return file types that have been registered for that variant plus file types registered with the platform ifrestrict=false
. Ifrestrict=true
the query will only return file types registered for that particular variant.
- Parameters:
platform
- A platform object or null to return items for all platformsvariant
- A platform variant or null to return items for all variantsrestrict
- Indicates if the query should be restricted to inlcude fewer items- Returns:
- A query returning
PlatformFileType
items
- It has no meaning if both
-
getData
PlatformFileTypeData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this 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 theItem
enumeration.- Specified by:
getType
in interfaceIdentifiable
- 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 classBasicChildItem
- Returns:
- The item type of the parent item
-
getPlatform
Get the platform.- Returns:
- A platform item
-
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
Get the type of the file.- Specified by:
getDataFileType
in interfaceUsableDataFileType
- 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 aFileSet
contains all files that have been marked as required useFileSet.hasAllRequiredFiles()
.- Specified by:
isRequired
in interfaceUsableDataFileType
-
setRequired
public void setRequired(boolean required) Set the required flag for this file type. -
getAllowMultiple
public boolean getAllowMultiple()Check if more than one file of this type is allowed in a file set 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.- Specified by:
getAllowMultiple
in interfaceUsableDataFileType
-
setAllowMultiple
public void setAllowMultiple(boolean multiple) Allow or disallow multiple files of this file type in a file set.
-