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
public class Help extends ChildItem implements 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
Fields Modifier and Type Field Description static int
MAX_EXTERNAL_ID_LENGTH
The maximum length of the external id variable that can be stored in the database.private static QueryRuntimeFilter
RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to clients.static Item
TYPE
The type of item represented by this class.-
Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Help
getById(DbControl dc, int id)
Get aHelp
item when you know the ID.Client
getClient()
Get the client application this setting is valid for.(package private) HelpData
getData()
Get theBasicData
object that holds all data for this item.String
getDescription()
Get the description for the item.String
getExternalId()
Get the external id for thisHelp
item.String
getName()
Get the name of the item.static Help
getNew(DbControl dc, Client client, String externalId)
Create a newHelp
item.static ItemQuery<Help>
getQuery(Client client)
Get a query configured to retrieve help texts for the specified client application.(package private) SharedData
getSharedParent()
Get the shareable parent item of this child item.Item
getType()
Get the type of item represented by the object.(package private) void
setClient(Client client)
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
setName(String name)
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 Detail
-
TYPE
public static final Item TYPE
The type of item represented by this class.
-
MAX_EXTERNAL_ID_LENGTH
public static final int MAX_EXTERNAL_ID_LENGTH
The 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:
- Constant Field Values
-
RUNTIME_FILTER
private static final QueryRuntimeFilter RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to clients.
-
-
Constructor Detail
-
Help
Help(HelpData data)
Creates a new help item- Parameters:
data
- the data
-
-
Method Detail
-
getNew
public static Help getNew(DbControl dc, Client client, String externalId) throws BaseException
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:
Client.newHelp(String)
-
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
public static ItemQuery<Help> getQuery(Client client)
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:
Client.getHelp()
-
getData
HelpData getData()
Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.
-
getType
public 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
public String getName()
Description copied from interface:Nameable
Get the name of the item.
-
setName
public void setName(String name) throws PermissionDeniedException, InvalidDataException
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
public String 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
-
getSharedParent
SharedData getSharedParent()
Description copied from class:ChildItem
Get the shareable parent item of this child item. This is used by theChildItem.initPermissions(int, int)
method to calculate the logged in user's permissions for the child item.- Specified by:
getSharedParent
in classChildItem
- Returns:
- The parent item
-
getClient
public Client getClient() throws PermissionDeniedException, BaseException
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
void setClient(Client client) throws PermissionDeniedException, InvalidDataException
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
public String getExternalId()
Get the external id for thisHelp
item.- Returns:
- A string with the external id of this item
-
setExternalId
public void setExternalId(String externalId) throws PermissionDeniedException, InvalidDataException
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
-
-