bug 1946: rewritten UserIdentifier generator to fix this, along with many other changes including extensive refactoring of adl2controllerclasses.
This commit is contained in:
parent
f5b524e5c7
commit
8f5573d224
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Application Description Language framework
|
Application Description Language framework
|
||||||
adl2controllerclasses.xsl
|
adl2controllerclasses.xsl
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@
|
||||||
Transform ADL into (partial) controller classes
|
Transform ADL into (partial) controller classes
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.10 $
|
$Revision: 1.11 $
|
||||||
$Date: 2008-06-06 08:46:27 $
|
$Date: 2008-06-06 15:52:48 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- 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! -->
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns="http://cygnets.co.uk/schemas/adl-1.2"
|
xmlns="http://cygnets.co.uk/schemas/adl-1.2"
|
||||||
|
@ -57,36 +57,31 @@
|
||||||
<xsl:param name="area-name"/>
|
<xsl:param name="area-name"/>
|
||||||
|
|
||||||
<xsl:template match="adl:application">
|
<xsl:template match="adl:application">
|
||||||
<xsl:call-template name="collection-factory"/>
|
|
||||||
<xsl:apply-templates select="adl:entity"/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<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'] ---------------- */
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// <xsl:value-of select="$product-version"/>
|
// <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
|
||||||
//
|
//
|
||||||
// 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; generated using
|
// <xsl:value-of select="/adl:application/@name"/> application; generated using
|
||||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.10 $', 10)"/>
|
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.11 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
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 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
|
||||||
|
@ -111,58 +106,61 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<xsl:apply-templates select="adl:entity"/>
|
||||||
</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:template match="adl:entity">
|
||||||
<xsl:comment>Not generating controller for entity <xsl:value-of select="@name"/>,
|
/*
|
||||||
as it has no forms, pages or lists.
|
* Not generating controller for entity <xsl:value-of select="@name"/>,
|
||||||
</xsl:comment>
|
* as it has no forms, pages or lists.
|
||||||
|
*/
|
||||||
</xsl:template>
|
</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'] ---------------- */
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// <xsl:value-of select="$product-version"/>
|
// <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.10 $', 10)"/>
|
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.11 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Security;
|
using System.Web.Security;
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
using System.Web.UI.WebControls.WebParts;
|
using System.Web.UI.WebControls.WebParts;
|
||||||
using System.Web.UI.HtmlControls;
|
using System.Web.UI.HtmlControls;
|
||||||
using Castle.MonoRail.Framework.Helpers;
|
using Castle.MonoRail.Framework.Helpers;
|
||||||
using Cygnet.Exceptions;
|
using Cygnet.Exceptions;
|
||||||
using Cygnet.Web.Helpers;
|
using Cygnet.Web.Helpers;
|
||||||
using Cygnet.Web.Controllers;
|
using Cygnet.Web.Controllers;
|
||||||
using Cygnet.Web.SmartControls;
|
using Cygnet.Web.SmartControls;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
using NHibernate.Expression;
|
using NHibernate.Expression;
|
||||||
using Castle.MonoRail.Framework;
|
using Castle.MonoRail.Framework;
|
||||||
using Iesi.Collections.Generic;
|
using Iesi.Collections.Generic;
|
||||||
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 partial controller class following 'thin controller'
|
/// Automatically generated partial controller class following 'thin controller'
|
||||||
|
@ -218,8 +216,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void fixupMessages() {
|
public void fixupMessages() {
|
||||||
ISession hibernator =
|
ISession hibernator =
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
Session[ NHibernateHelper.USERTOKEN],
|
||||||
|
Session[NHibernateHelper.PASSTOKEN]
|
||||||
|
</xsl:if>);
|
||||||
ICollection<<xsl:value-of select="concat($entityns, '.', @name)"/>> instances =
|
ICollection<<xsl:value-of select="concat($entityns, '.', @name)"/>> instances =
|
||||||
hibernator.CreateCriteria( typeof( <xsl:value-of select="concat($entityns, '.', @name)"/>))
|
hibernator.CreateCriteria( typeof( <xsl:value-of select="concat($entityns, '.', @name)"/>))
|
||||||
.List<<xsl:value-of select="concat($entityns, '.', @name)"/>>();
|
.List<<xsl:value-of select="concat($entityns, '.', @name)"/>>();
|
||||||
|
@ -251,8 +251,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
private void Store()
|
private void Store()
|
||||||
{
|
{
|
||||||
ISession hibernator =
|
ISession hibernator =
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
Session[ NHibernateHelper.USERTOKEN],
|
||||||
|
Session[NHibernateHelper.PASSTOKEN]
|
||||||
|
</xsl:if>);
|
||||||
List<string> messages = new List<string>();
|
List<string> messages = new List<string>();
|
||||||
/* A 'newborn' instance can be updated even if the current user doesn't have
|
/* A 'newborn' instance can be updated even if the current user doesn't have
|
||||||
* update permissions, seeing that we use an update operation to set the
|
* update permissions, seeing that we use an update operation to set the
|
||||||
|
@ -285,7 +287,9 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$basetype='integer'">Int32.Parse( Form["<xsl:value-of select="concat( 'instance.', @name)"/>"])</xsl:when>
|
<xsl:when test="$basetype='integer'">
|
||||||
|
Int32.Parse( Form["<xsl:value-of select="concat( 'instance.', @name)"/>"])
|
||||||
|
</xsl:when>
|
||||||
<xsl:when test="$basetype='entity'">
|
<xsl:when test="$basetype='entity'">
|
||||||
<!-- Maybe TODO: this doesn't work recursively - if an entity has a key which is an 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! -->
|
and the key of that entity is an entity, you're on your own, mate! -->
|
||||||
|
@ -302,8 +306,11 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
Form[ "<xsl:value-of select="concat( 'instance.', @name)"/>"]
|
Form[ "<xsl:value-of select="concat( 'instance.', @name)"/>"]
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', $keyentity)"/>>()</xsl:when>
|
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', $keyentity)"/>>()
|
||||||
<xsl:otherwise>Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]</xsl:otherwise>
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]
|
||||||
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="position() = last()"/>
|
<xsl:when test="position() = last()"/>
|
||||||
|
@ -346,7 +353,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
* if these have yet to be initialised they must be handled specially */
|
* if these have yet to be initialised they must be handled specially */
|
||||||
Locale locale = GetBestLocaleForUser();
|
Locale locale = GetBestLocaleForUser();
|
||||||
<xsl:for-each select="descendant::adl:property[@type='message']">
|
<xsl:for-each select="descendant::adl:property[@type='message']">
|
||||||
if ( ! String.IsNullOrEmpty( Form["<xsl:value-of select="concat( 'i18n.instance.', @name)"/>"])){
|
if ( ! String.IsNullOrEmpty( Form["<xsl:value-of select="concat( 'instance.', @name)"/>"])){
|
||||||
/* there's an uninitialised message for this slot */
|
/* there's an uninitialised message for this slot */
|
||||||
Message mess = record.<xsl:value-of select="@name"/>;
|
Message mess = record.<xsl:value-of select="@name"/>;
|
||||||
if ( mess == null) {
|
if ( mess == null) {
|
||||||
|
@ -358,7 +365,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
if ( trans == null) {
|
if ( trans == null) {
|
||||||
trans = new Translation( mess, locale);
|
trans = new Translation( mess, locale);
|
||||||
}
|
}
|
||||||
trans.MessageText = Form["<xsl:value-of select="concat( 'i18n.instance.', @name)"/>"];
|
trans.MessageText = Form["<xsl:value-of select="concat( 'instance.', @name)"/>"];
|
||||||
record.<xsl:value-of select="@name"/> = mess;
|
record.<xsl:value-of select="@name"/> = mess;
|
||||||
hibernator.Save( trans);
|
hibernator.Save( trans);
|
||||||
}
|
}
|
||||||
|
@ -375,7 +382,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
{
|
{
|
||||||
record.<xsl:value-of select="@name"/> = <xsl:call-template name="fetch-property-instance">
|
record.<xsl:value-of select="@name"/> = <xsl:call-template name="fetch-property-instance">
|
||||||
<xsl:with-param name="property" select="."/>
|
<xsl:with-param name="property" select="."/>
|
||||||
<xsl:with-param name="valuename" select="@name"/>
|
<xsl:with-param name="value">Form[ "<xsl:value-of select="concat( 'instance.', @name)"/>"]</xsl:with-param>
|
||||||
</xsl:call-template>;
|
</xsl:call-template>;
|
||||||
}
|
}
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
@ -410,7 +417,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<xsl:value-of select="concat( 'record.', @name)"/> = new HashedSet<<xsl:value-of select="@entity"/>>();
|
<xsl:value-of select="concat( 'record.', @name)"/> = new HashedSet<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* then reinstate the values from the indexes passed */
|
/* then reinstate the values from the indexes passed */
|
||||||
|
@ -420,7 +427,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @entity)"/>))
|
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @entity)"/>))
|
||||||
<xsl:call-template name="add-hibernate-expression-eq">
|
<xsl:call-template name="add-hibernate-expression-eq">
|
||||||
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
|
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
|
||||||
<xsl:with-param name="value" select="index"/>
|
<xsl:with-param name="value" select="'index'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>());
|
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>());
|
||||||
}
|
}
|
||||||
|
@ -482,7 +489,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
hibernator.CreateCriteria(typeof(<xsl:value-of select="@entity"/>))
|
hibernator.CreateCriteria(typeof(<xsl:value-of select="@entity"/>))
|
||||||
<xsl:call-template name="add-hibernate-expression-eq">
|
<xsl:call-template name="add-hibernate-expression-eq">
|
||||||
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
|
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
|
||||||
<xsl:with-param name="value" select="index"/>
|
<xsl:with-param name="value" select="'index'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>();
|
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>();
|
||||||
|
|
||||||
|
@ -541,23 +548,12 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
NHibernateHelper.CloseSession();
|
NHibernateHelper.CloseSession();
|
||||||
hibernator = NHibernateHelper.GetCurrentSession(<xsl:if test="$authentication-layer = 'Database'">
|
hibernator = NHibernateHelper.GetCurrentSession(<xsl:if test="$authentication-layer = 'Database'">
|
||||||
Session[ NHibernateHelper.USERTOKEN],
|
Session[ NHibernateHelper.USERTOKEN],
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
Session[NHibernateHelper.PASSTOKEN]
|
||||||
|
</xsl:if>);
|
||||||
|
|
||||||
record = FetchRecord( hibernator);
|
record = FetchRecord( hibernator);
|
||||||
} /* if ( ! HasNoErrors()) */
|
} /* if ( ! HasNoErrors()) */
|
||||||
|
<xsl:value-of select="concat( 'this.',adl:form[position()=1]/@name)"/>( record);
|
||||||
TypedPropertyBag = new {
|
|
||||||
<xsl:call-template name="formmenus">
|
|
||||||
<xsl:with-param name="form" select="adl:form[position()=1]"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:if test="$authentication-layer = 'Database'">
|
|
||||||
username = Session[ NHibernateHelper.USERTOKEN],
|
|
||||||
</xsl:if>
|
|
||||||
messages = messages,
|
|
||||||
instance = record };
|
|
||||||
|
|
||||||
RenderViewWithFailover("<xsl:value-of select="concat( adl:form[position()=1]/@name, '.vm')"/>",
|
|
||||||
"<xsl:value-of select="concat( adl:form[position()=1]/@name, '.auto.vm')"/>");
|
|
||||||
}
|
}
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
|
@ -571,8 +567,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
{
|
{
|
||||||
AssertUserCanDelete();
|
AssertUserCanDelete();
|
||||||
ISession hibernator =
|
ISession hibernator =
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
Session[ NHibernateHelper.USERTOKEN],
|
||||||
|
Session[NHibernateHelper.PASSTOKEN]
|
||||||
|
</xsl:if>);
|
||||||
|
|
||||||
if ( "true".Equals( Params["reallydelete"]))
|
if ( "true".Equals( Params["reallydelete"]))
|
||||||
{
|
{
|
||||||
|
@ -621,8 +619,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
{
|
{
|
||||||
AssertUserCanRead();
|
AssertUserCanRead();
|
||||||
ISession hibernator =
|
ISession hibernator =
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
Session[ NHibernateHelper.USERTOKEN],
|
||||||
|
Session[NHibernateHelper.PASSTOKEN]
|
||||||
|
</xsl:if>);
|
||||||
|
|
||||||
ICriteria search =
|
ICriteria search =
|
||||||
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>));
|
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>));
|
||||||
|
@ -641,7 +641,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
if ( ! String.IsNullOrEmpty( Params[ "<xsl:value-of select="concat( 'search_', @name)"/>"])) {
|
if ( ! String.IsNullOrEmpty( Params[ "<xsl:value-of select="concat( 'search_', @name)"/>"])) {
|
||||||
search<xsl:call-template name="add-hibernate-expression-like">
|
search<xsl:call-template name="add-hibernate-expression-like">
|
||||||
<xsl:with-param name="property" select="."/>
|
<xsl:with-param name="property" select="."/>
|
||||||
<xsl:with-param name="value" select="concat( 'search_', @name)"/>
|
<xsl:with-param name="value">Params["<xsl:value-of select="concat( 'search_', @name)"/>"]</xsl:with-param>
|
||||||
</xsl:call-template>;
|
</xsl:call-template>;
|
||||||
}
|
}
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
|
@ -687,11 +687,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
/* it's (probably) existing, retrieve it */
|
/* it's (probably) existing, retrieve it */
|
||||||
record = hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>))
|
record = hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>))
|
||||||
<xsl:for-each select="adl:key/adl:property">
|
<xsl:for-each select="adl:key/adl:property">
|
||||||
<xsl:variable name="basetype">
|
<xsl:call-template name="add-hibernate-expression-eq">
|
||||||
<xsl:call-template name="base-type">
|
|
||||||
<xsl:with-param name="property" select="."/>
|
<xsl:with-param name="property" select="."/>
|
||||||
|
<xsl:with-param name="value">Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @name)"/>>();
|
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @name)"/>>();
|
||||||
}
|
}
|
||||||
|
@ -699,7 +698,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* ---- [ cut here: next file 'junk'] ------------------------- */
|
/* ---- [ cut here: next file 'junk'] ------------------------- */
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
@ -754,8 +753,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
if ( command.Equals( "delete"))
|
if ( command.Equals( "delete"))
|
||||||
{
|
{
|
||||||
ISession hibernator =
|
ISession hibernator =
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
Session[ NHibernateHelper.USERTOKEN],
|
||||||
|
Session[NHibernateHelper.PASSTOKEN]
|
||||||
|
</xsl:if>);
|
||||||
|
|
||||||
<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record = FetchRecord( hibernator);
|
<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record = FetchRecord( hibernator);
|
||||||
|
|
||||||
|
@ -787,31 +788,9 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
{
|
{
|
||||||
AssertUserCanRead();
|
AssertUserCanRead();
|
||||||
|
|
||||||
/* we don't actually instantiate this local variable; it exists to that
|
<xsl:value-of select="concat( 'this.', @name)"/>( (<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>)null);
|
||||||
* TypedPropertyBag can do introspection to infer property types */
|
|
||||||
<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record = null;
|
|
||||||
|
|
||||||
ISession hibernator =
|
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
|
||||||
|
|
||||||
TypedPropertyBag = new {
|
|
||||||
<xsl:if test="$authentication-layer = 'Database'">
|
|
||||||
username = Session[ NHibernateHelper.USERTOKEN],
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:call-template name="formmenus">
|
|
||||||
<xsl:with-param name="form" select="."/>
|
|
||||||
</xsl:call-template>
|
|
||||||
instance = record
|
|
||||||
};
|
|
||||||
|
|
||||||
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>",
|
|
||||||
"<xsl:value-of select="concat( @name, '.auto.vm')"/>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<xsl:if test="ancestor::adl:entity/adl:key/adl:property[@type='entity']">
|
|
||||||
<!-- if there's a key which is an entity, the actual entity can't be passed in.
|
|
||||||
So what will be passed in is the key value, from which we can find the entity -->
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show the form named <xsl:value-of select="@name"/>, containing the indicated record. As
|
/// Show the form named <xsl:value-of select="@name"/>, containing the indicated record. As
|
||||||
|
@ -820,7 +799,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
<xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
<xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@type='entity'">
|
<xsl:when test="@type='entity'">
|
||||||
/// <param name="<xsl:value-of select="concat( @name, '_Value')"/>">the key value of the key value of the record to show</param>
|
/// <param name="<xsl:value-of select="@name"/>">the key value of the key value of the record to show</param>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
/// <param name="<xsl:value-of select="@name"/>">the key value of the record to show</param>
|
/// <param name="<xsl:value-of select="@name"/>">the key value of the record to show</param>
|
||||||
|
@ -829,73 +808,37 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
[AccessibleThrough(Verb.Get)]
|
[AccessibleThrough(Verb.Get)]
|
||||||
public void <xsl:value-of select="@name"/>( <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
public void <xsl:value-of select="@name"/>( <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
||||||
<!-- all args are passed as string because that's what hibernate-expression-eq -->
|
<!-- all args are passed as string because that's what hibernate-expression-eq expects -->
|
||||||
string <xsl:choose>
|
string <xsl:value-of select="concat( ' ', @name)"/>
|
||||||
<xsl:when test="@type='entity'">
|
|
||||||
<!-- xsl:call-template name="csharp-base-type">
|
|
||||||
<xsl:with-param name="property" select="."/>
|
|
||||||
</xsl:call-template -->
|
|
||||||
<xsl:value-of select="concat( ' ', @name, '_Value')"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<!-- xsl:call-template name="csharp-base-type">
|
|
||||||
<xsl:with-param name="property" select="."/>
|
|
||||||
</xsl:call-template -->
|
|
||||||
<xsl:value-of select="concat( ' ', @name)"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
<xsl:if test="not( position() = last())">,</xsl:if>
|
<xsl:if test="not( position() = last())">,</xsl:if>
|
||||||
</xsl:for-each>) {
|
</xsl:for-each>) {
|
||||||
ISession hibernator =
|
ISession hibernator =
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
Session[ NHibernateHelper.USERTOKEN],
|
||||||
this.<xsl:value-of select="@name"/>( <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
Session[NHibernateHelper.PASSTOKEN]
|
||||||
<xsl:choose>
|
</xsl:if>);
|
||||||
<xsl:when test="@type='entity'">
|
<xsl:value-of select="concat( 'this.', @name)"/>(
|
||||||
<xsl:variable name="entity" select="@entity"/>
|
hibernator.CreateCriteria( typeof(<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>))
|
||||||
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat($entityns, '.', @entity)"/>))
|
|
||||||
<xsl:call-template name="add-hibernate-expression-eq">
|
|
||||||
<xsl:with-param name="property" select="//adl:entity[@name=$entity]/adl:key/adl:property[position()=1]"/>
|
|
||||||
<xsl:with-param name="value" select="concat( @name, '_Value')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
.UniqueResult<<xsl:value-of select="concat($entityns, '.', @entity)"/>>()
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="concat( ' ', @name)"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
<xsl:if test="not( position() = last())">,</xsl:if>
|
|
||||||
</xsl:for-each>);
|
|
||||||
}
|
|
||||||
</xsl:if>
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Show the form named <xsl:value-of select="@name"/>, containing the indicated record
|
|
||||||
/// </summary>
|
|
||||||
<xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
|
||||||
/// <param name="<xsl:value-of select="@name"/>">the key value of the record to show</param>
|
|
||||||
</xsl:for-each>
|
|
||||||
[AccessibleThrough(Verb.Get)]
|
|
||||||
public void <xsl:value-of select="@name"/>( <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
|
||||||
<!-- xsl:call-template name="csharp-type">
|
|
||||||
<xsl:with-param name="property" select="."/>
|
|
||||||
</xsl:call-template -->
|
|
||||||
string <xsl:value-of select="concat( ' ', @name)"/>
|
|
||||||
<xsl:if test="not( position() = last())">,</xsl:if>
|
|
||||||
</xsl:for-each>)
|
|
||||||
{
|
|
||||||
ISession hibernator =
|
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
|
||||||
<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record =
|
|
||||||
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>))
|
|
||||||
<xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
<xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
||||||
<xsl:call-template name="add-hibernate-expression-eq">
|
<xsl:call-template name="add-hibernate-expression-eq">
|
||||||
<xsl:with-param name="property" select="."/>
|
<xsl:with-param name="property" select="."/>
|
||||||
<xsl:with-param name="value" select="@name"/>
|
<xsl:with-param name="value" select="@name"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
.UniqueResult<<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>>();
|
.UniqueResult<<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>>());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show the form named <xsl:value-of select="@name"/>, containing the indicated record
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="record">the record to show</param>
|
||||||
|
protected void <xsl:value-of select="@name"/>( <xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record)
|
||||||
|
{
|
||||||
|
ISession hibernator =
|
||||||
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||||
|
Session[ NHibernateHelper.USERTOKEN],
|
||||||
|
Session[NHibernateHelper.PASSTOKEN]
|
||||||
|
</xsl:if>);
|
||||||
|
|
||||||
TypedPropertyBag = new {
|
TypedPropertyBag = new {
|
||||||
<xsl:if test="$authentication-layer = 'Database'">
|
<xsl:if test="$authentication-layer = 'Database'">
|
||||||
|
@ -908,7 +851,6 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>", "<xsl:value-of select="concat( @name, '.auto.vm')"/>");
|
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>", "<xsl:value-of select="concat( @name, '.auto.vm')"/>");
|
||||||
}
|
}
|
||||||
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="adl:list">
|
<xsl:template match="adl:list">
|
||||||
|
@ -955,7 +897,9 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
matchCriteria<xsl:call-template name="add-hibernate-expression-eq">
|
matchCriteria<xsl:call-template name="add-hibernate-expression-eq">
|
||||||
<xsl:with-param name="property" select="$property"/>
|
<xsl:with-param name="property" select="$property"/>
|
||||||
<xsl:with-param name="value" select="concat('instance.', $property/@name)"/>
|
<xsl:with-param name="value">
|
||||||
|
Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]
|
||||||
|
</xsl:with-param>
|
||||||
</xsl:call-template>;
|
</xsl:call-template>;
|
||||||
|
|
||||||
if ( record != null) {
|
if ( record != null) {
|
||||||
|
@ -969,7 +913,8 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
matchCriteria.Add(Expression.Not(<xsl:call-template name="hibernate-expression-eq">
|
matchCriteria.Add(Expression.Not(<xsl:call-template name="hibernate-expression-eq">
|
||||||
<xsl:with-param name="property" select="."/>
|
<xsl:with-param name="property" select="."/>
|
||||||
<xsl:with-param name="value">
|
<xsl:with-param name="value">
|
||||||
Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]</xsl:with-param>
|
Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]
|
||||||
|
</xsl:with-param>
|
||||||
</xsl:call-template>));
|
</xsl:call-template>));
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
}
|
}
|
||||||
|
@ -1164,11 +1109,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
Decimal.Parse( <xsl:value-of select="$value"/>)
|
Decimal.Parse( <xsl:value-of select="$value"/>)
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$basetype = 'date'">
|
<xsl:when test="$basetype = 'date'">
|
||||||
Date.Parse( <xsl:value-of select="$value"/>)
|
DateTime.Parse( <xsl:value-of select="$value"/>)
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$basetype='entity'">
|
<xsl:when test="$basetype='entity'">
|
||||||
<xsl:call-template name="fetch-property-instance">
|
<xsl:call-template name="fetch-property-instance">
|
||||||
<!-- recurse -->
|
|
||||||
<xsl:with-param name="property" select="$property"/>
|
<xsl:with-param name="property" select="$property"/>
|
||||||
<xsl:with-param name="value" select="$value"/>
|
<xsl:with-param name="value" select="$value"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
|
@ -1194,7 +1138,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$basetype='string' or $basetype='text'">
|
<xsl:when test="$basetype='string' or $basetype='text'">
|
||||||
Expression.Like( "<xsl:value-of select="@name"/>", "%"+Params["<xsl:value-of select="$value"/>"]+"%")
|
Expression.Like( "<xsl:value-of select="@name"/>", "%"+<xsl:value-of select="$value"/>+"%")
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:call-template name="hibernate-expression-eq">
|
<xsl:call-template name="hibernate-expression-eq">
|
||||||
|
@ -1233,7 +1177,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
<xsl:param name="property"/>
|
<xsl:param name="property"/>
|
||||||
<!-- the name of the value in the returned values from which the instance
|
<!-- the name of the value in the returned values from which the instance
|
||||||
must be resolved -->
|
must be resolved -->
|
||||||
<xsl:param name="valuename"/>
|
<xsl:param name="value"/>
|
||||||
<xsl:variable name="basetype">
|
<xsl:variable name="basetype">
|
||||||
<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"/>
|
||||||
|
@ -1248,7 +1192,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
<xsl:for-each select="//adl:entity[@name=$property/@entity]/adl:key/adl:property">
|
<xsl:for-each select="//adl:entity[@name=$property/@entity]/adl:key/adl:property">
|
||||||
<xsl:call-template name="add-hibernate-expression-eq">
|
<xsl:call-template name="add-hibernate-expression-eq">
|
||||||
<xsl:with-param name="property" select="."/>
|
<xsl:with-param name="property" select="."/>
|
||||||
<xsl:with-param name="value">Form["<xsl:value-of select="concat( 'instance.', $valuename)"/>"]</xsl:with-param>
|
<xsl:with-param name="value" select="$value"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>()
|
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!--
|
<!--
|
||||||
Application Description Language framework
|
Application Description Language framework
|
||||||
adl2entityclass.xsl
|
adl2entityclass.xsl
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@
|
||||||
Transform ADL into entity classes
|
Transform ADL into entity classes
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.5 $
|
$Revision: 1.6 $
|
||||||
$Date: 2008-05-29 16:39:38 $
|
$Date: 2008-06-06 15:52:48 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- 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! -->
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
@ -61,13 +61,11 @@
|
||||||
// (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="substring( '$Revision: 1.5 $', 10)"/>
|
// adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.6 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
namespace <xsl:value-of select="$entityns"/>
|
|
||||||
{
|
|
||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
@ -78,12 +76,14 @@
|
||||||
using Cygnet.Entities;
|
using Cygnet.Entities;
|
||||||
using Iesi.Collections.Generic;
|
using Iesi.Collections.Generic;
|
||||||
|
|
||||||
|
namespace <xsl:value-of select="$entityns"/>
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <xsl:value-of select="normalize-space( adl:documentation)"/>
|
/// <xsl:value-of select="normalize-space( adl:documentation)"/>
|
||||||
/// </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="substring( '$Revision: 1.5 $', 10)"/>.
|
/// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.6 $', 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.
|
||||||
///
|
///
|
||||||
|
@ -162,38 +162,35 @@
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="descendant::adl:property[@distinct='user' or @distinct='all']">
|
<xsl:when test="descendant::adl:property[@distinct='user' or @distinct='all']">
|
||||||
<xsl:for-each select="descendant::adl:property[@distinct='user' or @distinct='all']">
|
<xsl:for-each select="descendant::adl:property[@distinct='user' or @distinct='all']">
|
||||||
|
if ( <xsl:value-of select="@name"/> != null){
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@type='message'">
|
<xsl:when test="@type='message'">
|
||||||
if ( <xsl:value-of select="@name"/> != null)
|
|
||||||
result.Append( <xsl:value-of select="concat( @name, '.LocalText')"/>);
|
result.Append( <xsl:value-of select="concat( @name, '.LocalText')"/>);
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type='entity'">
|
<xsl:when test="@type='entity'">
|
||||||
<!-- TODO: this is dangerous and could potentially give rise to
|
<!-- TODO: this is dangerous and could potentially give rise to
|
||||||
infinite loops; find a way of stopping it running away! -->
|
infinite loops; find a way of stopping it running away! -->
|
||||||
if ( <xsl:value-of select="@name"/> != null)
|
|
||||||
result.Append( <xsl:value-of select="concat( @name, '.UserIdentifier')"/>);
|
result.Append( <xsl:value-of select="concat( @name, '.UserIdentifier')"/>);
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type='date'">
|
<xsl:when test="@type='date'">
|
||||||
<!-- if what we've got is just a date, we only want to see the date part of it -->
|
<!-- if what we've got is just a date, we only want to see the date part of it -->
|
||||||
if ( <xsl:value-of select="@name"/> != null)
|
|
||||||
result.Append(<xsl:value-of select="@name"/>.ToString( "d"));
|
result.Append(<xsl:value-of select="@name"/>.ToString( "d"));
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type='time'">
|
<xsl:when test="@type='time'">
|
||||||
<!-- if what we've got is just a time, we only want to see the time part of it -->
|
<!-- if what we've got is just a time, we only want to see the time part of it -->
|
||||||
if ( <xsl:value-of select="@name"/> != null)
|
|
||||||
result.Append(<xsl:value-of select="@name"/>.ToString( "t"));
|
result.Append(<xsl:value-of select="@name"/>.ToString( "t"));
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
if ( <xsl:value-of select="@name"/> != null)
|
|
||||||
result.Append(<xsl:value-of select="@name"/>);
|
result.Append(<xsl:value-of select="@name"/>);
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="position() = last()"/>
|
<xsl:when test="position() = last()"/>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
result.Append( ", ");
|
result.Append( ",");
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
}
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
@ -319,13 +316,17 @@
|
||||||
private <xsl:value-of select="normalize-space( $csharp-type)"/><xsl:value-of select="normalize-space( $nullable-decoration)"/> <xsl:value-of select="concat( ' _', @name)"/> <xsl:value-of select="normalize-space( $initialiser)"/>;
|
private <xsl:value-of select="normalize-space( $csharp-type)"/><xsl:value-of select="normalize-space( $nullable-decoration)"/> <xsl:value-of select="concat( ' _', @name)"/> <xsl:value-of select="normalize-space( $initialiser)"/>;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="adl:documentation">
|
<xsl:when test="adl:documentation">
|
||||||
<xsl:value-of select="normalize-space( adl:documentation)"/>
|
/// <xsl:value-of select="normalize-space( adl:documentation)"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>Auto generated property for field <xsl:value-of select="@name"/></xsl:otherwise>
|
<xsl:otherwise>
|
||||||
</xsl:choose><xsl:if test="help[@locale=$locale]">:
|
/// Auto generated property for field <xsl:value-of select="@name"/>
|
||||||
/// <xsl:value-of select="normalize-space( help[@locale=$locale])"/></xsl:if>
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:if test="help[@locale=$locale]">
|
||||||
|
/// <xsl:value-of select="normalize-space( help[@locale=$locale])"/>
|
||||||
|
</xsl:if>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual <xsl:value-of select="normalize-space( $csharp-type)"/><xsl:value-of select="normalize-space( $nullable-decoration)"/><xsl:text> </xsl:text> <xsl:value-of select="@name"/>
|
public virtual <xsl:value-of select="normalize-space( $csharp-type)"/><xsl:value-of select="normalize-space( $nullable-decoration)"/><xsl:text> </xsl:text> <xsl:value-of select="@name"/>
|
||||||
{
|
{
|
||||||
|
@ -393,7 +394,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
<xsl:if test="parent::adl:key and @type='entity'">
|
<xsl:if test="parent::adl:key and @type='entity'">
|
||||||
/* generate primitive value getter/setter for key property of type entity (experimental) */
|
/// <summary>
|
||||||
|
/// auto generated primitive value for key property of type entity (experimental)
|
||||||
|
/// </summary>
|
||||||
<xsl:variable name="csharp-base-type">
|
<xsl:variable name="csharp-base-type">
|
||||||
<xsl:call-template name="csharp-base-type">
|
<xsl:call-template name="csharp-base-type">
|
||||||
<xsl:with-param name="property" select="."/>
|
<xsl:with-param name="property" select="."/>
|
||||||
|
@ -405,10 +408,14 @@
|
||||||
<xsl:when test="$csharp-base-type = 'Decimal'"> = 0.0M</xsl:when>
|
<xsl:when test="$csharp-base-type = 'Decimal'"> = 0.0M</xsl:when>
|
||||||
<xsl:when test="$csharp-base-type = 'real'"> = 0.0</xsl:when>
|
<xsl:when test="$csharp-base-type = 'real'"> = 0.0</xsl:when>
|
||||||
<xsl:when test="$csharp-base-type='String'"> = null</xsl:when>
|
<xsl:when test="$csharp-base-type='String'"> = null</xsl:when>
|
||||||
<xsl:otherwise>[unknown? <xsl:value-of select="$csharp-base-type"/>]
|
<xsl:otherwise>
|
||||||
|
[unknown? <xsl:value-of select="$csharp-base-type"/>]
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>;
|
</xsl:choose>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// auto generated primitive value getter/setter for key property of type entity (experimental)
|
||||||
|
/// </summary>
|
||||||
public virtual <xsl:value-of select="concat( $csharp-base-type, ' ', @name, '_Value')"/> {
|
public virtual <xsl:value-of select="concat( $csharp-base-type, ' ', @name, '_Value')"/> {
|
||||||
get { return <xsl:value-of select="concat( '_', @name, '_Value')"/>; }
|
get { return <xsl:value-of select="concat( '_', @name, '_Value')"/>; }
|
||||||
set { <xsl:value-of select="concat( '_', @name, '_Value')"/> = value; }
|
set { <xsl:value-of select="concat( '_', @name, '_Value')"/> = value; }
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
Transform ADL into velocity view templates
|
Transform ADL into velocity view templates
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.7 $
|
$Revision: 1.8 $
|
||||||
$Date: 2008-06-06 08:46:27 $
|
$Date: 2008-06-06 15:52:48 $
|
||||||
-->
|
-->
|
||||||
<!-- 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! -->
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
||||||
generated from ADL.
|
generated from ADL.
|
||||||
|
|
||||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.7 $', 10)"/>
|
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.8 $', 10)"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
<xsl:call-template name="maybe-delete">
|
<xsl:call-template name="maybe-delete">
|
||||||
<xsl:with-param name="entity" select="."/>
|
<xsl:with-param name="entity" select="."/>
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
||||||
generated from ADL.
|
generated from ADL.
|
||||||
|
|
||||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.7 $', 10)"/>
|
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.8 $', 10)"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
<xsl:call-template name="install-scripts"/>
|
<xsl:call-template name="install-scripts"/>
|
||||||
</head>
|
</head>
|
||||||
|
@ -243,7 +243,7 @@
|
||||||
Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
||||||
generated from ADL.
|
generated from ADL.
|
||||||
|
|
||||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.7 $', 10)"/>
|
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.8 $', 10)"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
#capturefor( title)
|
#capturefor( title)
|
||||||
#if ( $instance)
|
#if ( $instance)
|
||||||
|
@ -364,7 +364,7 @@
|
||||||
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
||||||
generated from ADL.
|
generated from ADL.
|
||||||
|
|
||||||
Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.7 $', 10)"/>
|
Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.8 $', 10)"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
<xsl:call-template name="install-scripts"/>
|
<xsl:call-template name="install-scripts"/>
|
||||||
<script type='text/javascript' language='JavaScript1.2'>
|
<script type='text/javascript' language='JavaScript1.2'>
|
||||||
|
@ -963,7 +963,7 @@
|
||||||
Auto generated Velocity list for <xsl:value-of select="@name"/>,
|
Auto generated Velocity list for <xsl:value-of select="@name"/>,
|
||||||
generated from ADL.
|
generated from ADL.
|
||||||
|
|
||||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.7 $', 10)"/>
|
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.8 $', 10)"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
|
|
||||||
#capturefor( title)
|
#capturefor( title)
|
||||||
|
@ -1002,7 +1002,7 @@
|
||||||
Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
||||||
generated from ADL.
|
generated from ADL.
|
||||||
|
|
||||||
Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.7 $', 10)"/>
|
Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.8 $', 10)"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
<xsl:call-template name="install-scripts"/>
|
<xsl:call-template name="install-scripts"/>
|
||||||
</head>
|
</head>
|
||||||
|
@ -1188,7 +1188,7 @@
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@type='entity'">
|
<xsl:when test="@type='entity'">
|
||||||
<xsl:value-of select="concat( $sep, @name, '_Value=$', $entity/@name, '.', @name, '_Value')"/>
|
<xsl:value-of select="concat( $sep, @name, '=$', $entity/@name, '.', @name, '_Value')"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="concat( $sep, @name, '=$', $entity/@name, '.', @name)"/>
|
<xsl:value-of select="concat( $sep, @name, '=$', $entity/@name, '.', @name)"/>
|
||||||
|
@ -1327,7 +1327,7 @@
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@type='entity'">
|
<xsl:when test="@type='entity'">
|
||||||
<xsl:value-of select="concat( $sep, @name, '_Value=$', $entity/@name, '.', @name, '_Value')"/>
|
<xsl:value-of select="concat( $sep, @name, '=$', $entity/@name, '.', @name, '_Value')"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="concat( $sep, @name, '=$', $entity/@name, '.', @name)"/>
|
<xsl:value-of select="concat( $sep, @name, '=$', $entity/@name, '.', @name)"/>
|
||||||
|
|
Loading…
Reference in a new issue