fedora.server.storage.types
Class BasicDigitalObject

java.lang.Object
  extended by fedora.server.storage.types.BasicDigitalObject
All Implemented Interfaces:
DigitalObject

public class BasicDigitalObject
extends java.lang.Object
implements DigitalObject

A basic implementation of DigitalObject that stores things in memory.

Version:
$Id: BasicDigitalObject.java 6418 2007-12-15 05:47:17Z cwilper $
Author:
cwilper@cs.cornell.edu

Field Summary
 
Fields inherited from interface fedora.server.storage.types.DigitalObject
FEDORA_BDEF_OBJECT, FEDORA_BMECH_OBJECT, FEDORA_CONTENT_MODEL_OBJECT, FEDORA_OBJECT
 
Constructor Summary
BasicDigitalObject()
           
 
Method Summary
 void addDatastreamVersion(Datastream ds, boolean addNewVersion)
          Adds a datastream to a digital object, respecting the versionable flag of that datastream.
 void addFedoraObjectType(int type)
           
 java.util.Iterator<java.lang.String> datastreamIdIterator()
          Gets an Iterator over the datastream ids in this object.
 java.util.List<Datastream> datastreams(java.lang.String id)
          Gets a mutable List of that consists of versions of the same datastream that is identified by the requested datastream identifier.
 java.util.Iterator<java.lang.String> disseminatorIdIterator()
          Deprecated. 
 java.util.List<Disseminator> disseminators(java.lang.String id)
          Deprecated. 
 java.util.List<AuditRecord> getAuditRecords()
          Gets this object's mutable List of AuditRecord objects.
 java.lang.String getContentModelId()
          Deprecated. 
 java.util.Date getCreateDate()
          Gets the date the object was created.
 java.util.Map<java.lang.String,java.lang.String> getExtProperties()
          Gets a Map containing all of the extended properties on the object.
 java.lang.String getExtProperty(java.lang.String propName)
          Gets an extended property value, given the property name.
 java.lang.String getFedoraObjectTypes()
           
 java.lang.String getLabel()
          Gets the label.
 java.util.Date getLastModDate()
          Gets the date the object was last modified.
 java.lang.String getOwnerId()
          Gets the userid of the user who owns the object.
 java.lang.String getPid()
          Gets the pid.
 java.lang.String getState()
          Gets the state.
 boolean isFedoraObjectType(int type)
           
 boolean isNew()
           
 java.lang.String newAuditRecordID()
          Generate a unique id for an audit record.
 java.lang.String newDatastreamID()
          Generate a unique id for a datastream.
 java.lang.String newDatastreamID(java.lang.String id)
          Generate a unique id for a datastream version.
 void removeFedoraObjectType(int type)
           
 void setContentModelId(java.lang.String id)
          Sets the content model id.
 void setCreateDate(java.util.Date createDate)
          Sets the date the object was created.
 void setExtProperty(java.lang.String propName, java.lang.String propValue)
          Sets an extended property on the object.
 void setLabel(java.lang.String label)
          Sets the label.
 void setLastModDate(java.util.Date lastModDate)
          Sets the date the object was last modified.
 void setNew(boolean isNew)
           
 void setOwnerId(java.lang.String owner)
          Sets the owner of the object.
 void setPid(java.lang.String pid)
          Sets the pid.
 void setState(java.lang.String state)
          Sets the state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicDigitalObject

public BasicDigitalObject()
Method Detail

isNew

public boolean isNew()
Specified by:
isNew in interface DigitalObject

setNew

public void setNew(boolean isNew)
Specified by:
setNew in interface DigitalObject

isFedoraObjectType

public boolean isFedoraObjectType(int type)
Specified by:
isFedoraObjectType in interface DigitalObject

getFedoraObjectTypes

public java.lang.String getFedoraObjectTypes()
Specified by:
getFedoraObjectTypes in interface DigitalObject

addFedoraObjectType

public void addFedoraObjectType(int type)
Specified by:
addFedoraObjectType in interface DigitalObject

removeFedoraObjectType

public void removeFedoraObjectType(int type)
Specified by:
removeFedoraObjectType in interface DigitalObject

getPid

public java.lang.String getPid()
Description copied from interface: DigitalObject
Gets the pid.

Specified by:
getPid in interface DigitalObject
Returns:
The pid, or null if it hasn't been set.

setPid

public void setPid(java.lang.String pid)
Description copied from interface: DigitalObject
Sets the pid.

Specified by:
setPid in interface DigitalObject
Parameters:
pid - The pid.

getState

public java.lang.String getState()
Description copied from interface: DigitalObject
Gets the state.

Specified by:
getState in interface DigitalObject
Returns:
The state, or null if it hasn't been set.

setState

public void setState(java.lang.String state)
Description copied from interface: DigitalObject
Sets the state.

Specified by:
setState in interface DigitalObject
Parameters:
state - The state.

getOwnerId

public java.lang.String getOwnerId()
Description copied from interface: DigitalObject
Gets the userid of the user who owns the object.

Specified by:
getOwnerId in interface DigitalObject
Returns:
The userid

setOwnerId

public void setOwnerId(java.lang.String owner)
Description copied from interface: DigitalObject
Sets the owner of the object.

Specified by:
setOwnerId in interface DigitalObject

getLabel

public java.lang.String getLabel()
Description copied from interface: DigitalObject
Gets the label.

Specified by:
getLabel in interface DigitalObject
Returns:
The label, or null if it hasn't been set.

setLabel

public void setLabel(java.lang.String label)
Description copied from interface: DigitalObject
Sets the label.

Specified by:
setLabel in interface DigitalObject
Parameters:
label - The label.

getContentModelId

@Deprecated
public java.lang.String getContentModelId()
Deprecated. 

Description copied from interface: DigitalObject
Gets the content model id.

Specified by:
getContentModelId in interface DigitalObject
Returns:
The content model id.
See Also:
fedora.common.Constants.MODEL.HAS_CONTENT_MODEL

setContentModelId

public void setContentModelId(java.lang.String id)
Description copied from interface: DigitalObject
Sets the content model id.

Specified by:
setContentModelId in interface DigitalObject
Parameters:
id - The content model id.
See Also:
fedora.common.Constants.MODEL.HAS_CONTENT_MODEL

getCreateDate

public java.util.Date getCreateDate()
Description copied from interface: DigitalObject
Gets the date the object was created.

Specified by:
getCreateDate in interface DigitalObject
Returns:
The date, or null if it hasn't been set.

setCreateDate

public void setCreateDate(java.util.Date createDate)
Description copied from interface: DigitalObject
Sets the date the object was created.

Specified by:
setCreateDate in interface DigitalObject
Parameters:
createDate - The date.

getLastModDate

public java.util.Date getLastModDate()
Description copied from interface: DigitalObject
Gets the date the object was last modified.

Specified by:
getLastModDate in interface DigitalObject
Returns:
The date, or null if it hasn't been set.

setLastModDate

public void setLastModDate(java.util.Date lastModDate)
Description copied from interface: DigitalObject
Sets the date the object was last modified.

Specified by:
setLastModDate in interface DigitalObject
Parameters:
lastModDate - The date.

getAuditRecords

public java.util.List<AuditRecord> getAuditRecords()
Description copied from interface: DigitalObject
Gets this object's mutable List of AuditRecord objects.

Specified by:
getAuditRecords in interface DigitalObject
Returns:
The List of AuditRecords, possibly of zero size but never null.

datastreamIdIterator

public java.util.Iterator<java.lang.String> datastreamIdIterator()
Description copied from interface: DigitalObject
Gets an Iterator over the datastream ids in this object.

The Iterator is not tied to the underlying Collection and cannot be used to remove datastreams.

Specified by:
datastreamIdIterator in interface DigitalObject
Returns:
A new Iterator of datastream ids, possibly of zero size but never null.

datastreams

public java.util.List<Datastream> datastreams(java.lang.String id)
Description copied from interface: DigitalObject
Gets a mutable List of that consists of versions of the same datastream that is identified by the requested datastream identifier.

Specified by:
datastreams in interface DigitalObject
Parameters:
id - The datastream id.
Returns:
The list, possibly of zero size but never null.

addDatastreamVersion

public void addDatastreamVersion(Datastream ds,
                                 boolean addNewVersion)
Description copied from interface: DigitalObject
Adds a datastream to a digital object, respecting the versionable flag of that datastream. Appending a new version of the datastream if the datastream is marked as versionable or replacing the existing version(s) of the datastream is it is marked as non-versionable identifier.

Specified by:
addDatastreamVersion in interface DigitalObject
Parameters:
ds - The datastream to add.
addNewVersion - Controls whether to add a new version, or replace existing version.

disseminatorIdIterator

@Deprecated
public java.util.Iterator<java.lang.String> disseminatorIdIterator()
Deprecated. 

Description copied from interface: DigitalObject
Gets an Iterator over the disseminator ids in this object.

The Iterator is not tied to the underlying Collection and cannot be used to remove datastreams.

Specified by:
disseminatorIdIterator in interface DigitalObject
Returns:
A new Iterator of disseminator ids, possibly of zero size but never null.

disseminators

@Deprecated
public java.util.List<Disseminator> disseminators(java.lang.String id)
Deprecated. 

Description copied from interface: DigitalObject
Gets a mutable List that consists of versions of the same disseminator which is identified by the requested disseminator identifier.

Specified by:
disseminators in interface DigitalObject
Parameters:
id - The disseminator id.
Returns:
The list, possibly of zero size but never null.

newDatastreamID

public java.lang.String newDatastreamID()
Description copied from interface: DigitalObject
Generate a unique id for a datastream.

Specified by:
newDatastreamID in interface DigitalObject

newDatastreamID

public java.lang.String newDatastreamID(java.lang.String id)
Description copied from interface: DigitalObject
Generate a unique id for a datastream version.

Specified by:
newDatastreamID in interface DigitalObject

newAuditRecordID

public java.lang.String newAuditRecordID()
Description copied from interface: DigitalObject
Generate a unique id for an audit record.

Specified by:
newAuditRecordID in interface DigitalObject

setExtProperty

public void setExtProperty(java.lang.String propName,
                           java.lang.String propValue)
Sets an extended property on the object.

Specified by:
setExtProperty in interface DigitalObject
Parameters:
propName - The extende property name, either a string, or URI as string.

getExtProperty

public java.lang.String getExtProperty(java.lang.String propName)
Gets an extended property value, given the property name.

Specified by:
getExtProperty in interface DigitalObject
Returns:
The property value.

getExtProperties

public java.util.Map<java.lang.String,java.lang.String> getExtProperties()
Gets a Map containing all of the extended properties on the object. Map key is property name.

Specified by:
getExtProperties in interface DigitalObject
Returns:
The property Map.