Static code generator template bugs
-----------------------------------
Key: TUSCANY-1120
URL: https://issues.apache.org/jira/browse/TUSCANY-1120
Project: Tuscany
Issue Type: Bug
Components: Java SDO Tools
Affects Versions: Java-SDO-M3
Reporter: Frank Budinsky
Fix For: Java-SDO-M3
There are some serious problems with the new SDO (noEMF) codegen templates:
Problem 1
========
SDOClass.javajet uses containment-type lists (EObjectContainmentEList) for all
List-type properties. List property generation seems to be completely broken in
general. The template isn't handling bi-directional (e.g.,
EObjectWithInverseEList), proxy resolving, unsettable, etc. Every flavor of
list other than basic containment is broken with the new template.
This part of the template should not always be calling createPropertyList with
the containment list kind:
<%=genFeature.getSafeName()%> = createPropertyList(ListKind.CONTAINMENT,
<%=genFeature.getListItemType()%>.class, ...
It needs to pass a "correct" kind indicator, which createPropertyList() would
use to create the correct kind of EMF List. It used to just new up the right
kind of EList, but createPropertyList() was added as the indirect way to do it
without having an EMF dependency in the generated code. The new noEMF template
should have all the same logic as before, but just using
"createPropertyList(<some kind>, ...)" instead of "new E<some kind>List(...)".
Note that the implementation of createPropertyList() in class FactoryBase, also
needs to be completed.
Note: that the built-in model, sdoModel.xsd, need to be regenerated when this
is fixed - see TUSCANY-1095.
Problem 2
========
SDOFactoryClass.javajet is not adding the correct xsdMapping annotations for
open or mixed properties (and maybe others).
The following changes were made manually to fix the generated
SequencesFactoryImpl.java test model. They illustrate the changes that are
needed in the generator.
---
java/sdo/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java
(revision 505122)
+++
java/sdo/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java
(working copy)
@@ -346,13 +346,13 @@
new String[]
{
"name", "MixedQuote",
- "kind", "elementOnly"
+ "kind", "mixed"
});
addXSDMapping
((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.MIXED),
new String[]
{
- "kind", "element",
+ "kind", "elementWildcard",
"name", "mixed"
});
@@ -434,13 +434,13 @@
new String[]
{
"name", "MixedRepeatingChoice",
- "kind", "elementOnly"
+ "kind", "mixed"
});
addXSDMapping
((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.MIXED),
new String[]
{
- "kind", "element",
+ "kind", "elementWildcard",
"name", "mixed"
});
@@ -448,8 +448,8 @@
((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.GROUP),
new String[]
{
- "kind", "element",
- "name", "group"
+ "kind", "group",
+ "name", "group:1"
});
addXSDMapping
@@ -457,7 +457,8 @@
new String[]
{
"kind", "element",
- "name", "a"
+ "name", "a",
+ "group", "#group:1"
});
addXSDMapping
@@ -465,7 +466,8 @@
new String[]
{
"kind", "element",
- "name", "b"
+ "name", "b",
+ "group", "#group:1"
});
// TODO - kdk - is the order right? should kind, elementOnly be first
@@ -480,8 +482,8 @@
((Property)repeatingChoiceType.getProperties().get(RepeatingChoiceImpl.GROUP),
new String[]
{
- "kind", "element",
- "name", "group"
+ "kind", "group",
+ "name", "group:0"
});
addXSDMapping
@@ -489,7 +491,8 @@
new String[]
{
"kind", "element",
- "name", "a"
+ "name", "a",
+ "group", "#group:0"
});
addXSDMapping
@@ -497,7 +500,8 @@
new String[]
{
"kind", "element",
- "name", "b"
+ "name", "b",
+ "group", "#group:0"
});
// TODO - kdk - is the order right? should kind, elementOnly be first
@@ -512,8 +516,8 @@
((Property)twoRCsType.getProperties().get(TwoRCsImpl.GROUP),
new String[]
{
- "kind", "element",
- "name", "group"
+ "kind", "group",
+ "name", "group:0"
});
addXSDMapping
@@ -521,7 +525,8 @@
new String[]
{
"kind", "element",
- "name", "a"
+ "name", "a",
+ "group", "#group:0"
});
addXSDMapping
@@ -529,7 +534,8 @@
new String[]
{
"kind", "element",
- "name", "b"
+ "name", "b",
+ "group", "#group:0"
});
addXSDMapping
@@ -544,8 +550,8 @@
((Property)twoRCsType.getProperties().get(TwoRCsImpl.GROUP1),
new String[]
{
- "kind", "element",
- "name", "group1"
+ "kind", "group",
+ "name", "group:4"
});
addXSDMapping
@@ -553,7 +559,8 @@
new String[]
{
"kind", "element",
- "name", "y"
+ "name", "y",
+ "group", "#group:4"
});
addXSDMapping
@@ -561,7 +568,8 @@
new String[]
{
"kind", "element",
- "name", "z"
+ "name", "z",
+ "group", "#group:4"
});
// TODO - kdk - is the order right? should kind, elementOnly be first
@@ -570,13 +578,13 @@
new String[]
{
"name", "TwoRCsMixed",
- "kind", "elementOnly"
+ "kind", "mixed"
});
addXSDMapping
((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.MIXED),
new String[]
{
- "kind", "element",
+ "kind", "elementWildcard",
"name", "mixed"
});
@@ -584,8 +592,8 @@
((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.GROUP),
new String[]
{
- "kind", "element",
- "name", "group"
+ "kind", "group",
+ "name", "group:1"
});
addXSDMapping
@@ -593,7 +601,8 @@
new String[]
{
"kind", "element",
- "name", "a"
+ "name", "a",
+ "group", "#group:1"
});
addXSDMapping
@@ -601,7 +610,8 @@
new String[]
{
"kind", "element",
- "name", "b"
+ "name", "b",
+ "group", "#group:1"
});
addXSDMapping
@@ -616,8 +626,8 @@
((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.GROUP1),
new String[]
{
- "kind", "element",
- "name", "group1"
+ "kind", "group",
+ "name", "group:5"
});
addXSDMapping
@@ -625,7 +635,8 @@
new String[]
{
"kind", "element",
- "name", "y"
+ "name", "y",
+ "group", "#group:5"
});
addXSDMapping
@@ -633,7 +644,8 @@
new String[]
{
"kind", "element",
- "name", "z"
+ "name", "z",
+ "group", "#group:5"
});
--
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]