com.ibm.di.fc.emf
Class GraphObjects

java.lang.Object
  extended by com.ibm.di.fc.emf.GraphObjects

public class GraphObjects
extends Object

This class is used for traversing Data Object structures. It can create Entry Attributes corresponding to the Data Objects in the Data Graph and to add new Data Object to it.


Constructor Summary
GraphObjects(ResourceHash resHash)
          Initializes the object.
 
Method Summary
 void applyAttribute(org.eclipse.emf.ecore.sdo.EDataObject root, Attribute attribute, Map prefixToURIMap)
          Adds the value(s) of the Entry Attribute to the data graph rooted at root.
 void applyClassToModel(org.eclipse.emf.ecore.EClass rootClass, String featurePath, org.eclipse.emf.ecore.EClass dataType, Map prefixToURIMap)
          The method changes the type of a feature in the model specified by path expression defining the nesting of the XML elements.
 List getAttributes(org.eclipse.emf.ecore.sdo.EDataObject root, Map uriToPrefixMap, boolean alwaysPrefix)
          Traverse the data graph rooted at root and creates Entry Attributes for the Data Objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphObjects

public GraphObjects(ResourceHash resHash)
Initializes the object.

Parameters:
resHash - Specifies the logger used for logging information and errors messages.
Method Detail

getAttributes

public List getAttributes(org.eclipse.emf.ecore.sdo.EDataObject root,
                          Map uriToPrefixMap,
                          boolean alwaysPrefix)
Traverse the data graph rooted at root and creates Entry Attributes for the Data Objects.

Parameters:
root - Data Object specifying the root element of the data graph.
uriToPrefixMap - namespace URI to prefix map.
alwaysPrefix - if true the XML element or attribute names are prefixed with namespace URI if no prefix is present.
Returns:
list with Entry Attributes containing Data Objects from the data graph.

applyAttribute

public void applyAttribute(org.eclipse.emf.ecore.sdo.EDataObject root,
                           Attribute attribute,
                           Map prefixToURIMap)
                    throws Exception
Adds the value(s) of the Entry Attribute to the data graph rooted at root. The Entry Attribute's name specifies the position of the value(s) in the data graph. If part of the intermediate elements from the root to the values' position do not exists they are also created.

Parameters:
root - Data Object specifying the root element of the data graph.
attribute - an Entry Attribute which name specifies the position in the data graph where the Entry Attribute's value(s) have to be inserted.
prefixToURIMap - prefix to namespace URI map.
Throws:
Exception - if the Entry Attribute's name contains a non-existing XML element or attribute name according to the XML Schema. if the Entry Attribute's name specifies an XML element or attribute that.

applyClassToModel

public void applyClassToModel(org.eclipse.emf.ecore.EClass rootClass,
                              String featurePath,
                              org.eclipse.emf.ecore.EClass dataType,
                              Map prefixToURIMap)
                       throws Exception
The method changes the type of a feature in the model specified by path expression defining the nesting of the XML elements.

Parameters:
rootClass - the root class in the Ecore model.
featurePath - path expression representing the path from to root class to the feature.
dataType - the feature's new data type.
prefixToURIMap - prefix to namespace URI map
Throws:
Exception - if the Entry Attribute's name contains a non-existing XML element or attribute name according to the model.