From b528b71c28ba6e2297147cca81f072a7b758b69f Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 21 Jul 2010 21:27:31 +0000 Subject: [PATCH] Minor fix to the file upload code. --- transforms/adl2entityclasses.xslt | 1822 +++++++++++++++-------------- 1 file changed, 916 insertions(+), 906 deletions(-) diff --git a/transforms/adl2entityclasses.xslt b/transforms/adl2entityclasses.xslt index b0f629f..71a081c 100755 --- a/transforms/adl2entityclasses.xslt +++ b/transforms/adl2entityclasses.xslt @@ -1,907 +1,917 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - abcdefghijklmnopqrstuvwxyz .,;:?/() - ABCDEFGHIJKLMNOPQRSTUVWXYZ_________ - - - - - - - - - - - /* ---- [ cut here: next file '.auto.cs'] ---------------- */ - - //------------------------------------------------------------- - // - // - // .auto.cs - // - // (c)2007 Cygnet Solutions Ltd - // - // Automatically generated from application description using - // adl2entityclass.xsl revision - // - // - // - // This file is automatically generated; DO NOT EDIT IT. - // - //------------------------------------------------------------- - using System; - using System.Configuration; - using System.Collections; - using System.Collections.Generic; - using System.Text; - using System.Text.RegularExpressions; - using Cygnet.Exceptions; - using Cygnet.Entities; - using Iesi.Collections.Generic; - using NHibernate; - using NHibernate.Classic; - - namespace - { - /// <summary> - /// Dummy entity class for security group - /// - /// </summary> - /// <remarks> - /// Automatically generated from description of group - /// using adl2entityclass.xsl revision . - /// - /// DO NOT EDIT THIS FILE! - /// </remarks> - public class : Entity { - private int _Check; - public virtual int Check { - get { return Check; } - set { _Check = value; } - } - } - } - - - - - /* ---- [ cut here: next file '.auto.cs'] ---------------- */ - - //------------------------------------------------------------- - // - // - // .auto.cs - // - // (c)2007 Cygnet Solutions Ltd - // - // Automatically generated from application description using - // adl2entityclass.xsl revision - // - // - // - // This file is automatically generated; DO NOT EDIT IT. - // - //------------------------------------------------------------- - - - /// <summary> - /// \mainpage - /// - /// - /// \package - /// Entity (MVC model) classes for - /// </summary> - - namespace - { - using System; - using System.Configuration; - using System.Collections; - using System.Collections.Generic; - using System.Text; - using System.Text.RegularExpressions; - using Cygnet.Exceptions; - using Cygnet.Entities; - using Iesi.Collections.Generic; - using NHibernate; - using NHibernate.Classic; - - /// <summary> - /// - /// </summary> - /// <remarks> - /// Automatically generated from description of entity - /// using adl2entityclass.xsl revision . - /// Note that manually maintained parts of this class may be defined in - /// a separate file called .manual.cs, q.v. - /// - /// DO NOT EDIT THIS FILE! - /// </remarks> - public partial class : Entity - { - #if DEBUG - /// <summary> - /// while debugging, keep track of the number of live instances - /// </summary> - public volatile static int instances = 0; - #endif - /// <summary> - /// Auto-generated no-args constructor; does nothing (but probably should - /// ensure ID slot is initialised correctly) - /// </summary> - public () : base(){ - - - #if DEBUG - /* while debugging, keep track of the number of live instances; increment on creation */ - instances ++; - #endif - } - - #if DEBUG - /// <summary> - /// while debugging, keep track of the number of live instances; decrement on deletion - /// </summary> - () { - instances --; - } - #endif - - - - /* natural primary key exists - not generating abstract key */ - - - /* primary key exists - not generating abstract key */ - - /// <summary> - /// Auto-generated constructor; initialises each of the slots within - /// the primary key and also all one-to-many and many-to-many slots - /// </summary> - public ( - - - - - - - , - ){ - - - - - this. = ; - - } - - - - - ADL: ERROR: Entity '' has no key. Was the - canonicalise stage missed in the build process? - - - - /// <summary> - /// Auto-generated overridden property for the Key slot, maps onto - /// </summary> - public override string KeyString { - get { - StringBuilder result = new StringBuilder(); - - result.Append(.KeyString); - - result.Append('|'); - - - return result.ToString(); - } - } - - /// <summary> - /// True if I have not yet been persisted to the database, else false. - /// NOTE: This code is experimental and may change! - /// </summary> - public override Boolean IsNew { - get { - Boolean result = false; - - - - if ( == 0) { - result = true; - } - - - if ( String.IsNullOrEmpty( )) { - result = true; - } - - - /* TODO: ADL does not yet correctly generate IsNew for - * properties of type */ - - - - return result; - } - } - - /// <summary> - /// A user readable distinct identifying string - /// </summary> - public override string UserIdentifier - { - get { - StringBuilder result = new StringBuilder(); - - - - - - if ( != null){ - result.Append( ); - } - - - - if ( != null){ - result.Append( ); - } - - - - if ( != null){ - result.Append(((DateTime)).ToShortDateString()); - } - - - - if ( != null){ - result.Append(((DateTime)).ToShortTimeString()); - } - - - - result.Append(.ToString()); - - - if ( != null){ - result.Append(); - } - - - - - - result.Append( ", "); - - - - - - result.AppendFormat( "#{0}", KeyString); - - - - return result.ToString(); - } - } - - /// <summary> - /// If I should not be deleted, return a message explaining why I should not be deleted; else null. - /// </summary> - /// <returns>a message explaining why I should not be deleted; else null</returns> - public override string NoDeleteReason { - get { - string result = null; - - StringBuilder bob = new StringBuilder(); - - - - - - - - - - - if ( != null && .Count > 0) { - bob.AppendFormat("Cannot delete this as it has {0} dependent ; ", .Count); - } - - - - - if (bob.Length > 0) { - result = bob.ToString(); - } - - return result; - } - } - - /// <summary> - /// Should I permit myself to be deleted? If I have a valid NoDeleteReason then no. Otherwise - /// I should remove my backlinks to entities which list me in lists which have 'inverse="true"' - /// </summary> - /// <returns>a veto if I should not be deleted; else no veto</returns> - public override LifecycleVeto OnDelete(ISession hibernator) { - string ndr = NoDeleteReason; - LifecycleVeto result = LifecycleVeto.NoVeto; - if ( ndr != null) { - result = LifecycleVeto.Veto; - } else { - _indeletion = true; - - - = null; - - } - return result; - } - - - - } - - /// A prototype for used when initialising forms for which - /// there is as yet no real record. This has only those properties of - /// which have default values. Objects of this class are not known to NHibernate and are - /// never persisted to the database. - public class { - - /// Dummy IsNew property always returns true - public Boolean IsNew { get { return true; }} - - /// Dummy user identifier which always returns just '[new]' - public string UserIdentifier { get { return "[new]";}} - - - - - - - } - } - /* ---- [ cut here: next file 'junk'] ------------------------- */ - - - - - - /* NOTE: property '' is marked as being abstract; it must - * be supported by manually maintained code */ - - - - // auto generating iv/property pair for slot with name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ? - - - - - - - - = "" - - - = null /* should collect the whose keyfield value is , but don't have a session in scope through which this could be done */ - - - = "" - - - = - - - - = null - = false - = 0 - = 0.0M - = 0.0 - - - - = "" - - - = null - - - - - - - - - - - - - - - - - - - - - - - private Regex Validator = new Regex( ""); - - - - - - - - - - - public const int = - - - - - - - - - - - - - ADL: ERROR: Cannot infer a value for option - - - ; - - - - private ; - - /// <summary> - - - /// - - - /// Auto generated property for field - - - - /// - - /// </summary> - - - - - - - - - [FieldWidth()] - - [IsUserDistinct()] - [Dimension( "money",Unit="")] - public virtual - { - get { - - if ( == null) { - = new HashedSet<>(); - } - - - return ; - } - set { - - - - - - - - - - - if ( ! _indeletion && value == null) - { - throw new DataRequiredException( - - - - - "The value for may not be set to null" - - - ); - } - - - - - - - - - - - - - - - if ( value > ) - { - throw new DataRangeException( "The maximum permitted value for is "); - } - - - if ( value < ) - { - throw new DataRangeException( "The minimum permitted value for is "); - } - - - if ( value != null && ! Validator.IsMatch( value)) - { - throw new DataFormatException( string.Format( "The value supplied ({0}) does not match the format required by ", value)); - } - - - - - - - - - if ( value != null){ - - - switch ( value ) { - - case - - - : - - break; - default: - throw new DataRangeException( string.Format( "The value supplied ({0}) is not an acceptable value for ", value)); - } - - - - } - - - - - bool acceptable = false; - - - - - if ( value == null) { acceptable = true; } else - - - - if ( "".Equals( value)) { acceptable = true; } - else - - if ( ! acceptable) { - throw new DataRangeException( string.Format( "The value supplied ('{0}') is not an acceptable value for ", value)); - } - - - - - if ( value != null && value.Length > ) - { - value = value.Substring( 0, ); - } - - = value; - } - } - - - /// <summary> - /// auto generated primitive value for key property of type entity (experimental) - /// </summary> - private - = false - = 0 - = 0.0M - = 0.0 - = null - - [unknown? ] - - ; - - /// <summary> - /// auto generated primitive value getter/setter for key property of type entity (experimental) - /// </summary> - public virtual { - get { return ; } - set { = value; } - } - - - - - - - - - /* */ - - - - - [LocalisedDisplayName( "", Locale="")] - - - - - "" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - = new Message(); - - - - - - - - - - - - = new HashedSet<>(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ? - - - - - - - - - "" - - - null /* should collect the whose keyfield value is , but don't have a session in scope through which this could be done */ - - - - - - - - null - - false - 0 - 0.0M - 0.0 - DateTime.Today - - - - "" - - - null - - - - - null - - - - /// <summary> - /// Auto generated prototype property for field - /// </summary> - - - - - - - - - [FieldWidth()] - - [IsUserDistinct()] - - [Dimension( "money",Unit="")] - - public virtual - { - get { return ;} - } - - + + + + + + + + + + + + + + + + + + + + + + + + + + + abcdefghijklmnopqrstuvwxyz .,;:?/() + ABCDEFGHIJKLMNOPQRSTUVWXYZ_________ + + + + + + + + + + + /* ---- [ cut here: next file '.auto.cs'] ---------------- */ + + //------------------------------------------------------------- + // + // + // .auto.cs + // + // (c)2007 Cygnet Solutions Ltd + // + // Automatically generated from application description using + // adl2entityclass.xsl revision + // + // + // + // This file is automatically generated; DO NOT EDIT IT. + // + //------------------------------------------------------------- + using System; + using System.Configuration; + using System.Collections; + using System.Collections.Generic; + using System.Text; + using System.Text.RegularExpressions; + using Cygnet.Exceptions; + using Cygnet.Entities; + using Iesi.Collections.Generic; + using NHibernate; + using NHibernate.Classic; + + namespace + { + /// <summary> + /// Dummy entity class for security group + /// + /// </summary> + /// <remarks> + /// Automatically generated from description of group + /// using adl2entityclass.xsl revision . + /// + /// DO NOT EDIT THIS FILE! + /// </remarks> + public class : Entity { + private int _Check; + public virtual int Check { + get { return Check; } + set { _Check = value; } + } + } + } + + + + + /* ---- [ cut here: next file '.auto.cs'] ---------------- */ + + //------------------------------------------------------------- + // + // + // .auto.cs + // + // (c)2007 Cygnet Solutions Ltd + // + // Automatically generated from application description using + // adl2entityclass.xsl revision + // + // + // + // This file is automatically generated; DO NOT EDIT IT. + // + //------------------------------------------------------------- + + + /// <summary> + /// \mainpage + /// + /// + /// \package + /// Entity (MVC model) classes for + /// </summary> + + namespace + { + using System; + using System.Configuration; + using System.Collections; + using System.Collections.Generic; + using System.Text; + using System.Text.RegularExpressions; + using Cygnet.Exceptions; + using Cygnet.Entities; + using Iesi.Collections.Generic; + using NHibernate; + using NHibernate.Classic; + + /// <summary> + /// + /// </summary> + /// <remarks> + /// Automatically generated from description of entity + /// using adl2entityclass.xsl revision . + /// Note that manually maintained parts of this class may be defined in + /// a separate file called .manual.cs, q.v. + /// + /// DO NOT EDIT THIS FILE! + /// </remarks> + public partial class : Entity + { + #if DEBUG + /// <summary> + /// while debugging, keep track of the number of live instances + /// </summary> + public volatile static int instances = 0; + #endif + /// <summary> + /// Auto-generated no-args constructor; does nothing (but probably should + /// ensure ID slot is initialised correctly) + /// </summary> + public () : base(){ + + + #if DEBUG + /* while debugging, keep track of the number of live instances; increment on creation */ + instances ++; + #endif + } + + #if DEBUG + /// <summary> + /// while debugging, keep track of the number of live instances; decrement on deletion + /// </summary> + () { + instances --; + } + #endif + + + + /* natural primary key exists - not generating abstract key */ + + + /* primary key exists - not generating abstract key */ + + /// <summary> + /// Auto-generated constructor; initialises each of the slots within + /// the primary key and also all one-to-many and many-to-many slots + /// </summary> + public ( + + + + + + + , + ){ + + + + + this. = ; + + } + + + + + ADL: ERROR: Entity '' has no key. Was the + canonicalise stage missed in the build process? + + + + /// <summary> + /// Auto-generated overridden property for the Key slot, maps onto + /// </summary> + public override string KeyString { + get { + StringBuilder result = new StringBuilder(); + + result.Append(.KeyString); + + result.Append('|'); + + + return result.ToString(); + } + } + + /// <summary> + /// True if I have not yet been persisted to the database, else false. + /// NOTE: This code is experimental and may change! + /// </summary> + public override Boolean IsNew { + get { + Boolean result = false; + + + + if ( == 0) { + result = true; + } + + + if ( String.IsNullOrEmpty( )) { + result = true; + } + + + /* TODO: ADL does not yet correctly generate IsNew for + * properties of type */ + + + + return result; + } + } + + /// <summary> + /// A user readable distinct identifying string + /// </summary> + public override string UserIdentifier + { + get { + StringBuilder result = new StringBuilder(); + + + + + + if ( != null){ + result.Append( ); + } + + + + if ( != null){ + result.Append( ); + } + + + + if ( != null){ + result.Append(((DateTime)).ToShortDateString()); + } + + + + if ( != null){ + result.Append(((DateTime)).ToShortTimeString()); + } + + + + result.Append(.ToString()); + + + if ( != null){ + result.Append(); + } + + + + + + result.Append( ", "); + + + + + + result.AppendFormat( "#{0}", KeyString); + + + + return result.ToString(); + } + } + + /// <summary> + /// If I should not be deleted, return a message explaining why I should not be deleted; else null. + /// </summary> + /// <returns>a message explaining why I should not be deleted; else null</returns> + public override string NoDeleteReason { + get { + string result = null; + + StringBuilder bob = new StringBuilder(); + + + + + + + + + + + if ( != null && .Count > 0) { + bob.AppendFormat("Cannot delete this as it has {0} dependent ; ", .Count); + } + + + + + if (bob.Length > 0) { + result = bob.ToString(); + } + + return result; + } + } + + /// <summary> + /// Should I permit myself to be deleted? If I have a valid NoDeleteReason then no. Otherwise + /// I should remove my backlinks to entities which list me in lists which have 'inverse="true"' + /// </summary> + /// <returns>a veto if I should not be deleted; else no veto</returns> + public override LifecycleVeto OnDelete(ISession hibernator) { + string ndr = NoDeleteReason; + LifecycleVeto result = LifecycleVeto.NoVeto; + if ( ndr != null) { + result = LifecycleVeto.Veto; + } else { + _indeletion = true; + + + = null; + + } + return result; + } + + + + } + + /// A prototype for used when initialising forms for which + /// there is as yet no real record. This has only those properties of + /// which have default values. Objects of this class are not known to NHibernate and are + /// never persisted to the database. + public class { + + /// Dummy IsNew property always returns true + public Boolean IsNew { get { return true; }} + + /// Dummy user identifier which always returns just '[new]' + public string UserIdentifier { get { return "[new]";}} + + + + + + + } + } + /* ---- [ cut here: next file 'junk'] ------------------------- */ + + + + + + /* NOTE: property '' is marked as being abstract; it must + * be supported by manually maintained code */ + + + + // auto generating iv/property pair for slot with name + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ? + + + + + + + + = "" + + + = null /* should collect the whose keyfield value is , but don't have a session in scope through which this could be done */ + + + = "" + + + = + + + + = null + = false + = 0 + = 0.0M + = 0.0 + + + + = "" + + + = null + + + + + + + + + + + + + + + + + + + + + + + private Regex Validator = new Regex( ""); + + + + + + + + + + + public const int = + + + + + + + + + + + + + ADL: ERROR: Cannot infer a value for option + + + ; + + + + private ; + + /// <summary> + + + /// + + + /// Auto generated property for field + + + + /// + + /// </summary> + + + + + + + + + [FieldWidth()] + + [IsUserDistinct()] + [Dimension( "money",Unit="")] + public virtual + { + get { + + if ( == null) { + = new HashedSet<>(); + } + + + return ; + } + set { + + + + + + + + + + + if ( ! _indeletion && value == null) + { + throw new DataRequiredException( + + + + + "The value for may not be set to null" + + + ); + } + + + + + + + + + + + + + + + if ( value > ) + { + throw new DataRangeException( "The maximum permitted value for is "); + } + + + if ( value < ) + { + throw new DataRangeException( "The minimum permitted value for is "); + } + + + if ( value != null && ! Validator.IsMatch( value)) + { + throw new DataFormatException( string.Format( "The value supplied ({0}) does not match the format required by ", value)); + } + + + + + + + + + if ( value != null){ + + + switch ( value ) { + + case + + + : + + break; + default: + throw new DataRangeException( string.Format( "The value supplied ({0}) is not an acceptable value for ", value)); + } + + + + } + + + + + bool acceptable = false; + + + + + if ( value == null) { acceptable = true; } else + + + + if ( "".Equals( value)) { acceptable = true; } + else + + if ( ! acceptable) { + throw new DataRangeException( string.Format( "The value supplied ('{0}') is not an acceptable value for ", value)); + } + + + + + if ( value != null && value.Length > ) + { + value = value.Substring( 0, ); + } + + + if ( ! String.IsNullOrEmpty(value)) { + /* don't set uploadables to null - the 'file' html widget will return null + * when no new file is uploaded. This of course means you can't unset an + * upload once you've set one, but I don't see a workaround for this just now. */ + + = value; + } + } + } + + + /// <summary> + /// auto generated primitive value for key property of type entity (experimental) + /// </summary> + private + = false + = 0 + = 0.0M + = 0.0 + = null + + [unknown? ] + + ; + + /// <summary> + /// auto generated primitive value getter/setter for key property of type entity (experimental) + /// </summary> + public virtual { + get { return ; } + set { = value; } + } + + + + + + + + + /* */ + + + + + [LocalisedDisplayName( "", Locale="")] + + + + + "" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = new Message(); + + + + + + + + + + + + = new HashedSet<>(); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ? + + + + + + + + + "" + + + null /* should collect the whose keyfield value is , but don't have a session in scope through which this could be done */ + + + + + + + + null + + false + 0 + 0.0M + 0.0 + DateTime.Today + + + + "" + + + null + + + + + null + + + + /// <summary> + /// Auto generated prototype property for field + /// </summary> + + + + + + + + + [FieldWidth()] + + [IsUserDistinct()] + + [Dimension( "money",Unit="")] + + public virtual + { + get { return ;} + } + + \ No newline at end of file