Humboldt Alignment Editor 2.5.0

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

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

public class OInstance
extends OGroup
implements MutableInstance

Instance implementation based on ODocuments

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

Field Summary
static String FIELD_METADATA
          Name for the special field for MetaData documents
static String FIELD_VALUE
          Name for the special field for an instance value
 
Fields inherited from class eu.esdihumboldt.hale.common.instance.orient.OGroup
db, document
 
Constructor Summary
OInstance(Instance org)
          Copy constructor.
OInstance(com.orientechnologies.orient.core.record.impl.ODocument document, TypeDefinition typeDef, com.orientechnologies.orient.core.db.record.ODatabaseRecord db, DataSet dataSet)
          Creates an instance based on the given document.
OInstance(TypeDefinition typeDef, DataSet dataSet)
          Creates an empty instance associated with the given type.
 
Method Summary
 DataSet getDataSet()
          Get the data set the instance is associated to.
 TypeDefinition getDefinition()
          Get the group definition
 List<Object> getMetaData(String key)
          Get the metadata the instance my be associated with
 Set<String> getMetaDataNames()
          Get all keys the metadata is associated with
protected  Collection<String> getSpecialFieldNames()
          Get the special field names, e.g.
 Object getValue()
          Get the instance value.

The value is only present for certain types where the HasValueFlag or AugmentedValueFlag constraint is enabled.
 void putMetaData(String key, Object obj)
          add Data to the MetaData, which the Instance can be associated with If there is no MetaData in the Instance, a new container will be created
 void setDataSet(DataSet dataSet)
          Set the data set the instance is associated to.
 void setMetaData(String key, Object... values)
          Sets the metadata of a certain key, may also delet or reset the value of the key if the values parameter is null or empty
 void setValue(Object value)
          Set the instance value.
 
Methods inherited from class eu.esdihumboldt.hale.common.instance.orient.OGroup
addProperty, addProperty, associatedDbWithThread, configureDocument, convertDocument, convertInstance, decodeProperty, encodeProperty, getDb, getDocument, getProperty, getProperty, getPropertyNames, getPropertyNames, setProperty, setPropertyInternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface eu.esdihumboldt.hale.common.instance.model.MutableGroup
addProperty, setProperty
 
Methods inherited from interface eu.esdihumboldt.hale.common.instance.model.Group
getProperty, getPropertyNames
 

Field Detail

FIELD_VALUE

public static final String FIELD_VALUE
Name for the special field for an instance value

See Also:
Constant Field Values

FIELD_METADATA

public static final String FIELD_METADATA
Name for the special field for MetaData documents

See Also:
Constant Field Values
Constructor Detail

OInstance

public OInstance(TypeDefinition typeDef,
                 DataSet dataSet)
Creates an empty instance associated with the given type.

Parameters:
typeDef - the definition of the instance's type
dataSet - the data set the instance is associated to

OInstance

public OInstance(com.orientechnologies.orient.core.record.impl.ODocument document,
                 TypeDefinition typeDef,
                 com.orientechnologies.orient.core.db.record.ODatabaseRecord db,
                 DataSet dataSet)
Creates an instance based on the given document.

Parameters:
document - the document
typeDef - the definition of the instance's type
db - the database
dataSet - the data set the instance is associated to

OInstance

public OInstance(Instance org)
Copy constructor. Creates an instance based on the properties and values of the given instance.

Parameters:
org - the instance to copy
Method Detail

setValue

public void setValue(Object value)
Description copied from interface: MutableInstance
Set the instance value. It may only be a simple value, no collection or Instance.

Specified by:
setValue in interface MutableInstance
Parameters:
value - the instance value to set
See Also:
MutableInstance.setValue(Object)

getValue

public Object getValue()
Description copied from interface: Instance
Get the instance value.

The value is only present for certain types where the HasValueFlag or AugmentedValueFlag constraint is enabled. The Binding constraint on the type definition defines the binding of the value.

NOTE: This is needed for instance for XML elements with text content and attributes. It may only be a simple value (i.e. no Group or Instance).

Specified by:
getValue in interface Instance
Returns:
the instance value if it is defined, otherwise null
See Also:
Instance.getValue()

getSpecialFieldNames

protected Collection<String> getSpecialFieldNames()
Description copied from class: OGroup
Get the special field names, e.g. for metadata.

Overrides:
getSpecialFieldNames in class OGroup
Returns:
the collection of special field names.
See Also:
OGroup.getSpecialFieldNames()

getDefinition

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

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

getDataSet

public DataSet getDataSet()
Description copied from interface: Instance
Get the data set the instance is associated to.

Specified by:
getDataSet in interface Instance
Returns:
the instance data set, null if not set

setDataSet

public void setDataSet(DataSet dataSet)
Description copied from interface: MutableInstance
Set the data set the instance is associated to.

Specified by:
setDataSet in interface MutableInstance
Parameters:
dataSet - the instance data set

getMetaData

public List<Object> getMetaData(String key)
Description copied from interface: Instance
Get the metadata the instance my be associated with

Specified by:
getMetaData in interface Instance
Parameters:
key - the key to access a certain metadata
Returns:
A list of objects from the metadata, may be an empty List if the key can not be found or there is not metadata associated with the Instance
See Also:
Instance.getMetaData(java.lang.String)

putMetaData

public void putMetaData(String key,
                        Object obj)
add Data to the MetaData, which the Instance can be associated with If there is no MetaData in the Instance, a new container will be created The parameter "Object obj" may not be an ODocument

Specified by:
putMetaData in interface MutableInstance
Parameters:
key - a key the data to add will be associated with
obj - the Data to add, may not be Instance or Group

getMetaDataNames

public Set<String> getMetaDataNames()
Description copied from interface: Instance
Get all keys the metadata is associated with

Specified by:
getMetaDataNames in interface Instance
Returns:
an Set of String keys, or an empty Set if the data doesn't exist or the container is empty, the Set may not be changed
See Also:
Instance.getMetaDataNames()

setMetaData

public void setMetaData(String key,
                        Object... values)
Sets the metadata of a certain key, may also delet or reset the value of the key if the values parameter is null or empty The parameter values may not contain an ODocument

Specified by:
setMetaData in interface MutableInstance
Parameters:
key - the key the data is associated with
values - the values to set, may not contain Instance or Group

Humboldt Alignment Editor 2.5.0

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