Package net.sf.basedb.core
Class FileSetMember
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.FileSetMember
- All Implemented Interfaces:
AccessControlled
,Identifiable
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) $
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final QueryRuntimeFilter
This filter gives everybody read permission to file set members.static final Item
The type of item represented by this class. -
Constructor Summary
ConstructorDescriptionCreates a new member item from the given data. -
Method Summary
Modifier and TypeMethodDescriptionstatic FileSetMember
Get aFileSetMember
object when you know the ID.(package private) FileSetMemberData
getData()
Get theBasicData
object that holds all data for this item.Get the type of the file.Get the error message if the validation failed.getFile()
Get the file this item is representing in the file set.Get the file set the file is a member of.(package private) static FileSetMember
getNew
(DbControl dc, FileSet fileSet, File file, DataFileType type) Create a new member in a file set.(package private) PluginPermission
static ItemQuery<FileSetMember>
Get a query configured to retrieveFileSetMember
items.getType()
Get the type of item represented by the object.(package private) void
initPermissions
(int granted, int denied) READ permission is granted to all users.boolean
Checks if this file is part of the platform/variant the parent item belongs to.isValid()
Check if the file has been validated and if it passed or not.void
Set the validation status of this member.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 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
Create a new member in a file set.- See Also:
-
getById
public static FileSetMember getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aFileSetMember
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
FileSetMember
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 itemsBaseException
- If there is another error
-
getQuery
Get a query configured to retrieveFileSetMember
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 callAbstractHqlQuery.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
FileSetMemberData 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.- Returns:
- A value indicating the type of item
-
initPermissions
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 classBasicItem
- Parameters:
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass- Throws:
BaseException
- If the permissions couldn't be initialised
-
getPluginPermissions
PluginPermission getPluginPermissions()- Overrides:
getPluginPermissions
in classBasicItem
-
getFileSet
Get the file set the file is a member of.- Returns:
- A file set item
-
getFile
Get the file this item is representing in the file set.- Returns:
- A file item
-
getDataFileType
Get the type of the file.- Returns:
- A file set member type item
-
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
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 performederrorMessage
- The error message if the validation failes
-
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
-