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


Copyright © 2009 The DSpace Foundation. All Rights Reserved.