Mainly grammatical changes involving the replacement of type='serial' with generators

This commit is contained in:
sb 2008-02-04 15:54:46 +00:00
parent 78a038a764
commit d61f36c13d
2 changed files with 73 additions and 27 deletions

View file

@ -13,7 +13,7 @@
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!--
$Revision: 1.7 $
$Revision: 1.8 $
-->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
@ -82,15 +82,8 @@
char(1) java.sql.Types.CHAR
text: text or java.sql.Types.LONGVARCHAR
memo java.sql.Types.CLOB
Also, a hack, which may not belong here:
serial: An integer whose value is automatically assigned by the database. Given
that Canonical ADL requires that every key must be specified, we
need a way of distinguishing those which are system generated from
those which aren't. This may not be the right way to do it!
-->
<!ENTITY % SimpleDataTypes "%DefinableDataTypes;|boolean|text|serial" >
<!ENTITY % SimpleDataTypes "%DefinableDataTypes;|boolean|text" >
<!--
data types which are more complex than SimpleDataTypes...
@ -128,6 +121,18 @@
"name CDATA #REQUIRED
properties (all|user-distict|listed) #REQUIRED" >
<!-- Actions for generators (mainly for keyfields - see entity 'generator', below
assigned: In manually-maintained code, you contract to assign a value
to this property before it is persisted.
guid: The system will supply a unique GUid value to this field
before it is persisted.
mannual: You contract to supply a generatos class in manually maintained
code.
native: The database will supply a unique value to this field when it
is persisted; the value will be an integer. RECOMMENDED!
-->
<!ENTITY % GeneratorActions "assigned|guid|manual|native">
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- Elements -->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
@ -276,7 +281,7 @@
committed to persistent store, the value which it holds before
it has been committed
-->
<!ELEMENT property ( documentation?, permission*, option*, prompt*, help*, ifmissing*)>
<!ELEMENT property ( documentation?, generator?, permission*, option*, prompt*, help*, ifmissing*)>
<!ATTLIST property
name CDATA #REQUIRED
@ -394,15 +399,45 @@ property[@type='entity']. TODO: Not complete, not yet strictly convinced it's th
-->
<!ELEMENT many-to-one (documentation?)>
<!ATTLIST many-to-one
name CDATA #REQUIRED
name CDATA #REQUIRED
distinct (none|all|user|system) #IMPLIED
entity CDATA #IMPLIED
farkey CDATA #IMPLIED
required %Boolean; #IMPLIED
concrete %Boolean; #IMPLIED
cascade (%CascadeActions;) #IMPLIED
column CDATA #IMPLIED
unsaved-value CDATA #IMPLIED>
entity CDATA #IMPLIED
farkey CDATA #IMPLIED
required %Boolean; #IMPLIED
concrete %Boolean; #IMPLIED
cascade (%CascadeActions;) #IMPLIED
column CDATA #IMPLIED
unsaved-value CDATA #IMPLIED>
<!--
marks a property which is auto-generated by some part of the system.
This is based on the Hibernate construct, except that the Hibernate
implementation folds both its internal generators and custom generators
onto the same attribute. This separates them onto two attributes so we
can police values for Hibernate's 'builtin' generators.
action: one of the supported Hibernate builtin generators, or
'manual'. 'native' is strongly recommended in most instances
class: if action is 'manual', the name of a manually maintained
class conforming to the Hibernate IdentifierGenerator
interface, or its equivalent in other languages
-->
<!ELEMENT generator (documentation?, param*)>
<!ATTLIST generator
action (%GeneratorActions;) #REQUIRED
class CDATA #IMPLIED>
<!--
A parameter passed to the generator. Again, based on the Hibernate
implementation.
name: the name of this parameter
-->
<!ELEMENT param (CDATA)>
<!ATTLIST param
name CDATA #REQUIRED>
<!--
one of an explicit list of optional values a property may have

View file

@ -16,8 +16,8 @@
are generated.
$Author: sb $
$Revision: 1.2 $
$Date: 2008-02-01 18:25:38 $
$Revision: 1.3 $
$Date: 2008-02-04 15:54:46 $
-->
<xsl:stylesheet version="1.0"
@ -47,7 +47,7 @@
* THIS FILE IS AUTOMATICALLY GENERATED AND SHOULD NOT
* BE MANUALLY EDITED.
*
* Generated using adl2canonical.xsl revision <xsl:value-of select="substring('$Revision: 1.2 $', 12)"/>
* Generated using adl2canonical.xsl revision <xsl:value-of select="substring('$Revision: 1.3 $', 12)"/>
*
***************************************************************************
</xsl:comment>
@ -69,7 +69,7 @@
Since we've got the key tag, I think this should be disallowed -->
<xsl:template match="adl:entity[@natural-key]">
<xsl:message terminate="no">
[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</xsl:message>
<entity>
<xsl:variable name="nkey" select="@natural-key"/>
<xsl:apply-templates select="@*"/>
@ -120,7 +120,7 @@
<!-- check that it is unique, and abort hard if not... -->
<xsl:if test="descendant::adl:property[@name=$key]">
<xsl:message terminate="yes">
Entity '<xsl:value-of select="@name"/>' has a property '<xsl:value-of select="$key"/>' which conflicts
ADL ERROR: Entity '<xsl:value-of select="@name"/>' has a property '<xsl:value-of select="$key"/>' which conflicts
with your chosen key naming convention <xsl:value-of select="$abstract-key-name-convention"/>. Either:
(i) Make property '<xsl:value-of select="$key"/>' an explicit key by putting it in the &lt;key&gt; tag;
(ii) Name property '<xsl:value-of select="$key"/>' something else; or
@ -129,10 +129,11 @@
</xsl:if>
<!-- generate one property, the abstract primary key -->
<property type="serial" distinct="system">
<property type="integer" distinct="system">
<xsl:attribute name="name">
<xsl:value-of select="normalize-space( $key)"/>
</xsl:attribute>
<generator action="native"/>
</property>
</key>
<xsl:apply-templates select="adl:property | adl:one-to-many | adl:many-to-many | adl:many-to-one"/>
@ -270,22 +271,32 @@
</xsl:for-each>
</xsl:template>
<xsl:template match="adl:typedef[ @type = 'string' and not( @size)]">
<xsl:message terminate="yes">
ADL ERROR: Type definitions of type 'string' must have a valid value for 'size'
Offending typedef: <xsl:value-of select="@name"/>
</xsl:message>
</xsl:template>
<!-- Language constraints -->
<xsl:template match="property[ @type = 'string' and not( number( @size))]">
<xsl:template match="adl:property[ @type = 'string' and not( @size)]">
<xsl:message terminate="yes">
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"/>
</xsl:message>
</xsl:template>
<xsl:template match="property[ @type = 'entity' and not( @entity)]">
<xsl:template match="adl:property[ @type = 'entity' and not( @entity)]">
<xsl:message terminate="yes">
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"/>
</xsl:message>
</xsl:template>
<xsl:template match="property[ @type = 'defined' and not( @typedef)]">
<xsl:template match="adl:property[ @type = 'defined' and not( @typedef)]">
<xsl:message terminate="yes">
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"/>
</xsl:message>
</xsl:template>