org.fcrepo.server.storage.types
Class BasicDigitalObject

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

public class BasicDigitalObject
extends Object
implements DigitalObject

A basic implementation of DigitalObject that stores things in memory.

Author:
Chris Wilper, Stephen Bayliss

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.
 Iterator<String> datastreamIdIterator()
          Gets an Iterator over the datastream ids in this object.
 Iterable<Datastream> datastreams(String id)
          Gets an interable view that consists of versions of the same datastream that is identified by the requested datastream identifier.
 Iterator<String> disseminatorIdIterator()
          Deprecated. 
 List<Disseminator> disseminators(String id)
          Deprecated. 
 List<AuditRecord> getAuditRecords()
          Gets this object's mutable List of AuditRecord objects.
 List<String> getContentModels()
          Gets a list of the content models of the object.
 Date getCreateDate()
          Gets the date the object was created.
 Map<String,String> getExtProperties()
          Gets a Map containing all of the extended properties on the object.
 String getExtProperty(String propName)
          Gets an extended property value, given the property name.
 String getLabel()
          Gets the label.
 Date getLastModDate()
          Gets the date the object was last modified.
 String getOwnerId()
          Gets the userid of the user who owns the object.
 String getPid()
          Gets the pid.
 Set<RelationshipTuple> getRelationships()
          Get all RELS-EXT and RELS-INT relationships in the object.
 Set<RelationshipTuple> getRelationships(org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object)
          Get all matching RELS-EXT relationships in the object, assumes pid is the subject
 Set<RelationshipTuple> getRelationships(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object)
          Get all matching RELS-EXT and RELS-INT relationships in the object.
 String getState()
          Gets the state.
 boolean hasContentModel(org.jrdf.graph.ObjectNode contentModel)
          Determins whether or not the object have the given uri as a content model.
 boolean hasRelationship(org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object)
          Determine if the object contains the given relationship, assumes pid is the subject
 boolean hasRelationship(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object)
          Determine if the object contains the given relationship.
 boolean isNew()
           
 String newAuditRecordID()
          Generate a unique id for an audit record.
 String newDatastreamID()
          Generate a unique id for a datastream.
 String newDatastreamID(String id)
          Generate a unique id for a datastream version.
 void removeDatastreamVersion(Datastream ds)
          Removes a datastream from a digital object.
 void setCreateDate(Date createDate)
          Sets the date the object was created.
 void setExtProperty(String propName, String propValue)
          Sets an extended property on the object.
 void setLabel(String label)
          Sets the label.
 void setLastModDate(Date lastModDate)
          Sets the date the object was last modified.
 void setNew(boolean isNew)
           
 void setOwnerId(String owner)
          Sets the owner of the object.
 void setPid(String pid)
          Sets the pid.
 void setState(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

getPid

public 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(String pid)
Description copied from interface: DigitalObject
Sets the pid.

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

getState

public 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(String state)
Description copied from interface: DigitalObject
Sets the state.

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

getOwnerId

public 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(String owner)
Description copied from interface: DigitalObject
Sets the owner of the object.

Specified by:
setOwnerId in interface DigitalObject

getLabel

public 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(String label)
Description copied from interface: DigitalObject
Sets the label.

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

getCreateDate

public 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(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 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(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 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 Iterator<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 Iterable<Datastream> datastreams(String id)
Description copied from interface: DigitalObject
Gets an interable view that consists of versions of the same datastream that is identified by the requested datastream identifier.

Datastreams within any iterators produced here are references to the actual datastreams in this DigitalObject, so modifying their contents is a persistent change. However, remove() is disabled, so to remove a datastream from the object, use DigitalObject.removeDatastreamVersion(Datastream)

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

removeDatastreamVersion

public void removeDatastreamVersion(Datastream ds)
Description copied from interface: DigitalObject
Removes a datastream from a digital object.

Specified by:
removeDatastreamVersion in interface DigitalObject
Parameters:
ds - Datastream to remove.

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 Iterator<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 List<Disseminator> disseminators(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 String newDatastreamID()
Description copied from interface: DigitalObject
Generate a unique id for a datastream.

Specified by:
newDatastreamID in interface DigitalObject

newDatastreamID

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

Specified by:
newDatastreamID in interface DigitalObject

newAuditRecordID

public 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(String propName,
                           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 String getExtProperty(String propName)
Gets an extended property value, given the property name.

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

getExtProperties

public Map<String,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.

hasRelationship

public boolean hasRelationship(org.jrdf.graph.PredicateNode predicate,
                               org.jrdf.graph.ObjectNode object)
Description copied from interface: DigitalObject
Determine if the object contains the given relationship, assumes pid is the subject

Returns results that are accurate for the current state of the object at the time of invocation. Thus, if there is some change to the object that changes the set of relationships contained within, the next call to hasRelationship will reflect those changes.

Specified by:
hasRelationship in interface DigitalObject
Parameters:
predicate - Predicate of the relationship, or null if unspecified (will match any).
object - Object (target) of the relationship, or null if unspecified (will match any).
Returns:
true if the object

hasRelationship

public boolean hasRelationship(org.jrdf.graph.SubjectNode subject,
                               org.jrdf.graph.PredicateNode predicate,
                               org.jrdf.graph.ObjectNode object)
Description copied from interface: DigitalObject
Determine if the object contains the given relationship.

Returns results that are accurate for the current state of the object at the time of invocation. Thus, if there is some change to the object that changes the set of relationships contained within, the next call to hasRelationship will reflect those changes.

Specified by:
hasRelationship in interface DigitalObject
Parameters:
subject - Subject of the relationship, or null if unspecified (will match any).
predicate - Predicate of the relationship, or null if unspecified (will match any).
object - Object (target) of the relationship, or null if unspecified (will match any).
Returns:
true if the object

getRelationships

public Set<RelationshipTuple> getRelationships(org.jrdf.graph.PredicateNode predicate,
                                               org.jrdf.graph.ObjectNode object)
Description copied from interface: DigitalObject
Get all matching RELS-EXT relationships in the object, assumes pid is the subject

Returns results that are accurate for the current state of the object at the time of invocation. Thus, if there is some change to the object that changes the set of relationships contained within, the next call to getRelationships will reflect those changes.

Specified by:
getRelationships in interface DigitalObject
Parameters:
predicate - Predicate of the relationship, or null if unspecified (will match any).
object - Object (target) of the relationship, or null if unspecified (will match any).
Returns:
All RELS-EXT and RELS-INT relationships in the object

getRelationships

public Set<RelationshipTuple> getRelationships()
Description copied from interface: DigitalObject
Get all RELS-EXT and RELS-INT relationships in the object.

Returns results that are accurate for the current state of the object at the time of invocation. Thus, if there is some change to the object that changes the set of relationships contained within, the next call to getRelationships will reflect those changes.

Specified by:
getRelationships in interface DigitalObject
Returns:
All matching relationships in the object

getRelationships

public Set<RelationshipTuple> getRelationships(org.jrdf.graph.SubjectNode subject,
                                               org.jrdf.graph.PredicateNode predicate,
                                               org.jrdf.graph.ObjectNode object)
Description copied from interface: DigitalObject
Get all matching RELS-EXT and RELS-INT relationships in the object.

Returns results that are accurate for the current state of the object at the time of invocation. Thus, if there is some change to the object that changes the set of relationships contained within, the next call to getRelationships will reflect those changes.

Specified by:
getRelationships in interface DigitalObject
Parameters:
subject - Subject of the relationship, or null if unspecified (will match any).
predicate - Predicate of the relationship, or null if unspecified (will match any).
object - Object (target) of the relationship, or null if unspecified (will match any).
Returns:
All RELS-EXT and RELS-INT relationships in the object

getContentModels

public List<String> getContentModels()
Description copied from interface: DigitalObject
Gets a list of the content models of the object. The strings will be of the format "info:fedora/PID"

Specified by:
getContentModels in interface DigitalObject
Returns:
the content models of the object

hasContentModel

public boolean hasContentModel(org.jrdf.graph.ObjectNode contentModel)
Description copied from interface: DigitalObject
Determins whether or not the object have the given uri as a content model.

Specified by:
hasContentModel in interface DigitalObject
Parameters:
contentModel - The object node of the content model
Returns:
true if the object have the content model.


Copyright © 2012 DuraSpace. All Rights Reserved.