2.17.2: 2011-06-17

net.sf.basedb.core
Class Help

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.ChildItem<HelpData>
          extended by net.sf.basedb.core.Help
All Implemented Interfaces:
AccessControlled, Identifiable, Nameable

public class Help
extends ChildItem<HelpData>
implements Nameable

This class is used to represent a help text for a client application.

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Field Summary
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
 
Constructor Summary
Help(HelpData data)
          Creates a new help item
 
Method Summary
static Help getById(DbControl dc, int id)
          Get a Help item when you know the ID.
 Client getClient()
          Get the client application this setting is valid for.
 String getDescription()
          Get the description for the item.
 String getExternalId()
          Get the external id for this Help item.
 String getName()
          Get the name of the item.
static Help getNew(DbControl dc, Client client, String externalId)
          Create a new Help 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 this Help item.
 void setName(String name)
          Set the name of the item.
 
Methods inherited from class net.sf.basedb.core.ChildItem
getPermissionForWriteDeleteAndCreate, getPluginPermissions, initPermissions
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
 
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
 

Field Detail

TYPE

public static final Item TYPE
The type of item represented by this class.

See Also:
Item.HELP, getType()

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 the setExternalId(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 new Help item.

Parameters:
dc - The DbControl which will be used for permission checking and database access
client - The Client which this help text is for
externalId - 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 a Help item when you know the ID.

Parameters:
dc - The DbControl 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 found
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission to the item
BaseException - 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()

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 the Item enumeration.

Specified by:
getType in interface Identifiable
Returns:
A value indicating the type of item

getName

public String getName()
Description copied from interface: Nameable
Get the name of the item.

Specified by:
getName in interface Nameable
Returns:
A String with 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 the Nameable.MAX_NAME_LENGTH constant.

Specified by:
setName in interface Nameable
Parameters:
name - The new name for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the name is null or longer than specified by the Nameable.MAX_NAME_LENGTH constant

getDescription

public String getDescription()
Description copied from interface: Nameable
Get the description for the item.

Specified by:
getDescription in interface Nameable
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 the Nameable.MAX_DESCRIPTION_LENGTH constant.

Specified by:
setDescription in interface Nameable
Parameters:
description - The new description for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the description longer than specified by the Nameable.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 the ChildItem.initPermissions(int, int) method to calculate the logged in user's permissions for the child item.

Specified by:
getSharedParent in class ChildItem<HelpData>
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 have Permission.READ permission
BaseException - 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 null
PermissionDeniedException

getExternalId

public String getExternalId()
Get the external id for this Help 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 this Help item. The value cannot be null and must not be longer than the value specified by the MAX_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 permission
InvalidDataException - If the new value is null or longer than MAX_EXTERNAL_ID_LENGTH

2.17.2: 2011-06-17