Package net.sf.basedb.core
Class Help
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.ChildItem
net.sf.basedb.core.Help
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Nameable
This class is used to represent a help text for
a client application.
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2015-04-17 14:02:22 +0200 (fr, 17 apr 2015) $
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum length of the external id variable that can be stored in the database.private static final QueryRuntimeFilter
This filter will only return items if the logged in user has generic read permission to clients.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
-
Method Summary
Modifier and TypeMethodDescriptionstatic Help
Get aHelp
item when you know the ID.Get the client application this setting is valid for.(package private) HelpData
getData()
Get theBasicData
object that holds all data for this item.Get the description for the item.Get the external id for thisHelp
item.getName()
Get the name of the item.static Help
Create a newHelp
item.Get a query configured to retrieve help texts for the specified client application.(package private) SharedData
Get the shareable parent item of this child item.getType()
Get the type of item represented by the object.(package private) void
Set the client application this setting is valid for.void
setDescription
(String description) Set the description for the item.void
setExternalId
(String externalId) Set the external id for thisHelp
item.void
Set the name of the item.Methods inherited from class net.sf.basedb.core.ChildItem
getPermissionForUse, 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
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. -
MAX_EXTERNAL_ID_LENGTH
public static final int MAX_EXTERNAL_ID_LENGTHThe maximum length of the external id variable that can be stored in the database. Check the length against this value before calling thesetExternalId(String)
method to avoid exceptions.- See Also:
-
RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to clients.
-
-
Constructor Details
-
Help
Help(HelpData data) Creates a new help item- Parameters:
data
- the data
-
-
Method Details
-
getNew
Create a newHelp
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessclient
- TheClient
which this help text is forexternalId
- A unique string used for quick retrieval of a specific help text- Returns:
- The new
ClientDefaultSetting
item - Throws:
BaseException
- If there is an error- See Also:
-
getById
public static Help getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aHelp
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
Help
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 configured to retrieve help texts for the specified client application.- Parameters:
client
- The client to retreive help for, null is allowed if the logged in user has generic READ permission for clients in which case all help will be returned- Returns:
- An
ItemQuery
object - See Also:
-
getData
HelpData 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
-
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
-
getClient
Get the client application this setting is valid for.- Returns:
- The
Client
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permissionBaseException
- If there is another error
-
setClient
Set the client application this setting is valid for. Can only be set on a new item.- Throws:
InvalidDataException
- If the client is nullPermissionDeniedException
-
getExternalId
Get the external id for thisHelp
item.- Returns:
- A string with the external id of this item
-
setExternalId
Set the external id for thisHelp
item. The value cannot be null and must not be longer than the value specified by theMAX_EXTERNAL_ID_LENGTH
constant. It must also be a value that is unique for the client application.- Parameters:
externalId
- The new external id for this item- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the new value is null or longer thanMAX_EXTERNAL_ID_LENGTH
-