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
|
@ -9,8 +9,8 @@
|
|||
Transform ADL into (partial) controller classes
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.10 $
|
||||
$Date: 2008-06-06 08:46:27 $
|
||||
$Revision: 1.11 $
|
||||
$Date: 2008-06-06 15:52:48 $
|
||||
-->
|
||||
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
|
@ -57,11 +57,6 @@
|
|||
<xsl:param name="area-name"/>
|
||||
|
||||
<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'] ---------------- */
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
|
@ -72,7 +67,7 @@
|
|||
//
|
||||
// Automatically generated abstract super class for controllers for the
|
||||
// <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.
|
||||
//
|
||||
|
@ -112,15 +107,18 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
</xsl:for-each>
|
||||
}
|
||||
}
|
||||
<xsl:apply-templates select="adl:entity"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Don't bother generating anything for foreign entities -->
|
||||
<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>
|
||||
/*
|
||||
* Not generating controller for entity <xsl:value-of select="@name"/>,
|
||||
* as it has no forms, pages or lists.
|
||||
*/
|
||||
</xsl:template>
|
||||
<xsl:template match="adl:entity[adl:form|adl:page|adl:list]">
|
||||
|
||||
|
@ -135,7 +133,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
//
|
||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||
// 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.
|
||||
//
|
||||
|
@ -218,8 +216,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
/// </summary>
|
||||
public void fixupMessages() {
|
||||
ISession hibernator =
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||
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)"/>>();
|
||||
|
@ -251,8 +251,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
private void Store()
|
||||
{
|
||||
ISession hibernator =
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||
Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]
|
||||
</xsl:if>);
|
||||
List<string> messages = new List<string>();
|
||||
/* 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
|
||||
|
@ -285,7 +287,9 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<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'">
|
||||
<!-- 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! -->
|
||||
|
@ -302,8 +306,11 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
Form[ "<xsl:value-of select="concat( 'instance.', @name)"/>"]
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', $keyentity)"/>>()</xsl:when>
|
||||
<xsl:otherwise>Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]</xsl:otherwise>
|
||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', $keyentity)"/>>()
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<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 */
|
||||
Locale locale = GetBestLocaleForUser();
|
||||
<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 */
|
||||
Message mess = record.<xsl:value-of select="@name"/>;
|
||||
if ( mess == null) {
|
||||
|
@ -358,7 +365,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
if ( trans == null) {
|
||||
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;
|
||||
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">
|
||||
<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:when>
|
||||
|
@ -410,7 +417,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
}
|
||||
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 */
|
||||
|
@ -420,7 +427,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
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=$farentityname]/adl:key/adl:property[position()=1]"/>
|
||||
<xsl:with-param name="value" select="index"/>
|
||||
<xsl:with-param name="value" select="'index'"/>
|
||||
</xsl:call-template>
|
||||
.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"/>))
|
||||
<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="value" select="index"/>
|
||||
<xsl:with-param name="value" select="'index'"/>
|
||||
</xsl:call-template>
|
||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>();
|
||||
|
||||
|
@ -541,23 +548,12 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
NHibernateHelper.CloseSession();
|
||||
hibernator = NHibernateHelper.GetCurrentSession(<xsl:if test="$authentication-layer = 'Database'">
|
||||
Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||
Session[NHibernateHelper.PASSTOKEN]
|
||||
</xsl:if>);
|
||||
|
||||
record = FetchRecord( hibernator);
|
||||
} /* if ( ! HasNoErrors()) */
|
||||
|
||||
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:value-of select="concat( 'this.',adl:form[position()=1]/@name)"/>( record);
|
||||
}
|
||||
</xsl:if>
|
||||
|
||||
|
@ -571,8 +567,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
{
|
||||
AssertUserCanDelete();
|
||||
ISession hibernator =
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||
Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]
|
||||
</xsl:if>);
|
||||
|
||||
if ( "true".Equals( Params["reallydelete"]))
|
||||
{
|
||||
|
@ -621,8 +619,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
{
|
||||
AssertUserCanRead();
|
||||
ISession hibernator =
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||
Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]
|
||||
</xsl:if>);
|
||||
|
||||
ICriteria search =
|
||||
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)"/>"])) {
|
||||
search<xsl:call-template name="add-hibernate-expression-like">
|
||||
<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:otherwise>
|
||||
|
@ -687,11 +687,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
/* it's (probably) existing, retrieve it */
|
||||
record = hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>))
|
||||
<xsl:for-each select="adl:key/adl:property">
|
||||
<xsl:variable name="basetype">
|
||||
<xsl:call-template name="base-type">
|
||||
<xsl:call-template name="add-hibernate-expression-eq">
|
||||
<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:variable>
|
||||
</xsl:for-each>
|
||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @name)"/>>();
|
||||
}
|
||||
|
@ -754,8 +753,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
if ( command.Equals( "delete"))
|
||||
{
|
||||
ISession hibernator =
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||
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 = FetchRecord( hibernator);
|
||||
|
||||
|
@ -787,31 +788,9 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
{
|
||||
AssertUserCanRead();
|
||||
|
||||
/* we don't actually instantiate this local variable; it exists to that
|
||||
* 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:value-of select="concat( 'this.', @name)"/>( (<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>)null);
|
||||
}
|
||||
|
||||
<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>
|
||||
/// 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:choose>
|
||||
<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:otherwise>
|
||||
/// <param name="<xsl:value-of select="@name"/>">the key value of the record to show</param>
|
||||
|
@ -829,65 +808,16 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
</xsl:for-each>
|
||||
[AccessibleThrough(Verb.Get)]
|
||||
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 -->
|
||||
string <xsl:choose>
|
||||
<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>
|
||||
<!-- all args are passed as string because that's what hibernate-expression-eq expects -->
|
||||
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>);
|
||||
this.<xsl:value-of select="@name"/>( <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type='entity'">
|
||||
<xsl:variable name="entity" select="@entity"/>
|
||||
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 =
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">
|
||||
Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]
|
||||
</xsl:if>);
|
||||
<xsl:value-of select="concat( 'this.', @name)"/>(
|
||||
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:call-template name="add-hibernate-expression-eq">
|
||||
|
@ -895,7 +825,20 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
<xsl:with-param name="value" select="@name"/>
|
||||
</xsl:call-template>
|
||||
</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 {
|
||||
<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')"/>");
|
||||
}
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="adl:list">
|
||||
|
@ -955,7 +897,9 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
|
||||
matchCriteria<xsl:call-template name="add-hibernate-expression-eq">
|
||||
<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>;
|
||||
|
||||
if ( record != null) {
|
||||
|
@ -969,7 +913,8 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
matchCriteria.Add(Expression.Not(<xsl:call-template name="hibernate-expression-eq">
|
||||
<xsl:with-param name="property" select="."/>
|
||||
<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:for-each>
|
||||
}
|
||||
|
@ -1164,11 +1109,10 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
Decimal.Parse( <xsl:value-of select="$value"/>)
|
||||
</xsl:when>
|
||||
<xsl:when test="$basetype = 'date'">
|
||||
Date.Parse( <xsl:value-of select="$value"/>)
|
||||
DateTime.Parse( <xsl:value-of select="$value"/>)
|
||||
</xsl:when>
|
||||
<xsl:when test="$basetype='entity'">
|
||||
<xsl:call-template name="fetch-property-instance">
|
||||
<!-- recurse -->
|
||||
<xsl:with-param name="property" select="$property"/>
|
||||
<xsl:with-param name="value" select="$value"/>
|
||||
</xsl:call-template>
|
||||
|
@ -1194,7 +1138,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<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:otherwise>
|
||||
<xsl:call-template name="hibernate-expression-eq">
|
||||
|
@ -1233,7 +1177,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
<xsl:param name="property"/>
|
||||
<!-- the name of the value in the returned values from which the instance
|
||||
must be resolved -->
|
||||
<xsl:param name="valuename"/>
|
||||
<xsl:param name="value"/>
|
||||
<xsl:variable name="basetype">
|
||||
<xsl:call-template name="base-type">
|
||||
<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:call-template name="add-hibernate-expression-eq">
|
||||
<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:for-each>
|
||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>()
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
Transform ADL into entity classes
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.5 $
|
||||
$Date: 2008-05-29 16:39:38 $
|
||||
$Revision: 1.6 $
|
||||
$Date: 2008-06-06 15:52:48 $
|
||||
-->
|
||||
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
|
@ -61,13 +61,11 @@
|
|||
// (c)2007 Cygnet Solutions Ltd
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//-------------------------------------------------------------
|
||||
namespace <xsl:value-of select="$entityns"/>
|
||||
{
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
|
@ -78,12 +76,14 @@
|
|||
using Cygnet.Entities;
|
||||
using Iesi.Collections.Generic;
|
||||
|
||||
namespace <xsl:value-of select="$entityns"/>
|
||||
{
|
||||
/// <summary>
|
||||
/// <xsl:value-of select="normalize-space( adl:documentation)"/>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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
|
||||
/// a separate file called <xsl:value-of select="@name"/>.manual.cs, q.v.
|
||||
///
|
||||
|
@ -162,29 +162,25 @@
|
|||
<xsl:choose>
|
||||
<xsl:when test="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:when test="@type='message'">
|
||||
if ( <xsl:value-of select="@name"/> != null)
|
||||
result.Append( <xsl:value-of select="concat( @name, '.LocalText')"/>);
|
||||
</xsl:when>
|
||||
<xsl:when test="@type='entity'">
|
||||
<!-- TODO: this is dangerous and could potentially give rise to
|
||||
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')"/>);
|
||||
</xsl:when>
|
||||
<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 ( <xsl:value-of select="@name"/> != null)
|
||||
result.Append(<xsl:value-of select="@name"/>.ToString( "d"));
|
||||
</xsl:when>
|
||||
<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 ( <xsl:value-of select="@name"/> != null)
|
||||
result.Append(<xsl:value-of select="@name"/>.ToString( "t"));
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
if ( <xsl:value-of select="@name"/> != null)
|
||||
result.Append(<xsl:value-of select="@name"/>);
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
@ -194,6 +190,7 @@
|
|||
result.Append( ",");
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
}
|
||||
</xsl:for-each>
|
||||
</xsl:when>
|
||||
<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)"/>;
|
||||
|
||||
/// <summary>
|
||||
/// <xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="adl:documentation">
|
||||
<xsl:value-of select="normalize-space( adl:documentation)"/>
|
||||
/// <xsl:value-of select="normalize-space( adl:documentation)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>Auto generated property for field <xsl:value-of select="@name"/></xsl:otherwise>
|
||||
</xsl:choose><xsl:if test="help[@locale=$locale]">:
|
||||
/// <xsl:value-of select="normalize-space( help[@locale=$locale])"/></xsl:if>
|
||||
<xsl:otherwise>
|
||||
/// Auto generated property for field <xsl:value-of select="@name"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="help[@locale=$locale]">
|
||||
/// <xsl:value-of select="normalize-space( help[@locale=$locale])"/>
|
||||
</xsl:if>
|
||||
/// </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"/>
|
||||
{
|
||||
|
@ -393,7 +394,9 @@
|
|||
}
|
||||
|
||||
<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:call-template name="csharp-base-type">
|
||||
<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 = 'real'"> = 0.0</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: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')"/> {
|
||||
get { return <xsl:value-of select="concat( '_', @name, '_Value')"/>; }
|
||||
set { <xsl:value-of select="concat( '_', @name, '_Value')"/> = value; }
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
Transform ADL into velocity view templates
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.7 $
|
||||
$Date: 2008-06-06 08:46:27 $
|
||||
$Revision: 1.8 $
|
||||
$Date: 2008-06-06 15:52:48 $
|
||||
-->
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
Whitespace (or lack of it) is significant! -->
|
||||
|
@ -124,7 +124,7 @@
|
|||
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
||||
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:call-template name="maybe-delete">
|
||||
<xsl:with-param name="entity" select="."/>
|
||||
|
@ -162,7 +162,7 @@
|
|||
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
||||
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:call-template name="install-scripts"/>
|
||||
</head>
|
||||
|
@ -243,7 +243,7 @@
|
|||
Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
||||
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>
|
||||
#capturefor( title)
|
||||
#if ( $instance)
|
||||
|
@ -364,7 +364,7 @@
|
|||
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
||||
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:call-template name="install-scripts"/>
|
||||
<script type='text/javascript' language='JavaScript1.2'>
|
||||
|
@ -963,7 +963,7 @@
|
|||
Auto generated Velocity list for <xsl:value-of select="@name"/>,
|
||||
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>
|
||||
|
||||
#capturefor( title)
|
||||
|
@ -1002,7 +1002,7 @@
|
|||
Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
||||
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:call-template name="install-scripts"/>
|
||||
</head>
|
||||
|
@ -1188,7 +1188,7 @@
|
|||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<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:otherwise>
|
||||
<xsl:value-of select="concat( $sep, @name, '=$', $entity/@name, '.', @name)"/>
|
||||
|
@ -1327,7 +1327,7 @@
|
|||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<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:otherwise>
|
||||
<xsl:value-of select="concat( $sep, @name, '=$', $entity/@name, '.', @name)"/>
|
||||
|
|
Loading…
Reference in a new issue