org.gcube.contentmanagement.contentmanager.stubs.model.trees
Class GDoc

java.lang.Object
  extended by org.gcube.contentmanagement.contentmanager.stubs.model.trees.Node
      extended by org.gcube.contentmanagement.contentmanager.stubs.model.trees.InnerNode
          extended by org.gcube.contentmanagement.contentmanager.stubs.model.trees.GDoc

public final class GDoc
extends InnerNode

Extends InnerNode for roots of trees that model gDoc documents.

Author:
Fabio Simeoni (University of Strathclyde)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.contentmanagement.contentmanager.stubs.model.trees.Node
Node.State
 
Constructor Summary
GDoc()
          Creates an instance.
GDoc(Edge... edges)
          Constructs an instance with given edges.
GDoc(GDoc doc)
          Copy constructor, creates a clone of a given node.
GDoc(java.lang.String id)
          Constructs an instance with a given identifier.
GDoc(java.lang.String id, Edge... edges)
          Constructs an instance with a given identifier and edges.
GDoc(java.lang.String id, java.util.Map<javax.xml.namespace.QName,java.lang.String> attributes, Edge... edges)
          Constructs an instance with a given identifier, attributes, and edges.
GDoc(java.lang.String id, Node.State state, java.util.Map<javax.xml.namespace.QName,java.lang.String> attributes, Edge... edges)
           
GDoc(java.lang.String collID, java.lang.String id, Edge... edges)
          Constructs an instance in a given collection with a given identifier and given edges.
 
Method Summary
 java.lang.String collectionID()
          Returns the identifier of the document's collection.
 void collectionID(java.lang.String id)
          Sets the identifier of the document's collection.
 void delete()
          Marks the node as State#DELETED, removing all its attributes and all its edges.
 GDoc delta(GDoc future)
          Returns a document that reflects the delta between this document and a given input document, or null if the documents are equals.
 int hashCode()
          
 java.lang.String toString()
          
 
Methods inherited from class org.gcube.contentmanagement.contentmanager.stubs.model.trees.InnerNode
add, add, child, child, child, child, child, child, children, children, children, children, children, children, children, children, delta, descendant, descendant, descendants, descendants, descendants, descendants, edge, edge, edge, edges, edges, edges, edges, equals, hasEdge, hasEdge, hasEdge, labels, labels, main, remove, remove, remove, remove
 
Methods inherited from class org.gcube.contentmanagement.contentmanager.stubs.model.trees.Node
ancestors, ancestorsAndSelf, attribute, attribute, attribute, attributes, hasAttribute, hasAttribute, hasAttribute, id, parent, removeAttribute, removeAttribute, removeAttribute, setAttribute, setAttribute, setAttribute, state, uri
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GDoc

public GDoc(GDoc doc)
Copy constructor, creates a clone of a given node.

Parameters:
n - the node.

GDoc

public GDoc()
Creates an instance.


GDoc

public GDoc(java.lang.String id)
Constructs an instance with a given identifier.

Parameters:
id - the identifier.

GDoc

public GDoc(java.lang.String id,
            Edge... edges)
Constructs an instance with a given identifier and edges.

Parameters:
id - the identifier.
edges - the edges.

GDoc

public GDoc(Edge... edges)
Constructs an instance with given edges.

Parameters:
edges - the edges.

GDoc

public GDoc(java.lang.String collID,
            java.lang.String id,
            Edge... edges)
Constructs an instance in a given collection with a given identifier and given edges.

Parameters:
collID - the collection identifier.
id - the identifier.
edges - the edges.

GDoc

public GDoc(java.lang.String id,
            java.util.Map<javax.xml.namespace.QName,java.lang.String> attributes,
            Edge... edges)
Constructs an instance with a given identifier, attributes, and edges.

Parameters:
id - the identifier.
attributes - the attributes.
edges - the edges.

GDoc

public GDoc(java.lang.String id,
            Node.State state,
            java.util.Map<javax.xml.namespace.QName,java.lang.String> attributes,
            Edge... edges)
Method Detail

collectionID

public void collectionID(java.lang.String id)
Sets the identifier of the document's collection.

Parameters:
id - the identifier.

collectionID

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

Returns:
the identifier.

delta

public GDoc delta(GDoc future)
           throws java.lang.IllegalArgumentException
Returns a document that reflects the delta between this document and a given input document, or null if the documents are equals.

The delta document can only be computed if the input document has the same identifier as this document, and it is repeated recursively for all pairs of children that verify the same condition. For all purposes, in fact, the input document is expected to be (or simply look like) a future version of this document, as if it was originally cloned from this document and had evolved since.

Under this assumption, the delta document has:

Parameters:
future - the input document.
Throws:
java.lang.IllegalArgumentException - in the following circumstances:
  • this document has a different identifier from this node;
  • this document or one its descendants has no identifier;
  • the descendants of this document and the input document which have the same identifier have instead different types;
  • there are descendants of the input document that have no counterpart below this document but do have identifiers.

delete

public void delete()
Marks the node as State#DELETED, removing all its attributes and all its edges.


toString

public java.lang.String toString()

Overrides:
toString in class InnerNode

hashCode

public int hashCode()

Overrides:
hashCode in class InnerNode