org.dspace.content
Class DSpaceObject

java.lang.Object
  extended by org.dspace.content.DSpaceObject
Direct Known Subclasses:
Bitstream, BrowseItem, Bundle, Collection, Community, EPerson, Group, Item, Site

public abstract class DSpaceObject
extends Object

Abstract base class for DSpace objects


Constructor Summary
DSpaceObject()
           
 
Method Summary
protected  void addDetails(String d)
          Add a string to the cache of event details.
protected  void clearDetails()
          Reset the cache of event details.
static DSpaceObject find(Context context, int type, int id)
          Generic find for when the precise type of a DSO is not known, just the a pair of type number and database ID.
 DSpaceObject getAdminObject(int action)
          Return the dspace object where an ADMIN action right is sufficient to grant the initial authorize check.
protected  String getDetails()
           
abstract  String getHandle()
          Get the Handle of the object.
abstract  int getID()
          Get the internal ID (database primary key) of this object
abstract  String getName()
          Get a proper name for the object.
 DSpaceObject getParentObject()
          Return the dspace object that "own" the current object in the hierarchy.
abstract  int getType()
          Get the type of this object, found in Constants
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSpaceObject

public DSpaceObject()
Method Detail

clearDetails

protected void clearDetails()
Reset the cache of event details.


addDetails

protected void addDetails(String d)
Add a string to the cache of event details. Automatically separates entries with a comma. Subclass can just start calling addDetails, since it creates the cache if it needs to.

Parameters:
detail - detail string to add.

getDetails

protected String getDetails()

getType

public abstract int getType()
Get the type of this object, found in Constants

Returns:
type of the object

getID

public abstract int getID()
Get the internal ID (database primary key) of this object

Returns:
internal ID of object

getHandle

public abstract String getHandle()
Get the Handle of the object. This may return null

Returns:
Handle of the object, or null if it doesn't have one

getName

public abstract String getName()
Get a proper name for the object. This may return null. Name should be suitable for display in a user interface.

Returns:
Name for the object, or null if it doesn't have one

find

public static DSpaceObject find(Context context,
                                int type,
                                int id)
                         throws SQLException
Generic find for when the precise type of a DSO is not known, just the a pair of type number and database ID.

Parameters:
context - - the context
type - - type number
id - - id within table of type'd objects
Returns:
the object found, or null if it does not exist.
Throws:
SQLException - only upon failure accessing the database.

getAdminObject

public DSpaceObject getAdminObject(int action)
                            throws SQLException
Return the dspace object where an ADMIN action right is sufficient to grant the initial authorize check.

Default behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as need.

Parameters:
action - ID of action being attempted, from org.dspace.core.Constants. The ADMIN action is not a valid parameter for this method, an IllegalArgumentException should be thrown
Returns:
the dspace object, if any, where an ADMIN action is sufficient to grant the original action
Throws:
SQLException
IllegalArgumentException - if the ADMIN action is supplied as parameter of the method call

getParentObject

public DSpaceObject getParentObject()
                             throws SQLException
Return the dspace object that "own" the current object in the hierarchy. Note that this method has a meaning slightly different from the getAdminObject because it is independent of the action but it is in a way related to it. It defines the "first" dspace object OTHER then the current one, where allowed ADMIN actions imply allowed ADMIN actions on the object self.

Returns:
the dspace object that "own" the current object in the hierarchy
Throws:
SQLException


Copyright © 2010 DuraSpace. All Rights Reserved.