Package net.sf.basedb.core
Class ReporterCloneTemplate
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.OwnedItem
net.sf.basedb.core.SharedItem
net.sf.basedb.core.CommonItem
net.sf.basedb.core.ReporterCloneTemplate
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
A reporter clone template is a definition of which reporter properties/annotations
that should be cloned to a per-experiment table in the dynamic database. The
cloning operation is initiated with
Experiment.getReporterCloneBatcher(DbControl)
.
The reporter internal and external id
are always cloned and should not be part of the template. The cloning operation
also creates a locked copy of the template, so that it is possible to make modifications
to the original template without affecting the cloned data.- Since:
- 3.1
- Author:
- Nicklas
- Last modified
- $Date $
-
Field Summary
Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) void
addBytes
(long bytes) void
addClonableProperty
(ClonableProperty property) Add a clonable property to this template.(package private) static ReporterCloneTemplateData
createAllCopy
(String name) (package private) ReporterCloneTemplateData
Create a deep clone of this template.static ReporterCloneTemplate
Get a reporter clone template item when you know the id.long
getBytes()
Get the number of bytes the cloned reporter information use in the database.Get a list with all clonable properties in this template.(package private) static List<ClonableProperty>
getClonableProperty
(String propertyName) Get information about a clonable property that is included in this template.(package private) ReporterCloneTemplateData
getData()
Get theBasicData
object that holds all data for this item.Get the date that the item was registered in the database.static ReporterCloneTemplate
Create a new reporter clone template item.(package private) PluginPermission
static ItemQuery<ReporterCloneTemplate>
getQuery()
Get a query that returns reporter clone templates.getType()
Get the type of item represented by the object.Get all: Experiment that is using this templateboolean
hasClonableProperty
(String propertyName) Check if this template contains a clonable property with the given name.(package private) void
initPermissions
(int granted, int denied) Locked templates are READ-able by all, and everything else is denied.boolean
isLocked()
If the template is locked it means that it is used by an experiment and can't be modified or deleted.boolean
isUsed()
Check if: An experiment/virtualdb is using this templatevoid
removeClonableProperty
(String propertyName) Remove the property with the given name from this templatevoid
setDescription
(String description) Allow the description to be changed with RESTRICTED_WRITE permission.void
setEntryDate
(Date entryDate) Set the date the entry was registered in the database.Methods inherited from class net.sf.basedb.core.CommonItem
getDescription, getName, getRemovedBy, isRemoved, setName, setRemoved
Methods inherited from class net.sf.basedb.core.SharedItem
getItemKey, getProjectKey, isShared, onBeforeCommit, setItemKey, setProjectKey
Methods inherited from class net.sf.basedb.core.OwnedItem
getOwner, isOwner, setOwner, takeOwnership
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
-
Constructor Details
-
ReporterCloneTemplate
ReporterCloneTemplate(ReporterCloneTemplateData data)
-
-
Method Details
-
getNew
Create a new reporter clone template item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access- Returns:
- The new
ReporterCloneTemplate
item - Throws:
BaseException
- If there is an error
-
getById
public static ReporterCloneTemplate getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get a reporter clone template item 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
ReporterCloneTemplate
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
Get a query that returns reporter clone templates. It will always only return unlocked templates.- Returns:
- An
ItemQuery
object
-
getData
ReporterCloneTemplateData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.- Overrides:
getData
in classCommonItem
-
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
-
initPermissions
Locked templates are READ-able by all, and everything else is denied. Unlocked templates use the regular permissions.- Overrides:
initPermissions
in classSharedItem
- 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
-
isUsed
Check if:- An experiment/virtualdb is using this template
- Overrides:
isUsed
in classBasicItem
- Returns:
- TRUE if this item is used, FALSE otherwise
- Throws:
BaseException
- If not able to tell if item is used or not.- See Also:
-
getUsingItems
Get all:- Experiment that is using this template
- Overrides:
getUsingItems
in classBasicItem
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- See Also:
-
getEntryDate
Description copied from interface:Registered
Get the date that the item was registered in the database.- Specified by:
getEntryDate
in interfaceRegistered
- Returns:
- A date or null if this is not known
-
setEntryDate
Description copied from interface:Registered
Set the date the entry was registered in the database. Implementations should only allow this property to be set before the item is first stored in the database. The intention of this method is to facilitate export/import of data between server.- Specified by:
setEntryDate
in interfaceRegistered
- Parameters:
entryDate
- A date or null to use today's date
-
setDescription
public void setDescription(String description) throws PermissionDeniedException, InvalidDataException Allow the description to be changed with RESTRICTED_WRITE permission.- Specified by:
setDescription
in interfaceNameable
- Overrides:
setDescription
in classCommonItem
- Parameters:
description
- The new description for the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the description longer than specified by theNameable.MAX_DESCRIPTION_LENGTH
constant
-
isLocked
public boolean isLocked()If the template is locked it means that it is used by an experiment and can't be modified or deleted. Locked templates are managed automatically by the BASE core. -
getBytes
public long getBytes()Get the number of bytes the cloned reporter information use in the database. -
addBytes
void addBytes(long bytes) -
addClonableProperty
Add a clonable property to this template.- Parameters:
property
- Information about the property to include in the template (null is not allowed)
-
removeClonableProperty
Remove the property with the given name from this template- Parameters:
propertyName
- The name of a property (null is not allowed)
-
getClonableProperty
Get information about a clonable property that is included in this template.- Parameters:
propertyName
- The name of a property- Returns:
- Cloned property information, or null if the named property is not part of this template
-
hasClonableProperty
Check if this template contains a clonable property with the given name.- Parameters:
propertyName
- The property name to check- Returns:
- TRUE if the template contains the given property, FALSE if not
-
getClonableProperties
Get a list with all clonable properties in this template. The returned list is a copy of the information in this template and modifications to the list do not affect this template.- Returns:
- A list with cloned properties
-
createLockedCopy
ReporterCloneTemplateData createLockedCopy()Create a deep clone of this template. Modifications made to the template after this call do not affect the copy. The returned copy is locked and cannot be modifed. Properties that are part of the original template, but no longer exists are not copied. -
createAllCopy
-
getClonableProperties
-