You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Veselin Vasilev <va...@gmail.com> on 2007/02/20 16:52:41 UTC

how to activate changesummary

Hello ,
I have the following example :
How can I create or activate a ChangeSummary (mine is always null)
I am using the following code that loads an xml file.

DataObject datagraph = *null*;

*try* {

FileInputStream stream = *new* FileInputStream(xmlFileName2);

datagraph =

XMLHelper.*INSTANCE*.load(stream).getRootObject();

} *catch* (Exception ex) {ex.printStackTrace();}

DataObject company = datagraph.getDataObject("company");

// Access the company DataObject from the "company" property of

// the root object.

DataObject rootObject = datagraph.getRootObject();

System.*out*.println("DG CHANGE SUM IS NuLL ? " + (
datagraph.getChangeSummary() == *null*));





and the xml is :



<sdo:datagraph xmlns:company="company.xsd"
xmlns:sdo="commonj.sdo">
<company:company name="ACME" employeeOfTheMonth="E0002">
<departments name="Advanced Technologies" location="NY"
number="123">
<employees name="John Jones" SN="E0001"/>
<employees name="Mary Smith" SN="E0002" manager="true"/>
<employees name="Jane Doe" SN="E0003"/>
</departments>
</company:company>
</sdo:datagraph>

Re: how to activate changesummary

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi,

This is one of the messy parts of SDO that is still in the process of 
being cleaned up. Currently an sdo:datagraph maps to the java interface 
commonj.sdo.DataGraph, not commonj.sdo.DataObject, so you cannot load it 
using XMLHelper like show below. In Tuscany we have a special method 
SDOUtil.loadDataGraph() that you can use, but this is not a standard SDO 
API. In the future, the plan is to make a DataGraph also be a DataObject, 
so then you will be able to load it using XMLHelper.

Note that you can associate a ChangeSummary with a graph of objects in 
either of two ways:

1) put the data objects into a commonj.sdo.DataGraph.
2) create a type with a ChangeSummary-type property and use it as the root 
data object.

For examples of how to work with DataGraphs and ChangeSummarys, I would 
suggest looking at the following JUnit test in sdo/impl/src/test/java:

org.apache.tuscany.sdo.test.ChangeSummaryOnDataObjectTestCase
org.apache.tuscany.sdo.test.ChangeSummaryPropertyTestCase
org.apache.tuscany.sdo.test.ChangeSummaryTestCase
org.apache.tuscany.sdo.test.DataGraphTestCase

Frank.

"Veselin Vasilev" <va...@gmail.com> wrote on 02/20/2007 10:52:41 AM:

> Hello ,
> I have the following example :
> How can I create or activate a ChangeSummary (mine is always null)
> I am using the following code that loads an xml file.
> 
> DataObject datagraph = *null*;
> 
> *try* {
> 
> FileInputStream stream = *new* FileInputStream(xmlFileName2);
> 
> datagraph =
> 
> XMLHelper.*INSTANCE*.load(stream).getRootObject();
> 
> } *catch* (Exception ex) {ex.printStackTrace();}
> 
> DataObject company = datagraph.getDataObject("company");
> 
> // Access the company DataObject from the "company" property of
> 
> // the root object.
> 
> DataObject rootObject = datagraph.getRootObject();
> 
> System.*out*.println("DG CHANGE SUM IS NuLL ? " + (
> datagraph.getChangeSummary() == *null*));
> 
> 
> 
> 
> 
> and the xml is :
> 
> 
> 
> <sdo:datagraph xmlns:company="company.xsd"
> xmlns:sdo="commonj.sdo">
> <company:company name="ACME" employeeOfTheMonth="E0002">
> <departments name="Advanced Technologies" location="NY"
> number="123">
> <employees name="John Jones" SN="E0001"/>
> <employees name="Mary Smith" SN="E0002" manager="true"/>
> <employees name="Jane Doe" SN="E0003"/>
> </departments>
> </company:company>
> </sdo:datagraph>


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org