org.gcube.contentmanagement.gcubemodellibrary.elements
Class GCubeDocument

java.lang.Object
  extended by org.gcube.contentmanagement.gcubemodellibrary.elements.BaseElement
      extended by org.gcube.contentmanagement.gcubemodellibrary.elements.GCubeDocument
All Implemented Interfaces:
GCubeElement

public class GCubeDocument
extends BaseElement

A gCube Document.

This implementation if thread-unsafe. Where required, thread-safety is responsibility of clients.

Author:
Federico De Faveri defaveri@isti.cnr.it, Lucio Lelii lucio.lelii@isti.cnr.it, Fabio Simeoni (University of Strathclyde)

Constructor Summary
GCubeDocument()
          Creates an instance.
GCubeDocument(java.lang.String id)
          Creates an instance that act as a proxy for a given document.
GCubeDocument(java.lang.String id, java.lang.String collectionID)
          Creates an instance that act as a proxy for a given document in given collection.
 
Method Summary
 InnerElements<GCubeAlternative> alternatives()
          Returns the GCubeAlternative elements of the document for read and write access.
 AnnotationElements annotations()
          Returns the GCubeAnnotation elements of the document for read and write access.
 java.lang.String collectionID()
          Returns the identifier of the document's collection
 GDoc delta()
           
 java.util.Map<java.lang.String,BaseInnerElement> elements()
          Returns all the elements of the document, in no particular order.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isTracked()
           
 MetadataElements metadata()
          Returns the GCubeMetadata elements of the document for read and write access.
 InnerElements<GCubePart> parts()
          Returns the GCubePart elements of the document for read and write access.
 void resetChanges()
           
 void setCollectionID(java.lang.String id)
          Sets the identifier of the document's collection.
 java.lang.String toString()
          
 void trackChanges()
           
 java.net.URI uri()
          Returns the storage URI of the element.
 
Methods inherited from class org.gcube.contentmanagement.gcubemodellibrary.elements.BaseElement
addProperty, bytestream, bytestreamURI, creationTime, id, isNew, language, lastUpdate, length, mimeType, name, properties, property, removeProperty, resolveBytestream, schemaName, schemaURI, setBytestream, setBytestream, setBytestream, setBytestreamURI, setLanguage, setLenght, setMimeType, setName, setSchemaName, setSchemaURI, setType, type
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GCubeDocument

public GCubeDocument()
Creates an instance.


GCubeDocument

public GCubeDocument(java.lang.String id)
Creates an instance that act as a proxy for a given document.

Parameters:
id - the document identifier.

GCubeDocument

public GCubeDocument(java.lang.String id,
                     java.lang.String collectionID)
Creates an instance that act as a proxy for a given document in given collection.

Parameters:
id - the document identifier.
collectionID - the collection identifier
Method Detail

collectionID

public java.lang.String collectionID()
Returns the identifier of the document's collection

Returns:
the identifier.

setCollectionID

public void setCollectionID(java.lang.String id)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalStateException
Sets the identifier of the document's collection.

Parameters:
id - the collection identifier
Throws:
java.lang.IllegalArgumentException - if the collection identifier is null.
java.lang.IllegalStateException - if the document has already a collection identifier.

uri

public java.net.URI uri()
                 throws java.lang.IllegalStateException,
                        java.net.URISyntaxException
Returns the storage URI of the element.

Returns:
the URI.
Throws:
java.lang.IllegalStateException - if the element has no identifier or is not bound to a document.
java.net.URISyntaxException - if the identifier of the element or its document cannot be used in a URI.

metadata

public MetadataElements metadata()
Returns the GCubeMetadata elements of the document for read and write access.

Returns:
the elements.

annotations

public AnnotationElements annotations()
Returns the GCubeAnnotation elements of the document for read and write access.

Returns:
the elements.

parts

public InnerElements<GCubePart> parts()
Returns the GCubePart elements of the document for read and write access.

Returns:
the elements.

alternatives

public InnerElements<GCubeAlternative> alternatives()
Returns the GCubeAlternative elements of the document for read and write access.

Returns:
the elements.

elements

public java.util.Map<java.lang.String,BaseInnerElement> elements()
Returns all the elements of the document, in no particular order.

Returns:
the documents;

isTracked

public boolean isTracked()

trackChanges

public void trackChanges()
                  throws java.lang.IllegalStateException,
                         java.lang.Exception
Throws:
java.lang.IllegalStateException
java.lang.Exception

resetChanges

public void resetChanges()
                  throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

delta

public GDoc delta()
           throws java.lang.IllegalStateException,
                  java.lang.Exception
Throws:
java.lang.IllegalStateException
java.lang.Exception

toString

public java.lang.String toString()

Overrides:
toString in class BaseElement

hashCode

public int hashCode()
Overrides:
hashCode in class BaseElement

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class BaseElement