More impreovements based on experience with ASL
This commit is contained in:
		
							parent
							
								
									e423b325a4
								
							
						
					
					
						commit
						95e8e5ae30
					
				
					 4 changed files with 95 additions and 66 deletions
				
			
		| 
						 | 
					@ -9,8 +9,8 @@
 | 
				
			||||||
    Transform ADL into (partial) controller classes
 | 
					    Transform ADL into (partial) controller classes
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    $Author: sb $
 | 
					    $Author: sb $
 | 
				
			||||||
    $Revision: 1.12 $
 | 
					    $Revision: 1.13 $
 | 
				
			||||||
    $Date: 2008-03-04 17:30:52 $
 | 
					    $Date: 2008-03-05 11:05:12 $
 | 
				
			||||||
  -->
 | 
					  -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!-- WARNING WARNING WARNING: Do NOT reformat this file! 
 | 
					  <!-- WARNING WARNING WARNING: Do NOT reformat this file! 
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,7 @@
 | 
				
			||||||
    with the revision number of the generated file if the generated file is 
 | 
					    with the revision number of the generated file if the generated file is 
 | 
				
			||||||
    stored to CVS -->
 | 
					    stored to CVS -->
 | 
				
			||||||
      <xsl:variable name="transform-rev1"
 | 
					      <xsl:variable name="transform-rev1"
 | 
				
			||||||
                    select="substring( '$Revision: 1.12 $', 11)"/>
 | 
					                    select="substring( '$Revision: 1.13 $', 11)"/>
 | 
				
			||||||
      <xsl:variable name="transform-revision"
 | 
					      <xsl:variable name="transform-revision"
 | 
				
			||||||
                    select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
 | 
					                    select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -172,11 +172,30 @@ namespace <xsl:value-of select="$controllerns"/> {
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          /* it's existing, retrieve it */
 | 
					          /* it's existing, retrieve it */
 | 
				
			||||||
        <!-- TODO: this does not correctly handle entities with composite primary keys -->
 | 
					          <!-- TODO: this does not correctly handle entities with composite primary keys -->
 | 
				
			||||||
 | 
					          <xsl:choose>
 | 
				
			||||||
 | 
					            <xsl:when test="adl:key/adl:property[position()=1]/@type='entity'">
 | 
				
			||||||
 | 
					              <!-- Maybe TODO: this doesn't work recursively - if an entity has a key which is an entity 
 | 
				
			||||||
 | 
					              and the key of that entity is an entity, you're on your own, mate! -->
 | 
				
			||||||
 | 
					              <xsl:variable name="keyentity" select="adl:key/adl:property[position()=1]/@entity"/>
 | 
				
			||||||
 | 
					          <xsl:value-of select="$keytype"/> eid =
 | 
				
			||||||
 | 
					            hibernator.CreateCriteria( typeof( <xsl:value-of select="$keytype"/>))
 | 
				
			||||||
 | 
					              .Add(Expression.Eq( "<xsl:value-of select="//adl:entity[@name=$keyentity]/adl:key/adl:property[position()=1]/@name"/>", id))
 | 
				
			||||||
 | 
					              .UniqueResult<<xsl:value-of select="$keytype"/>>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          record =
 | 
					          record =
 | 
				
			||||||
            hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>))
 | 
					            hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>))
 | 
				
			||||||
              .Add(Expression.Eq("<xsl:value-of select="$key"/>", id))
 | 
					              .Add(Expression.Eq("<xsl:value-of select="$key"/>", eid))
 | 
				
			||||||
              .UniqueResult<<xsl:value-of select="concat( $entityns, '.', @name)"/>>();
 | 
					              .UniqueResult<<xsl:value-of select="concat( $entityns, '.', @name)"/>>();
 | 
				
			||||||
 | 
					            </xsl:when>
 | 
				
			||||||
 | 
					            <xsl:otherwise>
 | 
				
			||||||
 | 
					            record =
 | 
				
			||||||
 | 
					              hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>))
 | 
				
			||||||
 | 
					                .Add(Expression.Eq("<xsl:value-of select="$key"/>", id))
 | 
				
			||||||
 | 
					                .UniqueResult<<xsl:value-of select="concat( $entityns, '.', @name)"/>>();
 | 
				
			||||||
 | 
					            </xsl:otherwise>
 | 
				
			||||||
 | 
					          </xsl:choose>
 | 
				
			||||||
 | 
					          
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ( record != null)
 | 
					        if ( record != null)
 | 
				
			||||||
| 
						 | 
					@ -317,7 +336,7 @@ namespace <xsl:value-of select="$controllerns"/> {
 | 
				
			||||||
        Session[ NHibernateHelper.USERTOKEN],
 | 
					        Session[ NHibernateHelper.USERTOKEN],
 | 
				
			||||||
        Session[NHibernateHelper.PASSTOKEN]
 | 
					        Session[NHibernateHelper.PASSTOKEN]
 | 
				
			||||||
      </xsl:if>);
 | 
					      </xsl:if>);
 | 
				
			||||||
      }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      <xsl:call-template name="menus">
 | 
					      <xsl:call-template name="menus">
 | 
				
			||||||
              <xsl:with-param name="entity" select="."/>
 | 
					              <xsl:with-param name="entity" select="."/>
 | 
				
			||||||
| 
						 | 
					@ -673,16 +692,18 @@ namespace <xsl:value-of select="$controllerns"/> {
 | 
				
			||||||
    <xsl:param name="entity"/>
 | 
					    <xsl:param name="entity"/>
 | 
				
			||||||
    <xsl:if test="not( $entity)">
 | 
					    <xsl:if test="not( $entity)">
 | 
				
			||||||
      <xsl:message terminate="yes">
 | 
					      <xsl:message terminate="yes">
 | 
				
			||||||
        No entity?
 | 
					        ADL: ERROR: No entity passed to template primary-key-csharp-type
 | 
				
			||||||
      </xsl:message>
 | 
					      </xsl:message>
 | 
				
			||||||
    </xsl:if>
 | 
					    </xsl:if>
 | 
				
			||||||
    <xsl:if test="not($entity/adl:key/adl:property)">
 | 
					    <xsl:if test="not($entity/adl:key/adl:property)">
 | 
				
			||||||
      <xsl:message terminate="yes">
 | 
					      <xsl:message terminate="no">
 | 
				
			||||||
        ADL: ERROR: entity '<xsl:value-of select="$entity/@name"/>' has no primary key.
 | 
					        ADL: WARNING: entity '<xsl:value-of select="$entity/@name"/>' has no primary key.
 | 
				
			||||||
 | 
					        You will have to manually edit <xsl:value-of select="concat( $entity/@name, 'Controller.auto.cs')"/>
 | 
				
			||||||
      </xsl:message>
 | 
					      </xsl:message>
 | 
				
			||||||
    </xsl:if>
 | 
					    </xsl:if>
 | 
				
			||||||
    <xsl:call-template name="csharp-type">
 | 
					    <xsl:call-template name="csharp-type">
 | 
				
			||||||
      <xsl:with-param name="property" select="$entity/adl:key/adl:property[ position() = 1]"/>
 | 
					      <xsl:with-param name="property" select="$entity/adl:key/adl:property[ position() = 1]"/>
 | 
				
			||||||
 | 
					      <xsl:with-param name="entityns" select="$entityns"/>
 | 
				
			||||||
    </xsl:call-template>
 | 
					    </xsl:call-template>
 | 
				
			||||||
  </xsl:template>
 | 
					  </xsl:template>
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
| 
						 | 
					@ -690,37 +711,21 @@ namespace <xsl:value-of select="$controllerns"/> {
 | 
				
			||||||
      <!-- return the name of the primary key of the entity with this name -->
 | 
					      <!-- return the name of the primary key of the entity with this name -->
 | 
				
			||||||
      <xsl:param name="entity"/>
 | 
					      <xsl:param name="entity"/>
 | 
				
			||||||
      <xsl:choose>
 | 
					      <xsl:choose>
 | 
				
			||||||
        <xsl:when test="$entity/@natural-key">
 | 
					        <xsl:when test="$entity/adl:key/adl:property[position()=2]">
 | 
				
			||||||
          <xsl:value-of select="$entity/@natural-key"/>
 | 
					          <xsl:message terminate="no">
 | 
				
			||||||
 | 
					            ADL: WARNING: Entity <xsl:value-of select="$entity/@name"/> has a composite primary key.
 | 
				
			||||||
 | 
					            You will need to manually edit <xsl:value-of select="concat( $entity/@name, 'Controller.auto.cs')"/>
 | 
				
			||||||
 | 
					          </xsl:message>
 | 
				
			||||||
 | 
					          <xsl:value-of select="$entity/adl:key/adl:property[position()=1]/@name"/>
 | 
				
			||||||
        </xsl:when>
 | 
					        </xsl:when>
 | 
				
			||||||
        <xsl:when test="$entity/key">
 | 
					        <xsl:when test="$entity/adl:key/adl:property">
 | 
				
			||||||
          <xsl:choose>
 | 
					          <xsl:value-of select="$entity/adl:key/adl:property[position()=1]/@name"/>
 | 
				
			||||||
            <xsl:when test="count($entity/adl:key/adl:property) > 1">
 | 
					 | 
				
			||||||
              <xsl:message terminate="no">
 | 
					 | 
				
			||||||
                ADL: WARNING: entity '<xsl:value-of select="$entity/@name"/>' has a compound primary key;
 | 
					 | 
				
			||||||
                adl2controllerclasses is not yet clever enough to generate appropriate code.
 | 
					 | 
				
			||||||
              </xsl:message>
 | 
					 | 
				
			||||||
            </xsl:when>
 | 
					 | 
				
			||||||
            <xsl:otherwise>
 | 
					 | 
				
			||||||
              <xsl:value-of select="$entity/adl:key/adl:property[position()=1]"/>
 | 
					 | 
				
			||||||
            </xsl:otherwise>
 | 
					 | 
				
			||||||
          </xsl:choose>
 | 
					 | 
				
			||||||
        </xsl:when>
 | 
					        </xsl:when>
 | 
				
			||||||
        <xsl:otherwise>
 | 
					        <xsl:otherwise>
 | 
				
			||||||
          <xsl:choose>
 | 
					          <xsl:message terminate="no">
 | 
				
			||||||
            <xsl:when test="$abstract-key-name-convention='Name'">
 | 
					            ADL: WARNING: Entity <xsl:value-of select="$entity/@name"/> has no primary key.
 | 
				
			||||||
              <xsl:value-of select="@name"/>
 | 
					            You will need to manually edit <xsl:value-of select="concat( $entity/@name, 'Controller.auto.cs')"/>
 | 
				
			||||||
            </xsl:when>
 | 
					          </xsl:message>
 | 
				
			||||||
            <xsl:when test="$abstract-key-name-convention = 'NameId'">
 | 
					 | 
				
			||||||
              <xsl:value-of select="concat( $entity/@name, 'Id')"/>
 | 
					 | 
				
			||||||
            </xsl:when>
 | 
					 | 
				
			||||||
            <xsl:when test="$abstract-key-name-convention = 'Name_Id'">
 | 
					 | 
				
			||||||
              <xsl:value-of select="concat( $entity/@name, '_Id')"/>
 | 
					 | 
				
			||||||
            </xsl:when>
 | 
					 | 
				
			||||||
            <xsl:otherwise>
 | 
					 | 
				
			||||||
              <xsl:value-of select="'Id'"/>
 | 
					 | 
				
			||||||
            </xsl:otherwise>
 | 
					 | 
				
			||||||
          </xsl:choose>
 | 
					 | 
				
			||||||
        </xsl:otherwise>
 | 
					        </xsl:otherwise>
 | 
				
			||||||
      </xsl:choose>
 | 
					      </xsl:choose>
 | 
				
			||||||
    </xsl:template>
 | 
					    </xsl:template>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,8 +8,8 @@
 | 
				
			||||||
    Transform ADL into entity classes
 | 
					    Transform ADL into entity classes
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    $Author: sb $
 | 
					    $Author: sb $
 | 
				
			||||||
    $Revision: 1.9 $
 | 
					    $Revision: 1.10 $
 | 
				
			||||||
    $Date: 2008-03-03 17:35:28 $
 | 
					    $Date: 2008-03-05 11:05:12 $
 | 
				
			||||||
  -->
 | 
					  -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!-- WARNING WARNING WARNING: Do NOT reformat this file! 
 | 
					  <!-- WARNING WARNING WARNING: Do NOT reformat this file! 
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,7 @@
 | 
				
			||||||
    stored to CVS -->
 | 
					    stored to CVS -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <xsl:variable name="transform-rev1"
 | 
					    <xsl:variable name="transform-rev1"
 | 
				
			||||||
                  select="substring( '$Revision: 1.9 $', 11)"/>
 | 
					                  select="substring( '$Revision: 1.10 $', 11)"/>
 | 
				
			||||||
    <xsl:variable name="transform-revision"
 | 
					    <xsl:variable name="transform-revision"
 | 
				
			||||||
                  select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
 | 
					                  select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -301,7 +301,7 @@
 | 
				
			||||||
                <xsl:when test="@cascade='all-delete-orphan'"/>
 | 
					                <xsl:when test="@cascade='all-delete-orphan'"/>
 | 
				
			||||||
                <xsl:when test="@cascade='delete'"/>
 | 
					                <xsl:when test="@cascade='delete'"/>
 | 
				
			||||||
                <xsl:otherwise>
 | 
					                <xsl:otherwise>
 | 
				
			||||||
            if ( <xsl:value-of select="concat( ' _', @name)"/>.Count > 0) {
 | 
					            if ( <xsl:value-of select="concat( ' _', @name)"/> != null && <xsl:value-of select="concat( ' _', @name)"/>.Count > 0) {
 | 
				
			||||||
                bob.AppendFormat("Cannot delete this <xsl:value-of select="../@name"/> as it has {0} dependent <xsl:value-of select="@name"/>; ", <xsl:value-of select="concat( ' _', @name)"/>.Count);
 | 
					                bob.AppendFormat("Cannot delete this <xsl:value-of select="../@name"/> as it has {0} dependent <xsl:value-of select="@name"/>; ", <xsl:value-of select="concat( ' _', @name)"/>.Count);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,8 +12,8 @@
 | 
				
			||||||
    Transform ADL into velocity view templates
 | 
					    Transform ADL into velocity view templates
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    $Author: sb $
 | 
					    $Author: sb $
 | 
				
			||||||
    $Revision: 1.8 $
 | 
					    $Revision: 1.9 $
 | 
				
			||||||
    $Date: 2008-03-04 17:30:52 $
 | 
					    $Date: 2008-03-05 11:05:12 $
 | 
				
			||||||
  -->
 | 
					  -->
 | 
				
			||||||
  <!-- WARNING WARNING WARNING: Do NOT reformat this file! 
 | 
					  <!-- WARNING WARNING WARNING: Do NOT reformat this file! 
 | 
				
			||||||
     Whitespace (or lack of it) is significant! -->
 | 
					     Whitespace (or lack of it) is significant! -->
 | 
				
			||||||
| 
						 | 
					@ -44,7 +44,7 @@
 | 
				
			||||||
    stored to CVS -->
 | 
					    stored to CVS -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <xsl:variable name="transform-rev1"
 | 
					  <xsl:variable name="transform-rev1"
 | 
				
			||||||
                select="substring( '$Revision: 1.8 $', 11)"/>
 | 
					                select="substring( '$Revision: 1.9 $', 11)"/>
 | 
				
			||||||
  <xsl:variable name="transform-revision"
 | 
					  <xsl:variable name="transform-revision"
 | 
				
			||||||
                select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
 | 
					                select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -654,6 +654,7 @@
 | 
				
			||||||
      </td>
 | 
					      </td>
 | 
				
			||||||
      <td class="widget" colspan="2">
 | 
					      <td class="widget" colspan="2">
 | 
				
			||||||
        <xsl:value-of select="concat( '$t.Msg( $instance.', @name, ')')"/>
 | 
					        <xsl:value-of select="concat( '$t.Msg( $instance.', @name, ')')"/>
 | 
				
			||||||
 | 
					        $FormHelper.HiddenField( "instance.<xsl:value-of select="@name"/>")
 | 
				
			||||||
      </td>
 | 
					      </td>
 | 
				
			||||||
    </tr>    
 | 
					    </tr>    
 | 
				
			||||||
  </xsl:template>
 | 
					  </xsl:template>
 | 
				
			||||||
| 
						 | 
					@ -1108,9 +1109,9 @@
 | 
				
			||||||
                <span class="add">
 | 
					                <span class="add">
 | 
				
			||||||
                  <a>
 | 
					                  <a>
 | 
				
			||||||
                    <xsl:attribute name="href">
 | 
					                    <xsl:attribute name="href">
 | 
				
			||||||
                      <xsl:value-of select="concat( ../form[position() = 1]/@name, '.rails')"/>
 | 
					                      <xsl:value-of select="concat( ancestor::adl:entity/adl:form[position()=1]/@name, '.rails')"/>
 | 
				
			||||||
                    </xsl:attribute>
 | 
					                    </xsl:attribute>
 | 
				
			||||||
                    Add a new <xsl:value-of select="../@name"/>
 | 
					                    Add a new <xsl:value-of select="ancestor::adl:entity/@name"/>
 | 
				
			||||||
                  </a>
 | 
					                  </a>
 | 
				
			||||||
                </span>
 | 
					                </span>
 | 
				
			||||||
              </xsl:if>
 | 
					              </xsl:if>
 | 
				
			||||||
| 
						 | 
					@ -1164,15 +1165,17 @@
 | 
				
			||||||
                          #end
 | 
					                          #end
 | 
				
			||||||
                        </xsl:when>
 | 
					                        </xsl:when>
 | 
				
			||||||
                        <xsl:when test="ancestor::adl:entity//adl:property[@name=$prop]/@type='message'">
 | 
					                        <xsl:when test="ancestor::adl:entity//adl:property[@name=$prop]/@type='message'">
 | 
				
			||||||
 | 
					                          #if ( $instance.<xsl:value-of select="$prop"/>)
 | 
				
			||||||
                          $t.Msg( $instance.<xsl:value-of select="$prop"/>)
 | 
					                          $t.Msg( $instance.<xsl:value-of select="$prop"/>)
 | 
				
			||||||
 | 
					                          #end
 | 
				
			||||||
                        </xsl:when>
 | 
					                        </xsl:when>
 | 
				
			||||||
                        <xsl:when test="ancestor::adl:entity//adl:property[@name=$prop]/@type='entity'">
 | 
					                        <xsl:when test="ancestor::adl:entity//adl:property[@name=$prop]/@type='entity'">
 | 
				
			||||||
                            #if( $instance.<xsl:value-of select="$prop"/>)
 | 
					                          #if( $instance.<xsl:value-of select="$prop"/>)
 | 
				
			||||||
                            $instance.<xsl:value-of select="$prop"/>.UserIdentifier
 | 
					                          $instance.<xsl:value-of select="$prop"/>.UserIdentifier
 | 
				
			||||||
                            #end
 | 
					                          #end
 | 
				
			||||||
                        </xsl:when>
 | 
					                        </xsl:when>
 | 
				
			||||||
                        <xsl:otherwise>
 | 
					                        <xsl:otherwise>
 | 
				
			||||||
                            $!instance.<xsl:value-of select="$prop"/>
 | 
					                          $!instance.<xsl:value-of select="$prop"/>
 | 
				
			||||||
                        </xsl:otherwise>
 | 
					                        </xsl:otherwise>
 | 
				
			||||||
                      </xsl:choose>
 | 
					                      </xsl:choose>
 | 
				
			||||||
                    </td>
 | 
					                    </td>
 | 
				
			||||||
| 
						 | 
					@ -1239,19 +1242,29 @@
 | 
				
			||||||
                #end
 | 
					                #end
 | 
				
			||||||
                <tr class="$oddity">
 | 
					                <tr class="$oddity">
 | 
				
			||||||
                  <xsl:for-each select="ancestor::adl:entity//adl:property[@distinct='user']">
 | 
					                  <xsl:for-each select="ancestor::adl:entity//adl:property[@distinct='user']">
 | 
				
			||||||
                <td>
 | 
					                    <td>
 | 
				
			||||||
                  <xsl:choose>
 | 
					                      <xsl:choose>
 | 
				
			||||||
                    <xsl:when test="@type='entity'">
 | 
					                        <xsl:when test="@type = 'date'">
 | 
				
			||||||
                      #if( $instance.<xsl:value-of select="@name"/>)
 | 
					                          #if ( $instance.<xsl:value-of select="@name"/>)
 | 
				
			||||||
                      $instance.<xsl:value-of select="@name"/>.UserIdentifier
 | 
					                          $instance.<xsl:value-of select="@name"/>.ToString( 'd')
 | 
				
			||||||
                      #end
 | 
					                          #end
 | 
				
			||||||
                    </xsl:when>
 | 
					                        </xsl:when>
 | 
				
			||||||
                    <xsl:otherwise>
 | 
					                        <xsl:when test="@type='message'">
 | 
				
			||||||
                      $!instance.<xsl:value-of select="@name"/>
 | 
					                          #if ( $instance.<xsl:value-of select="@name"/>)
 | 
				
			||||||
                    </xsl:otherwise>
 | 
					                          $t.Msg( $instance.<xsl:value-of select="@name"/>)
 | 
				
			||||||
                  </xsl:choose>
 | 
					                          #end
 | 
				
			||||||
                </td>
 | 
					                        </xsl:when>
 | 
				
			||||||
              </xsl:for-each>
 | 
					                        <xsl:when test="@type='entity'">
 | 
				
			||||||
 | 
					                          #if( $instance.<xsl:value-of select="@name"/>)
 | 
				
			||||||
 | 
					                          $instance.<xsl:value-of select="@name"/>.UserIdentifier
 | 
				
			||||||
 | 
					                          #end
 | 
				
			||||||
 | 
					                        </xsl:when>
 | 
				
			||||||
 | 
					                        <xsl:otherwise>
 | 
				
			||||||
 | 
					                          $!instance.<xsl:value-of select="@name"/>
 | 
				
			||||||
 | 
					                        </xsl:otherwise>
 | 
				
			||||||
 | 
					                      </xsl:choose>
 | 
				
			||||||
 | 
					                    </td>
 | 
				
			||||||
 | 
					                  </xsl:for-each>
 | 
				
			||||||
                  <xsl:variable name="keys">
 | 
					                  <xsl:variable name="keys">
 | 
				
			||||||
                    <!-- assemble keys in a Velocity-friendly format, then splice it into
 | 
					                    <!-- assemble keys in a Velocity-friendly format, then splice it into
 | 
				
			||||||
                    the HREF below -->
 | 
					                    the HREF below -->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,8 +10,8 @@
 | 
				
			||||||
    one place for ease of maintenance
 | 
					    one place for ease of maintenance
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    $Author: sb $
 | 
					    $Author: sb $
 | 
				
			||||||
    $Revision: 1.4 $
 | 
					    $Revision: 1.5 $
 | 
				
			||||||
    $Date: 2008-02-27 17:38:42 $
 | 
					    $Date: 2008-03-05 11:05:12 $
 | 
				
			||||||
  -->
 | 
					  -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<xsl:stylesheet version="1.0"
 | 
					<xsl:stylesheet version="1.0"
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,7 @@
 | 
				
			||||||
  of the keyfield of that entity, and so on. -->
 | 
					  of the keyfield of that entity, and so on. -->
 | 
				
			||||||
  <xsl:template name="csharp-base-type">
 | 
					  <xsl:template name="csharp-base-type">
 | 
				
			||||||
    <xsl:param name="property"/>
 | 
					    <xsl:param name="property"/>
 | 
				
			||||||
 | 
					    <xsl:param name="entityns"/>
 | 
				
			||||||
    <xsl:choose>
 | 
					    <xsl:choose>
 | 
				
			||||||
      <xsl:when test="$property/@type = 'entity'">
 | 
					      <xsl:when test="$property/@type = 'entity'">
 | 
				
			||||||
        <xsl:variable name="entityname" select="$property/@entity"/>
 | 
					        <xsl:variable name="entityname" select="$property/@entity"/>
 | 
				
			||||||
| 
						 | 
					@ -36,6 +37,7 @@
 | 
				
			||||||
            <xsl:call-template name="csharp-base-type">
 | 
					            <xsl:call-template name="csharp-base-type">
 | 
				
			||||||
              <xsl:with-param name="property" 
 | 
					              <xsl:with-param name="property" 
 | 
				
			||||||
                              select="//adl:entity[@name=$entityname]/adl:key/adl:property[position()=1]"/>
 | 
					                              select="//adl:entity[@name=$entityname]/adl:key/adl:property[position()=1]"/>
 | 
				
			||||||
 | 
					              <xsl:with-param name="entityns" select="$entityns"/>
 | 
				
			||||||
            </xsl:call-template>
 | 
					            </xsl:call-template>
 | 
				
			||||||
          </xsl:when>
 | 
					          </xsl:when>
 | 
				
			||||||
          <xsl:otherwise>
 | 
					          <xsl:otherwise>
 | 
				
			||||||
| 
						 | 
					@ -48,6 +50,7 @@
 | 
				
			||||||
      <xsl:otherwise>
 | 
					      <xsl:otherwise>
 | 
				
			||||||
        <xsl:call-template name="csharp-type">
 | 
					        <xsl:call-template name="csharp-type">
 | 
				
			||||||
          <xsl:with-param name="property" select="$property"/>
 | 
					          <xsl:with-param name="property" select="$property"/>
 | 
				
			||||||
 | 
					          <xsl:with-param name="entityns" select="$entityns"/>
 | 
				
			||||||
        </xsl:call-template>
 | 
					        </xsl:call-template>
 | 
				
			||||||
      </xsl:otherwise>
 | 
					      </xsl:otherwise>
 | 
				
			||||||
    </xsl:choose>
 | 
					    </xsl:choose>
 | 
				
			||||||
| 
						 | 
					@ -56,6 +59,7 @@
 | 
				
			||||||
  <!-- return the C# type of the property which is passed as a parameter -->
 | 
					  <!-- return the C# type of the property which is passed as a parameter -->
 | 
				
			||||||
  <xsl:template name="csharp-type">
 | 
					  <xsl:template name="csharp-type">
 | 
				
			||||||
    <xsl:param name="property"/>
 | 
					    <xsl:param name="property"/>
 | 
				
			||||||
 | 
					    <xsl:param name="entityns"/>
 | 
				
			||||||
    <xsl:variable name="base-type">
 | 
					    <xsl:variable name="base-type">
 | 
				
			||||||
      <xsl:call-template name="base-type">
 | 
					      <xsl:call-template name="base-type">
 | 
				
			||||||
        <xsl:with-param name="property" select="$property"/>
 | 
					        <xsl:with-param name="property" select="$property"/>
 | 
				
			||||||
| 
						 | 
					@ -79,7 +83,14 @@
 | 
				
			||||||
      <xsl:when test="$base-type = 'real'">double</xsl:when>
 | 
					      <xsl:when test="$base-type = 'real'">double</xsl:when>
 | 
				
			||||||
      <xsl:when test="$base-type = 'money'">Decimal</xsl:when>
 | 
					      <xsl:when test="$base-type = 'money'">Decimal</xsl:when>
 | 
				
			||||||
      <xsl:when test="$base-type = 'entity'">
 | 
					      <xsl:when test="$base-type = 'entity'">
 | 
				
			||||||
        <xsl:value-of select="$property/@entity"/>
 | 
					        <xsl:choose>
 | 
				
			||||||
 | 
					          <xsl:when test="$entityns">
 | 
				
			||||||
 | 
					            <xsl:value-of select="concat( $entityns, '.', $property/@entity)"/>
 | 
				
			||||||
 | 
					          </xsl:when>
 | 
				
			||||||
 | 
					          <xsl:otherwise>
 | 
				
			||||||
 | 
					            <xsl:value-of select="$property/@entity"/>
 | 
				
			||||||
 | 
					          </xsl:otherwise>
 | 
				
			||||||
 | 
					        </xsl:choose>
 | 
				
			||||||
      </xsl:when>
 | 
					      </xsl:when>
 | 
				
			||||||
      <xsl:otherwise>[unknown?]</xsl:otherwise>
 | 
					      <xsl:otherwise>[unknown?]</xsl:otherwise>
 | 
				
			||||||
    </xsl:choose>
 | 
					    </xsl:choose>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue