You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Christian Schuhegger (JIRA)" <de...@tuscany.apache.org> on 2008/07/06 11:06:42 UTC

[jira] Commented: (TUSCANY-1725) XSD2JavaGenerator has a problem with associations navigable from both sides

    [ https://issues.apache.org/jira/browse/TUSCANY-1725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610729#action_12610729 ] 

Christian Schuhegger commented on TUSCANY-1725:
-----------------------------------------------

In the sources of the sdo subtree of your SVN is already a test cases called sdo/sample/src/main/resources/sports.xsd that tests for sdoXML:oppositeProperty. I tried to use XSD2JavaGenerator on it, but get several compile errors. I will attach the output of my compile attempt to this task. Some of these compile errors look like this:
    [javac] symbol  : variable INTERNAL_CAPTAIN
    [javac] location: class org.apache.tuscany.sports.impl.TeamImpl
    [javac] 				changeContext = inverseRemove(captainFor, this, TeamImpl.INTERNAL_CAPTAIN, Team.class, changeContext);
These can be solved manually by replacing TeamImpl.INTERNAL_CAPTAIN by TeamImpl._INTERNAL_CAPTAIN

Other compile errors are not so easy to solve.

I've created another more complex test case aswell. I will attach the CollectionManagerModel.xsd here, too. You can check-out the whole test project via:
svn co http://jclusterjobs.svn.sourceforge.net/svnroot/jclusterjobs/prototypes/p20080705/sdo
go to collection-manager-model and execute:
# mvn antprops:generate
# ant
# ant (twice, there is some problem i still have to figure out)
the collection manager model test case can be compiled via:
# ant compile_cmm
# ant compile_cmm


> XSD2JavaGenerator has a problem with associations navigable from both sides
> ---------------------------------------------------------------------------
>
>                 Key: TUSCANY-1725
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1725
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Tools
>    Affects Versions: Java-SDO-1.0
>         Environment: Linux
>            Reporter: Miro Kandic
>             Fix For: Java-SDO-Next
>
>         Attachments: xmlSchema.xsd
>
>
> XSD2JavaGenerator does not work in the case of any association type (association, composition) that is navigable from both sides.
> I have intentionally, just to test generator, made Customer-SoH association in the next schema navigable from both sides and generated code cannot be compiled.
> Frank, after initial analyses, confirmed that saying "Bidirectional references are broken in Tuscany. They seem
> to have been broken when we switched over to the new (noEMF) codegen
> patterns."
> Next is complete XSD built automatically from the UML model.
> <?xml version="1.0" encoding="UTF-8"?>
> <!--
>     Attention: Generated code! Do not modify by hand!
>     Generated by: XmlSchema.vsl in andromda-xmlschema-cartridge.
>   -->
> <xsd:schema
>     targetNamespace="http://www.cisco.com/odns/soa"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml"
>     xmlns:impl="http://www.cisco.com/odns/soa"
>     elementFormDefault="qualified">
>     <xsd:import namespace="commonj.sdo/xml" schemaLocation="sdoXML.xsd"/>
>     <xsd:complexType name="Address">
>         <xsd:sequence>
>             <xsd:element name="street" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="city" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>         </xsd:sequence>
>         <xsd:attribute name="xmlId" type="xsd:ID"/>
>     </xsd:complexType>
>     <xsd:complexType name="Customer">
>         <xsd:sequence>
>             <xsd:element name="orders" type="xsd:IDREF" sdoxml:propertyType="impl:SoH"
>                 sdoxml:oppositeProperty="customer" minOccurs="0" maxOccurs="unbounded" />
>             <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="created" type="xsd:date" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
>         </xsd:sequence>
>         <xsd:attribute name="xmlId" type="xsd:ID"/>
>     </xsd:complexType>
>     <xsd:complexType name="Part">
>         <xsd:sequence>
>             <xsd:element name="uom" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="aggState" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
>         </xsd:sequence>
>         <xsd:attribute name="xmlId" type="xsd:ID"/>
>     </xsd:complexType>
>     <xsd:complexType name="Product">
>      <xsd:complexContent>
>       <xsd:extension base="impl:Part">
>         <xsd:sequence>
>             <xsd:element name="description" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="created" type="xsd:date" minOccurs="1" maxOccurs="1"/>
>         </xsd:sequence>
>       </xsd:extension>
>      </xsd:complexContent>
>     </xsd:complexType>
>     <xsd:complexType name="SoH">
>         <xsd:sequence>
>             <xsd:element name="customer" type="xsd:IDREF" sdoxml:propertyType="impl:Customer"
>                 sdoxml:oppositeProperty="orders" minOccurs="1" maxOccurs="1" />
>             <xsd:element name="lines" type="impl:SoL" minOccurs="0" maxOccurs="unbounded" />
>             <xsd:element name="number" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="receivedDate" type="xsd:date" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="created" type="xsd:date" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
>         </xsd:sequence>
>         <xsd:attribute name="xmlId" type="xsd:ID"/>
>     </xsd:complexType>
>     <xsd:complexType name="SoL">
>         <xsd:sequence>
>             <xsd:element name="product" type="xsd:IDREF" sdoxml:propertyType="impl:Product"
>                 sdoxml:oppositeProperty="soLs" minOccurs="1" maxOccurs="1" />
>             <xsd:element name="soLineSch" type="impl:SoLSch" minOccurs="0" maxOccurs="unbounded" />
>             <xsd:element name="quantity" type="xsd:double" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="requestedDate" type="xsd:date" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="created" type="xsd:date" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
>         </xsd:sequence>
>         <xsd:attribute name="xmlId" type="xsd:ID"/>
>     </xsd:complexType>
>     <xsd:complexType name="SoLSch">
>         <xsd:sequence>
>             <xsd:element name="requestedDate" type="xsd:date" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="quantity" type="xsd:double" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="created" type="xsd:date" minOccurs="1" maxOccurs="1"/>
>             <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
>         </xsd:sequence>
>         <xsd:attribute name="xmlId" type="xsd:ID"/>
>     </xsd:complexType>
>     <xsd:element name="DataGraphRootEl" type="impl:DataGraphRoot"/>
>     <xsd:complexType name="DataGraphRoot">
>         <xsd:sequence>
>             <xsd:element name="customer" type="impl:Customer" minOccurs="0" maxOccurs="unbounded" />
>             <xsd:element name="product" type="impl:Product" minOccurs="0" maxOccurs="unbounded" />
>             <xsd:element name="part" type="impl:Part" minOccurs="0" maxOccurs="unbounded" />
>             <xsd:element name="soH" type="impl:SoH" minOccurs="0" maxOccurs="unbounded" />
>         </xsd:sequence>
>     </xsd:complexType>
> </xsd:schema>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.