2.17.2: 2011-06-17

net.sf.basedb.clients.web.util
Class NameablePluginAdaptor

java.lang.Object
  extended by net.sf.basedb.clients.web.util.NameablePluginAdaptor
All Implemented Interfaces:
AccessControlled, Identifiable, Nameable

public class NameablePluginAdaptor
extends Object
implements Nameable

This class wraps a Nameable object around a PluginDefinition. Calls to setName and setDescription are ignored.

Version:
2.0
Author:
Nicklas

Field Summary
private  PluginDefinition plugin
           
 
Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
 
Constructor Summary
NameablePluginAdaptor(PluginDefinition plugin)
           
 
Method Summary
 void checkPermission(Permission permission)
          Check if the logged in user has the desired permission on the item, otherwise throw an exception.
 String getDescription()
          Get the description for the item.
 int getId()
          Get the id for the item.
 String getName()
          Get the name of the item.
 Set<Permission> getPermissions()
          Get the logged in user's permissions on the item.
 Item getType()
          Get the type of item represented by the object.
 int getVersion()
          Get the version number of the item.
 boolean hasPermission(Permission permission)
          Check if the logged in user has the desired permission on the item.
 void setDescription(String description)
          Ignored.
 void setName(String name)
          Ignored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

plugin

private final PluginDefinition plugin
Constructor Detail

NameablePluginAdaptor

public NameablePluginAdaptor(PluginDefinition plugin)
Method Detail

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

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
Ignored.

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

setName

public void setName(String name)
             throws PermissionDeniedException,
                    InvalidDataException
Ignored.

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

getId

public int getId()
Description copied from interface: Identifiable
Get the id for the item. If it hasn't yet been saved to the database 0 is returned.

Specified by:
getId in interface Identifiable
Returns:
The id of the item or 0

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

getVersion

public int getVersion()
Description copied from interface: Identifiable
Get the version number of the item. The version number is incremented each time the item is updated and is used to prevent that the same item is updated at the same time by two or more different threads or processes.

Specified by:
getVersion in interface Identifiable

checkPermission

public void checkPermission(Permission permission)
                     throws PermissionDeniedException
Description copied from interface: AccessControlled
Check if the logged in user has the desired permission on the item, otherwise throw an exception.

Specified by:
checkPermission in interface AccessControlled
Parameters:
permission - Permission the user should have.
Throws:
PermissionDeniedException - If the user doesn't have the requested permission

hasPermission

public boolean hasPermission(Permission permission)
Description copied from interface: AccessControlled
Check if the logged in user has the desired permission on the item.

Specified by:
hasPermission in interface AccessControlled
Parameters:
permission - The permission to check if the user has.
Returns:
TRUE if the user has the permission, FALSE otherwise

getPermissions

public Set<Permission> getPermissions()
Description copied from interface: AccessControlled
Get the logged in user's permissions on the item.

Specified by:
getPermissions in interface AccessControlled

2.17.2: 2011-06-17