org.mycore.datamodel.ifs2
Class MCRStoredMetadata

java.lang.Object
  extended by org.mycore.datamodel.ifs2.MCRStoredMetadata
Direct Known Subclasses:
MCRVersionedMetadata

public class MCRStoredMetadata
extends Object

Represents an XML metadata document that is stored in MCRMetadataStore.

Author:
Frank Lützenkirchen

Field Summary
protected  org.apache.commons.vfs.FileObject fo
          The file object in local filesystem storing the data
protected  int id
          The ID of the metadata document
protected  MCRMetadataStore store
          The store this document is stored in
 
Constructor Summary
MCRStoredMetadata(MCRMetadataStore store, org.apache.commons.vfs.FileObject fo, int id)
          Creates a new stored metadata object
 
Method Summary
(package private)  void create(MCRContent xml)
          Creates a new local file to save XML to
 void delete()
          Deletes the metadata document.
 int getID()
          Returns the ID of this metadata document
 Date getLastModified()
          Returns the date this metadata document was last modified
 MCRContent getMetadata()
          Returns the stored XML document
 MCRMetadataStore getStore()
          Returns the store this metadata document is stored in
 boolean isDeleted()
          Returns true if this object is deleted
 void setLastModified(Date date)
          Sets the date this metadata document was last modified
 void update(MCRContent xml)
          Updates the stored XML document
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected int id
The ID of the metadata document


fo

protected org.apache.commons.vfs.FileObject fo
The file object in local filesystem storing the data


store

protected MCRMetadataStore store
The store this document is stored in

Constructor Detail

MCRStoredMetadata

MCRStoredMetadata(MCRMetadataStore store,
                  org.apache.commons.vfs.FileObject fo,
                  int id)
Creates a new stored metadata object

Parameters:
store - the store this document is stored in
fo - the file object storing the data
id - the ID of the metadata document
Method Detail

create

void create(MCRContent xml)
      throws Exception
Creates a new local file to save XML to

Parameters:
xml - the XML to save to a new file
Throws:
Exception

update

public void update(MCRContent xml)
            throws Exception
Updates the stored XML document

Parameters:
xml - the XML document to be stored
Throws:
Exception

getMetadata

public MCRContent getMetadata()
                       throws Exception
Returns the stored XML document

Returns:
the stored XML document
Throws:
Exception

getID

public int getID()
Returns the ID of this metadata document

Returns:
the ID of this metadata document

getStore

public MCRMetadataStore getStore()
Returns the store this metadata document is stored in

Returns:
the store this metadata document is stored in

getLastModified

public Date getLastModified()
                     throws Exception
Returns the date this metadata document was last modified

Returns:
the date this metadata document was last modified
Throws:
Exception

setLastModified

public void setLastModified(Date date)
                     throws Exception
Sets the date this metadata document was last modified

Parameters:
date - the date this metadata document was last modified
Throws:
Exception

delete

public void delete()
            throws Exception
Deletes the metadata document. This object is invalid afterwards, do not use it any more.

Throws:
Exception

isDeleted

public boolean isDeleted()
                  throws Exception
Returns true if this object is deleted

Throws:
Exception