[
https://issues.apache.org/jira/browse/TUSCANY-1430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512278
]
Frank Budinsky commented on TUSCANY-1430:
-----------------------------------------
Test case that illustrates the problem:
The XSD:
========
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://abc.com/services"
xmlns:tns="http://abc.com/services"
xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java"
xmlns:sdoXml="commonj.sdo/xml"
sdoJava:package="com.abc.services"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="commonj.sdo" schemaLocation="datagraph.xsd" />
<xsd:complexType name="NestedType">
<xsd:sequence>
<xsd:element name="test1"
type="xsd:string" />
<xsd:element name="test2"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MyDataGraph">
<complexContent>
<extension base="sdo:BaseDataGraphType">
<xsd:sequence>
<xsd:element name="NestedType"
type="tns:NestedType" />
</xsd:sequence>
</extension>
</complexContent>
</xsd:complexType>
<xsd:complexType name="Input">
<xsd:sequence>
<xsd:element name="MyDataGraph" type="tns:MyDataGraph"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
The Java Test:
==============
package com.abc.services;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.apache.tuscany.sdo.util.SDOUtil;
import com.abc.services.impl.TestFactoryImpl;
import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;
import commonj.sdo.Type;
import commonj.sdo.helper.XMLHelper;
import commonj.sdo.impl.HelperProvider;
public class TestABC {
public static void main(String[] args) {
TestFactory.INSTANCE.register(HelperProvider.getDefaultContext());
NestedType nested;
System.out.println("**************** static graph
**********************\n");
Input input = TestFactory.INSTANCE.createInput();
MyDataGraph staticGraph = TestFactory.INSTANCE.createMyDataGraph();
nested = TestFactory.INSTANCE.createNestedType();
staticGraph.setNestedType(nested);
((DataObject)nested).set("test1", "test1");
((DataObject)nested).set("test2", "test2");
staticGraph.getChangeSummary().beginLogging();
((DataObject)nested).set("test2", "test2_modified");
nested.setTest1("test1_modified");
input.setMyDataGraph(staticGraph);
saveGraph(staticGraph);
System.out.println("\n\n");
System.out.println("**************** dynamic graph
**********************\n");
DataGraph dynamicGraph = SDOUtil.createDataGraph();
Type type = ((TestFactoryImpl)TestFactory.INSTANCE).getNestedType();
nested = (NestedType)dynamicGraph.createRootObject(type);
((DataObject)nested).set("test1", "test1");
((DataObject)nested).set("test2", "test2");
dynamicGraph.getChangeSummary().beginLogging();
((DataObject)nested).set("test2", "test2_modified");
nested.setTest1("test1_modified");
saveGraph(dynamicGraph);
}
/**
* @param dataobject
*/
private static void saveGraph(MyDataGraph dataobject) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
XMLHelper.INSTANCE.save((DataObject)dataobject, null, "datagraph",
os);
System.out.println(os.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* @param datagraph
*/
private static void saveGraph(DataGraph datagraph) {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
SDOUtil.saveDataGraph(datagraph, os, null);
System.out.println(os.toString());
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
> SDO codegen is needs to use internal property numbers for inverseAdd,
> inverseRemove, and notify calls
> -----------------------------------------------------------------------------------------------------
>
> Key: TUSCANY-1430
> URL: https://issues.apache.org/jira/browse/TUSCANY-1430
> Project: Tuscany
> Issue Type: Bug
> Components: Java SDO Tools
> Affects Versions: Java-SDO-beta1
> Reporter: Frank Budinsky
> Fix For: Java-SDO-1.0
>
>
> The SDOClass.javajet needs to use INTERNAL_ features when calling
> inverseAdd(), inverseRemove(), and notify() methods. ChangeSummary doesn't
> work properly otherwise.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]