This is a work-in-progress commit while trying to produce grand unified ADL.
Applied Sweepers /does/ build with this version; SRU still /does not/ build with this version.
This commit is contained in:
parent
1abaead774
commit
be2cc24ea7
|
@ -20,8 +20,8 @@
|
||||||
explicitly state the permission, even if it is 'none'.
|
explicitly state the permission, even if it is 'none'.
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.9 $
|
$Revision: 1.10 $
|
||||||
$Date: 2008-05-09 16:12:12 $
|
$Date: 2008-05-21 13:00:55 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
|
@ -30,392 +30,398 @@
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
exclude-result-prefixes="adl">
|
exclude-result-prefixes="adl">
|
||||||
|
|
||||||
<xsl:output encoding="UTF-8" indent="yes" method="xml" />
|
<xsl:output encoding="UTF-8" indent="yes" method="xml" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The convention to use for naming auto-generated abstract primary keys. Known values are
|
The convention to use for naming auto-generated abstract primary keys. Known values are
|
||||||
Id - the autogenerated primary key, if any, is called just 'Id'
|
Id - the autogenerated primary key, if any, is called just 'Id'
|
||||||
Name - the autogenerated primary key has the same name as the entity
|
Name - the autogenerated primary key has the same name as the entity
|
||||||
NameId - the name of the auto generated primary key is the name of the entity followed by 'Id'
|
NameId - the name of the auto generated primary key is the name of the entity followed by 'Id'
|
||||||
Name_Id - the name of the auto generated primary key is the name of the entity followed by '_Id'
|
Name_Id - the name of the auto generated primary key is the name of the entity followed by '_Id'
|
||||||
-->
|
-->
|
||||||
<xsl:param name="abstract-key-name-convention" select="Id"/>
|
<xsl:param name="abstract-key-name-convention" select="Id"/>
|
||||||
|
|
||||||
<!-- a prefix to prepend to all tablenames -->
|
<!-- the name and version of the product being built -->
|
||||||
<xsl:param name="tablename-prefix"/>
|
<xsl:param name="product-version" select="'Application Description Language Framework'"/>
|
||||||
|
|
||||||
<xsl:template match="adl:application">
|
|
||||||
<xsl:copy>
|
|
||||||
<xsl:attribute name="name">
|
|
||||||
<xsl:value-of select="@name"/>
|
|
||||||
</xsl:attribute>
|
|
||||||
<xsl:if test="@version">
|
|
||||||
<xsl:attribute name="version">
|
|
||||||
<xsl:value-of select="@version"/>
|
|
||||||
</xsl:attribute>
|
|
||||||
</xsl:if>
|
|
||||||
|
|
||||||
<xsl:comment>
|
<!-- a prefix to prepend to all tablenames -->
|
||||||
|
<xsl:param name="tablename-prefix"/>
|
||||||
|
|
||||||
|
<xsl:template match="adl:application">
|
||||||
|
<xsl:copy>
|
||||||
|
<xsl:attribute name="name">
|
||||||
|
<xsl:value-of select="@name"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
<xsl:if test="@version">
|
||||||
|
<xsl:attribute name="version">
|
||||||
|
<xsl:value-of select="@version"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<xsl:comment>
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
*
|
*
|
||||||
* Application Description Language framework
|
* <xsl:value-of select="$product-version"/>
|
||||||
* ©2007 Cygnet Solutions Ltd
|
* ©2007 Cygnet Solutions Ltd
|
||||||
*
|
*
|
||||||
* THIS FILE IS AUTOMATICALLY GENERATED AND SHOULD NOT
|
* THIS FILE IS AUTOMATICALLY GENERATED AND SHOULD NOT
|
||||||
* BE MANUALLY EDITED.
|
* BE MANUALLY EDITED.
|
||||||
*
|
*
|
||||||
* Generated using adl2canonical.xslt <xsl:value-of select="substring('$Revision: 1.9 $', 12)"/>
|
* Generated using adl2canonical.xslt <xsl:value-of select="substring('$Revision: 1.10 $', 12)"/>
|
||||||
*
|
*
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
<xsl:apply-templates select="@* | node()"/>
|
<xsl:apply-templates select="@* | node()"/>
|
||||||
</xsl:copy>
|
</xsl:copy>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- an entity which already has a key tag - just copy it through -->
|
<!-- an entity which already has a key tag - just copy it through -->
|
||||||
<xsl:template match="adl:entity[adl:key]">
|
<xsl:template match="adl:entity[adl:key]">
|
||||||
<xsl:if test="not( @table)">
|
<xsl:if test="not( @table)">
|
||||||
<xsl:attribute name="table">
|
<xsl:attribute name="table">
|
||||||
<xsl:value-of select="concat( $tablename-prefix, @name)"/>
|
<xsl:value-of select="concat( $tablename-prefix, @name)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:comment>
|
<xsl:comment>
|
||||||
entity <xsl:value-of select="@name"/> already has a key - not generating one
|
entity <xsl:value-of select="@name"/> already has a key - not generating one
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
<entity>
|
<entity>
|
||||||
<xsl:apply-templates select="@* | node()"/>
|
<xsl:apply-templates select="@* | node()"/>
|
||||||
</entity>
|
</entity>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- an entity which has a '@natural-key' attribute.
|
<!-- an entity which has a '@natural-key' attribute.
|
||||||
Since we've got the key tag, I think this should be disallowed -->
|
Since we've got the key tag, I think this should be disallowed -->
|
||||||
<xsl:template match="adl:entity[@natural-key]">
|
<xsl:template match="adl:entity[@natural-key]">
|
||||||
<xsl:if test="not( @table)">
|
<xsl:if test="not( @table)">
|
||||||
<xsl:attribute name="table">
|
<xsl:attribute name="table">
|
||||||
<xsl:value-of select="concat( $tablename-prefix, @name)"/>
|
<xsl:value-of select="concat( $tablename-prefix, @name)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:message terminate="no">
|
<xsl:message terminate="no">
|
||||||
ADL WARNING: [In entity '<xsl:value-of select="@name"/>']: '@natural-key' is deprecated - use the 'key' sub element instead</xsl:message>
|
ADL WARNING: [In entity '<xsl:value-of select="@name"/>']: '@natural-key' is deprecated - use the 'key' sub element instead
|
||||||
<entity>
|
</xsl:message>
|
||||||
<xsl:variable name="nkey" select="@natural-key"/>
|
<entity>
|
||||||
<xsl:apply-templates select="@*"/>
|
<xsl:variable name="nkey" select="@natural-key"/>
|
||||||
<!-- children copied through in legal order, to ensure the document remains valid -->
|
<xsl:apply-templates select="@*"/>
|
||||||
<xsl:apply-templates select="adl:documentation"/>
|
<!-- children copied through in legal order, to ensure the document remains valid -->
|
||||||
<xsl:apply-templates select="adl:content"/>
|
<xsl:apply-templates select="adl:documentation"/>
|
||||||
<key>
|
<xsl:apply-templates select="adl:content"/>
|
||||||
<xsl:apply-templates select="adl:property[@name=$nkey]"/>
|
<key>
|
||||||
<xsl:apply-templates select="adl:key/adl:property"/>
|
<xsl:apply-templates select="adl:property[@name=$nkey]"/>
|
||||||
</key>
|
<xsl:apply-templates select="adl:key/adl:property"/>
|
||||||
<xsl:apply-templates select="adl:property[not(@name=$nkey)] | adl:one-to-many | adl:many-to-many | adl:many-to-one"/>
|
</key>
|
||||||
|
<xsl:apply-templates select="adl:property[not(@name=$nkey)] | adl:one-to-many | adl:many-to-many | adl:many-to-one"/>
|
||||||
|
|
||||||
<xsl:variable name="entity" select="."/>
|
<xsl:variable name="entity" select="."/>
|
||||||
<xsl:for-each select="//adl:group">
|
<xsl:for-each select="//adl:group">
|
||||||
<xsl:call-template name="entity-group-permission">
|
<xsl:call-template name="entity-group-permission">
|
||||||
<xsl:with-param name="entity" select="$entity"/>
|
<xsl:with-param name="entity" select="$entity"/>
|
||||||
<xsl:with-param name="group" select="."/>
|
<xsl:with-param name="group" select="."/>
|
||||||
<xsl:with-param name="descendantname" select="@name"/>
|
<xsl:with-param name="descendantname" select="@name"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
<xsl:apply-templates select="adl:form | adl:page | adl:list"/>
|
<xsl:apply-templates select="adl:form | adl:page | adl:list"/>
|
||||||
</entity>
|
</entity>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- an entity which has no explicit key: auto-generate one -->
|
<!-- an entity which has no explicit key: auto-generate one -->
|
||||||
<xsl:template match="adl:entity">
|
<xsl:template match="adl:entity">
|
||||||
<xsl:comment>
|
<xsl:comment>
|
||||||
entity <xsl:value-of select="@name"/> has no key - generating one
|
entity <xsl:value-of select="@name"/> has no key - generating one
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
<entity>
|
|
||||||
<!-- copy attributes through -->
|
|
||||||
<xsl:apply-templates select="@*"/>
|
|
||||||
<xsl:if test="not( @table)">
|
|
||||||
<xsl:attribute name="table">
|
|
||||||
<xsl:value-of select="concat( $tablename-prefix, @name)"/>
|
|
||||||
</xsl:attribute>
|
|
||||||
</xsl:if>
|
|
||||||
<!-- children copied through in legal order, to ensure the document remains valid -->
|
|
||||||
<xsl:apply-templates select="adl:documentation"/>
|
|
||||||
<xsl:apply-templates select="adl:content"/>
|
|
||||||
<key>
|
|
||||||
<!-- autogenerate a key element... -->
|
|
||||||
<!-- select a name... -->
|
|
||||||
<xsl:variable name="key">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$abstract-key-name-convention='Name'">
|
|
||||||
<xsl:value-of select="@name"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$abstract-key-name-convention = 'NameId'">
|
|
||||||
<xsl:value-of select="concat( @name, 'Id')"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$abstract-key-name-convention = 'Name_Id'">
|
|
||||||
<xsl:value-of select="concat( @name, '_Id')"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="'Id'"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
|
|
||||||
<!-- check that it is unique, and abort hard if not... -->
|
<entity>
|
||||||
<xsl:if test="descendant::adl:property[@name=$key]">
|
<!-- copy attributes through -->
|
||||||
<xsl:message terminate="yes">
|
<xsl:apply-templates select="@*"/>
|
||||||
ADL ERROR: Entity '<xsl:value-of select="@name"/>' has a property '<xsl:value-of select="$key"/>' which conflicts
|
<xsl:if test="not( @table)">
|
||||||
with your chosen key naming convention <xsl:value-of select="$abstract-key-name-convention"/>. Either:
|
<xsl:attribute name="table">
|
||||||
(i) Make property '<xsl:value-of select="$key"/>' an explicit key by putting it in the <key> tag;
|
<xsl:value-of select="concat( $tablename-prefix, @name)"/>
|
||||||
(ii) Name property '<xsl:value-of select="$key"/>' something else; or
|
</xsl:attribute>
|
||||||
(iii) Choose a different key naming convention.
|
</xsl:if>
|
||||||
</xsl:message>
|
<!-- children copied through in legal order, to ensure the document remains valid -->
|
||||||
</xsl:if>
|
<xsl:apply-templates select="adl:documentation"/>
|
||||||
|
<xsl:apply-templates select="adl:content"/>
|
||||||
|
<key>
|
||||||
|
<!-- autogenerate a key element... -->
|
||||||
|
<!-- select a name... -->
|
||||||
|
<xsl:variable name="key">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$abstract-key-name-convention='Name'">
|
||||||
|
<xsl:value-of select="@name"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$abstract-key-name-convention = 'NameId'">
|
||||||
|
<xsl:value-of select="concat( @name, 'Id')"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$abstract-key-name-convention = 'Name_Id'">
|
||||||
|
<xsl:value-of select="concat( @name, '_Id')"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="'Id'"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
<!-- generate one property, the abstract primary key -->
|
<!-- check that it is unique, and abort hard if not... -->
|
||||||
<property type="integer" distinct="system">
|
<xsl:if test="descendant::adl:property[@name=$key]">
|
||||||
<xsl:attribute name="name">
|
<xsl:message terminate="yes">
|
||||||
<xsl:value-of select="normalize-space( $key)"/>
|
ADL ERROR: Entity '<xsl:value-of select="@name"/>' has a property '<xsl:value-of select="$key"/>' which conflicts
|
||||||
</xsl:attribute>
|
with your chosen key naming convention <xsl:value-of select="$abstract-key-name-convention"/>. Either:
|
||||||
<generator action="native"/>
|
(i) Make property '<xsl:value-of select="$key"/>' an explicit key by putting it in the <key> tag;
|
||||||
<documentation>
|
(ii) Name property '<xsl:value-of select="$key"/>' something else; or
|
||||||
Auto-generated abstract primary key
|
(iii) Choose a different key naming convention.
|
||||||
</documentation>
|
</xsl:message>
|
||||||
</property>
|
</xsl:if>
|
||||||
</key>
|
|
||||||
<xsl:apply-templates select="adl:property | adl:one-to-many | adl:many-to-many | adl:many-to-one"/>
|
|
||||||
|
|
||||||
<xsl:variable name="entity" select="."/>
|
<!-- generate one property, the abstract primary key -->
|
||||||
<xsl:for-each select="//adl:group">
|
<property type="integer" distinct="system">
|
||||||
<xsl:call-template name="entity-group-permission">
|
<xsl:attribute name="name">
|
||||||
<xsl:with-param name="entity" select="$entity"/>
|
<xsl:value-of select="normalize-space( $key)"/>
|
||||||
<xsl:with-param name="group" select="."/>
|
</xsl:attribute>
|
||||||
<xsl:with-param name="descendantname" select="@name"/>
|
<generator action="native"/>
|
||||||
</xsl:call-template>
|
<documentation>
|
||||||
</xsl:for-each>
|
Auto-generated abstract primary key
|
||||||
|
</documentation>
|
||||||
|
</property>
|
||||||
|
</key>
|
||||||
|
<xsl:apply-templates select="adl:property | adl:one-to-many | adl:many-to-many | adl:many-to-one"/>
|
||||||
|
|
||||||
<xsl:apply-templates select="adl:form | adl:page | adl:list"/>
|
<xsl:variable name="entity" select="."/>
|
||||||
</entity>
|
<xsl:for-each select="//adl:group">
|
||||||
</xsl:template>
|
<xsl:call-template name="entity-group-permission">
|
||||||
|
<xsl:with-param name="entity" select="$entity"/>
|
||||||
|
<xsl:with-param name="group" select="."/>
|
||||||
|
<xsl:with-param name="descendantname" select="@name"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
<xsl:template match="@table">
|
<xsl:apply-templates select="adl:form | adl:page | adl:list"/>
|
||||||
<xsl:attribute name="table">
|
</entity>
|
||||||
<xsl:value-of select="concat( $tablename-prefix, .)"/>
|
</xsl:template>
|
||||||
</xsl:attribute>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!-- If properties='all', unroll them into a properties='listed' form.
|
<xsl:template match="@table">
|
||||||
|
<xsl:attribute name="table">
|
||||||
|
<xsl:value-of select="concat( $tablename-prefix, .)"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- If properties='all', unroll them into a properties='listed' form.
|
||||||
We need to do this for lists, pages and forms; there's probably some clever
|
We need to do this for lists, pages and forms; there's probably some clever
|
||||||
way of doing it all in a oner, but I don't know what that is -->
|
way of doing it all in a oner, but I don't know what that is -->
|
||||||
<xsl:template match="adl:form[ @properties='all']">
|
<xsl:template match="adl:form[ @properties='all']">
|
||||||
<form properties='listed'>
|
<form properties='listed'>
|
||||||
<!-- copy the name attribute through -->
|
<!-- copy the name attribute through -->
|
||||||
<xsl:apply-templates select="@name"/>
|
<xsl:apply-templates select="@name"/>
|
||||||
<!-- children copied through in legal order, to ensure the document remains valid -->
|
<!-- children copied through in legal order, to ensure the document remains valid -->
|
||||||
<xsl:apply-templates select="adl:documentation"/>
|
<xsl:apply-templates select="adl:documentation"/>
|
||||||
<!-- unroll the properties -->
|
<!-- unroll the properties -->
|
||||||
<xsl:call-template name="unroll-properties"/>
|
<xsl:call-template name="unroll-properties"/>
|
||||||
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
||||||
adl:fieldgroup|adl:auxlist|adl:verb|
|
adl:fieldgroup|adl:auxlist|adl:verb|
|
||||||
adl:permission|adl:pragma"/>
|
adl:permission|adl:pragma"/>
|
||||||
</form>
|
</form>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- If properties='all', unroll them into a properties='listed' form.
|
<!-- If properties='all', unroll them into a properties='listed' form.
|
||||||
We need to do this for lists, pages and forms; there's probably some clever
|
We need to do this for lists, pages and forms; there's probably some clever
|
||||||
way of doing it all in a oner, but I don't know what that is -->
|
way of doing it all in a oner, but I don't know what that is -->
|
||||||
<xsl:template match="adl:page[ @properties='all']">
|
<xsl:template match="adl:page[ @properties='all']">
|
||||||
<page properties='listed'>
|
<page properties='listed'>
|
||||||
<!-- copy the name attribute through -->
|
<!-- copy the name attribute through -->
|
||||||
<xsl:apply-templates select="@name"/>
|
<xsl:apply-templates select="@name"/>
|
||||||
<!-- children copied through in legal order, to ensure the document remains valid -->
|
<!-- children copied through in legal order, to ensure the document remains valid -->
|
||||||
<xsl:apply-templates select="adl:documentation"/>
|
<xsl:apply-templates select="adl:documentation"/>
|
||||||
<!-- unroll the properties -->
|
<!-- unroll the properties -->
|
||||||
<xsl:call-template name="unroll-properties"/>
|
<xsl:call-template name="unroll-properties"/>
|
||||||
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
||||||
adl:fieldgroup|adl:auxlist|adl:verb|
|
adl:fieldgroup|adl:auxlist|adl:verb|
|
||||||
adl:permission|adl:pragma"/>
|
adl:permission|adl:pragma"/>
|
||||||
</page>
|
</page>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- If properties='all', unroll them into a properties='listed' form.
|
<!-- If properties='all', unroll them into a properties='listed' form.
|
||||||
We need to do this for lists, pages and forms; there's probably some clever
|
We need to do this for lists, pages and forms; there's probably some clever
|
||||||
way of doing it all in a oner, but I don't know what that is -->
|
way of doing it all in a oner, but I don't know what that is -->
|
||||||
<xsl:template match="adl:list[ @properties='all']">
|
<xsl:template match="adl:list[ @properties='all']">
|
||||||
<list properties='listed'>
|
<list properties='listed'>
|
||||||
<!-- copy the name attribute through -->
|
<!-- copy the name attribute through -->
|
||||||
<xsl:apply-templates select="@name"/>
|
<xsl:apply-templates select="@name"/>
|
||||||
<!-- children copied through in legal order, to ensure the document remains valid -->
|
<!-- children copied through in legal order, to ensure the document remains valid -->
|
||||||
<xsl:apply-templates select="adl:documentation"/>
|
<xsl:apply-templates select="adl:documentation"/>
|
||||||
<!-- unroll the properties -->
|
<!-- unroll the properties -->
|
||||||
<xsl:call-template name="unroll-properties"/>
|
<xsl:call-template name="unroll-properties"/>
|
||||||
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
||||||
adl:fieldgroup|adl:auxlist|adl:verb|
|
adl:fieldgroup|adl:auxlist|adl:verb|
|
||||||
adl:permission|adl:pragma"/>
|
adl:permission|adl:pragma"/>
|
||||||
</list>
|
</list>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- In practice it's likely only to be lists which have properties='user-distinct',
|
<!-- In practice it's likely only to be lists which have properties='user-distinct',
|
||||||
but the grammar allows this for pages and forms as well so we'll deal with it -->
|
but the grammar allows this for pages and forms as well so we'll deal with it -->
|
||||||
<xsl:template match="adl:form[ @properties='user-distinct']">
|
<xsl:template match="adl:form[ @properties='user-distinct']">
|
||||||
<form properties='listed'>
|
<form properties='listed'>
|
||||||
<!-- copy the name attribute through -->
|
<!-- copy the name attribute through -->
|
||||||
<xsl:apply-templates select="@name"/>
|
<xsl:apply-templates select="@name"/>
|
||||||
<!-- children copied through in legal order, to ensure the document remains valid -->
|
<!-- children copied through in legal order, to ensure the document remains valid -->
|
||||||
<xsl:apply-templates select="adl:documentation"/>
|
<xsl:apply-templates select="adl:documentation"/>
|
||||||
<!-- unroll the properties -->
|
<!-- unroll the properties -->
|
||||||
<xsl:call-template name="unroll-user-distinct"/>
|
<xsl:call-template name="unroll-user-distinct"/>
|
||||||
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
||||||
adl:fieldgroup|adl:auxlist|adl:verb|
|
adl:fieldgroup|adl:auxlist|adl:verb|
|
||||||
adl:permission|adl:pragma"/>
|
adl:permission|adl:pragma"/>
|
||||||
</form>
|
</form>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- In practice it's likely only to be lists which have properties='user-distinct',
|
<!-- In practice it's likely only to be lists which have properties='user-distinct',
|
||||||
but the grammar allows this for pages and forms as well so we'll deal with it -->
|
but the grammar allows this for pages and forms as well so we'll deal with it -->
|
||||||
<xsl:template match="adl:page[ @properties='user-distinct']">
|
<xsl:template match="adl:page[ @properties='user-distinct']">
|
||||||
<page properties='listed'>
|
<page properties='listed'>
|
||||||
<!-- copy the name attribute through -->
|
<!-- copy the name attribute through -->
|
||||||
<xsl:apply-templates select="@name"/>
|
<xsl:apply-templates select="@name"/>
|
||||||
<!-- children copied through in legal order, to ensure the document remains valid -->
|
<!-- children copied through in legal order, to ensure the document remains valid -->
|
||||||
<xsl:apply-templates select="adl:documentation"/>
|
<xsl:apply-templates select="adl:documentation"/>
|
||||||
<!-- unroll the properties -->
|
<!-- unroll the properties -->
|
||||||
<xsl:call-template name="unroll-user-distinct"/>
|
<xsl:call-template name="unroll-user-distinct"/>
|
||||||
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
||||||
adl:fieldgroup|adl:auxlist|adl:verb|
|
adl:fieldgroup|adl:auxlist|adl:verb|
|
||||||
adl:permission|adl:pragma"/>
|
adl:permission|adl:pragma"/>
|
||||||
</page>
|
</page>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- In practice it's likely only to be lists which have properties='user-distinct',
|
<!-- In practice it's likely only to be lists which have properties='user-distinct',
|
||||||
but the grammar allows this for pages and forms as well so we'll deal with it -->
|
but the grammar allows this for pages and forms as well so we'll deal with it -->
|
||||||
<xsl:template match="adl:list[ @properties='user-distinct']">
|
<xsl:template match="adl:list[ @properties='user-distinct']">
|
||||||
<list properties='listed'>
|
<list properties='listed'>
|
||||||
<!-- copy the name attribute through -->
|
<!-- copy the name attribute through -->
|
||||||
<xsl:apply-templates select="@name"/>
|
<xsl:apply-templates select="@name"/>
|
||||||
<!-- children copied through in legal order, to ensure the document remains valid -->
|
<!-- children copied through in legal order, to ensure the document remains valid -->
|
||||||
<xsl:apply-templates select="adl:documentation"/>
|
<xsl:apply-templates select="adl:documentation"/>
|
||||||
<!-- unroll the properties -->
|
<!-- unroll the properties -->
|
||||||
<xsl:call-template name="unroll-user-distinct"/>
|
<xsl:call-template name="unroll-user-distinct"/>
|
||||||
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
<xsl:apply-templates select="adl:head|adl:top|adl:foot|adl:field|
|
||||||
adl:fieldgroup|adl:auxlist|adl:verb|
|
adl:fieldgroup|adl:auxlist|adl:verb|
|
||||||
adl:permission|adl:pragma"/>
|
adl:permission|adl:pragma"/>
|
||||||
</list>
|
</list>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="adl:typedef[ @type = 'string' and not( @size)]">
|
<xsl:template match="adl:typedef[ @type = 'string' and not( @size)]">
|
||||||
<xsl:message terminate="yes">
|
<xsl:message terminate="yes">
|
||||||
ADL ERROR: Type definitions of type 'string' must have a valid value for 'size'
|
ADL ERROR: Type definitions of type 'string' must have a valid value for 'size'
|
||||||
Offending typedef: <xsl:value-of select="@name"/>
|
Offending typedef: <xsl:value-of select="@name"/>
|
||||||
</xsl:message>
|
</xsl:message>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- Language constraints -->
|
<!-- Language constraints -->
|
||||||
<xsl:template match="adl:property[ @type = 'string' and not( @size)]">
|
<xsl:template match="adl:property[ @type = 'string' and not( @size)]">
|
||||||
<xsl:message terminate="yes">
|
<xsl:message terminate="yes">
|
||||||
ADL ERROR: Properties of type 'string' must have a valid value for 'size'
|
ADL ERROR: Properties of type 'string' must have a valid value for 'size'
|
||||||
Offending property: <xsl:value-of select="@name"/> of entity <xsl:value-of select="ancestor::adl:entity/@name"/>
|
Offending property: <xsl:value-of select="@name"/> of entity <xsl:value-of select="ancestor::adl:entity/@name"/>
|
||||||
</xsl:message>
|
</xsl:message>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="adl:property[ @type = 'entity' and not( @entity)]">
|
<xsl:template match="adl:property[ @type = 'entity' and not( @entity)]">
|
||||||
<xsl:message terminate="yes">
|
<xsl:message terminate="yes">
|
||||||
ADL ERROR: Properties of type 'entity' must have a valid value for 'entity'
|
ADL ERROR: Properties of type 'entity' must have a valid value for 'entity'
|
||||||
Offending property: <xsl:value-of select="@name"/> of entity <xsl:value-of select="ancestor::adl:entity/@name"/>
|
Offending property: <xsl:value-of select="@name"/> of entity <xsl:value-of select="ancestor::adl:entity/@name"/>
|
||||||
</xsl:message>
|
</xsl:message>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="adl:property[ @type = 'defined' and not( @typedef)]">
|
<xsl:template match="adl:property[ @type = 'defined' and not( @typedef)]">
|
||||||
<xsl:message terminate="yes">
|
<xsl:message terminate="yes">
|
||||||
ADL ERROR: Properties of type 'defined' must have a valid value for 'typedef'
|
ADL ERROR: Properties of type 'defined' must have a valid value for 'typedef'
|
||||||
Offending property: <xsl:value-of select="@name"/> of entity <xsl:value-of select="ancestor::adl:entity/@name"/>
|
Offending property: <xsl:value-of select="@name"/> of entity <xsl:value-of select="ancestor::adl:entity/@name"/>
|
||||||
</xsl:message>
|
</xsl:message>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- copy anything that isn't explicitly matched -->
|
<!-- copy anything that isn't explicitly matched -->
|
||||||
<xsl:template match="@* | node()">
|
<xsl:template match="@* | node()">
|
||||||
<xsl:copy>
|
<xsl:copy>
|
||||||
<xsl:apply-templates select="@* | node()"/>
|
<xsl:apply-templates select="@* | node()"/>
|
||||||
</xsl:copy>
|
</xsl:copy>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- generate a permission element for this group and this entity -->
|
<!-- generate a permission element for this group and this entity -->
|
||||||
<xsl:template name="entity-group-permission">
|
<xsl:template name="entity-group-permission">
|
||||||
<xsl:param name="entity"/>
|
<xsl:param name="entity"/>
|
||||||
<xsl:param name="group"/>
|
<xsl:param name="group"/>
|
||||||
<xsl:param name="descendantname"/>
|
<xsl:param name="descendantname"/>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$entity/adl:permission[@group=$group/@name]">
|
<xsl:when test="$entity/adl:permission[@group=$group/@name]">
|
||||||
<!-- there's an explicit permission for this group -->
|
<!-- there's an explicit permission for this group -->
|
||||||
<permission>
|
<permission>
|
||||||
<xsl:attribute name="group">
|
<xsl:attribute name="group">
|
||||||
<xsl:value-of select="$descendantname"/>
|
<xsl:value-of select="$descendantname"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:attribute name="permission">
|
<xsl:attribute name="permission">
|
||||||
<xsl:value-of select="$entity/adl:permission[@group=$group/@name]/@permission"/>
|
<xsl:value-of select="$entity/adl:permission[@group=$group/@name]/@permission"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</permission>
|
</permission>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$group/@parent">
|
<xsl:when test="$group/@parent">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$group/@parent = $group/@name">
|
<xsl:when test="$group/@parent = $group/@name">
|
||||||
<xsl:message terminate="yes">
|
<xsl:message terminate="yes">
|
||||||
ADL: ERROR: A group may not be its own parent; offending group <xsl:value-of select="$group/@name"/>
|
ADL: ERROR: A group may not be its own parent; offending group <xsl:value-of select="$group/@name"/>
|
||||||
</xsl:message>
|
</xsl:message>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="//adl:group[@name=$group/@parent]">
|
<xsl:when test="//adl:group[@name=$group/@parent]">
|
||||||
<xsl:call-template name="entity-group-permission">
|
<xsl:call-template name="entity-group-permission">
|
||||||
<xsl:with-param name="entity" select="$entity"/>
|
<xsl:with-param name="entity" select="$entity"/>
|
||||||
<xsl:with-param name="group" select="//adl:group[@name=$group/@parent]"/>
|
<xsl:with-param name="group" select="//adl:group[@name=$group/@parent]"/>
|
||||||
<xsl:with-param name="descendantname" select="$descendantname"/>
|
<xsl:with-param name="descendantname" select="$descendantname"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:message terminate="yes">
|
<xsl:message terminate="yes">
|
||||||
ADL: ERROR: Group specified (<xsl:value-of select="$group/@parent"/> does not exist.
|
ADL: ERROR: Group specified (<xsl:value-of select="$group/@parent"/> does not exist.
|
||||||
</xsl:message>
|
</xsl:message>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<permission permission="none">
|
<permission permission="none">
|
||||||
<xsl:attribute name="group">
|
<xsl:attribute name="group">
|
||||||
<xsl:value-of select="$descendantname"/>
|
<xsl:value-of select="$descendantname"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</permission>
|
</permission>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- unroll all the explicit properties in the ancestor entity of
|
<!-- unroll all the explicit properties in the ancestor entity of
|
||||||
the context (assumed to be form, page or list) into a list of fields -->
|
the context (assumed to be form, page or list) into a list of fields -->
|
||||||
<xsl:template name="unroll-properties">
|
<xsl:template name="unroll-properties">
|
||||||
<xsl:for-each select="ancestor::adl:entity/descendant::adl:property |
|
<xsl:for-each select="ancestor::adl:entity/descendant::adl:property |
|
||||||
ancestor::adl:entity/descendant::adl:one-to-many |
|
ancestor::adl:entity/descendant::adl:one-to-many |
|
||||||
ancestor::adl:entity/descendant::adl:many-to-many |
|
ancestor::adl:entity/descendant::adl:many-to-many |
|
||||||
ancestor::adl:entity/descendant::adl:many-to-one">
|
ancestor::adl:entity/descendant::adl:many-to-one">
|
||||||
<field>
|
<field>
|
||||||
<xsl:attribute name="property">
|
<xsl:attribute name="property">
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</field>
|
</field>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- unroll all the user-distinct properties in the ancestor entity of
|
<!-- unroll all the user-distinct properties in the ancestor entity of
|
||||||
the context (assumed to be form, page or list) into a list of fields.
|
the context (assumed to be form, page or list) into a list of fields.
|
||||||
NOTE that n-to-n properties cannot currently be user-distinct and are
|
NOTE that n-to-n properties cannot currently be user-distinct and are
|
||||||
therefore not inspected -->
|
therefore not inspected -->
|
||||||
<xsl:template name="unroll-user-distinct">
|
<xsl:template name="unroll-user-distinct">
|
||||||
<xsl:for-each select="ancestor::adl:entity/descendant::adl:property[@distinct='user' or @distinct='all']">
|
<xsl:for-each select="ancestor::adl:entity/descendant::adl:property[@distinct='user' or @distinct='all']">
|
||||||
<field>
|
<field>
|
||||||
<xsl:attribute name="property">
|
<xsl:attribute name="property">
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:apply-templates select="adl:prompt"/>
|
<xsl:apply-templates select="adl:prompt"/>
|
||||||
<xsl:apply-templates select="adl:help"/>
|
<xsl:apply-templates select="adl:help"/>
|
||||||
</field>
|
</field>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
|
@ -9,8 +9,8 @@
|
||||||
Transform ADL into (partial) controller classes
|
Transform ADL into (partial) controller classes
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.29 $
|
$Revision: 1.30 $
|
||||||
$Date: 2008-05-19 14:49:18 $
|
$Date: 2008-05-21 13:00:56 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||||
|
@ -39,39 +39,34 @@
|
||||||
<!-- Whether to authenticate at application or at database layer.
|
<!-- Whether to authenticate at application or at database layer.
|
||||||
If not 'Application', then 'Database'. -->
|
If not 'Application', then 'Database'. -->
|
||||||
<xsl:param name="authentication-layer" select="Application"/>
|
<xsl:param name="authentication-layer" select="Application"/>
|
||||||
<!--
|
|
||||||
The convention to use for naming auto-generated abstract primary keys. Known values are
|
<!-- the name and version of the product being built -->
|
||||||
Id - the autogenerated primary key, if any, is called just 'Id'
|
<xsl:param name="product-version" select="'Application Description Language Framework'"/>
|
||||||
Name - the autogenerated primary key has the same name as the entity
|
|
||||||
NameId - the name of the auto generated primary key is the name of the entity followed by 'Id'
|
|
||||||
Name_Id - the name of the auto generated primary key is the name of the entity followed by '_Id'
|
|
||||||
-->
|
|
||||||
<xsl:param name="abstract-key-name-convention" select="Id"/>
|
|
||||||
|
|
||||||
<!-- bug 1800 : the name of the Velocity layout to use -->
|
<!-- bug 1800 : the name of the Velocity layout to use -->
|
||||||
<xsl:param name="layout-name" select="adl-default-layout"/>
|
<xsl:param name="layout-name" select="adl-default-layout"/>
|
||||||
<!-- bug 1800 : the name of the Velocity rescue view to use -->
|
<!-- bug 1800 : the name of the Velocity rescue view to use -->
|
||||||
<xsl:param name="rescue-name" select="adl-default-rescue"/>
|
<xsl:param name="rescue-name"/>
|
||||||
<!-- bug 1800 : the name of the area (i.e. URL path part) to use -->
|
<!-- bug 1800 : the name of the area (i.e. URL path part) to use -->
|
||||||
<xsl:param name="area-name" select="auto"/>
|
<xsl:param name="area-name"/>
|
||||||
|
|
||||||
<xsl:template match="adl:application">
|
<xsl:template match="adl:application">
|
||||||
<xsl:call-template name="collection-factory"/>
|
<xsl:call-template name="collection-factory"/>
|
||||||
<xsl:apply-templates select="adl:entity"/>
|
<xsl:apply-templates select="adl:entity"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="collection-factory">
|
<xsl:template name="collection-factory">
|
||||||
/* ---- [ cut here: next file '<xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/>.auto.cs'] ---------------- */
|
/* ---- [ cut here: next file '<xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/>.auto.cs'] ---------------- */
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Application Description Language framework
|
// <xsl:value-of select="$product-version"/>
|
||||||
// <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/>.auto.cs
|
// <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller.auto.cs')"/>
|
||||||
//
|
//
|
||||||
// (c) 2007 Cygnet Solutions Ltd
|
// (c) 2007 Cygnet Solutions Ltd
|
||||||
//
|
//
|
||||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
// Automatically generated abstract super class for controllers for the
|
||||||
// Automatically generated from application description using
|
// <xsl:value-of select="/adl:application/@name"/> application; generated using
|
||||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.29 $', 10)"/>
|
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.30 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
|
@ -82,53 +77,59 @@ using System.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
using NHibernate.Expression;
|
using NHibernate.Expression;
|
||||||
|
using Cygnet.Web.Controllers;
|
||||||
using <xsl:value-of select="$entityns"/>;
|
using <xsl:value-of select="$entityns"/>;
|
||||||
|
|
||||||
namespace <xsl:value-of select="$controllerns"/> {
|
namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Automatically generated abstract super class for controllers for the
|
/// Automatically generated abstract super class for controllers for the
|
||||||
/// <xsl:value-of select="/adl:application/@name"/> application
|
/// <xsl:value-of select="/adl:application/@name"/> application
|
||||||
///
|
///
|
||||||
/// DO NOT EDIT THIS FILE!
|
/// DO NOT EDIT THIS FILE!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract partial class <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/> : BaseController {
|
public abstract partial class <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/> : BaseController {
|
||||||
<xsl:for-each select="//adl:entity">
|
<xsl:for-each select="//adl:entity">
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a list of all instances of <xsl:value-of select="@name"/> for use in menus, etc;
|
/// Return a list of all instances of <xsl:value-of select="@name"/> for use in menus, etc;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected IList<<xsl:value-of select="concat( $entityns, '.', @name)"/>> <xsl:value-of select="concat( 'FetchAll', @name)"/>( ISession hibernator) {
|
protected IList<<xsl:value-of select="concat( $entityns, '.', @name)"/>> <xsl:value-of select="concat( 'FetchAll', @name)"/>( ISession hibernator) {
|
||||||
return hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>))
|
return hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>))
|
||||||
<xsl:for-each select="descendant::adl:property[@distinct='user']">
|
<xsl:for-each select="descendant::adl:property[@distinct='user']">
|
||||||
.AddOrder( <xsl:value-of select="concat('new Order( "', @name, '", true)')"/>)
|
.AddOrder( <xsl:value-of select="concat('new Order( "', @name, '", true)')"/>)
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
.SetCacheable( true)
|
.SetCacheable( true)
|
||||||
.SetCacheRegion( "<xsl:value-of select="/adl:application/@name"/>")
|
.SetCacheRegion( "<xsl:value-of select="/adl:application/@name"/>")
|
||||||
.List<<xsl:value-of select="concat( $entityns, '.', @name)"/>>();
|
.List<<xsl:value-of select="concat( $entityns, '.', @name)"/>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- Don't bother generating anything for foreign entities -->
|
<!-- Don't bother generating anything for foreign entities -->
|
||||||
<xsl:template match="adl:entity[@foreign='true']"/>
|
<xsl:template match="adl:entity[@foreign='true']"/>
|
||||||
|
|
||||||
|
<xsl:template match="adl:entity">
|
||||||
|
<xsl:comment>Not generating controller for entity <xsl:value-of select="@name"/>,
|
||||||
|
as it has no forms, pages or lists.
|
||||||
|
</xsl:comment>
|
||||||
|
</xsl:template>
|
||||||
<xsl:template match="adl:entity[adl:form|adl:page|adl:list]">
|
<xsl:template match="adl:entity[adl:form|adl:page|adl:list]">
|
||||||
|
|
||||||
/* ---- [ cut here: next file '<xsl:value-of select="@name"/>Controller.auto.cs'] ---------------- */
|
/* ---- [ cut here: next file '<xsl:value-of select="@name"/>Controller.auto.cs'] ---------------- */
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Application Description Language framework
|
// <xsl:value-of select="$product-version"/>
|
||||||
// <xsl:value-of select="@name"/>Controller.auto.cs
|
// <xsl:value-of select="@name"/>Controller.auto.cs
|
||||||
//
|
//
|
||||||
// (c) 2007 Cygnet Solutions Ltd
|
// (c) 2007 Cygnet Solutions Ltd
|
||||||
//
|
//
|
||||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||||
// Automatically generated from application description using
|
// Automatically generated from application description using
|
||||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.29 $', 10)"/>
|
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.30 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
|
@ -166,8 +167,12 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
/// DO NOT EDIT THIS FILE!
|
/// DO NOT EDIT THIS FILE!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[
|
[
|
||||||
|
<xsl:if test="$layout-name">
|
||||||
Layout("<xsl:value-of select="$layout-name"/>"),
|
Layout("<xsl:value-of select="$layout-name"/>"),
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$rescue-name">
|
||||||
Rescue("<xsl:value-of select="$rescue-name"/>"),
|
Rescue("<xsl:value-of select="$rescue-name"/>"),
|
||||||
|
</xsl:if>
|
||||||
ControllerDetails("<xsl:value-of select="@name"/>", Area = "<xsl:value-of select="$area-name"/>"),
|
ControllerDetails("<xsl:value-of select="@name"/>", Area = "<xsl:value-of select="$area-name"/>"),
|
||||||
Helper(typeof(<xsl:value-of select="concat( @name, 'FieldHelper')"/>), "<xsl:value-of select="concat( @name, 'FieldHelper')"/>")
|
Helper(typeof(<xsl:value-of select="concat( @name, 'FieldHelper')"/>), "<xsl:value-of select="concat( @name, 'FieldHelper')"/>")
|
||||||
]
|
]
|
||||||
|
@ -196,7 +201,35 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<xsl:if test="adl:form">
|
<xsl:if test="adl:property[@type='message']">
|
||||||
|
/// <summary>
|
||||||
|
/// Temporary hack to sort a problem with uninitialised messages
|
||||||
|
/// </summary>
|
||||||
|
public void fixupMessages() {
|
||||||
|
ISession hibernator =
|
||||||
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
||||||
|
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||||
|
ICollection<<xsl:value-of select="concat($entityns, '.', @name)"/>> instances =
|
||||||
|
hibernator.CreateCriteria( typeof( <xsl:value-of select="concat($entityns, '.', @name)"/>))
|
||||||
|
.List<<xsl:value-of select="concat($entityns, '.', @name)"/>>();
|
||||||
|
|
||||||
|
foreach ( <xsl:value-of select="concat($entityns, '.', @name)"/> instance in instances) {
|
||||||
|
<xsl:for-each select="adl:property[@type='message']">
|
||||||
|
if ( <xsl:value-of select="concat( 'instance.', @name)"/> == null || <xsl:value-of select="concat( 'instance.', @name, '.MessageId')"/> == 0 ){
|
||||||
|
<xsl:value-of select="concat( 'instance.', @name)"/> = new Message();
|
||||||
|
hibernator.Save( <xsl:value-of select="concat( 'instance.', @name)"/>);
|
||||||
|
}
|
||||||
|
</xsl:for-each>
|
||||||
|
hibernator.Save( instance);
|
||||||
|
}
|
||||||
|
hibernator.Flush();
|
||||||
|
<xsl:if test="adl:list[@name='list']">
|
||||||
|
list();
|
||||||
|
</xsl:if>
|
||||||
|
}
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<xsl:if test="adl:form">
|
||||||
<!-- unless there's at least one form, we won't generate a 'store' method -->
|
<!-- unless there's at least one form, we won't generate a 'store' method -->
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Store the record represented by the parameters passed in an HTTP service
|
/// Store the record represented by the parameters passed in an HTTP service
|
||||||
|
@ -960,23 +993,25 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
/* form menus */
|
||||||
<xsl:for-each select="$form//adl:field">
|
<xsl:for-each select="$form//adl:field">
|
||||||
<xsl:variable name="propname" select="@property"/>
|
<xsl:variable name="propname" select="@property"/>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
|
<xsl:when test="parent::adl:auxlist"/>
|
||||||
<xsl:when test="$form/ancestor::adl:entity/adl:property[@name=$propname and @type='entity']">
|
<xsl:when test="$form/ancestor::adl:entity/adl:property[@name=$propname and @type='entity']">
|
||||||
/* produce a list of <xsl:value-of select="$form/ancestor::adl:entity/adl:property[@name=$propname]/@entity"/> to populate the select for <xsl:value-of select="$propname"/> */
|
/* produce a list of <xsl:value-of select="$form/ancestor::adl:entity/adl:property[@name=$propname]/@entity"/> to populate the select for <xsl:value-of select="$propname"/> */
|
||||||
<xsl:call-template name="menu">
|
<xsl:call-template name="menu">
|
||||||
<xsl:with-param name="property" select="$form/ancestor::adl:entity/adl:property[@name=$propname]"/>
|
<xsl:with-param name="property" select="$form/ancestor::adl:entity/adl:property[@name=$propname]"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$form/ancestor::adl:entity/adl:property[@name=$propname and @type='link']">
|
<xsl:when test="$form/ancestor::adl:entity/adl:property[@name=$propname and @type='link']">
|
||||||
/* produce a list of <xsl:value-of select="$form/ancestor::adl:entity/adl:property[@name=$propname]/@entity"/> to populate the LHS of the shuffle for <xsl:value-of select="$propname"/> */
|
/* produce a list of <xsl:value-of select="$form/ancestor::adl:entity/adl:property[@name=$propname]/@entity"/> to populate the LHS of the shuffle for <xsl:value-of select="$propname"/> */
|
||||||
<xsl:call-template name="menu">
|
<xsl:call-template name="menu">
|
||||||
<xsl:with-param name="property" select="$form/ancestor::adl:entity/adl:property[@name=$propname]"/>
|
<xsl:with-param name="property" select="$form/ancestor::adl:entity/adl:property[@name=$propname]"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$form/ancestor::adl:entity/adl:property[@name=$propname and @type='list']">
|
<xsl:when test="$form/ancestor::adl:entity/adl:property[@name=$propname and @type='list']">
|
||||||
/* produce a list of <xsl:value-of select="$form/ancestor::adl:entity/adl:property[@name=$propname]/@entity"/> to populate the multi-select for <xsl:value-of select="@name"/> */
|
/* produce a list of <xsl:value-of select="$form/ancestor::adl:entity/adl:property[@name=$propname]/@entity"/> to populate the multi-select for <xsl:value-of select="@name"/> */
|
||||||
<xsl:call-template name="menu">
|
<xsl:call-template name="menu">
|
||||||
<xsl:with-param name="property" select="$form/ancestor::adl:entity/adl:property[@name=$propname]"/>
|
<xsl:with-param name="property" select="$form/ancestor::adl:entity/adl:property[@name=$propname]"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
|
@ -1026,7 +1061,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
<xsl:template name="menu">
|
<xsl:template name="menu">
|
||||||
<xsl:param name="property"/>
|
<xsl:param name="property"/>
|
||||||
<xsl:variable name="entity" select="//adl:entity[@name=$property/@entity]"/>
|
<xsl:variable name="entity" select="//adl:entity[@name=$property/@entity]"/>
|
||||||
<xsl:value-of select="concat('all_', $property/@name)"/> =
|
<xsl:value-of select="concat('all_', $property/@name)"/> =
|
||||||
<xsl:value-of select="concat( 'FetchAll', $entity/@name)"/>( NHibernateHelper.GetCurrentSession()),
|
<xsl:value-of select="concat( 'FetchAll', $entity/@name)"/>( NHibernateHelper.GetCurrentSession()),
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
Transform ADL into entity classes
|
Transform ADL into entity classes
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.13 $
|
$Revision: 1.14 $
|
||||||
$Date: 2008-05-09 16:12:12 $
|
$Date: 2008-05-21 13:00:56 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||||
|
@ -20,79 +20,48 @@
|
||||||
xmlns:adl="http://cygnets.co.uk/schemas/adl-1.2"
|
xmlns:adl="http://cygnets.co.uk/schemas/adl-1.2"
|
||||||
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
|
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
|
||||||
|
|
||||||
<xsl:include href="csharp-type-include.xslt"/>
|
<xsl:include href="csharp-type-include.xslt"/>
|
||||||
|
|
||||||
<xsl:output encoding="UTF-8" method="text"/>
|
<xsl:output encoding="UTF-8" method="text"/>
|
||||||
|
|
||||||
<!-- The locale for which these entities are generated
|
<!-- The locale for which these entities are generated
|
||||||
TODO: Entities should NOT be locale specific. Instead, the
|
TODO: Entities should NOT be locale specific. Instead, the
|
||||||
entity should generate messages based on the
|
entity should generate messages based on the
|
||||||
client's locale. However, there may still need to be a concept of a
|
client's locale. However, there may still need to be a concept of a
|
||||||
'default locale', for when we don't have messages which suit the
|
'default locale', for when we don't have messages which suit the
|
||||||
client's locale -->
|
client's locale -->
|
||||||
<xsl:param name="locale" select="en-UK"/>
|
<xsl:param name="locale" select="en-UK"/>
|
||||||
|
|
||||||
<!--
|
<!-- The C# namespace within which I shall generate controllers -->
|
||||||
The convention to use for naming auto-generated abstract primary keys. Known values are
|
<xsl:param name="controllerns" select="Unset"/>
|
||||||
Id - the autogenerated primary key, if any, is called just 'Id'
|
|
||||||
Name - the autogenerated primary key has the same name as the entity
|
|
||||||
NameId - the name of the auto generated primary key is the name of the entity followed by 'Id'
|
|
||||||
Name_Id - the name of the auto generated primary key is the name of the entity followed by '_Id'
|
|
||||||
-->
|
|
||||||
<xsl:param name="abstract-key-name-convention" select="Id"/>
|
|
||||||
|
|
||||||
<!-- The C# namespace within which I shall generate controllers -->
|
<!-- The C# namespace within which I shall generate entities -->
|
||||||
<xsl:param name="controllerns" select="Unset"/>
|
<xsl:param name="entityns" select="Unset"/>
|
||||||
|
|
||||||
<!-- The C# namespace within which I shall generate entities -->
|
<!-- the name and version of the product being built -->
|
||||||
<xsl:param name="entityns" select="Unset"/>
|
<xsl:param name="product-version" select="'Application Description Language Framework'"/>
|
||||||
|
|
||||||
<xsl:template match="adl:application">
|
|
||||||
<xsl:apply-templates select="adl:entity"/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!-- Don't bother generating anything for foreign entities -->
|
<xsl:template match="adl:application">
|
||||||
<xsl:template match="adl:entity[@foreign='true']"/>
|
<xsl:apply-templates select="adl:entity"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="adl:entity">
|
<!-- Don't bother generating anything for foreign entities -->
|
||||||
<!-- what's all this about? the objective is to get the revision number of the
|
<xsl:template match="adl:entity[@foreign='true']"/>
|
||||||
transform into the output, /without/ getting that revision number overwritten
|
|
||||||
with the revision number of the generated file if the generated file is
|
|
||||||
stored to CVS -->
|
|
||||||
|
|
||||||
<xsl:variable name="transform-rev1"
|
<xsl:template match="adl:entity">
|
||||||
select="substring( '$Revision: 1.13 $', 11)"/>
|
|
||||||
<xsl:variable name="transform-revision"
|
|
||||||
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
|
|
||||||
|
|
||||||
<xsl:variable name="keyfield">
|
/* ---- [ cut here: next file '<xsl:value-of select="@name"/>.auto.cs'] ---------------- */
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$abstract-key-name-convention='Name'">
|
|
||||||
<xsl:value-of select="@name"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$abstract-key-name-convention = 'NameId'">
|
|
||||||
<xsl:value-of select="concat( @name, 'Id')"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$abstract-key-name-convention = 'Name_Id'">
|
|
||||||
<xsl:value-of select="concat( @name, '_Id')"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="'Id'"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
|
|
||||||
/* ---- [ cut here: next file '<xsl:value-of select="@name"/>.auto.cs'] ---------------- */
|
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Application Description Language framework
|
// <xsl:value-of select="$product-version"/>
|
||||||
// <xsl:value-of select="@name"/>.auto.cs
|
// <xsl:value-of select="@name"/>.auto.cs
|
||||||
//
|
//
|
||||||
// (c)2007 Cygnet Solutions Ltd
|
// (c)2007 Cygnet Solutions Ltd
|
||||||
//
|
//
|
||||||
// Automatically generated from application description using
|
// Automatically generated from application description using
|
||||||
// adl2entityclass.xsl revision <xsl:value-of select="$transform-revision"/>
|
// adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.14 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
|
@ -114,7 +83,7 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Automatically generated from description of entity <xsl:value-of select="@name"/>
|
/// Automatically generated from description of entity <xsl:value-of select="@name"/>
|
||||||
/// using adl2entityclass.xsl revision <xsl:value-of select="$transform-revision"/>.
|
/// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.14 $', 10)"/>.
|
||||||
/// Note that manually maintained parts of this class may be defined in
|
/// Note that manually maintained parts of this class may be defined in
|
||||||
/// a separate file called <xsl:value-of select="@name"/>.manual.cs, q.v.
|
/// a separate file called <xsl:value-of select="@name"/>.manual.cs, q.v.
|
||||||
///
|
///
|
||||||
|
@ -152,6 +121,7 @@
|
||||||
<xsl:if test="not( position() = last())">, </xsl:if>
|
<xsl:if test="not( position() = last())">, </xsl:if>
|
||||||
</xsl:for-each>){
|
</xsl:for-each>){
|
||||||
<xsl:call-template name="initialise-lists"/>
|
<xsl:call-template name="initialise-lists"/>
|
||||||
|
<xsl:call-template name="initialise-messages"/>
|
||||||
|
|
||||||
<xsl:for-each select="adl:key/adl:property">
|
<xsl:for-each select="adl:key/adl:property">
|
||||||
this.<xsl:value-of select="@name"/> = <xsl:value-of select="@name"/>;
|
this.<xsl:value-of select="@name"/> = <xsl:value-of select="@name"/>;
|
||||||
|
@ -160,40 +130,10 @@
|
||||||
|
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
/// <summary>
|
<xsl:message terminate="yes">
|
||||||
/// Auto-generated one-arg constructor; initialises Id slot and also all
|
ADL: ERROR: Entity '<xsl:value-of select="@name"/>' has no key. Was the
|
||||||
/// one-to-many slots
|
canonicalise stage missed in the build process?
|
||||||
/// </summary>
|
</xsl:message>
|
||||||
public <xsl:value-of select="@name"/>( int key)
|
|
||||||
{
|
|
||||||
<xsl:call-template name="initialise-lists"/>
|
|
||||||
|
|
||||||
<xsl:value-of select="concat( ' _', $keyfield)"/> = key;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Auto-generated iv for Id (abstract primary key) slot
|
|
||||||
/// </summary>
|
|
||||||
private int <xsl:value-of select="concat( ' _', $keyfield)"/> = -1;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Auto-generated property for Id (abstract primary key) slot
|
|
||||||
/// </summary>
|
|
||||||
public virtual int <xsl:value-of select="$keyfield"/>
|
|
||||||
{
|
|
||||||
get { return <xsl:value-of select="concat( ' _', $keyfield)"/>; }
|
|
||||||
set { <xsl:value-of select="concat( ' _', $keyfield)"/> = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Auto-generated overridden property for the Key slot, maps onto
|
|
||||||
/// <xsl:value-of select="concat( ' _', $keyfield)"/>
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete]
|
|
||||||
public override int Key
|
|
||||||
{
|
|
||||||
get { return <xsl:value-of select="concat( ' _', $keyfield)"/>; }
|
|
||||||
}
|
|
||||||
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -282,6 +222,7 @@
|
||||||
<xsl:when test="@cascade='all'"/>
|
<xsl:when test="@cascade='all'"/>
|
||||||
<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:when test="@concrete='false'"/>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
if ( <xsl:value-of select="concat( ' _', @name)"/> != null && <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);
|
||||||
|
@ -490,24 +431,28 @@
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="initialise-lists">
|
<xsl:template name="initialise-messages">
|
||||||
<!-- initialise all cocrete lists and links -->
|
<!-- each IV of type message needs to be initialised -->
|
||||||
<xsl:for-each select="property[@type='list']">
|
<xsl:for-each select="adl:property[@type='message']">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@concrete='false'"/>
|
<xsl:when test="@concrete='false'"/>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="concat( ' _', @name)"/> = new HashedSet<<xsl:value-of select="@entity"/>>();
|
<xsl:value-of select="concat( ' _', @name)"/> = new Message();
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:for-each select="property[@type='link']">
|
</xsl:template>
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="@concrete='false'"/>
|
<xsl:template name="initialise-lists">
|
||||||
<xsl:otherwise>
|
<!-- initialise all concrete lists and links -->
|
||||||
<xsl:value-of select="concat( ' _', @name)"/> = new HashedSet<<xsl:value-of select="@entity"/>>();
|
<xsl:for-each select="adl:property[@type='list' or @type='link']">
|
||||||
</xsl:otherwise>
|
<xsl:choose>
|
||||||
</xsl:choose>
|
<xsl:when test="@concrete='false'"/>
|
||||||
</xsl:for-each>
|
<xsl:otherwise>
|
||||||
</xsl:template>
|
<xsl:value-of select="concat( ' _', @name)"/> = new HashedSet<<xsl:value-of select="@entity"/>>();
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
File diff suppressed because it is too large
Load diff
|
@ -12,7 +12,7 @@
|
||||||
Convert ADL to MS-SQL
|
Convert ADL to MS-SQL
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.12 $
|
$Revision: 1.13 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:output indent="no" encoding="UTF-8" method="text"/>
|
<xsl:output indent="no" encoding="UTF-8" method="text"/>
|
||||||
|
@ -27,70 +27,72 @@
|
||||||
-->
|
-->
|
||||||
<xsl:param name="abstract-key-name-convention" select="Id"/>
|
<xsl:param name="abstract-key-name-convention" select="Id"/>
|
||||||
<xsl:param name="database"/>
|
<xsl:param name="database"/>
|
||||||
|
<!-- the name and version of the product being built -->
|
||||||
|
<xsl:param name="product-version" select="'Application Description Language Framework'"/>
|
||||||
|
|
||||||
<!-- define upper and lower case letters to enable case conversion -->
|
<!-- define upper and lower case letters to enable case conversion -->
|
||||||
<xsl:variable name="ucase">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
<xsl:variable name="ucase">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
||||||
<xsl:variable name="lcase">abcdefghijklmnopqrstuvwxyz</xsl:variable>
|
<xsl:variable name="lcase">abcdefghijklmnopqrstuvwxyz</xsl:variable>
|
||||||
<!-- define SQL keywords to police these out of field names -->
|
<!-- define SQL keywords to police these out of field names -->
|
||||||
<xsl:variable name="sqlkeywords-multiline">
|
<xsl:variable name="sqlkeywords-multiline">
|
||||||
ADD EXCEPT PERCENT
|
ADD EXCEPT PERCENT
|
||||||
ALL EXEC PLAN
|
ALL EXEC PLAN
|
||||||
ALTER EXECUTE PRECISION
|
ALTER EXECUTE PRECISION
|
||||||
AND EXISTS PRIMARY
|
AND EXISTS PRIMARY
|
||||||
ANY EXIT PRINT
|
ANY EXIT PRINT
|
||||||
AS FETCH PROC
|
AS FETCH PROC
|
||||||
ASC FILE PROCEDURE
|
ASC FILE PROCEDURE
|
||||||
AUTHORIZATION FILLFACTOR PUBLIC
|
AUTHORIZATION FILLFACTOR PUBLIC
|
||||||
BACKUP FOR RAISERROR
|
BACKUP FOR RAISERROR
|
||||||
BEGIN FOREIGN READ
|
BEGIN FOREIGN READ
|
||||||
BETWEEN FREETEXT READTEXT
|
BETWEEN FREETEXT READTEXT
|
||||||
BREAK FREETEXTTABLE RECONFIGURE
|
BREAK FREETEXTTABLE RECONFIGURE
|
||||||
BROWSE FROM REFERENCES
|
BROWSE FROM REFERENCES
|
||||||
BULK FULL REPLICATION
|
BULK FULL REPLICATION
|
||||||
BY FUNCTION RESTORE
|
BY FUNCTION RESTORE
|
||||||
CASCADE GOTO RESTRICT
|
CASCADE GOTO RESTRICT
|
||||||
CASE GRANT RETURN
|
CASE GRANT RETURN
|
||||||
CHECK GROUP REVOKE
|
CHECK GROUP REVOKE
|
||||||
CHECKPOINT HAVING RIGHT
|
CHECKPOINT HAVING RIGHT
|
||||||
CLOSE HOLDLOCK ROLLBACK
|
CLOSE HOLDLOCK ROLLBACK
|
||||||
CLUSTERED IDENTITY ROWCOUNT
|
CLUSTERED IDENTITY ROWCOUNT
|
||||||
COALESCE IDENTITY_INSERT ROWGUIDCOL
|
COALESCE IDENTITY_INSERT ROWGUIDCOL
|
||||||
COLLATE IDENTITYCOL RULE
|
COLLATE IDENTITYCOL RULE
|
||||||
COLUMN IF SAVE
|
COLUMN IF SAVE
|
||||||
COMMIT IN SCHEMA
|
COMMIT IN SCHEMA
|
||||||
COMPUTE INDEX SELECT
|
COMPUTE INDEX SELECT
|
||||||
CONSTRAINT INNER SESSION_USER
|
CONSTRAINT INNER SESSION_USER
|
||||||
CONTAINS INSERT SET
|
CONTAINS INSERT SET
|
||||||
CONTAINSTABLE INTERSECT SETUSER
|
CONTAINSTABLE INTERSECT SETUSER
|
||||||
CONTINUE INTO SHUTDOWN
|
CONTINUE INTO SHUTDOWN
|
||||||
CONVERT IS SOME
|
CONVERT IS SOME
|
||||||
CREATE JOIN STATISTICS
|
CREATE JOIN STATISTICS
|
||||||
CROSS KEY SYSTEM_USER
|
CROSS KEY SYSTEM_USER
|
||||||
CURRENT KILL TABLE
|
CURRENT KILL TABLE
|
||||||
CURRENT_DATE LEFT TEXTSIZE
|
CURRENT_DATE LEFT TEXTSIZE
|
||||||
CURRENT_TIME LIKE THEN
|
CURRENT_TIME LIKE THEN
|
||||||
CURRENT_TIMESTAMP LINENO TO
|
CURRENT_TIMESTAMP LINENO TO
|
||||||
CURRENT_USER LOAD TOP
|
CURRENT_USER LOAD TOP
|
||||||
CURSOR NATIONAL TRAN
|
CURSOR NATIONAL TRAN
|
||||||
DATABASE NOCHECK TRANSACTION
|
DATABASE NOCHECK TRANSACTION
|
||||||
DBCC NONCLUSTERED TRIGGER
|
DBCC NONCLUSTERED TRIGGER
|
||||||
DEALLOCATE NOT TRUNCATE
|
DEALLOCATE NOT TRUNCATE
|
||||||
DECLARE NULL TSEQUAL
|
DECLARE NULL TSEQUAL
|
||||||
DEFAULT NULLIF UNION
|
DEFAULT NULLIF UNION
|
||||||
DELETE OF UNIQUE
|
DELETE OF UNIQUE
|
||||||
DENY OFF UPDATE
|
DENY OFF UPDATE
|
||||||
DESC OFFSETS UPDATETEXT
|
DESC OFFSETS UPDATETEXT
|
||||||
DISK ON USE
|
DISK ON USE
|
||||||
DISTINCT OPEN USER
|
DISTINCT OPEN USER
|
||||||
DISTRIBUTED OPENDATASOURCE VALUES
|
DISTRIBUTED OPENDATASOURCE VALUES
|
||||||
DOUBLE OPENQUERY VARYING
|
DOUBLE OPENQUERY VARYING
|
||||||
DROP OPENROWSET VIEW
|
DROP OPENROWSET VIEW
|
||||||
DUMMY OPENXML WAITFOR
|
DUMMY OPENXML WAITFOR
|
||||||
DUMP OPTION WHEN
|
DUMP OPTION WHEN
|
||||||
ELSE OR WHERE
|
ELSE OR WHERE
|
||||||
END ORDER WHILE
|
END ORDER WHILE
|
||||||
ERRLVL OUTER WITH
|
ERRLVL OUTER WITH
|
||||||
ESCAPE OVER WRITETEXT
|
ESCAPE OVER WRITETEXT
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="sqlkeywords" select="concat(' ', normalize-space($sqlkeywords-multiline), ' ')"/>
|
<xsl:variable name="sqlkeywords" select="concat(' ', normalize-space($sqlkeywords-multiline), ' ')"/>
|
||||||
|
|
||||||
|
@ -98,10 +100,10 @@
|
||||||
<xsl:template match="adl:application">
|
<xsl:template match="adl:application">
|
||||||
-------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------
|
||||||
--
|
--
|
||||||
-- Application Description Language framework
|
-- <xsl:value-of select="$product-version"/>
|
||||||
--
|
--
|
||||||
-- Database for application <xsl:value-of select="@name"/> version <xsl:value-of select="@version"/>
|
-- Database for application <xsl:value-of select="@name"/> version <xsl:value-of select="@version"/>
|
||||||
-- Generated for MS-SQL 2000+ using adl2mssql.xslt <xsl:value-of select="substring('$Revision: 1.12 $', 12)"/>
|
-- Generated for MS-SQL 2000+ using adl2mssql.xslt <xsl:value-of select="substring('$Revision: 1.13 $', 12)"/>
|
||||||
--
|
--
|
||||||
-- Code generator (c) 2007 Cygnet Solutions Ltd
|
-- Code generator (c) 2007 Cygnet Solutions Ltd
|
||||||
--
|
--
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue