Revision: 3388
Author: [email protected]
Date: Fri Mar 19 15:34:23 2010
Log: The OLAP model objects can now be persisted and loaded with the server. This includes changes to the model to add a constructor that accepts all mandatory properties on all objects. Also to make this work SPObjects can now define to have children of an interface or abstract class and the list can contain different implementations and can be correctly persisted
to and loaded from the server.
http://code.google.com/p/power-architect/source/detail?r=3388

Modified:
 /trunk/src/ca/sqlpower/architect/olap/MondrianModel.java
 /trunk/src/ca/sqlpower/architect/olap/xml-to-java-classes.xsl

=======================================
--- /trunk/src/ca/sqlpower/architect/olap/MondrianModel.java Fri Mar 12 15:01:53 2010 +++ /trunk/src/ca/sqlpower/architect/olap/MondrianModel.java Fri Mar 19 15:34:23 2010
@@ -7,6 +7,8 @@
 import java.util.Collections;

 import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Constructor;
+import ca.sqlpower.object.annotation.ConstructorParameter;
 import ca.sqlpower.object.annotation.Accessor;
 import ca.sqlpower.object.annotation.Mutator;
 import ca.sqlpower.object.annotation.NonProperty;
@@ -31,6 +33,30 @@
     public Schema() {
         setName("New Schema");
     }
+
+
+    /**
+     * Creates a new Schema with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Schema(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "measuresCaption")
+        String measuresCaption
+        , @ConstructorParameter(propertyName = "defaultRole")
+        String defaultRole
+    ) {
+        this();
+        setName(name);
+
+        setMeasuresCaption(measuresCaption);
+
+        setDefaultRole(defaultRole);
+
+    }
+

     /**
      * Creates a new Schema with all
@@ -774,6 +800,30 @@
     public CubeDimension() {
     setName("New CubeDimension");
     }
+
+
+    /**
+     * Creates a new  with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public CubeDimension(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+        , @ConstructorParameter(propertyName = "foreignKey")
+        String foreignKey
+    ) {
+        this();
+        setName(name);
+
+        setCaption(caption);
+
+        setForeignKey(foreignKey);
+
+    }
+

     /**
      * Creates a new CubeDimension with all
@@ -948,6 +998,38 @@
     public Cube() {
         setName("New Cube");
     }
+
+
+    /**
+     * Creates a new Cube with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Cube(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+        , @ConstructorParameter(propertyName = "defaultMeasure")
+        String defaultMeasure
+        , @ConstructorParameter(propertyName = "cache")
+        Boolean cache
+        , @ConstructorParameter(propertyName = "enabled")
+        Boolean enabled
+    ) {
+        this();
+        setName(name);
+
+        setCaption(caption);
+
+        setDefaultMeasure(defaultMeasure);
+
+        setCache(cache);
+
+        setEnabled(enabled);
+
+    }
+

     /**
      * Creates a new Cube with all
@@ -1540,6 +1622,34 @@
     public VirtualCube() {
         setName("New VirtualCube");
     }
+
+
+    /**
+     * Creates a new VirtualCube with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public VirtualCube(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "enabled")
+        Boolean enabled
+        , @ConstructorParameter(propertyName = "defaultMeasure")
+        String defaultMeasure
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+    ) {
+        this();
+        setName(name);
+
+        setEnabled(enabled);
+
+        setDefaultMeasure(defaultMeasure);
+
+        setCaption(caption);
+
+    }
+

     /**
      * Creates a new VirtualCube with all
@@ -2105,6 +2215,22 @@
     public CubeUsages() {
         setName("New CubeUsages");
     }
+
+
+    /**
+     * Creates a new CubeUsages with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public CubeUsages(
+        @ConstructorParameter(propertyName = "name") String name
+
+    ) {
+        this();
+        setName(name);
+
+    }
+

     /**
      * Creates a new CubeUsages with all
@@ -2293,6 +2419,30 @@
     public CubeUsage() {
         setName("New CubeUsage");
     }
+
+
+    /**
+     * Creates a new CubeUsage with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public CubeUsage(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "cubeName")
+        String cubeName
+        , @ConstructorParameter(propertyName = "ignoreUnrelatedDimensions")
+        Boolean ignoreUnrelatedDimensions
+    ) {
+        this();
+        setName(name);
+
+        setCubeName(cubeName);
+
+        setIgnoreUnrelatedDimensions(ignoreUnrelatedDimensions);
+
+    }
+

     /**
      * Creates a new CubeUsage with all
@@ -2440,6 +2590,34 @@
     public VirtualCubeDimension() {
         setName("New VirtualCubeDimension");
     }
+
+
+    /**
+     * Creates a new VirtualCubeDimension with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public VirtualCubeDimension(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "cubeName")
+        String cubeName
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+        , @ConstructorParameter(propertyName = "foreignKey")
+        String foreignKey
+    ) {
+        this();
+        setName(name);
+
+        setCubeName(cubeName);
+
+        setCaption(caption);
+
+        setForeignKey(foreignKey);
+
+    }
+

     /**
      * Creates a new VirtualCubeDimension with all
@@ -2591,6 +2769,30 @@
     public VirtualCubeMeasure() {
         setName("New VirtualCubeMeasure");
     }
+
+
+    /**
+     * Creates a new VirtualCubeMeasure with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public VirtualCubeMeasure(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "cubeName")
+        String cubeName
+        , @ConstructorParameter(propertyName = "visible")
+        Boolean visible
+    ) {
+        this();
+        setName(name);
+
+        setCubeName(cubeName);
+
+        setVisible(visible);
+
+    }
+

     /**
      * Creates a new VirtualCubeMeasure with all
@@ -2762,6 +2964,42 @@
     public DimensionUsage() {
         setName("New DimensionUsage");
     }
+
+
+    /**
+     * Creates a new DimensionUsage with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public DimensionUsage(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "source")
+        String source
+        , @ConstructorParameter(propertyName = "level")
+        String level
+        , @ConstructorParameter(propertyName = "usagePrefix")
+        String usagePrefix
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+        , @ConstructorParameter(propertyName = "foreignKey")
+        String foreignKey
+    ) {
+        this();
+        setName(name);
+
+        setSource(source);
+
+        setLevel(level);
+
+        setUsagePrefix(usagePrefix);
+
+        setCaption(caption);
+
+        setForeignKey(foreignKey);
+
+    }
+

     /**
      * Creates a new DimensionUsage with all
@@ -2944,6 +3182,40 @@
     public Dimension() {
         setName("New Dimension");
     }
+
+
+    /**
+     * Creates a new Dimension with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Dimension(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "type")
+        String type
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+        , @ConstructorParameter(propertyName = "usagePrefix")
+        String usagePrefix
+        , @ConstructorParameter(propertyName = "foreignKey")
+        String foreignKey
+    ) {
+        this();
+        setName(name);
+
+        setType(type);
+
+        setCaption(caption);
+
+        setUsagePrefix(usagePrefix);
+
+        setCaption(caption);
+
+        setForeignKey(foreignKey);
+
+    }
+

     /**
      * Creates a new Dimension with all
@@ -3243,6 +3515,58 @@
     public Hierarchy() {
         setName("New Hierarchy");
     }
+
+
+    /**
+     * Creates a new Hierarchy with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Hierarchy(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "hasAll")
+        Boolean hasAll
+        , @ConstructorParameter(propertyName = "allMemberName")
+        String allMemberName
+        , @ConstructorParameter(propertyName = "allMemberCaption")
+        String allMemberCaption
+        , @ConstructorParameter(propertyName = "allLevelName")
+        String allLevelName
+        , @ConstructorParameter(propertyName = "primaryKey")
+        String primaryKey
+        , @ConstructorParameter(propertyName = "primaryKeyTable")
+        String primaryKeyTable
+        , @ConstructorParameter(propertyName = "defaultMember")
+        String defaultMember
+        , @ConstructorParameter(propertyName = "memberReaderClass")
+        String memberReaderClass
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+    ) {
+        this();
+        setName(name);
+
+        setHasAll(hasAll);
+
+        setAllMemberName(allMemberName);
+
+        setAllMemberCaption(allMemberCaption);
+
+        setAllLevelName(allLevelName);
+
+        setPrimaryKey(primaryKey);
+
+        setPrimaryKeyTable(primaryKeyTable);
+
+        setDefaultMember(defaultMember);
+
+        setMemberReaderClass(memberReaderClass);
+
+        setCaption(caption);
+
+    }
+

     /**
      * Creates a new Hierarchy with all
@@ -3796,6 +4120,78 @@
     public Level() {
         setName("New Level");
     }
+
+
+    /**
+     * Creates a new Level with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Level(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "approxRowCount")
+        String approxRowCount
+        , @ConstructorParameter(propertyName = "table")
+        String table
+        , @ConstructorParameter(propertyName = "column")
+        String column
+        , @ConstructorParameter(propertyName = "nameColumn")
+        String nameColumn
+        , @ConstructorParameter(propertyName = "ordinalColumn")
+        String ordinalColumn
+        , @ConstructorParameter(propertyName = "parentColumn")
+        String parentColumn
+        , @ConstructorParameter(propertyName = "nullParentValue")
+        String nullParentValue
+        , @ConstructorParameter(propertyName = "type")
+        String type
+        , @ConstructorParameter(propertyName = "uniqueMembers")
+        Boolean uniqueMembers
+        , @ConstructorParameter(propertyName = "levelType")
+        String levelType
+        , @ConstructorParameter(propertyName = "hideMemberIf")
+        String hideMemberIf
+        , @ConstructorParameter(propertyName = "formatter")
+        String formatter
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+        , @ConstructorParameter(propertyName = "captionColumn")
+        String captionColumn
+    ) {
+        this();
+        setName(name);
+
+        setApproxRowCount(approxRowCount);
+
+        setTable(table);
+
+        setColumn(column);
+
+        setNameColumn(nameColumn);
+
+        setOrdinalColumn(ordinalColumn);
+
+        setParentColumn(parentColumn);
+
+        setNullParentValue(nullParentValue);
+
+        setType(type);
+
+        setUniqueMembers(uniqueMembers);
+
+        setLevelType(levelType);
+
+        setHideMemberIf(hideMemberIf);
+
+        setFormatter(formatter);
+
+        setCaption(caption);
+
+        setCaptionColumn(captionColumn);
+
+    }
+

     /**
      * Creates a new Level with all
@@ -4594,6 +4990,30 @@
     public Closure() {
         setName("New Closure");
     }
+
+
+    /**
+     * Creates a new Closure with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Closure(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "parentColumn")
+        String parentColumn
+        , @ConstructorParameter(propertyName = "childColumn")
+        String childColumn
+    ) {
+        this();
+        setName(name);
+
+        setParentColumn(parentColumn);
+
+        setChildColumn(childColumn);
+
+    }
+

     /**
      * Creates a new Closure with all
@@ -4795,6 +5215,38 @@
     public Property() {
         setName("New Property");
     }
+
+
+    /**
+     * Creates a new Property with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Property(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "column")
+        String column
+        , @ConstructorParameter(propertyName = "type")
+        String type
+        , @ConstructorParameter(propertyName = "formatter")
+        String formatter
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+    ) {
+        this();
+        setName(name);
+
+        setColumn(column);
+
+        setType(type);
+
+        setFormatter(formatter);
+
+        setCaption(caption);
+
+    }
+

     /**
      * Creates a new Property with all
@@ -5009,6 +5461,50 @@
     public Measure() {
         setName("New Measure");
     }
+
+
+    /**
+     * Creates a new Measure with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Measure(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "column")
+        String column
+        , @ConstructorParameter(propertyName = "datatype")
+        String datatype
+        , @ConstructorParameter(propertyName = "formatString")
+        String formatString
+        , @ConstructorParameter(propertyName = "aggregator")
+        String aggregator
+        , @ConstructorParameter(propertyName = "formatter")
+        String formatter
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+        , @ConstructorParameter(propertyName = "visible")
+        Boolean visible
+    ) {
+        this();
+        setName(name);
+
+        setColumn(column);
+
+        setDatatype(datatype);
+
+        setFormatString(formatString);
+
+        setAggregator(aggregator);
+
+        setFormatter(formatter);
+
+        setCaption(caption);
+
+        setVisible(visible);
+
+    }
+

     /**
      * Creates a new Measure with all
@@ -5438,6 +5934,42 @@
     public CalculatedMember() {
         setName("New CalculatedMember");
     }
+
+
+    /**
+     * Creates a new CalculatedMember with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public CalculatedMember(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "formatString")
+        String formatString
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+        , @ConstructorParameter(propertyName = "formula")
+        String formula
+        , @ConstructorParameter(propertyName = "dimension")
+        String dimension
+        , @ConstructorParameter(propertyName = "visible")
+        Boolean visible
+    ) {
+        this();
+        setName(name);
+
+        setFormatString(formatString);
+
+        setCaption(caption);
+
+        setFormula(formula);
+
+        setDimension(dimension);
+
+        setVisible(visible);
+
+    }
+

     /**
      * Creates a new CalculatedMember with all
@@ -5816,6 +6348,34 @@
     public CalculatedMemberProperty() {
         setName("New CalculatedMemberProperty");
     }
+
+
+    /**
+     * Creates a new CalculatedMemberProperty with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public CalculatedMemberProperty(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "caption")
+        String caption
+        , @ConstructorParameter(propertyName = "expression")
+        String expression
+        , @ConstructorParameter(propertyName = "value")
+        String value
+    ) {
+        this();
+        setName(name);
+
+        setCaption(caption);
+
+        setExpression(expression);
+
+        setValue(value);
+
+    }
+

     /**
      * Creates a new CalculatedMemberProperty with all
@@ -6028,6 +6588,26 @@
     public NamedSet() {
         setName("New NamedSet");
     }
+
+
+    /**
+     * Creates a new NamedSet with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public NamedSet(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "formula")
+        String formula
+    ) {
+        this();
+        setName(name);
+
+        setFormula(formula);
+
+    }
+

     /**
      * Creates a new NamedSet with all
@@ -6234,6 +6814,22 @@
     public Formula() {
         setName("New Formula");
     }
+
+
+    /**
+     * Creates a new Formula with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Formula(
+        @ConstructorParameter(propertyName = "name") String name
+
+    ) {
+        this();
+        setName(name);
+
+    }
+

     /**
      * Creates a new Formula with all
@@ -6351,6 +6947,26 @@
     public MemberReaderParameter() {
         setName("New MemberReaderParameter");
     }
+
+
+    /**
+     * Creates a new MemberReaderParameter with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public MemberReaderParameter(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "value")
+        String value
+    ) {
+        this();
+        setName(name);
+
+        setValue(value);
+
+    }
+

     /**
      * Creates a new MemberReaderParameter with all
@@ -6491,6 +7107,22 @@
     public RelationOrJoin() {
     setName("New RelationOrJoin");
     }
+
+
+    /**
+     * Creates a new  with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public RelationOrJoin(
+        @ConstructorParameter(propertyName = "name") String name
+
+    ) {
+        this();
+        setName(name);
+
+    }
+

     /**
      * Creates a new RelationOrJoin with all
@@ -6592,6 +7224,22 @@
     public Relation() {
     setName("New Relation");
     }
+
+
+    /**
+     * Creates a new  with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Relation(
+        @ConstructorParameter(propertyName = "name") String name
+
+    ) {
+        this();
+        setName(name);
+
+    }
+

     /**
      * Creates a new Relation with all
@@ -6699,6 +7347,26 @@
     public View() {
         setName("New View");
     }
+
+
+    /**
+     * Creates a new View with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public View(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "alias")
+        String alias
+    ) {
+        this();
+        setName(name);
+
+        setAlias(alias);
+
+    }
+

     /**
      * Creates a new View with all
@@ -6912,6 +7580,26 @@
     public SQL() {
         setName("New SQL");
     }
+
+
+    /**
+     * Creates a new SQL with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public SQL(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "dialect")
+        String dialect
+    ) {
+        this();
+        setName(name);
+
+        setDialect(dialect);
+
+    }
+

     /**
      * Creates a new SQL with all
@@ -7052,6 +7740,38 @@
     public Join() {
         setName("New Join");
     }
+
+
+    /**
+     * Creates a new Join with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Join(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "leftAlias")
+        String leftAlias
+        , @ConstructorParameter(propertyName = "leftKey")
+        String leftKey
+        , @ConstructorParameter(propertyName = "rightAlias")
+        String rightAlias
+        , @ConstructorParameter(propertyName = "rightKey")
+        String rightKey
+    ) {
+        this();
+        setName(name);
+
+        setLeftAlias(leftAlias);
+
+        setLeftKey(leftKey);
+
+        setRightAlias(rightAlias);
+
+        setRightKey(rightKey);
+
+    }
+

     /**
      * Creates a new Join with all
@@ -7346,6 +8066,30 @@
     public Table() {
         setName("New Table");
     }
+
+
+    /**
+     * Creates a new Table with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public Table(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "schema")
+        String schema
+        , @ConstructorParameter(propertyName = "alias")
+        String alias
+    ) {
+        this();
+        setName(name);
+
+        setSchema(schema);
+
+        setAlias(alias);
+
+    }
+

     /**
      * Creates a new Table with all
@@ -7728,6 +8472,26 @@
     public InlineTable() {
         setName("New InlineTable");
     }
+
+
+    /**
+     * Creates a new InlineTable with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public InlineTable(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "alias")
+        String alias
+    ) {
+        this();
+        setName(name);
+
+        setAlias(alias);
+
+    }
+

     /**
      * Creates a new InlineTable with all
@@ -7959,6 +8723,22 @@
     public ColumnDefs() {
         setName("New ColumnDefs");
     }
+
+
+    /**
+     * Creates a new ColumnDefs with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public ColumnDefs(
+        @ConstructorParameter(propertyName = "name") String name
+
+    ) {
+        this();
+        setName(name);
+
+    }
+

     /**
      * Creates a new ColumnDefs with all
@@ -8149,6 +8929,26 @@
     public ColumnDef() {
         setName("New ColumnDef");
     }
+
+
+    /**
+     * Creates a new ColumnDef with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public ColumnDef(
+        @ConstructorParameter(propertyName = "name") String name
+
+        , @ConstructorParameter(propertyName = "type")
+        String type
***The diff for this file has been truncated for email.***
=======================================
--- /trunk/src/ca/sqlpower/architect/olap/xml-to-java-classes.xsl Fri Mar 12 15:01:53 2010 +++ /trunk/src/ca/sqlpower/architect/olap/xml-to-java-classes.xsl Fri Mar 19 15:34:23 2010
@@ -26,6 +26,8 @@
 import java.util.Collections;

 import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Constructor;
+import ca.sqlpower.object.annotation.ConstructorParameter;
 import ca.sqlpower.object.annotation.Accessor;
 import ca.sqlpower.object.annotation.Mutator;
 import ca.sqlpower.object.annotation.NonProperty;
@@ -57,6 +59,10 @@
     public <xsl:value-of select="@type"/>() {
         setName("New <xsl:value-of select="@type"/>");
     }
+
+    <xsl:call-template name="annotated-constructor">
+        <xsl:with-param name="class-name" select="@type"/>
+    </xsl:call-template>

     /**
      * Creates a new <xsl:value-of select="@type"/> with all
@@ -96,6 +102,91 @@
 } // end of element <xsl:value-of select="@type"/>
 </xsl:template>

+<!-- Creates a constructor that is annotated to create a persister helper that accepts all mandatory values. -->
+<xsl:template name="annotated-constructor">
+<xsl:param name="class-name"/>
+    /**
+     * Creates a new <xsl:value-of select="@type"/> with all mandatory
+     * values passed in.
+     */
+    @Constructor
+    public <xsl:value-of select="$class-name"/>(
+        @ConstructorParameter(propertyName = "name") String name
+        <xsl:call-template name="annotated-constructor-arguments">
+            <xsl:with-param name="class-name" select="$class-name"/>
+            <xsl:with-param name="processed-names" select=". | ."/>
+        </xsl:call-template>
+    ) {
+        this();
+        setName(name);
+        <xsl:call-template name="annotated-constructor-setters">
+            <xsl:with-param name="class-name" select="$class-name"/>
+        </xsl:call-template>
+    }
+</xsl:template>
+
+<xsl:template name="annotated-constructor-arguments">
+<xsl:param name="class-name"/>
+<xsl:param name="processed-names"/>
+<xsl:for-each select="../eleme...@type = $class-name]/attribu...@name != 'name']">
+        <xsl:call-template name="annotated-constructor-argument">
+            <xsl:with-param name="property-name" select="@name"/>
+ <xsl:with-param name="processed-names" select="$processed-names"/>
+        </xsl:call-template>
+</xsl:for-each>
+<xsl:for-each select="../cla...@class= $class-name]/attribu...@name != 'name']">
+        <xsl:call-template name="annotated-constructor-argument">
+            <xsl:with-param name="property-name" select="@name"/>
+ <xsl:with-param name="processed-names" select="$processed-names"/>
+        </xsl:call-template>
+</xsl:for-each>
+<xsl:if test="../eleme...@type = $class-name and @class]">
+       <xsl:call-template name="annotated-constructor-arguments">
+               <xsl:with-param name="class-name" select="@class" />
+ <xsl:with-param name="processed-names" select="$processed-names | attribu...@name != 'name']" />
+       </xsl:call-template>
+</xsl:if>
+<xsl:if test="../cla...@class = $class-name and @superclass]">
+       <xsl:call-template name="annotated-constructor-arguments">
+               <xsl:with-param name="class-name" select="@superclass" />
+ <xsl:with-param name="processed-names" select="$processed-names | attribu...@name != 'name']" />
+       </xsl:call-template>
+</xsl:if>
+</xsl:template>
+
+<xsl:template name="annotated-constructor-argument">
+<xsl:param name="property-name"/>
+<xsl:param name="processed-names"/>
+    <xsl:if test="not($processed-nam...@name = $property-name])">
+ , @ConstructorParameter(propertyName = "<xsl:value-of select="$property-name"/>") + <xsl:call-template name="attribute-type"/><xsl:text> </xsl:text><xsl:value-of select="$property-name"/>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="annotated-constructor-setters">
+<xsl:param name="class-name"/>
+<xsl:for-each select="../eleme...@type = $class-name]/Attribute">
+    <xsl:if test="@name != 'name'">
+ set<xsl:call-template name="name-initcap"/>(<xsl:value-of select="@name"/>);
+    </xsl:if>
+</xsl:for-each>
+<xsl:for-each select="../cla...@class= $class-name]/Attribute">
+    <xsl:if test="@name != 'name'">
+ set<xsl:call-template name="name-initcap"/>(<xsl:value-of select="@name"/>);
+    </xsl:if>
+</xsl:for-each>
+<xsl:if test="../eleme...@type = $class-name and @class]">
+    <xsl:call-template name="annotated-constructor-setters">
+        <xsl:with-param name="class-name" select="@class" />
+    </xsl:call-template>
+</xsl:if>
+<xsl:if test="../cla...@class = $class-name and @superclass]">
+    <xsl:call-template name="annotated-constructor-setters">
+        <xsl:with-param name="class-name" select="@superclass" />
+    </xsl:call-template>
+</xsl:if>
+</xsl:template>
+
 <!-- Returns the correct superclass for the current Element element -->
 <xsl:template name="superclass-of-element">
   <xsl:choose>
@@ -120,6 +211,10 @@
     public <xsl:value-of select="@class"/>() {
     setName("New <xsl:value-of select="@class"/>");
     }
+
+    <xsl:call-template name="annotated-constructor">
+        <xsl:with-param name="class-name" select="@class"/>
+    </xsl:call-template>

     /**
      * Creates a new <xsl:value-of select="@class"/> with all

To unsubscribe from this group, send email to 
architect-commits+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to