org.purl.sword.base
Class Collection

java.lang.Object
  extended by org.purl.sword.base.XmlElement
      extended by org.purl.sword.base.Collection
All Implemented Interfaces:
SwordElementInterface

public class Collection
extends XmlElement
implements SwordElementInterface

A representation of a SWORD Collection.

Author:
Stuart Lewis, Neil Taylor

Field Summary
static String ATTRIBUTE_HREF
          Label for the Href attribute.
static String ELEMENT_NAME
          Deprecated. 
 
Fields inherited from class org.purl.sword.base.XmlElement
DATE_FORMAT, DATE_FORMATS, xmlName
 
Constructor Summary
Collection()
          Create a new instance.
Collection(String location)
          Create a new instance and set the initial location for the collection.
 
Method Summary
 void addAcceptPackaging(String acceptPackaging)
          Add an acceptPackaging format.
 void addAcceptPackaging(String acceptPackaging, float qualityValue)
          Add an acceptPackaging format.
 void addAccepts(String accepts)
          Add an accepts entry.
 void clearAcceptPackaging()
          Remove all of the accepted packaging formats associated with this Collection.
 void clearAccepts()
          Remove all of the accepts associated with this Collection.
static XmlName elementName()
           
 String getAbstract()
          Get the DC Term abstract.
 List<Accept> getAcceptList()
           
 List<SwordAcceptPackaging> getAcceptPackaging()
          Retrieve a hashtable that holds all the acceptsPackaging details.
 String[] getAccepts()
          Retrieve an array that holds all of the Accept details.
 List<String> getAcceptsList()
          Deprecated. 
 String getCollectionPolicy()
          Get the collection policy.
 String getLocation()
          Get the location.
 boolean getMediation()
          Get the mediation value.
 String getService()
          Get the sword service.
 String getTitle()
          Get the title.
 String getTreatment()
          Get the treatment value.
protected  void initialise()
           
 boolean isMediationSet()
           
 nu.xom.Element marshall()
          Marshall the data in this object to an Element object.
 void setAbstract(String abstractString)
          Set the abstract.
 void setCollectionPolicy(String collectionPolicy)
          Set the collection policy.
 void setLocation(String location)
          Set the location.
 void setMediation(boolean mediation)
          Set the mediation value.
 void setService(String serviceString)
          Set the sword service.
 void setTitle(String title)
          Set the title.
 void setTreatment(String treatment)
          Set the treatment.
 String toString()
          Get a string representation of this object.
 void unmarshall(nu.xom.Element collection)
          Unmarshall the content element into the data in this object.
 SwordValidationInfo unmarshall(nu.xom.Element collection, Properties validationProperties)
           
protected  SwordValidationInfo validate(List<SwordValidationInfo> existing, List<SwordValidationInfo> attributes, Properties validationContext)
           
 SwordValidationInfo validate(Properties validationContext)
           
 
Methods inherited from class org.purl.sword.base.XmlElement
createValidAttributeInfo, getQualifiedName, getQualifiedName, getQualifiedNameWithPrefix, getXmlName, handleIncorrectElement, isInstanceOf, isInstanceOf, processUnexpectedAttributes, processUnexpectedAttributes, unmarshallBoolean, unmarshallInteger, unmarshallString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_HREF

public static final String ATTRIBUTE_HREF
Label for the Href attribute.

See Also:
Constant Field Values

ELEMENT_NAME

@Deprecated
public static final String ELEMENT_NAME
Deprecated. 
Label for the local part of this element.

See Also:
Constant Field Values
Constructor Detail

Collection

public Collection()
Create a new instance.


Collection

public Collection(String location)
Create a new instance and set the initial location for the collection.

Parameters:
location - The initial location, expressed as a URL.
Method Detail

elementName

public static XmlName elementName()

initialise

protected final void initialise()

getAccepts

public String[] getAccepts()
Retrieve an array that holds all of the Accept details.

Returns:
An array of strings. Each string represents an individual accept element. The array will have a length of 0 if no accepts elements are stored in this collection.

getAcceptsList

@Deprecated
public List<String> getAcceptsList()
Deprecated. 

Retrieve an array that holds all of the Accept details.

Returns:
An array of strings. Each string represents an individual accept element. The array will have a length of 0 if no accepts elements are stored in this collection.

getAcceptList

public List<Accept> getAcceptList()
Returns:

addAccepts

public void addAccepts(String accepts)
Add an accepts entry.

Parameters:
accepts - The accepts value.

clearAccepts

public void clearAccepts()
Remove all of the accepts associated with this Collection.


getAcceptPackaging

public List<SwordAcceptPackaging> getAcceptPackaging()
Retrieve a hashtable that holds all the acceptsPackaging details.

Returns:
A hashtable. The keys are accepted packaging formats, and the values the quality values (stored as QualityValue objects)

addAcceptPackaging

public void addAcceptPackaging(String acceptPackaging,
                               float qualityValue)
Add an acceptPackaging format.

Parameters:
acceptPackaging - the packaging format.
qualityValue - the quality value of accepted packaging format.

addAcceptPackaging

public void addAcceptPackaging(String acceptPackaging)
Add an acceptPackaging format. A default quality vale is given.

Parameters:
acceptPackaging - the packaging format.

clearAcceptPackaging

public void clearAcceptPackaging()
Remove all of the accepted packaging formats associated with this Collection.


getCollectionPolicy

public String getCollectionPolicy()
Get the collection policy.

Returns:
The SWORD collectionPolicy.

setCollectionPolicy

public void setCollectionPolicy(String collectionPolicy)
Set the collection policy.

Parameters:
collectionPolicy - The collection policy.

getLocation

public String getLocation()
Get the location.

Returns:
TShe location

setLocation

public void setLocation(String location)
Set the location.

Parameters:
location - The location.

getMediation

public boolean getMediation()
Get the mediation value.

Returns:
The mediation

isMediationSet

public boolean isMediationSet()

setMediation

public void setMediation(boolean mediation)
Set the mediation value.

Parameters:
mediation - The mediation value.

getAbstract

public String getAbstract()
Get the DC Term abstract.

Returns:
The abstract.

setAbstract

public void setAbstract(String abstractString)
Set the abstract.

Parameters:
abstractString - The abstract.

getService

public String getService()
Get the sword service.

Returns:
The service.

setService

public void setService(String serviceString)
Set the sword service.

Parameters:
serviceString - The service.

setTitle

public void setTitle(String title)
Set the title. This will set the title type to ContentType.TEXT.

Parameters:
title - The title.

getTitle

public String getTitle()
Get the title.

Returns:
The title, or null if no title has been set.

getTreatment

public String getTreatment()
Get the treatment value.

Returns:
The treatment.

setTreatment

public void setTreatment(String treatment)
Set the treatment.

Parameters:
treatment - The treatment.

toString

public String toString()
Get a string representation of this object. This is equivalent to calling marshall().toString().

Overrides:
toString in class Object

marshall

public nu.xom.Element marshall()
Marshall the data in this object to an Element object.

Specified by:
marshall in interface SwordElementInterface
Returns:
A XOM Element that holds the data for this Content element.

unmarshall

public void unmarshall(nu.xom.Element collection)
                throws UnmarshallException
Unmarshall the content element into the data in this object.

Specified by:
unmarshall in interface SwordElementInterface
Parameters:
collection - The data to unmarshall.
Throws:
UnmarshallException - If the element does not contain a content element or if there are problems accessing the data.

unmarshall

public SwordValidationInfo unmarshall(nu.xom.Element collection,
                                      Properties validationProperties)
                               throws UnmarshallException
Throws:
UnmarshallException

validate

public SwordValidationInfo validate(Properties validationContext)
Specified by:
validate in class XmlElement
Returns:

validate

protected SwordValidationInfo validate(List<SwordValidationInfo> existing,
                                       List<SwordValidationInfo> attributes,
                                       Properties validationContext)
Parameters:
existing -
Returns:


Copyright © 2013 DuraSpace. All Rights Reserved.