Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-1120

Static code generator template bugs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Java-SDO-beta1
    • Java-SDO-beta1
    • Java SDO Tools
    • None
    • Patch Available

    Description

      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" }

      );

      Attachments

        1. 1120a.patch
          261 kB
          David T. Adcox
        2. 1120afix.patch
          2 kB
          David T. Adcox

        Activity

          People

            Unassigned Unassigned
            frankb Frank John Budinsky
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: