Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.instance.orient
Class OGroup

java.lang.Object
  extended by eu.esdihumboldt.hale.common.instance.orient.OGroup
All Implemented Interfaces:
Group, MutableGroup
Direct Known Subclasses:
OInstance

public class OGroup
extends Object
implements MutableGroup

Group implementation based on ODocuments

Author:
Simon Templer
Partner:
01 / Fraunhofer Institute for Computer Graphics Research

Field Summary
protected  com.orientechnologies.orient.core.db.record.ODatabaseRecord db
          The associated database record.
protected  com.orientechnologies.orient.core.record.impl.ODocument document
          The document backing the group
 
Constructor Summary
OGroup(DefinitionGroup definition)
          Creates an empty group with an associated definition group.
OGroup(Group org)
          Copy constructor.
OGroup(com.orientechnologies.orient.core.record.impl.ODocument document, DefinitionGroup definition, com.orientechnologies.orient.core.db.record.ODatabaseRecord db)
          Creates a group based on the given document
 
Method Summary
 void addProperty(QName propertyName, Object value)
          Adds a property value
protected  void addProperty(QName propertyName, Object value, com.orientechnologies.orient.core.record.impl.ODocument document)
          Adds a property value to a given ODocument
protected  void associatedDbWithThread()
          Associate the database with the current thread (if set on the group)
 com.orientechnologies.orient.core.record.impl.ODocument configureDocument(com.orientechnologies.orient.core.db.record.ODatabaseRecord db)
          Configure the internal document with the given database and return it
protected  Object convertDocument(Object value, QName propertyName)
          Converts ODocuments to Instances but leaves other objects untouched.
protected  Object convertInstance(Object value)
          Converts Groups and Instances to ODocument but leaves other objects untouched.
protected  QName decodeProperty(String encodedProperty)
          Decode an encoded property name to a qualified name
protected  String encodeProperty(QName propertyName)
          Encode a qualified property name to a string
 com.orientechnologies.orient.core.db.record.ODatabaseRecord getDb()
          Get the associated database.
 DefinitionGroup getDefinition()
          Get the group definition
 com.orientechnologies.orient.core.record.impl.ODocument getDocument()
          Get the internal document.
 Object[] getProperty(QName propertyName)
          Get the values for the property with the given name.
protected  Object[] getProperty(QName propertyName, com.orientechnologies.orient.core.record.impl.ODocument document)
          Gets a property value from a given ODocument
 Iterable<QName> getPropertyNames()
          Get the property names for which any values exist.
protected  Iterable<QName> getPropertyNames(com.orientechnologies.orient.core.record.impl.ODocument document)
          Returns the index keys of a certain ODocument
protected  Collection<String> getSpecialFieldNames()
          Get the special field names, e.g.
 void setProperty(QName propertyName, Object... values)
          Sets values for a property
protected  void setPropertyInternal(com.orientechnologies.orient.core.record.impl.ODocument document, QName propertyName, Object... values)
          Sets values for a property in a certain ODocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

document

protected final com.orientechnologies.orient.core.record.impl.ODocument document
The document backing the group


db

protected com.orientechnologies.orient.core.db.record.ODatabaseRecord db
The associated database record.

Constructor Detail

OGroup

public OGroup(DefinitionGroup definition)
Creates an empty group with an associated definition group.

Parameters:
definition - the associated group

OGroup

public OGroup(com.orientechnologies.orient.core.record.impl.ODocument document,
              DefinitionGroup definition,
              com.orientechnologies.orient.core.db.record.ODatabaseRecord db)
Creates a group based on the given document

Parameters:
document - the document
definition - the definition of the associated group
db - the database

OGroup

public OGroup(Group org)
Copy constructor. Creates a group based on the properties and values of the given group.

Parameters:
org - the instance to copy
Method Detail

configureDocument

public com.orientechnologies.orient.core.record.impl.ODocument configureDocument(com.orientechnologies.orient.core.db.record.ODatabaseRecord db)
Configure the internal document with the given database and return it

Parameters:
db - the database
Returns:
the internal document configured with the database

getDocument

public com.orientechnologies.orient.core.record.impl.ODocument getDocument()
Get the internal document.

Returns:
the internal document

addProperty

public void addProperty(QName propertyName,
                        Object value)
Description copied from interface: MutableGroup
Adds a property value

Specified by:
addProperty in interface MutableGroup
Parameters:
propertyName - the property name
value - the property value
See Also:
MutableGroup.addProperty(QName, Object)

addProperty

protected void addProperty(QName propertyName,
                           Object value,
                           com.orientechnologies.orient.core.record.impl.ODocument document)
Adds a property value to a given ODocument

Parameters:
propertyName - the property name
value - the property value
document - the {link ODocument} where the value is to add

convertInstance

protected Object convertInstance(Object value)
Converts Groups and Instances to ODocument but leaves other objects untouched.

Parameters:
value - the object to convert
Returns:
the converted object

setProperty

public void setProperty(QName propertyName,
                        Object... values)
Description copied from interface: MutableGroup
Sets values for a property

Specified by:
setProperty in interface MutableGroup
Parameters:
propertyName - the property name
values - the values for the property
See Also:
MutableGroup.setProperty(QName, Object[])

setPropertyInternal

protected void setPropertyInternal(com.orientechnologies.orient.core.record.impl.ODocument document,
                                   QName propertyName,
                                   Object... values)
Sets values for a property in a certain ODocument

Parameters:
propertyName - the property name
values - the values for the property
document - the document which should contain the data

encodeProperty

protected String encodeProperty(QName propertyName)
Encode a qualified property name to a string

Parameters:
propertyName - the qualified property name
Returns:
the name encoded as a single string

decodeProperty

protected QName decodeProperty(String encodedProperty)
Decode an encoded property name to a qualified name

Parameters:
encodedProperty - the encoded property name
Returns:
the qualified property name

getProperty

public Object[] getProperty(QName propertyName)
Description copied from interface: Group
Get the values for the property with the given name. Values can also be groups or instances.

Specified by:
getProperty in interface Group
Parameters:
propertyName - the property name
Returns:
the property values, may be null if none exist
See Also:
Group.getProperty(QName)

getProperty

protected Object[] getProperty(QName propertyName,
                               com.orientechnologies.orient.core.record.impl.ODocument document)
Gets a property value from a given ODocument

Parameters:
propertyName - the property name
document - the {link ODocument} which contains the property
Returns:
an Array of Objects containing the needed property

associatedDbWithThread

protected void associatedDbWithThread()
Associate the database with the current thread (if set on the group)


convertDocument

protected Object convertDocument(Object value,
                                 QName propertyName)
Converts ODocuments to Instances but leaves other objects untouched.

Parameters:
value - the object to convert
propertyName - the name of the property the value is associated with
Returns:
the converted object

getPropertyNames

public Iterable<QName> getPropertyNames()
Description copied from interface: Group
Get the property names for which any values exist. Especially helpful when there is (for whatever reason) no type definition associated to the instance.

Specified by:
getPropertyNames in interface Group
Returns:
the list of property names with associated values
See Also:
Group.getPropertyNames()

getPropertyNames

protected Iterable<QName> getPropertyNames(com.orientechnologies.orient.core.record.impl.ODocument document)
Returns the index keys of a certain ODocument

Parameters:
document - the keys are retrieved from
Returns:
an Iterable with the keys as QNames

getSpecialFieldNames

protected Collection<String> getSpecialFieldNames()
Get the special field names, e.g. for metadata.

Returns:
the collection of special field names.

getDefinition

public DefinitionGroup getDefinition()
Description copied from interface: Group
Get the group definition

Specified by:
getDefinition in interface Group
Returns:
the group definition
See Also:
Group.getDefinition()

getDb

public com.orientechnologies.orient.core.db.record.ODatabaseRecord getDb()
Get the associated database.

Returns:
the associated database record

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d