org.gcube.common
Class OAIRecord

java.lang.Object
  extended by org.gcube.common.OAIRecord

public class OAIRecord
extends Object

This class represents an OAI Record. The record may be an Identifier-only record, meaning it contains only the record identifier and possibly a status. If an attempt is made to access the metadata from an Identifier-only record, a GetRecord will be performed, turning the recored into a full record. This object is returned either by the OAIRepository.GetRecord method or by the OAIRecordList.CurrentItem property.


Constructor Summary
OAIRecord()
          Constructs an empty OAI record.
 
Method Summary
protected  void addSet(String s)
          Purpose: Set the status of the record
 boolean deleted()
          Returns true if the record has a status attribute of 'deleted'.
protected  void frndSetDatestamp(String d)
          Purpose: Set the datestamp of the record
protected  void frndSetIdentifier(String i)
          Purpose: Set the identifier of the record
protected  void frndSetIdOnly(boolean b)
          Purpose: Set whether this record is an id-only record
protected  void frndSetMetadataPrefix(String m)
          Purpose: Set the metadata prefix of the record
protected  void frndSetRecord(Node n)
          Purpose: Set the DOM Node of the record
protected  void frndSetRepository(OAIRepository r)
          Purpose: Set the repository from which the record is derived
protected  void frndSetStatus(String s)
          Purpose: Set the status of the record
protected  void frndSetValid(boolean v)
          Purpose: Set whether the record is valid or not
 Node getAbout()
          Returns the first about section of the record as an XML node.
 Node getAbout(int i)
          Returns the about section of the record as an XML node.
 int getAboutCount()
          Return the number of about elements associated with the record
 String getAboutNamespaceURI()
          Returns the namespace URI of the first about section of the record.
 String getAboutNamespaceURI(int i)
          Returns the namespace URI of the about section of the record.
 String getDatestamp()
          Returns the datestamp of this record as a string.
 String getIdentifier()
          Returns the OAI identifier of the record.
 Node getMetadata()
          Returns the metadata section of the record as an XML node.
 String getMetadataNamespaceURI()
          Returns the namespace URI of the metadata section of the record.
 String getMetadataPrefix()
          Returns the metadata prefix of the record.
 String getMetadataRecord()
           
 Node getRecord()
          Returns the complete record as an XML node; includes everything starting at the tag.
 String getSetSpec()
          Get the first setSpec strings associated with the record.
 String getSetSpec(int i)
          Get one of the setSpec strings associated with the record.
 int getSetSpecCount()
          Return the number of setSpec strings for the record.
 List<String> getSetSpeList()
          Get the list of sets associated with the record.
 String getStatus()
          Returns the status of the record
 boolean isIdentifierOnly()
          Returns true if this is an identifier-only record, meaning that it was probably created as a result of a ListIdentifiers request; else false; an identifier-only record can be explicitly converted to a complete record by calling the refreshRecord method; accessing any of the methods which return metadata will also implicitly convert it to a complete record.
 boolean isRecordValid()
          Returns true if the record appears to be valid (well-formed, and if the Validation is Very Strict also valid according to the XML Schemas); if the Validation is Loose and the record is not well-formed, false is returned.
 void refreshRecord()
          This will re-retrieve the record from the repository; this can be used to turn a identifier-only record into a complete record; the current metadataPrefix is used.
 void refreshRecord(String meta)
          This will re-retrieve the record from the repository; this can be used to turn a identifier-only record into a complete record or to change the record to a different metadataPrefix.
 void setMetadataRecord(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OAIRecord

public OAIRecord()
Constructs an empty OAI record.

Method Detail

getMetadataNamespaceURI

public String getMetadataNamespaceURI()
                               throws OAIException
Returns the namespace URI of the metadata section of the record. If there is no metadata an empty string is returned.

Throws:
OAIException

getAboutNamespaceURI

public String getAboutNamespaceURI()
                            throws OAIException
Returns the namespace URI of the first about section of the record. If there is no about section an empty string is returned.

Throws:
OAIException

getAboutNamespaceURI

public String getAboutNamespaceURI(int i)
                            throws OAIException
Returns the namespace URI of the about section of the record. If there is no about section an empty string is returned.

Throws:
OAIException

getDatestamp

public String getDatestamp()
                    throws OAIException
Returns the datestamp of this record as a string. If this is a IdOnly record it will be transformed into a complete record

Throws:
OAIException

deleted

public boolean deleted()
Returns true if the record has a status attribute of 'deleted'.


isRecordValid

public boolean isRecordValid()
Returns true if the record appears to be valid (well-formed, and if the Validation is Very Strict also valid according to the XML Schemas); if the Validation is Loose and the record is not well-formed, false is returned.


getIdentifier

public String getIdentifier()
Returns the OAI identifier of the record.


getStatus

public String getStatus()
Returns the status of the record


getMetadata

public Node getMetadata()
                 throws OAIException
Returns the metadata section of the record as an XML node. If there is no metadata section null node is returned.

Throws:
OAIException

getAboutCount

public int getAboutCount()
                  throws OAIException
Return the number of about elements associated with the record

Throws:
OAIException

getAbout

public Node getAbout()
              throws OAIException
Returns the first about section of the record as an XML node. If there is no about section null node is returned.

Throws:
OAIException

getAbout

public Node getAbout(int i)
              throws OAIException
Returns the about section of the record as an XML node. If there is no about section null node is returned.

Throws:
OAIException

isIdentifierOnly

public boolean isIdentifierOnly()
Returns true if this is an identifier-only record, meaning that it was probably created as a result of a ListIdentifiers request; else false; an identifier-only record can be explicitly converted to a complete record by calling the refreshRecord method; accessing any of the methods which return metadata will also implicitly convert it to a complete record.


getMetadataPrefix

public String getMetadataPrefix()
                         throws OAIException
Returns the metadata prefix of the record.

Throws:
OAIException

getRecord

public Node getRecord()
               throws OAIException
Returns the complete record as an XML node; includes everything starting at the tag.

Throws:
OAIException

refreshRecord

public void refreshRecord()
                   throws OAIException
This will re-retrieve the record from the repository; this can be used to turn a identifier-only record into a complete record; the current metadataPrefix is used.

Throws:
OAIException

refreshRecord

public void refreshRecord(String meta)
                   throws OAIException
This will re-retrieve the record from the repository; this can be used to turn a identifier-only record into a complete record or to change the record to a different metadataPrefix.

Throws:
OAIException

getSetSpecCount

public int getSetSpecCount()
                    throws OAIException
Return the number of setSpec strings for the record. OAI 1.x repositories will always return 0

Throws:
OAIException

getSetSpec

public String getSetSpec()
                  throws OAIException
Get the first setSpec strings associated with the record. Only valid for OAI 2.0 repositories

Throws:
OAIException

getSetSpeList

public List<String> getSetSpeList()
                           throws OAIException
Get the list of sets associated with the record.

Throws:
OAIException

getSetSpec

public String getSetSpec(int i)
                  throws OAIException
Get one of the setSpec strings associated with the record. Only valid for OAI 2.0 repositories

Throws:
OAIException

frndSetIdentifier

protected void frndSetIdentifier(String i)
Purpose: Set the identifier of the record


frndSetDatestamp

protected void frndSetDatestamp(String d)
Purpose: Set the datestamp of the record


frndSetRepository

protected void frndSetRepository(OAIRepository r)
Purpose: Set the repository from which the record is derived


frndSetMetadataPrefix

protected void frndSetMetadataPrefix(String m)
Purpose: Set the metadata prefix of the record


frndSetValid

protected void frndSetValid(boolean v)
Purpose: Set whether the record is valid or not


frndSetIdOnly

protected void frndSetIdOnly(boolean b)
Purpose: Set whether this record is an id-only record


frndSetRecord

protected void frndSetRecord(Node n)
Purpose: Set the DOM Node of the record


frndSetStatus

protected void frndSetStatus(String s)
Purpose: Set the status of the record


addSet

protected void addSet(String s)
Purpose: Set the status of the record


setMetadataRecord

public void setMetadataRecord(String s)

getMetadataRecord

public String getMetadataRecord()


Copyright © 2013. All Rights Reserved.