Package net.sf.basedb.core
Class ReporterType
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.ReporterType
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Nameable
,Registered
,Removable
This class holds reporter type information. A reporter may have,
but is not required to have a type. The main reason for a
reporter to have a type is to make it easier for client
application to filter the reporter list.
- Version:
- 2.0
- Author:
- Nicklas, Samuel
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final Item
The type of item represented by this class.Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
ConstructorDescriptionReporterType
(ReporterTypeData data) Constructor that sets reporter type data. -
Method Summary
Modifier and TypeMethodDescriptionstatic ReporterType
Get aReporterType
object when you know the ID.(package private) ReporterTypeData
getData()
Get theBasicData
object that holds all data for this item.Get the description for the item.Get the date that the item was registered in the database.getName()
Get the name of the item.static ReporterType
Create a newReporterType
item.static ItemQuery<ReporterType>
getQuery()
Get a query configured to retrieve reporter types.Get the user that flagged this item for removal.getType()
Get the type of item represented by the object.Get all:Reporter
:s of this typeboolean
Check if the removed flag is set for this item.boolean
isUsed()
Check if any reporters of this type exists.newReporter
(String externalId) Create a newReporterData
object of this type.void
setDescription
(String description) Set the description for the item.void
setEntryDate
(Date entryDate) Set the date the entry was registered in the database.void
Set the name of the item.void
setRemoved
(boolean removed) Set the removed flag for this item.Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, initPermissions, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, 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
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
-
Constructor Details
-
ReporterType
ReporterType(ReporterTypeData data) Constructor that sets reporter type data.- Parameters:
data
- AReporterTypeData
object.
-
-
Method Details
-
getNew
Create a newReporterType
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.- Returns:
- The new
ReporterType
item. - Throws:
PermissionDeniedException
- If the logged in user doesn't haveCREATE
permission for this type of item.BaseException
- If there is another error.
-
getById
public static ReporterType getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aReporterType
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
ReporterType
item. - Throws:
ItemNotFoundException
- This exception is thrown if an item with the specified ID is not found.PermissionDeniedException
- This exception is thrown if the logged in user doesn't haveREAD
permission to the items.BaseException
- This exception is thrown if there is another error.
-
getQuery
Get a query configured to retrieve reporter types.- Returns:
- An
ItemQuery
object
-
getData
ReporterTypeData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item. -
getType
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.
-
getName
Description copied from interface:Nameable
Get the name of the item. -
setName
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 theNameable.MAX_NAME_LENGTH
constant.- Specified by:
setName
in interfaceNameable
- Parameters:
name
- The new name for the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the name is null or longer than specified by theNameable.MAX_NAME_LENGTH
constant
-
getDescription
Description copied from interface:Nameable
Get the description for the item.- Specified by:
getDescription
in interfaceNameable
- 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 theNameable.MAX_DESCRIPTION_LENGTH
constant.- Specified by:
setDescription
in interfaceNameable
- 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
-
isRemoved
public boolean isRemoved()Description copied from interface:Removable
Check if the removed flag is set for this item. -
setRemoved
Description copied from interface:Removable
Set the removed flag for this item.- Specified by:
setRemoved
in interfaceRemovable
- Parameters:
removed
- TRUE if the item should be flagged as removed, FALSE otherwise- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.DELETE
permission for setting the flag to TRUE orPermission.WRITE
permission for setting the flag to FALSE
-
getRemovedBy
Description copied from interface:Removable
Get the user that flagged this item for removal.- Specified by:
getRemovedBy
in interfaceRemovable
- Returns:
- A User object, or null if this item has not been flagged
- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the userItemNotFoundException
- If the user that removed this item can't be found
-
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
-
isUsed
Check if any reporters of this type exists.- 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:Reporter
:s of this type
- Overrides:
getUsingItems
in classBasicItem
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- Since:
- 2.2
- See Also:
-
newReporter
public ReporterData newReporter(String externalId) throws PermissionDeniedException, InvalidDataException, BaseException Create a newReporterData
object of this type.- Parameters:
externalId
- The external id of the new reporter. Null is not allowed- Returns:
- The new
ReporterData
object - Throws:
PermissionDeniedException
- This exception is thrown if user doesn't have use permission for this reporter type.InvalidDataException
- If required argument is null.BaseException
- If there is another error.
-