From f59c6bf601ef413c94104142b8182f5358440394 Mon Sep 17 00:00:00 2001 From: af Date: Wed, 9 Jan 2008 15:01:43 +0000 Subject: [PATCH] *** empty log message *** --- ADL.NET/ADL.csproj | 84 ++ ADL.NET/Exceptions/DataFormatException.cs | 23 + ADL.NET/Exceptions/DataRangeException.cs | 23 + ADL.NET/Exceptions/DataRequiredException.cs | 21 + .../Exceptions/DataSuitabilityException.cs | 23 + .../DomainKnowledgeViolationException.cs | 24 + ADL.NET/Properties/AssemblyInfo.cs | 33 + ADL.NET/Trans/adl2controllerclasses.xsl | 542 ++++++++ ADL.NET/Trans/adl2entityclass.xsl | 378 ++++++ ADL.NET/Trans/adl2hibernate.xsl | 247 ++++ ADL.NET/Trans/adl2mssql.xsl | 471 +++++++ ADL.NET/Trans/adl2psql.xsl | 321 +++++ ADL.NET/Trans/adl2views.xsl | 1135 +++++++++++++++++ ADL.NET/Trans/datadescriber.xsl | 426 +++++++ ADL.NET/Trans/hibernate2adl.xsl | 100 ++ 15 files changed, 3851 insertions(+) create mode 100755 ADL.NET/ADL.csproj create mode 100755 ADL.NET/Exceptions/DataFormatException.cs create mode 100755 ADL.NET/Exceptions/DataRangeException.cs create mode 100755 ADL.NET/Exceptions/DataRequiredException.cs create mode 100755 ADL.NET/Exceptions/DataSuitabilityException.cs create mode 100755 ADL.NET/Exceptions/DomainKnowledgeViolationException.cs create mode 100755 ADL.NET/Properties/AssemblyInfo.cs create mode 100755 ADL.NET/Trans/adl2controllerclasses.xsl create mode 100755 ADL.NET/Trans/adl2entityclass.xsl create mode 100755 ADL.NET/Trans/adl2hibernate.xsl create mode 100755 ADL.NET/Trans/adl2mssql.xsl create mode 100755 ADL.NET/Trans/adl2psql.xsl create mode 100755 ADL.NET/Trans/adl2views.xsl create mode 100755 ADL.NET/Trans/datadescriber.xsl create mode 100755 ADL.NET/Trans/hibernate2adl.xsl diff --git a/ADL.NET/ADL.csproj b/ADL.NET/ADL.csproj new file mode 100755 index 0000000..b2b9933 --- /dev/null +++ b/ADL.NET/ADL.csproj @@ -0,0 +1,84 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {7D9E1F28-3F9C-4675-A02C-C9B2E98A839E} + Library + Properties + ADL + ADL + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + + + + + + + + + + + + {77FB7DE5-1F33-4DDC-8A2E-79EF4728705E} + CygnetToolkit + + + + + Designer + ResXFileCodeGenerator + Resources.Designer.cs + + + + + \ No newline at end of file diff --git a/ADL.NET/Exceptions/DataFormatException.cs b/ADL.NET/Exceptions/DataFormatException.cs new file mode 100755 index 0000000..cf93118 --- /dev/null +++ b/ADL.NET/Exceptions/DataFormatException.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +/* + * Application Description Framework + * DataRangeException.cs + * + * (c) 2007 Cygnet Solutions Ltd + * + * $Author: af $ + * $Revision: 1.1 $ + */ + +namespace ADL.Exceptions { + /// + /// An exception to be thrown if an attempt is made to set a property to a + /// value which is unsuitably formatted for the data type + /// + public class DataFormatException : DataSuitabilityException { + public DataFormatException(String message) : base(message) {} + } +} diff --git a/ADL.NET/Exceptions/DataRangeException.cs b/ADL.NET/Exceptions/DataRangeException.cs new file mode 100755 index 0000000..9906b6e --- /dev/null +++ b/ADL.NET/Exceptions/DataRangeException.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +/* + * Application Description Framework + * DataRangeException.cs + * + * (c) 2007 Cygnet Solutions Ltd + * + * $Author: af $ + * $Revision: 1.1 $ + */ + +namespace ADL.Exceptions { + /// + /// An exception to be thrown if an attempt is made to set a scalar property with a + /// defined range to a value which is outside that range + /// + public class DataRangeException : DataSuitabilityException { + public DataRangeException(String message) : base(message) {} + } +} diff --git a/ADL.NET/Exceptions/DataRequiredException.cs b/ADL.NET/Exceptions/DataRequiredException.cs new file mode 100755 index 0000000..1857b63 --- /dev/null +++ b/ADL.NET/Exceptions/DataRequiredException.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +/* + * Application Description Framework + * DataRequiredException.cs + * + * (c) 2007 Cygnet Solutions Ltd + * + * $Author: af $ + * $Revision: 1.1 $ + */ +namespace ADL.Exceptions { + /// + /// An exception to be thrown if an attempt is made to set a required property to null + /// + public class DataRequiredException : DataSuitabilityException { + public DataRequiredException(String message) : base(message){} + } +} diff --git a/ADL.NET/Exceptions/DataSuitabilityException.cs b/ADL.NET/Exceptions/DataSuitabilityException.cs new file mode 100755 index 0000000..377181c --- /dev/null +++ b/ADL.NET/Exceptions/DataSuitabilityException.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +/* + * Application Description Framework + * DataRangeException.cs + * + * (c) 2007 Cygnet Solutions Ltd + * + * $Author: af $ + * $Revision: 1.1 $ + */ + +namespace ADL.Exceptions { + /// + /// An exception to be thrown if an attempt is made to set a property + /// to a value which is unsuitable + /// + public abstract class DataSuitabilityException : Exception { + public DataSuitabilityException(String message) : base(message) {} + } +} diff --git a/ADL.NET/Exceptions/DomainKnowledgeViolationException.cs b/ADL.NET/Exceptions/DomainKnowledgeViolationException.cs new file mode 100755 index 0000000..67d0006 --- /dev/null +++ b/ADL.NET/Exceptions/DomainKnowledgeViolationException.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +/* + * Application Description Framework + * DomainKnowledgeViolationException.cs + * + * (c) 2007 Cygnet Solutions Ltd + * + * $Author: af $ + * $Revision: 1.1 $ + */ + +namespace ADL.Exceptions { + /// + /// An exception to be thrown if a state arises which violates + /// some specific knowledge about the application domain (i.e. + /// a 'business rule' violation) + /// + public class DomainKnowledgeViolationException : Exception { + public DomainKnowledgeViolationException(String message) : base(message) { } + } +} diff --git a/ADL.NET/Properties/AssemblyInfo.cs b/ADL.NET/Properties/AssemblyInfo.cs new file mode 100755 index 0000000..2e82949 --- /dev/null +++ b/ADL.NET/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ADL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ADL")] +[assembly: AssemblyCopyright("Copyright © 2007 Cygnet Solutions Ltd")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6be1b0e7-f012-44ee-a35f-892f53b627ad")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ADL.NET/Trans/adl2controllerclasses.xsl b/ADL.NET/Trans/adl2controllerclasses.xsl new file mode 100755 index 0000000..68bec4b --- /dev/null +++ b/ADL.NET/Trans/adl2controllerclasses.xsl @@ -0,0 +1,542 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/* ---- [ cut here: next file 'Controller.auto.cs'] ---------------- */ + +//------------------------------------------------------------------ +// +// Application Description Framework +// Controller.auto.cs +// +// (c) 2007 Cygnet Solutions Ltd +// +// Controller for auto-generated forms for editing s +// Automatically generated from application description using +// adl2controllerclass.xsl version +// +// This file is automatically generated; DO NOT EDIT IT. +// +//------------------------------------------------------------------ + +using System; +using System.Data; +using System.Collections.Generic; +using System.Configuration; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; +using Castle.MonoRail.Framework.Helpers; +using Cygnet.Web.Helpers; +using Cygnet.Web.Controllers; +using NHibernate; +using NHibernate.Expression; +using Castle.MonoRail.Framework; +using SRU.Hospitality.Entities; +using SRU.Hospitality.Helpers; +using ADL.Exceptions; +using Iesi.Collections.Generic; + +namespace { + + /// <summary> + /// Automatically generated partial controller class following 'thin controller' + /// strategy, for entity . Note that part of this + /// class may be defined in a separate file called + /// Controller.manual.cs, q.v. + /// + /// DO NOT EDIT THIS FILE! + /// </summary> + [ + Helper(typeof(ShuffleWidgetHelper), "ShuffleWidgetHelper"), + ] + public partial class Controller : BaseController { + + /// <summary> + /// Store the record represented by the parameters passed in an HTTP service + /// Without Id -> it's new, I create a new persistent object; + /// With Id -> it's existing, I update the existing persistent object. + /// NOTE: Should only be called from a handler for method 'POST', never 'GET'. + /// </summary> + private void Store() + { + ISession hibernator = + NHibernateHelper.GetCurrentSession( Session[ NHibernateHelper.USERTOKEN], + Session[NHibernateHelper.PASSTOKEN]); + List<string> messages = new List<string>(); + + . record; + + + + string id = Form[""]; + + if ( String.IsNullOrEmpty( id)) + { + /* it's new, create persistent object */ + record = new .(Form[] + + , + + ); + + /* perform any domain knowledge behaviour on the new record + * after instantiation */ + record.AfterCreationHook( hibernator); + messages.Add( "New record created"); + } + else + { + /* it's existing, retrieve it */ + record = + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq("", Int32.Parse(id))) + .UniqueResult<.>(); + } + + if ( record != null) + { + try + { + /* actually update the record */ + BindObjectInstance( record, ParamStore.Form, "instance"); + + + /* for properties of type 'entity', it should not be necessary to do anything + * special - BindObjectInstance /should/ do it all. Unfortunately it sometimes + * doesn't, and I haven't yet characterised why not. TODO: Fix this! */ + record. = + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq(" + + ", Int32.Parse(Form[""]))) + .UniqueResult<.>(); + + + + /* to update a link table which has no other data than the near and far keys, it is + * sufficient to smash the existing values and create new ones. It's also a lot easier! */ + + string[] = Form.GetValues( ""); + + if ( != null) + { + /* update the linking table for my ; first smash the old values */ + if ( != null) + { + .Clear(); + } + else + { + = new HashedSet<>(); + } + + /* then reinstate the values from the indexes passed */ + foreach ( string index in ) + { + + .Add( + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq("Id", Int32.Parse(index))) + .UniqueResult<.>()); + } + } + + + + /* with a list we cannot just smash the old values! Instead we need to check + * each one and exclude it if no longer required */ + if ( Form.GetValues( "") != null) + { + string[] = Form.GetValues( ""); + + /* updating child records; first remove any not on the submitted list */ + foreach ( item in record.) + { + String itemId = item.Key.ToString(); + bool found = false; + + foreach ( string index in ) + { + + if ( index.Equals( itemId)) + { + found = true; + } + } + + if ( ! found) + { + record..Remove( item); + } + } + + /* then add any on the included list which are not already members */ + foreach ( string index in ) + { + item = + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq("Id", Int32.Parse(index))) + .UniqueResult<.>(); + + if ( ! record..Contains( item)) + { + record..Add( item); + } + } + } + + + /* perform any domain knowledge behaviour on the record prior to updating */ + record.BeforeUpdateHook( hibernator); + + /* write the record to the database, in order to guarantee we have a valid key */ + hibernator.Save(record); + hibernator.Flush(); + + /* perform any domain knowledge behaviour on the record after updating */ + record.AfterUpdateHook( hibernator); + + messages.Add( "Record saved successfully"); + } + catch ( DataSuitabilityException dse) + { + AddError( dse.Message); + } + catch ( ApplicationException axe) + { + AddError( axe.Message); + } + + PropertyBag["messages"] = messages; + PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN]; + PropertyBag["instance"] = record; + + + + + RenderViewWithFailover("", ""); + } + else + { + throw new Exception( String.Format( "No record of type with key value {0} found", id)); + } + } + + /// <summary> + /// Actually delete the selected record + /// </summary> + [AccessibleThrough(Verb.Get)] + public void Delete() + { + ISession hibernator = + NHibernateHelper.GetCurrentSession( Session[ NHibernateHelper.USERTOKEN], + Session[NHibernateHelper.PASSTOKEN]); + string id = Params[""]; + string reallydelete = Params["reallydelete"]; + + if ( "true".Equals( reallydelete)) + { + record = + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq("", Int32.Parse(id))) + .UniqueResult<.>(); + + if ( record != null) + { + record.BeforeDeleteHook( hibernator); + + hibernator.Delete( + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq("", Int32.Parse(id))) + .UniqueResult<.>()); + + hibernator.Flush(); + } + else + { + throw new ApplicationException( "No such record?"); + } + } + + + InternalShowList(); + + + Redirect( FormsAuthentication.DefaultUrl); + + + } + + + + + + + /// <summary> + /// list all instances of this entity to allow the user to select one for editing + /// this method invokes the default list view - which is probably what you want unless + /// you've a special reason for doing something different + /// </summary> + public void InternalShowList() + { + InternalShowList( ""); + } + + /// <summary> + /// list all instances of this entity to allow the user to select one for editing + /// </summary> + /// <param name="view">The name of the list view to show</param> + public void InternalShowList( String view) + { + ISession hibernator = + NHibernateHelper.GetCurrentSession( Session[ NHibernateHelper.USERTOKEN], + Session[NHibernateHelper.PASSTOKEN]); + IList<> instances = + hibernator.CreateCriteria(typeof()) + + .List<>(); + + PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN]; + PropertyBag["instances"] = + PaginationHelper.CreatePagination( this, instances, 25); + + RenderViewWithFailover(view + ".vm", view + ".auto.vm"); + } + + } +} + + + + if ( Form[ "" ] == null) + { + AddError( + + + + "You must supply a value for " + ); + } + + + + + + + + "" + + + + + + + + + + + + + + /// <summary> + /// Handle the submission of the form named + /// </summary> + [AccessibleThrough(Verb.Post)] + public void ( ) + { + string command = Form[ "command"]; + + if ( command == null) + { + throw new Exception( "No command?"); + } + else + + if ( command.Equals( "")) + { + /* NOTE: You must write an implementation of this verb in a + manually maintained partial class file for this class */ + (); + } + else + + if ( command.Equals( "delete")) + { + ISession hibernator = + NHibernateHelper.GetCurrentSession( Session[ NHibernateHelper.USERTOKEN], + Session[NHibernateHelper.PASSTOKEN]); + string id = Form[""]; + + PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN]; + PropertyBag["instance"] = + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq("", Int32.Parse(id))) + .UniqueResult<.>(); + + RenderViewWithFailover( "maybedelete.vm", "maybedelete.auto.vm"); + } + else if ( command.Equals( "store")) + { + Store(); + } + else + { + throw new Exception( String.Format("Unrecognised command '{0}'", command)); + } + } + + /// <summary> + /// Show the form named , with no content + /// </summary> + [AccessibleThrough(Verb.Get)] + public void ( ) + { + ISession hibernator = + NHibernateHelper.GetCurrentSession( Session[ NHibernateHelper.USERTOKEN], + Session[NHibernateHelper.PASSTOKEN]); + + + + + PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN]; + RenderViewWithFailover("", ""); + } + + /// <summary> + /// Show the form named , containing the indicated record + /// </summary> + /// <param name="">the key value of the record to show</param> + [AccessibleThrough(Verb.Get)] + public void ( Int32 ) + { + ISession hibernator = + NHibernateHelper.GetCurrentSession( Session[ NHibernateHelper.USERTOKEN], + Session[NHibernateHelper.PASSTOKEN]); + . record = + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq("", Id)) + .UniqueResult<.>(); + + PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN]; + PropertyBag["instance"] = record; + + + + + RenderViewWithFailover("", ""); + } + + + + + /// <summary> + /// list all instances of this entity to allow the user to select one + /// this method invokes the named view. + /// </summary> + public void () + { + InternalShowList( ""); + } + + + + + + + /* produce a list of to populate the menu for */ + + + + + + + /* produce a list of to populate the LHS of the shuffle for */ + + + + + + /* produce a list of to populate the multi-select for */ + + + + + + + + + + + + PropertyBag[""] = + hibernator.CreateCriteria(typeof()) + + .List<>(); + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ADL.NET/Trans/adl2entityclass.xsl b/ADL.NET/Trans/adl2entityclass.xsl new file mode 100755 index 0000000..cd09d89 --- /dev/null +++ b/ADL.NET/Trans/adl2entityclass.xsl @@ -0,0 +1,378 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /* ---- [ cut here: next file '.auto.cs'] ---------------- */ + + //------------------------------------------------------------- + // + // Application Description Framework + // .auto.cs + // + // (c)2007 Cygnet Solutions Ltd + // + // Automatically generated from application description using + // adl2entityclass.xsl version + // + // This file is automatically generated; DO NOT EDIT IT. + // + //------------------------------------------------------------- + namespace + { + using System; + using System.Configuration; + using System.Collections; + using System.Collections.Generic; + using System.Text; + using System.Text.RegularExpressions; + using ADL.Exceptions; + using Iesi.Collections.Generic; + + /// <summary> + /// Automatically generated from description of entity + /// using adl2entityclass.xsl. Note that manually maintained parts of this + /// class may be defined in a separate file called .cs, q.v. + /// + /// DO NOT EDIT THIS FILE! + /// </summary> + public partial class : Entity + { + /// <summary> + /// Auto-generated no-args constructor; does nothing (but probably should + /// ensure ID slot is initialised correctly) + /// </summary> + public () : base(){ + + } + + /// <summary> + /// Auto-generated one-arg constructor; initialises Id slot and also all + /// one-to-many slots + /// </summary> + public ( int key) + { + + + + + /* natural primary key exists - not initialising abstract key */ + + + _Id = key; + + + } + + + + /* natural primary key exists - not generating abstract key */ + + + /// <summary> + /// Auto-generated iv/property for Id slot + /// </summary> + private int _Id = -1; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + /// <summary> + /// Auto-generated overridden property for the Key slot, maps onto + /// _Id + /// </summary> + public override int Key + { + get { return _Id; } + } + + + + /// <summary> + /// A user readable distinct identifying string + /// </summary> + public override string UserIdentifier + { + get { + StringBuilder result = new StringBuilder(); + + + + + + + result.Append( ); + + + result.Append(); + + + + + + result.Append( ", "); + + + + + + result.AppendFormat( "#{0}[", _Id); + + + + return result.ToString(); + } + } + + + } + } + + + + + + + + + + // auto generating iv/property pair for slot with name + + + + + + + + + + + + + + + + + ICollection<> + + + ICollection<> + + DateTime + DateTime + String + String + bool + TimeStamp + int + double + Decimal + + + + + + + + String + int + double + Decimal + DateTime + DateTime + TimeStamp + + + [unknown?] + + + + + + + ? + ? + ? + ? + ? + ? + + + + + + + + = "" + = + + + = null + = false + = 0 + = 0.0 + = 0.0M + = null + + + + + + + + + + + + + + + private Regex Validator = new Regex( ""); + + + private _ ; + + public virtual + { + get { return _; } + set { + + if ( 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 && value.Length > ) + { + value = value.Substring( 0, ); + } + + _ = value; + } + } + + + + + + + + /* */ + + + + + + "" + + + + + + + + + + _ = new HashedSet<>(); + + + + + + + + _ = new HashedSet<>(); + + + + + + \ No newline at end of file diff --git a/ADL.NET/Trans/adl2hibernate.xsl b/ADL.NET/Trans/adl2hibernate.xsl new file mode 100755 index 0000000..18e2a57 --- /dev/null +++ b/ADL.NET/Trans/adl2hibernate.xsl @@ -0,0 +1,247 @@ + + + + + + + + SRU.Hospitality.Entities + SRU.Hospitality.DataModel + + + + + + + + + + + *************************************************************************** + * + * C1873: C1873-SUS-Hospitality.auto.hbm.xml + * + * ©2007 Cygnet Solutions Ltd + * + * THIS FILE IS AUTOMATICALLY GENERATED AND SHOULD NOT + * BE MANUALLY EDITED. + * + * Generated using adl2hibernate-mapping.xsl revision + * + *************************************************************************** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DateTime + DateTime + String + String + Boolean + TimeStamp + Int32 + Double + Decimal + [unknown?] + + + + + + + + + + + + 0 + + + + + + + + -1 + + + 1 + + + + + + + + + \ No newline at end of file diff --git a/ADL.NET/Trans/adl2mssql.xsl b/ADL.NET/Trans/adl2mssql.xsl new file mode 100755 index 0000000..ed6242c --- /dev/null +++ b/ADL.NET/Trans/adl2mssql.xsl @@ -0,0 +1,471 @@ + + + + + + + + ------------------------------------------------------------------------------------------------- + -- + -- Database for application version + -- Generated for MS-SQL 2000+ using adl2mssql.xsl $Revision: 1.1 $ + -- + -- Code generator (c) 2007 Cygnet Solutions Ltd + -- + ------------------------------------------------------------------------------------------------- + + ------------------------------------------------------------------------------------------------- + -- authentication roles + ------------------------------------------------------------------------------------------------- + + + ------------------------------------------------------------------------------------------------- + -- tables, views and permissions + ------------------------------------------------------------------------------------------------- + + + + + ------------------------------------------------------------------------------------------------- + -- referential integrity constraints + ------------------------------------------------------------------------------------------------- + + + + + + + + + + + ------------------------------------------------------------------------------------------------- + -- end of file + ------------------------------------------------------------------------------------------------- + + + + execute sp_addrole @rolename = '' + + GO + + + + + + + ALTER TABLE "" + ADD FOREIGN KEY ( "") + REFERENCES "" ON DELETE NO ACTION + + GO + + + + + + + ------------------------------------------------------------------------------------------------- + -- primary table + ------------------------------------------------------------------------------------------------- + CREATE TABLE "" + ( + + Id INT IDENTITY( 1, 1) PRIMARY KEY + ) + + GO + + ---- permissions ------------------------------------------------------------------------------ + + + + + + + + + + + ------------------------------------------------------------------------------------------------- + -- convenience view VW_DL_ for default list + ------------------------------------------------------------------------------------------------- + + CREATE VIEW "VW_DL_" AS + SELECT ""."Id", + + + + + + + AS + ""."" + + + , + + + + FROM "" , "" AS "" + + + + + WHERE + AND + ""."" = ""."Id" + + + GO + + ---- permissions ------------------------------------------------------------------------------ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ""."" + ' ' + + + + + + + + + + + + + GRANT SELECT ON "" TO + + GO + GRANT INSERT ON "" TO + + GO + GRANT SELECT, INSERT ON "" TO + + GO + GRANT SELECT, INSERT, UPDATE ON "" TO + + GO + GRANT SELECT, INSERT, UPDATE, DELETE ON "" TO + + GO + REVOKE ALL ON "" FROM + + GO + + + + + + + + + + + REVOKE ALL ON "VW_DL_" FROM + + GO + REVOKE ALL ON "VW_DL_" FROM + + GO + GRANT SELECT ON "VW_DL_" TO + + GO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- Problems with responsibility for generating link tables: + -- @entity = + -- $nearside = + -- $farside = + -- $farentity = + -- farlink = + -- comparison = '' + + + + + + true + + true + + + + + false + true + + + false + + + + + + + + + + + + + -- Responsibility = '' + + + + + ------------------------------------------------------------------------------------------------- + -- link table joining with + ------------------------------------------------------------------------------------------------- + CREATE TABLE "" + ( + "Id" INT NOT NULL, + "Id" INT NOT NULL, + ) + + GO + + + + ---- permissions ------------------------------------------------------------------------------ + + + + + + + + + ---- referential integrity -------------------------------------------------------------------- + + + ALTER TABLE "" + ADD FOREIGN KEY ( "Id") + REFERENCES "" ON DELETE NO ACTION + + GO + + ALTER TABLE "" + ADD FOREIGN KEY ( "Id") + REFERENCES "" ON DELETE NO ACTION + + GO + + + + ALTER TABLE "" + ADD FOREIGN KEY ( "Id") + REFERENCES "" ON DELETE CASCADE + + GO + + ALTER TABLE "" + ADD FOREIGN KEY ( "Id") + REFERENCES "" ON DELETE CASCADE + + GO + + + + + + + + + -- Suppressing generation of , as it is not my responsibility + + + + + + + + -- Suppressing output of property , + -- as it is the 'one' end of a one-to-many relationship + + + + "" INT DEFAULT NOT NULL, + + + + + + + "" + VARCHAR( ) + INT + DOUBLE PRECISION + + DEFAULT NOT NULL, + + + + + + -- SQL Server doesn't have proper booleans! + "" BIT + DEFAULT 1 + DEFAULT 0 + NOT NULL, + + + + + + "" VARCHAR( ) DEFAULT '' NOT NULL, + + + + + "" DATETIME DEFAULT + NOT NULL, + + + + + + "" INT DEFAULT NOT NULL, + + + + + "" DOUBLE PRECISION DEFAULT NOT NULL, + + + + + "" DEFAULT NOT NULL, + + + + + + + + + + + 0 + + + + + + + + -1 + + + 1 + + + + + + + + + diff --git a/ADL.NET/Trans/adl2psql.xsl b/ADL.NET/Trans/adl2psql.xsl new file mode 100755 index 0000000..fc2707b --- /dev/null +++ b/ADL.NET/Trans/adl2psql.xsl @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + ------------------------------------------------------------------------------------------------- + -- + -- Database for application version + -- Generated for PostgreSQL [7|8] using adl2psql.xsl $Revision: 1.1 $ + -- + -- Code generator (c) 2006 Simon Brooke [sb@cygnets.co.uk] + -- http://www.weft.co.uk/library/jacquard/ + -- + ------------------------------------------------------------------------------------------------- + + ------------------------------------------------------------------------------------------------- + -- authentication roles + ------------------------------------------------------------------------------------------------- + + + ------------------------------------------------------------------------------------------------- + -- tables, views and permissions + ------------------------------------------------------------------------------------------------- + + + ------------------------------------------------------------------------------------------------- + -- referential integrity constraints + ------------------------------------------------------------------------------------------------- + + + + + + + + + + + + + + + + ------------------------------------------------------------------------------------------------- + -- end of file + ------------------------------------------------------------------------------------------------- + + + + CREATE GROUP ; + + + + + + + ALTER TABLE ADD CONSTRAINT ri__ + FOREIGN KEY ( ) REFERENCES ON DELETE NO ACTION; + + + + + + + ALTER TABLE ln__ + ADD CONSTRAINT ri____id + FOREIGN KEY ( _id) REFERENCES ON DELETE CASCADE; + + ALTER TABLE ln__ + ADD CONSTRAINT ri____id + FOREIGN KEY ( _id) REFERENCES ON DELETE CASCADE; + + + + + + + + ------------------------------------------------------------------------------------------------- + -- primary table + ------------------------------------------------------------------------------------------------- + CREATE TABLE + ( + + _id SERIAL NOT NULL PRIMARY KEY + ); + + ---- permissions ------------------------------------------------------------------------------ + + + + + + ------------------------------------------------------------------------------------------------- + -- convenience view lv_ for lists + ------------------------------------------------------------------------------------------------- + CREATE VIEW lv_ AS + SELECT + + + + + + AS + + . + + + + , + + + + FROM + , AS + + + + + WHERE + AND + . = ._id + ; + + ---- permissions ------------------------------------------------------------------------------ + + + + + + + + + + + + ---- permissions ------------------------------------------------------------------------------ + + + + ln__ + + + + + + + + + + + + + + + + + + + + + . | ' ' | + + + + + + + + + + + + GRANT SELECT ON TO GROUP ; + GRANT INSERT ON TO GROUP ; + GRANT SELECT, INSERT ON TO GROUP ; + GRANT SELECT, INSERT, UPDATE ON TO GROUP ; + GRANT SELECT, INSERT, UPDATE, DELETE ON TO GROUP ; + REVOKE ALL ON FROM GROUP ; + + + + + + + + + + + REVOKE ALL ON lv_ FROM GROUP ; + REVOKE ALL ON lv_ FROM GROUP ; + GRANT SELECT ON lv_ TO GROUP ; + + + + + + + + + + + + _1 + + + + + + + + ------------------------------------------------------------------------------------------------- + -- link table joining with + ------------------------------------------------------------------------------------------------- + CREATE TABLE ln__ + ( + _id INT NOT NULL, + _id INT NOT NULL, + ); + + + + + + + + + INT DEFAULT NOT NULL, + + + + + + + + VARCHAR( ) + INT + DOUBLE PRECISION + + DEFAULT NOT NULL, + + + + + VARCHAR( ) DEFAULT NOT NULL, + + + + + INT DEFAULT NOT NULL, + + + + + DOUBLE PRECISION DEFAULT NOT NULL, + + + + + DEFAULT NOT NULL, + + + + diff --git a/ADL.NET/Trans/adl2views.xsl b/ADL.NET/Trans/adl2views.xsl new file mode 100755 index 0000000..e9caa45 --- /dev/null +++ b/ADL.NET/Trans/adl2views.xsl @@ -0,0 +1,1135 @@ + + + + + + + + + + + + + + + + + + + + + + [ cut here: next file 'tail.txt' ] + + + + + + + + + [ cut here: next file '' ] + + + + + #set( $title = " $instance.UserIdentifier") + + + + + Auto generated Velocity maybe-delete form for , + generated from ADL. + + Generated using adl2views.xsl + + ${Ajax.InstallScripts()} + ${FormHelper.InstallScripts()} + ${Validation.InstallScripts()} + ${Scriptaculous.InstallScripts()} + + + +
+ + + + ${FormHelper.HiddenField( "instance.")} + + + + ${FormHelper.HiddenField( "instance.Id")} + + + + + + + + +
+ Really delete? + + + + +
+
+ + + +
+ + + + + + + + + an + an + an + an + an + a + + + + + [ cut here: next file '.auto.vm' ] + + + + + #if ( $instance) + #set( $title = " $instance.UserIdentifier") + #else + #set( $title = "Add a new ") + #end + + + + + Auto generated Velocity form for , + generated from ADL. + + Generated using adl2views.xsl + + ${Ajax.InstallScripts()} + ${FormHelper.InstallScripts()} + ${Validation.InstallScripts()} + ${Scriptaculous.InstallScripts()} + ${DateTime.InstallScripts()} + ${ShuffleWidgetHelper.InstallScripts()} + + + + + + + +
+ #if ( $Flash.errors) +
+

Errors were encountered

+ +
    + #foreach ($error in $Flash.errors) +
  • + $error +
  • + #end +
+
+ #end + #if ( $messages.Count == 0) + + #else +
+ #foreach ( $message in $messages) +

+ $message +

+ #end +
+ #end +
+ + + + + + + + + + + + + + + + + + + + + + ${FormHelper.HiddenField( "instance.")} + + + + + + ${FormHelper.HiddenField( "instance.Id")} + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ To save this record + + +
+ To delete this record + + +
+
+ +
+ + + +
+ + +
+ + + + + + + display: none + + + + + + +

+ + + +

+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Add a new + + + + + + + + + + + + + + + + + + + - + + + #foreach( $item in $instance.) + #if ( $velocityCount % 2 == 0) + #set( $oddity = "even") + #else + #set( $oddity = "odd") + #end + + + + + + + #if ( $item.) + $item..UserIdentifier + #end + + + + + #if ( $item. == '') + + + + #end + + + + $!item. + + + + + + + + + + Edit! + + + + #end + + + + + + + + + + + + + + + + + - + + #foreach( $instance in $instances) + #if ( $velocityCount % 2 == 0) + #set( $oddity = "even") + #else + #set( $oddity = "odd") + #end + + + + $!instance. + + + + + + + + Edit! + + + + #end + + + + + + + + actionDangerous + actionSafe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + even + odd + + + + + + + Computed field? TODO: Not yet implememented + + + + + + + + + + + + + + + ${FormHelper.LabelFor( "instance.", " + + ")} + + + + + + + + + + + +
+ ${ShuffleWidgetHelper.UnselectedOptions( "", , $instance.)} + + + + + + + + ${ShuffleWidgetHelper.SelectedOptions( "", $instance.)} +
+ + + + + +
+ + + + + + even + odd + + + + + + +
+ + + + + + + + + + + + + You must provide a value for + Enter a value for + + + + + + + + ${FormHelper.LabelFor( "instance.", " + + + + + + + ")} + + + ${FormHelper.TextArea( "instance.", "%{rows='8' cols='60' title=''}")} + + + + + + even + odd + + + + + + + + + + + + + + + + + + + + You must provide a value for + + + The value for must be + + + The value for must be an instance of + + + The value for must be + + + + + + + + + + + + + none + + + + + + + + ${FormHelper.LabelFor( "instance.", " + + ")} + + + + + [You are not authorised to see this data] + + + + + + + + + + + + + + + + + #if ( $instance) + ${FormHelper.Select( "instance.", $instance., , "%{firstoption='[unset]' firstoptionvalue='-1' text='UserIdentifier' value='' title=''}" )} + #else + ${FormHelper.Select( "instance.", $, , "%{firstoption='[unset]' firstoptionvalue='-1' text='UserIdentifier' value='' title=''}" )} + #end + + + + ${FormHelper.Select( "instance.", $instance., , "%{multiple='multiple' size='8' text='UserIdentifier' value='' title=''}" )} + + + + + + + + + + + + + + + + + + + + + + + + required + + validate-digits + validate-number + validate-number + date-field validate-date + + + + + + + + + + + + + + + + + + + + + + + + + + + $!instance. + + + + + +
+ + + +
+ + + +
+
+ + + + +
+
+ +
+ +
+ + + + + + + ${FormHelper.CheckboxField( "instance.")} + + + required date-field validate-date + ${FormHelper.TextField( "instance.", "%{class='' size='10' maxlength='10'}")} + + + + required + validate-digits + validate-number + validate-number + + + + + + + + 8 + 8 + 8 + 60 + + + ${FormHelper.TextField( "instance.", "%{class='' title='' size='' maxlength=''}")} + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + [ cut here: next file '.auto.vm' ] + + + + + + People + + es + + + ies + + + s + + + + + + #set( $title = "") + + + Auto generated Velocity list for , + generated from ADL. + + Generated using adl2listview.xsl + + ${Ajax.InstallScripts()} + ${FormHelper.InstallScripts()} + ${Validation.InstallScripts()} + ${Scriptaculous.InstallScripts()} + ${DateTime.InstallScripts()} + + + + +
+ + +
+ + Showing $instances.FirstItem - $instances.LastItem of $instances.TotalItems + + + #if($instances.HasFirst) $PaginationHelper.CreatePageLink( 1, "<<" ) #end + #if(!$instances.HasFirst) << #end + + + #if($instances.HasPrevious) $PaginationHelper.CreatePageLink( $instances.PreviousIndex, "<" ) #end + #if(!$instances.HasPrevious) < #end + + + #if($instances.HasNext) $PaginationHelper.CreatePageLink( $instances.NextIndex, ">" ) #end + #if(!$instances.HasNext) > #end + + + #if($instances.HasLast) $PaginationHelper.CreatePageLink( $instances.LastIndex, ">>" ) #end + #if(!$instances.HasLast) >> #end + + + + + + + + Add a new + + + + +
+
+ + + + + + + + + + #foreach( $instance in $instances) + #if ( $velocityCount % 2 == 0) + #set( $oddity = "even") + #else + #set( $oddity = "odd") + #end + + + + + + + #end + + + + + + + + + #foreach( $instance in $instances) + #if ( $velocityCount % 2 == 0) + #set( $oddity = "even") + #else + #set( $oddity = "odd") + #end + + + + + + + #end + + +
+ + + + + + + + + + + -
+ $!instance. + + + + + + Edit! + +
+ + + + + + + + + -
+ $!instance. + + + + + + Edit! + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/ADL.NET/Trans/datadescriber.xsl b/ADL.NET/Trans/datadescriber.xsl new file mode 100755 index 0000000..8b1d8dd --- /dev/null +++ b/ADL.NET/Trans/datadescriber.xsl @@ -0,0 +1,426 @@ + + + + + + + + + + + + Data definition for the <xsl:value-of select="@name"/> application + version <xsl:value-of select="@version"/> + + + + +

+ Data definition for the application version +

+ + + +

+ +

+ +
+ +
+ Group: + +
+
+ Permissions: + +
+
+
+ + + + + + + + + + + + + + + even + odd + + + + + + + + + + + + + + + + + + + + + +
PropertyTypeReq'dDef'ltSizeDistinctPrompt
+   + + + + of type + + + : + + + + + + + + + String matching + "" + + + < + < + + + + +   + +   + +   + +   + +   + + +   + +
+   +
+   +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + +
+

+ Form +

+ +

Permissions

+
    + +
+
+ + +

Showing the following properties

+ + + + + + + + +
 PropertyPromptDocumentation
+
+ +

Showing all properties

+
+
+
+
+ + +
+

+ Page +

+ +
    + +
+
+ + +

Showing the following properties

+ + + + + + + + +
 PropertyPromptDocumentation
+
+ +

Showing all properties

+
+
+
+
+ + +
+

+ List , on select +

+ +
    + +
+
+ + +

Showing the following properties

+ + + + + + + + +
 PropertyPromptDocumentation
+
+ +

Showing all properties

+
+
+
+
+ + + + + + + + fieldgroup-end + fieldgroup + + + + + auxlist-end + auxlist + + + + + Field + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fieldgroup-end + fieldgroup + + + + + auxlist-end + auxlist + + + + + Verb + + + [dangerous] + + + + + + + + + + + + + + + + + + + + + + + + + + Auxlist + + + + + + + + + + + + + + + On select: + + + + + + + Showing the following properties + + + Showing all properties + + + + + + + + + + Auxlist + + + + + + + + + + + + + + + On select: + + + + + + + Showing the following properties + + + Showing all properties + + + + + + + + + + +
diff --git a/ADL.NET/Trans/hibernate2adl.xsl b/ADL.NET/Trans/hibernate2adl.xsl new file mode 100755 index 0000000..90f1b7d --- /dev/null +++ b/ADL.NET/Trans/hibernate2adl.xsl @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + date + string + boolean + timestamp + integer + [unknown?] + + + + + true + false + + + + + + + + + + + + + + + + + date + string + boolean + timestamp + integer + [unknown?] + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file