Some new work on Postgres, but not yet working and maybe a false start; apart

from that, stuff brought over from Cygnets, getting file upload working on
Monorail.
This commit is contained in:
simon 2010-07-20 19:53:39 +00:00
parent 9b4c13178e
commit 8a3daa78d9
19 changed files with 5376 additions and 5754 deletions

View file

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{15DF3516-FE95-4BB0-9353-2E1E624303B8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ADL</RootNamespace>
<AssemblyName>ADL</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Content Include="transforms\adl2canonical.xslt" />
<Content Include="transforms\adl2controllerclasses.xslt" />
<Content Include="transforms\adl2documentation.xslt" />
<Content Include="transforms\adl2entityclasses.xslt" />
<Content Include="transforms\adl2hibernate.xslt" />
<Content Include="transforms\adl2mssql.xslt" />
<Content Include="transforms\adl2psql.xslt" />
<Content Include="transforms\adl2views.xslt" />
<Content Include="transforms\base-type-include.xslt" />
<Content Include="transforms\csharp-type-include.xslt" />
<Content Include="transforms\i18n-en-GB-include.xslt" />
<Content Include="transforms\localise-transform.xslt" />
</ItemGroup>
<ItemGroup>
<None Include="schemas\adl-1.1.dtd" />
<None Include="test.build" />
</ItemGroup>
</Project>

44
ADL.sln
View file

@ -1,44 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ADL", "ADL.csproj", "{15DF3516-FE95-4BB0-9353-2E1E624303B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CygnetToolkit", "..\CygnetToolkit\CygnetToolkit.csproj", "{77FB7DE5-1F33-4DDC-8A2E-79EF4728705E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{45578889-14A2-4A53-8391-0596369CCBA5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{D705F7CA-EB87-48EF-8F18-7D1AD90660BA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{83B41EED-23C8-4DEF-B113-46A426346E45}"
ProjectSection(SolutionItems) = preProject
ADL.vsmdi = ADL.vsmdi
LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{15DF3516-FE95-4BB0-9353-2E1E624303B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15DF3516-FE95-4BB0-9353-2E1E624303B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15DF3516-FE95-4BB0-9353-2E1E624303B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15DF3516-FE95-4BB0-9353-2E1E624303B8}.Release|Any CPU.Build.0 = Release|Any CPU
{77FB7DE5-1F33-4DDC-8A2E-79EF4728705E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77FB7DE5-1F33-4DDC-8A2E-79EF4728705E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77FB7DE5-1F33-4DDC-8A2E-79EF4728705E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77FB7DE5-1F33-4DDC-8A2E-79EF4728705E}.Release|Any CPU.Build.0 = Release|Any CPU
{45578889-14A2-4A53-8391-0596369CCBA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45578889-14A2-4A53-8391-0596369CCBA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45578889-14A2-4A53-8391-0596369CCBA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45578889-14A2-4A53-8391-0596369CCBA5}.Release|Any CPU.Build.0 = Release|Any CPU
{D705F7CA-EB87-48EF-8F18-7D1AD90660BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D705F7CA-EB87-48EF-8F18-7D1AD90660BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D705F7CA-EB87-48EF-8F18-7D1AD90660BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D705F7CA-EB87-48EF-8F18-7D1AD90660BA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,124 +0,0 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{45578889-14A2-4A53-8391-0596369CCBA5}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestApp</RootNamespace>
<AssemblyName>TestApp</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
<Reference Include="Castle.MonoRail.Framework, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
<Reference Include="Castle.MonoRail.Framework.Views.NVelocity, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
<Reference Include="Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>L:\Castle\1.0.3RC3\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web.Extensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
</ItemGroup>
<ItemGroup>
<Content Include="Default.aspx" />
<Content Include="testapp.adl.xml" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Auto\address.auto.cs" />
<Compile Include="Auto\person.auto.cs" />
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="Default.aspx.designer.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Web\Controllers\Auto\AbstractadltestappController.auto.cs" />
<Compile Include="Web\Controllers\Auto\addressController.auto.cs" />
<Compile Include="Web\Controllers\Auto\personController.auto.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Web\Views\Auto\test\address\edit.auto.vm" />
<None Include="Web\Views\Auto\test\address\list.auto.vm" />
<None Include="Web\Views\Auto\test\address\maybedelete.auto.vm" />
<None Include="Web\Views\Auto\test\person\edit.auto.vm" />
<None Include="Web\Views\Auto\test\person\maybedelete.auto.vm" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\CygnetToolkit\CygnetToolkit.csproj">
<Project>{77FB7DE5-1F33-4DDC-8A2E-79EF4728705E}</Project>
<Name>CygnetToolkit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Web\bin\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>3627</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

View file

@ -1,125 +0,0 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View file

@ -1,115 +1,82 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- DOCTYPE application PUBLIC "-//CYGNETS//DTD ADL 0.1//EN" "http://www.cygnets.co.uk/schemas/adl-0.1.1.dtd" -->
<!-- DOCTYPE application SYSTEM "file:/C:/Projects/ADL/schemas/adl-0.dtd" -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//JOURNEYMAN//DTD ADL 1.4//EN"
"http://bowyer.journeyman.cc/adl/stable/adl/schemas/adl-1.4.dtd">
<!--
Application Description Language framework
testapp.adl.xml
the object of this file is to exercise as many aspects of ADL as possible;
it isn't expected to describe an application which does anything useful
in the first instance, this is an attempt to recreate PRES in ADL
Copyright (c) 2008 Cygnet Solutions Ltd
$Author: sb $
$Revision: 1.2 $
$Date: 2008-07-01 16:08:17 $
-->
<application name="ADLTestApp" xmlns="http://cygnets.co.uk/schemas/adl-1.2">
<content>
<head>
</head>
<top>
</top>
<foot>
</foot>
</content>
<typedef name="postcode" type="string" size="10"
pattern="^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$">
<documentation>
a postcode follows arcane rules; this specification from
http://regexlib.com/REDetails.aspx?regexp_id=260.
$Author: simon $
$Revision: 1.3 $
$Date: 2010-07-20 19:53:40 $
-->
<application name="pres" xmlns="http://bowyer.journeyman.cc/adl/stable/">
<specification abbr="regexplib" name="RegexpLib.com" url="http://regexlib.com/"/>
<content>
<head/>
<top/>
<foot/>
</content>
<typedef name="postcode"
pattern="^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$"
size="10" type="string">
<documentation>
<reference abbr="regexplib" section="REDetails.aspx?regexp_id=260"/>
a postcode follows arcane rules.
</documentation>
</typedef>
<typedef name="age" type="integer" minimum="0" maximum="120">
<documentation>
</typedef>
<typedef maximum="120" minimum="0" name="age" type="integer">
<documentation>
We don't believe people who claim to be over 120.
</documentation>
</typedef>
<group name="public"/>
<group name="admin" parent="public"/>
<entity name="Person">
<property name="LastName" type="string" required="true" size="100" distinct="user">
<prompt locale="en-UK" prompt="Surname"/>
</property>
<property name="ForeNames" type="string" required="true" size="100" distinct="user">
<prompt locale="en-UK" prompt="Fore names"/>
</property>
<property name="Partner" type="entity" entity="Person"/>
<property name="Gender" type="string" size="1" required="true">
<option value="M">
<prompt locale="en-GB" prompt="Male"/>
</option>
<option value="F">
<prompt locale="en-GB" prompt="Female"/>
</option>
</property>
<property name="age" type="defined" typedef="age"/>
<property name="Address" type="entity" entity="Address" distinct="user"/>
<property name="Friends" type="link" entity="Person"/>
<form name="edit" properties="listed">
<fieldgroup name="Personal Data">
<documentation>
Basic data about the person
</documentation>
<field property="ForeNames">
<prompt locale="en-GB" prompt="Fore names"/>
</field>
<field property="LastName">
<prompt locale="en-GB" prompt="Surname"/>
<help locale="en-GB">
Family name of this person, conventionally their last name
</help>
</field>
<field property="Partner"/>
<field property="Gender"/>
<field property="Address"/>
</fieldgroup>
<fieldgroup name="Community">
<field property="Friends"/>
</fieldgroup>
</form>
</entity>
<entity name="Address">
<key>
<property name="Number" type="string" size="8" distinct="all">
<prompt locale="en-GB" prompt="House number"/>
<help locale="en-GB">
House or building number
</help>
</property>
<property name="Postcode" type="defined" typedef="postcode" required="false" distinct="all">
<prompt locale="en-UK" prompt="Post code"/>
</property>
</key>
<property name="Address1" type="string" required="true" size="255">
<prompt locale="en-UK" prompt="Address"/>
</property>
<property name="Address2" type="string" required="false" size="255">
<prompt locale="en-UK" prompt="Line 2"/>
</property>
<property name="Address3" type="string" required="false" size="255">
<prompt locale="en-UK" prompt="Line 3"/>
</property>
<property name="City" type="string" required="false" size="255">
<prompt locale="en-UK" prompt="Post town"/>
</property>
<property name="County" type="string" required="false" size="255" />
<form name="edit" properties="all"/>
<list name="list" properties="user-distinct"/>
</entity>
</typedef>
<typedef name="email"
pattern="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" size="128">
<documentation>
<reference abbr="regexplib" section="REDetails.aspx?regexp_id=26"/>
</documentation>
</typedef>
<group name="public"/>
<group name="admin" parent="public"/>
<entity name="Actor">
<documentation>
A real (administrative) user of this system with a first-class, database layer login,
as opposed to a Subscriber with a second-class, application layer login.
</documentation>
<property name="Name" size="64" type="string"/>
<property name="EMail" type="defined" typedef="email"/>
<property name="Approved" type="boolean"/>
</entity>
<entity name="Article">
<property name="Created" type="date"/>
<property name="Embargo" type="date"/>
<property entity="Category" name="Category" type="entity"/>
<property name="Title" size="128" type="string"/>
<property entity="Actor" name="Author" type="entity"/>
<property name="Location" type="entity" entity="Location"/>
</entity>
<entity name="Author">
<property name="CanonicalName" size="128" type="string"/>
<property entity="NomDePlume" name="NomsDePlume" type="list"/>
<property name="Disambiguation" size="256" type="string">
<documentation>
If the canonical name is a common one, or there are known to be two or more authors
with the same canonical name, some brief text about the author to disambiguate.
</documentation>
</property>
</entity>
<entity name="Book">
<property entity="Article" name="Article" type="entity"/>
<property name="AuthorAsEntered" size="128" type="string">
<documentation>The name of the author as entered by the original user, prior to being resolved against known authors</documentation>
</property>
<property entity="Author" name="Authors" type="link"/>
<property name="Title" size="128" type="string"/>
</entity>
<entity name="NomDePlume">
<property name="Name" size="128" type="string"/>
<property entity="Author" name="Author" type="entity"/>
</entity>
</application>

View file

@ -6,24 +6,19 @@
<!-- Document Type Description for Application Description -->
<!-- Language. Normative for now; will be replaced by a schema. ` -->
<!-- -->
<!-- Author: Simon Brooke <stillyet@journeyman.cc> -->
<!-- Author: Simon Brooke <simon@cygnets.co.uk> -->
<!-- Created: 24th January 2006 -->
<!-- Copyright: (c) 2007 Cygnet Solutions -->
<!-- -->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!--
$Revision: 1.4 $
$Revision: 1.5 $
-->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- Before we start: import XHTML for use in documentation sections -->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- doesn't work yet -->
<!-- ENTITY % XHTML PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
%XHTML; -->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- Before we start: some useful definitions -->
@ -477,6 +472,10 @@ that we can allow HTML block level entities within content elements -->
<!ELEMENT page (documentation?, ( %PageStuff;)*)>
<!ATTLIST page %PageAttrs;>
<!-- an ordering or records in a list
property: the property on which to order
sequence: the sequence in which to order
-->
<!ELEMENT order (documentation?)>
<!ATTLIST order
property CDATA #REQUIRED
@ -587,7 +586,8 @@ that we can allow HTML block level entities within content elements -->
<!ATTLIST specification
url CDATA #IMPLIED
name CDATA #REQUIRED
abbr CDATA #REQUIRED>
abbr CDATA #REQUIRED
>
<!--
The 'specification' and 'reference' elements are for documentation only,
@ -610,5 +610,6 @@ that we can allow HTML block level entities within content elements -->
abbr CDATA #IMPLIED
section CDATA #IMPLIED
entity CDATA #IMPLIED
property CDATA #IMPLIED>
property CDATA #IMPLIED
>

View file

@ -1,165 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<project name="ADL-Test-App" default="build"
xmlns="http://nant.sf.net/release/0.85-rc4/nant.xsd"
xmlns:nant="http://nant.sf.net/release/0.85-rc4/nant.xsd"
>
<property name="build.revision" value="$Revision: 1.5 $"/>
<property name="adl" value="."/>
<property name="adl-transforms" value="${adl}/transforms"/>
<property name="testapp" value="testapp"/>
<property name="rootns" value="Cygnet.ADL.TestApp"/>
<property name="entityns" value="${rootns}.Entities"/>
<property name="controllerns" value="${rootns}.Controllers"/>
<property name="controllers" value="testapp/Web/Controllers"/>
<property name="views" value="testapp/Web/Views" />
<property name="formcontroller" value="testapp/Web/Controllers/Form"/>
<property name="formview" value="testapp/Web/Views/Form"/>
<property name="bindir" value="testapp/Web/bin"/>
<property name="tmpdir" value="tmp"/>
<property name="adl-src" value="${testapp}/testapp.adl.xml" />
<property name="canonical" value="${tmpdir}/testapp.adl.xml" />
<property name="area-name" value="test"/>
<property name="nant-tasks" value="${tmpdir}/NantTasks.dll"/>
<property name="nant-contrib-dll" value="C:\Program Files\nantcontrib-0.85\bin\NAnt.Contrib.Tasks.dll"/>
<target name="fetchtasks" depends="prepare"
description="fetches our NantTaks library from the well known place where it resides">
<get src="http://libs.cygnets.co.uk/NantTasks.dll" dest="${nant-tasks}"/>
</target>
<target name="canonicalise" description="generates adl for testapp entities">
<!-- adl2canonical.xslt -->
<style verbose="true" style="${adl-transforms}/adl2canonical.xslt"
in="${adl-src}"
out="${canonical}">
<parameters>
<parameter name="abstract-key-name-convention" value="Name_Id"/>
</parameters>
</style>
</target>
<target name="analyse">
<loadtasks assembly="${nant-contrib-dll}" />
<fxcop directOutputToConsole="true" projectFile="${testapp}/TestApp.fxcop">
</fxcop>
</target>
<target name="hbm" description="generates adl for testapp database NHibernate mapping"
depends="canonicalise">
<style verbose="true" style="${adl-transforms}/adl2hibernate.xslt"
in="${canonical}"
out="${tmpdir}/testapp.hbm.xml">
<parameters>
<parameter name="namespace" value="${entityns}"/>
<parameter name="assembly" value="${rootns}"/>
</parameters>
</style>
</target>
<target name="sql" description="Generates testapp database initialisation script"
depends="canonicalise">
<style verbose="true" style="${adl-transforms}/adl2mssql.xslt"
in="${canonical}"
out="${testapp}/testapp.auto.sql">
<parameters>
<parameter name="abstract-key-name-convention" value="Name_Id"/>
<parameter name="database" value="ADL_TestApp"/>
</parameters>
</style>
</target>
<target name="entities" description="creates C# classes for entities in the database"
depends="fetchtasks canonicalise">
<loadtasks assembly="${nant-tasks}" />
<style verbose="true" style="${adl-transforms}/adl2entityclass.xslt"
in="${canonical}"
out="${tmpdir}/classes.auto.cs">
<parameters>
<parameter name="locale" value="en-UK"/>
<parameter name="controllerns" value="${controllerns}"/>
<parameter name="entityns" value="${entityns}"/>
</parameters>
</style>
<exec program="c:\Program Files\astyle\bin\astyle.exe"
basedir="."
commandline="--style=java --indent=tab=4 --indent-namespaces ${tmpdir}/classes.auto.cs"/>
<split-regex in="${tmpdir}/classes.auto.cs"
destdir="${testapp}/Auto"
pattern="cut here: next file '([a-zA-Z0-9_.]*)'"/>
</target>
<target name="views" description="creates Velocity templates"
depends="fetchtasks canonicalise">
<loadtasks assembly="${nant-tasks}" />
<style verbose="true" style="${adl-transforms}/adl2views.xslt"
in="${canonical}"
out="${tmpdir}/views.auto.vm">
<parameters>
<parameter name="layout-name" value="default"/>
<parameter name="locale" value="en-UK"/>
<parameter name="controllerns" value="${controllerns}"/>
<parameter name="entityns" value="${entityns}"/>
<parameter name="generate-site-navigation" value="false"/>
<parameter name="permissions-group" value="partsbookeditors"/>
<parameter name="area-name" value="${area-name}"/>
<parameter name="show-messages" value="true"/>
</parameters>
</style>
<split-regex in="${tmpdir}/views.auto.vm"
destdir="${views}/Auto/${area-name}" pattern="cut here: next file '([a-zA-Z0-9_./]*)'"/>
</target>
<target name="controllers" description="creates C# controller classes" depends="fetchtasks canonicalise">
<loadtasks assembly="${nant-tasks}" />
<style verbose="true" style="${adl-transforms}/adl2controllerclasses.xslt"
in="${canonical}"
out="${tmpdir}/controllers.auto.cs">
<parameters>
<parameter name="locale" value="en-UK"/>
<parameter name="controllerns" value="${controllerns}"/>
<parameter name="entityns" value="${entityns}"/>
<parameter name="layout-name" value="default"/>
<parameter name="rescue-name" value="generalerror"/>
<parameter name="area-name" value="${area-name}"/>
</parameters>
</style>
<exec program="c:\Program Files\astyle\bin\astyle.exe"
basedir="."
commandline="--style=java --indent=tab=4 --indent-namespaces ${tmpdir}/controllers.auto.cs"/>
<split-regex in="${tmpdir}/controllers.auto.cs"
destdir="${controllers}/Auto" pattern="cut here: next file '([a-zA-Z0-9_.]*)'"/>
</target>
<target name="prepare" description="prepare directories used during the build">
<mkdir dir="${bindir}" failonerror="false"/>
<mkdir dir="${tmpdir}" failonerror="false"/>
</target>
<target name="clean" description="removes all products of the build process except the xml-ised database schema">
<delete>
<fileset>
<include name="**/*.auto.*"/>
</fileset>
</delete>
<delete failonerror="false" dir="${bindir}"/>
<delete failonerror="false" dir="${tmpdir}"/>
</target>
<target name="build" depends="prepare entities controllers views sql hbm"
description="compiles Visual Studio solution using msbuild">
<exec program="msbuild.exe"
basedir="c:\windows\microsoft.net\framework\v3.5\"
commandline="ADL.sln"/>
</target>
<target name="deploy" depends="clean build"/>
</project>

View file

@ -19,14 +19,14 @@
every entity, form, page, list or field, the canonical form should
explicitly state the permission, even if it is 'none'.
$Author: sb $
$Revision: 1.9 $
$Date: 2010-01-12 17:20:17 $
$Author: simon $
$Revision: 1.10 $
$Date: 2010-07-20 19:53:40 $
-->
<xsl:stylesheet version="1.0"
xmlns="http://libs.cygnets.co.uk/adl/1.4/"
xmlns:adl="http://libs.cygnets.co.uk/adl/1.4/"
xmlns="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:adl="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="adl">
@ -74,7 +74,7 @@
* THIS FILE IS AUTOMATICALLY GENERATED AND SHOULD NOT
* BE MANUALLY EDITED.
*
* Generated using adl2canonical.xslt <xsl:value-of select="substring('$Revision: 1.9 $', 12)"/>
* Generated using adl2canonical.xslt <xsl:value-of select="substring('$Revision: 1.10 $', 12)"/>
*
***************************************************************************
</xsl:comment>

View file

@ -8,9 +8,9 @@
Transform ADL into (partial) controller classes
$Author: sb $
$Revision: 1.45 $
$Date: 2010-06-01 17:29:02 $
$Author: simon $
$Revision: 1.46 $
$Date: 2010-07-20 19:53:40 $
-->
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -72,7 +72,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.45 $', 10)"/>
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.46 $', 10)"/>
//
// <xsl:value-of select="/adl:application/@revision"/>
//
@ -188,7 +188,7 @@
//
// 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.45 $', 10)"/>
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.46 $', 10)"/>
//
// This file is automatically generated; DO NOT EDIT IT.
//
@ -345,7 +345,7 @@
record = FetchRecord( hibernator);
<xsl:apply-templates select="adl:property"/>
<xsl:apply-templates select="adl:property" mode="presenceAndValidity"/>
if ( HasNoErrors()) {
if ( record == null) {
@ -458,192 +458,9 @@
}
</xsl:for-each>
</xsl:if>
<xsl:for-each select="descendant::adl:property[@type='entity']">
/* 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. */
<xsl:variable name="entityname" select="@entity"/>
<xsl:choose>
<xsl:when test="//adl:entity[@name=$entityname]">
if ( ! String.IsNullOrEmpty( Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]) &amp;&amp;
! EntityMenuControl&lt;<xsl:value-of select="concat( $entityns, '.', @entity)"/>&gt;.NULLMARKER.Equals ( Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]))
{
record.<xsl:value-of select="@name"/> = <xsl:call-template name="fetch-property-instance">
<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>;
modified.Add( record.<xsl:value-of select="@name"/>);
}
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
ADL: ERROR: Could not fix up value of <xsl:value-of select="@name "/>, because no
entity was found called <xsl:value-of select="$entityname"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="descendant::adl:property[@type='link']">
<xsl:variable name="nearentityname" select="ancestor::adl:entity/@name"/>
<xsl:variable name="farentityname" select="@entity"/>
<xsl:variable name="entity" select="//adl:entity[@name=$farentityname]"/>
<xsl:variable name="farkey" select="$entity/adl:key/adl:property[position()=1]/@name"/>
<xsl:variable name="farkeybasetype">
<xsl:call-template name="base-type">
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="deletegroups">
<xsl:call-template name="entity-delete-groups">
<xsl:with-param name="entity" select="$entity"/>
</xsl:call-template>
</xsl:variable>
/* For a link, collect changes to link table and process them */
<xsl:if test="$authentication-layer = 'Database'">
if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">InGroup( "<xsl:value-of select="./@name"/>") ||</xsl:for-each> false) {
/* however, we cannot do anything unless we have delete permissions on the table, so
* should not try. */
</xsl:if>
LinkChanges&lt;<xsl:value-of select="concat( $entityns, '.', @entity)"/>&gt; changes =
LinkTableUpdater&lt;<xsl:value-of select="concat( $entityns, '.', @entity)"/>&gt;.Changes( <xsl:value-of select="concat( 'record.', @name)"/>, Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>"),
hibernator);
foreach ( var item in changes.ToRemove) {
modified.Add(item);
<xsl:value-of select="concat( 'record.', @name)"/>.Remove(item);
<xsl:for-each select="$entity//adl:property[@type='link' and @entity=$nearentityname]">
<xsl:value-of select="concat( 'item.', @name)"/>.Remove( record);
<xsl:if test="position() != 1">
/* WARNING WARNING WARNING! Could not uniquely determine the far side property;
* redesign your application or manually maintain this code! */
<xsl:message terminate="no">
WARNING: Could not uniquely determine far end of link represented by property <xsl:value-of select="@name"/> of <xsl:value-of select="$nearentityname"/>
</xsl:message>
</xsl:if>
</xsl:for-each>
}
foreach ( var item in changes.ToAdd) {
modified.Add(item);
<xsl:value-of select="concat( 'record.', @name)"/>.Add(item);
<xsl:for-each select="$entity//adl:property[@type='link' and @entity=$nearentityname]">
<xsl:value-of select="concat( 'item.', @name)"/>.Add( record);
<xsl:if test="position() != 1">
/* WARNING WARNING WARNING! Could not uniquely determine the far side property;
* redesign your application or manually maintain this code! */
<xsl:message terminate="no">
WARNING: Could not uniquely determine far end of link represented by property <xsl:value-of select="@name"/> of <xsl:value-of select="$nearentityname"/>
</xsl:message>
</xsl:if>
</xsl:for-each>
}
<xsl:if test="$authentication-layer = 'Database'">
} /* if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">
InGroup( "<xsl:value-of select="./@name"/>") ||
</xsl:for-each> false) */
</xsl:if>
</xsl:for-each>
<xsl:for-each select="descendant::adl:property[@type='list']">
<xsl:variable name="farentityname" select="@entity"/>
<xsl:variable name="entity" select="//adl:entity[@name=$farentityname]"/>
<xsl:variable name="farkey" select="$entity/adl:key/adl:property[position()=1]/@name"/>
<xsl:variable name="farkeybasetype">
<xsl:call-template name="base-type">
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="foreignkey">
<xsl:choose>
<xsl:when test="@farkey">
<xsl:value-of select="@farkey"/>
</xsl:when>
<xsl:otherwise>
<!-- If I haven't been told what the far side foreign key is, assume it has the
name of my entity -->
<xsl:value-of select="ancestor::adl:entity/@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="deletegroups">
<xsl:call-template name="entity-delete-groups">
<xsl:with-param name="entity" select="$entity"/>
</xsl:call-template>
</xsl:variable>
/* with a list we cannot just smash the old values! Instead we need to check
* each one and exclude it if no longer required; */
<xsl:if test="$authentication-layer = 'Database'">
if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">
InGroup( "<xsl:value-of select="./@name"/>") ||
</xsl:for-each> false) {
/* but once again only if we can delete and create entities at the far end. */
</xsl:if>
if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null)
{
string[] <xsl:value-of select="concat(@name, 'Values')"/> = Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>");
/* updating <xsl:value-of select="@name"/> child records; first remove any not on the submitted list */
foreach ( <xsl:value-of select="@entity"/> item in record.<xsl:value-of select="@name"/>)
{
String itemId = item.KeyString;
bool found = false;
foreach ( string index in <xsl:value-of select="concat(@name, 'Values')"/>)
{
if ( index.Equals( itemId))
{
found = true;
break;
}
} /* foreach ( string index... */
if ( ! found)
{
record.<xsl:value-of select="@name"/>.Remove( item);
modified.Add( item);
break;
}
} /* foreach ( <xsl:value-of select="@entity"/> item ... */
/* then add any on the included list which are not already members */
foreach ( string index in <xsl:value-of select="concat(@name, 'Values')"/>)
{
<xsl:value-of select="concat( $entityns, '.', @entity)"/> item =
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:call-template>
.UniqueResult&lt;<xsl:value-of select="concat( $entityns, '.', @entity)"/>&gt;();
if ( ! record.<xsl:value-of select="@name"/>.Contains( item))
{
/* check whether it's already a child of another <xsl:value-of select="ancestor::adl:entity/@name"/>
* and, if it is, remove it */
<xsl:value-of select="concat( $entityns, '.', ancestor::adl:entity/@name)"/> oldparent =
<xsl:value-of select="concat( 'item.', $foreignkey)"/>;
if ( oldparent != null) {
oldparent.<xsl:value-of select="@name"/>.Remove( item);
modified.Add( oldparent);
}
/* then add it to my <xsl:value-of select="@name"/> */
record.<xsl:value-of select="@name"/>.Add( item);
<xsl:value-of select="concat( 'item.', $foreignkey)"/> = record;
modified.Add( item);
}
} /* foreach ( string index... */
} /* if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null) */
<xsl:if test="$authentication-layer = 'Database'">
} /* if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">InGroup( "<xsl:value-of select="./@name"/>") ||</xsl:for-each> false) */
</xsl:if>
</xsl:for-each>
<!-- special binding for types which don't bind straightforwardly in BindObjectInstance-->
<xsl:apply-templates select="descendant::adl:property" mode="bind"/>
/* write the modified records to the database */
foreach ( Entity item in modified) {
@ -786,7 +603,7 @@
/* ---- [ cut here: next file 'junk'] ------------------------- */
</xsl:template>
<xsl:template match="adl:property">
<xsl:template match="adl:property" mode="presenceAndValidity">
<xsl:if test="@required='true'">
if (
<xsl:if test="@immutable='true'">
@ -813,7 +630,213 @@
</xsl:if>
</xsl:template>
<xsl:template match="adl:ifmissing">
<!-- upload and bind an image file to the instance -->
<xsl:template match="adl:property[@type='image']" mode="bind">
record.<xsl:value-of select="@name"/> =
this.MaybeUploadImage("<xsl:value-of select="concat( 'instance.', @name)"/>");
</xsl:template>
<!-- upload and bind a file to the instance -->
<xsl:template match="adl:property[@type='uploadable']" mode="bind">
record.<xsl:value-of select="@name"/> =
this.MaybeUploadFile("<xsl:value-of select="concat( 'instance.', @name)"/>");
</xsl:template>
<!-- locate and bind the specified instance of this entity -->
<xsl:template match="adl:property[@type='entity']" mode="bind">
/* 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. */
<xsl:variable name="entityname" select="@entity"/>
<xsl:choose>
<xsl:when test="//adl:entity[@name=$entityname]">
if ( ! String.IsNullOrEmpty( Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]) &amp;&amp;
! EntityMenuControl&lt;<xsl:value-of select="concat( $entityns, '.', @entity)"/>&gt;.NULLMARKER.Equals ( Form["<xsl:value-of select="concat( 'instance.', @name)"/>"]))
{
record.<xsl:value-of select="@name"/> = <xsl:call-template name="fetch-property-instance">
<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>;
modified.Add( record.<xsl:value-of select="@name"/>);
}
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
ADL: ERROR: Could not fix up value of <xsl:value-of select="@name "/>, because no
entity was found called <xsl:value-of select="$entityname"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- locate and bind the specified linked instances -->
<xsl:template match="adl:property[@type='link']" mode="bind">
<xsl:variable name="nearentityname" select="ancestor::adl:entity/@name"/>
<xsl:variable name="farentityname" select="@entity"/>
<xsl:variable name="entity" select="//adl:entity[@name=$farentityname]"/>
<xsl:variable name="farkey" select="$entity/adl:key/adl:property[position()=1]/@name"/>
<xsl:variable name="farkeybasetype">
<xsl:call-template name="base-type">
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="deletegroups">
<xsl:call-template name="entity-delete-groups">
<xsl:with-param name="entity" select="$entity"/>
</xsl:call-template>
</xsl:variable>
/* For a link, collect changes to link table and process them */
<xsl:if test="$authentication-layer = 'Database'">
if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">
InGroup( "<xsl:value-of select="./@name"/>") ||
</xsl:for-each> false) {
/* however, we cannot do anything unless we have delete permissions on the table, so
* should not try. */
</xsl:if>
LinkChanges&lt;<xsl:value-of select="concat( $entityns, '.', @entity)"/>&gt; changes =
LinkTableUpdater&lt;<xsl:value-of select="concat( $entityns, '.', @entity)"/>&gt;.Changes( <xsl:value-of select="concat( 'record.', @name)"/>, Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>"),
hibernator);
foreach ( var item in changes.ToRemove) {
modified.Add(item);
<xsl:value-of select="concat( 'record.', @name)"/>.Remove(item);
<xsl:for-each select="$entity//adl:property[@type='link' and @entity=$nearentityname]">
<xsl:value-of select="concat( 'item.', @name)"/>.Remove( record);
<xsl:if test="position() != 1">
/* WARNING WARNING WARNING! Could not uniquely determine the far side property;
* redesign your application or manually maintain this code! */
<xsl:message terminate="no">
WARNING: Could not uniquely determine far end of link represented by property <xsl:value-of select="@name"/> of <xsl:value-of select="$nearentityname"/>
</xsl:message>
</xsl:if>
</xsl:for-each>
}
foreach ( var item in changes.ToAdd) {
modified.Add(item);
<xsl:value-of select="concat( 'record.', @name)"/>.Add(item);
<xsl:for-each select="$entity//adl:property[@type='link' and @entity=$nearentityname]">
<xsl:value-of select="concat( 'item.', @name)"/>.Add( record);
<xsl:if test="position() != 1">
/* WARNING WARNING WARNING! Could not uniquely determine the far side property;
* redesign your application or manually maintain this code! */
<xsl:message terminate="no">
WARNING: Could not uniquely determine far end of link represented by property <xsl:value-of select="@name"/> of <xsl:value-of select="$nearentityname"/>
</xsl:message>
</xsl:if>
</xsl:for-each>
}
<xsl:if test="$authentication-layer = 'Database'">
} /* if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*"> InGroup( "<xsl:value-of select="./@name"/>") ||</xsl:for-each> false) */
</xsl:if>
</xsl:template>
<!-- locate and bind the specified child instances -->
<xsl:template match="adl:property[@type='list']" mode="bind">
<xsl:variable name="farentityname" select="@entity"/>
<xsl:variable name="entity" select="//adl:entity[@name=$farentityname]"/>
<xsl:variable name="farkey" select="$entity/adl:key/adl:property[position()=1]/@name"/>
<xsl:variable name="farkeybasetype">
<xsl:call-template name="base-type">
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="foreignkey">
<xsl:choose>
<xsl:when test="@farkey">
<xsl:value-of select="@farkey"/>
</xsl:when>
<xsl:otherwise>
<!-- If I haven't been told what the far side foreign key is, assume it has the
name of my entity -->
<xsl:value-of select="ancestor::adl:entity/@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="deletegroups">
<xsl:call-template name="entity-delete-groups">
<xsl:with-param name="entity" select="$entity"/>
</xsl:call-template>
</xsl:variable>
/* with a list we cannot just smash the old values! Instead we need to check
* each one and exclude it if no longer required; */
<xsl:if test="$authentication-layer = 'Database'">
if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">
InGroup( "<xsl:value-of select="./@name"/>") ||
</xsl:for-each> false) {
/* but once again only if we can delete and create entities at the far end. */
</xsl:if>
if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null)
{
string[] <xsl:value-of select="concat(@name, 'Values')"/> = Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>");
/* updating <xsl:value-of select="@name"/> child records; first remove any not on the submitted list */
foreach ( <xsl:value-of select="@entity"/> item in record.<xsl:value-of select="@name"/>)
{
String itemId = item.KeyString;
bool found = false;
foreach ( string index in <xsl:value-of select="concat(@name, 'Values')"/>)
{
if ( index.Equals( itemId))
{
found = true;
break;
}
} /* foreach ( string index... */
if ( ! found)
{
record.<xsl:value-of select="@name"/>.Remove( item);
modified.Add( item);
break;
}
} /* foreach ( <xsl:value-of select="@entity"/> item ... */
/* then add any on the included list which are not already members */
foreach ( string index in <xsl:value-of select="concat(@name, 'Values')"/>)
{
<xsl:value-of select="concat( $entityns, '.', @entity)"/> item =
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:call-template>
.UniqueResult&lt;<xsl:value-of select="concat( $entityns, '.', @entity)"/>&gt;();
if ( ! record.<xsl:value-of select="@name"/>.Contains( item))
{
/* check whether it's already a child of another <xsl:value-of select="ancestor::adl:entity/@name"/>
* and, if it is, remove it */
<xsl:value-of select="concat( $entityns, '.', ancestor::adl:entity/@name)"/> oldparent =
<xsl:value-of select="concat( 'item.', $foreignkey)"/>;
if ( oldparent != null) {
oldparent.<xsl:value-of select="@name"/>.Remove( item);
modified.Add( oldparent);
}
/* then add it to my <xsl:value-of select="@name"/> */
record.<xsl:value-of select="@name"/>.Add( item);
<xsl:value-of select="concat( 'item.', $foreignkey)"/> = record;
modified.Add( item);
}
} /* foreach ( string index... */
} /* if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null) */
<xsl:if test="$authentication-layer = 'Database'">
} /* if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">
InGroup( "<xsl:value-of select="./@name"/>") ||
</xsl:for-each> false) */
</xsl:if>
</xsl:template>
<!-- other properties don't need any special binding -->
<xsl:template match="adl:property" mode="bind"/>
<xsl:template match="adl:ifmissing">
"<xsl:value-of select="normalize-space(.)"/>"
</xsl:template>
@ -1269,7 +1292,15 @@
<xsl:when test="$basetype = 'string'">
<xsl:value-of select="$value"/>
</xsl:when>
<xsl:when test="$basetype = 'integer'">
<xsl:when test="$basetype = 'image'">
<!-- image and uplodable are essentially just comparisons of file names -->
<xsl:value-of select="$value"/>
</xsl:when>
<xsl:when test="$basetype = 'uploadable'">
<!-- image and uplodable are essentially just comparisons of file names -->
<xsl:value-of select="$value"/>
</xsl:when>
<xsl:when test="$basetype = 'integer'">
Int32.Parse( <xsl:value-of select="$value"/>)
</xsl:when>
<xsl:when test="$basetype = 'money'">

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns="http://libs.cygnets.co.uk/adl/1.4/"
xmlns:adl="http://libs.cygnets.co.uk/adl/1.4/"
xmlns="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:adl="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="UTF-8" method="xml" indent="yes" />

View file

@ -7,17 +7,17 @@
Transform ADL into C# entity classes
$Author: sb $
$Revision: 1.28 $
$Date: 2010-06-01 17:29:02 $
$Author: simon $
$Revision: 1.29 $
$Date: 2010-07-20 19:53:40 $
-->
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
Whitespace (or lack of it) is significant! -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsl="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:exsl="http://exslt.org/common"
xmlns:adl="http://libs.cygnets.co.uk/adl/1.4/"
xmlns:adl="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:include href="csharp-type-include.xslt"/>
@ -70,7 +70,7 @@
// (c)2007 Cygnet Solutions Ltd
//
// Automatically generated from application description using
// adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.28 $', 10)"/>
// adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.29 $', 10)"/>
//
// <xsl:value-of select="/adl:application/@revision"/>
//
@ -97,7 +97,7 @@
/// &lt;/summary&gt;
/// &lt;remarks&gt;
/// Automatically generated from description of group <xsl:value-of select="@name"/>
/// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.28 $', 10)"/>.
/// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.29 $', 10)"/>.
///
/// DO NOT EDIT THIS FILE!
/// &lt;/remarks&gt;
@ -123,7 +123,7 @@
// (c)2007 Cygnet Solutions Ltd
//
// Automatically generated from application description using
// adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.28 $', 10)"/>
// adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.29 $', 10)"/>
//
// <xsl:value-of select="/adl:application/@revision"/>
//
@ -159,7 +159,7 @@
/// &lt;/summary&gt;
/// &lt;remarks&gt;
/// Automatically generated from description of entity <xsl:value-of select="@name"/>
/// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.28 $', 10)"/>.
/// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.29 $', 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.
///

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns="urn:nhibernate-mapping-2.2"
xmlns:adl="http://libs.cygnets.co.uk/adl/1.4/"
xmlns:adl="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
Application Description Framework
@ -11,8 +11,8 @@
Transform ADL to Hibernate
$Author: sb $
$Revision: 1.10 $
$Author: simon $
$Revision: 1.11 $
-->
<xsl:param name="namespace"/>
@ -138,7 +138,7 @@
*
* <xsl:value-of select="@revision"/>
*
* Generated using adl2hibernate.xslt revision <xsl:value-of select="substring('$Revision: 1.10 $', 12)"/>
* Generated using adl2hibernate.xslt revision <xsl:value-of select="substring('$Revision: 1.11 $', 12)"/>
*
***************************************************************************
</xsl:comment>

View file

@ -11,8 +11,8 @@
Convert ADL to MS-SQL
$Author: sb $
$Revision: 1.20 $
$Author: simon $
$Revision: 1.21 $
-->
<xsl:output indent="no" encoding="UTF-8" method="text"/>
@ -112,7 +112,7 @@
-- <xsl:value-of select="$product-version"/>
--
-- Database for application <xsl:value-of select="@name"/> version <xsl:value-of select="@version"/>
-- Generated for MS-SQL 2000+ using adl2mssql.xslt <xsl:value-of select="substring('$Revision: 1.20 $', 12)"/>
-- Generated for MS-SQL 2000+ using adl2mssql.xslt <xsl:value-of select="substring('$Revision: 1.21 $', 12)"/>
-- THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT IT.
--
-- <xsl:value-of select="@revision"/>
@ -670,9 +670,26 @@
<xsl:call-template name="sql-type">
<xsl:with-param name="property" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="entity" select="@entity"/>
<xsl:variable name="defaulttype">
<xsl:call-template name="base-type">
<xsl:with-param name="property"
select="ancestor::adl:application/adl:entity[@name = $entity]/adl:key/adl:property[position() = 1]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="default">
<xsl:choose>
<xsl:when test="$defaulttype = 'string'">
'<xsl:value-of select="@default"/>'
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@default"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
"<xsl:value-of select="$column"/>" <xsl:value-of select="$type"/><xsl:if
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:if
test="string(@default)"> DEFAULT <xsl:value-of select="normalize-space($default)"/></xsl:if><xsl:if
test="@required='true'"> NOT NULL</xsl:if>
</xsl:template>
@ -789,6 +806,7 @@
<xsl:when test="$base-type = 'time'">DATETIME</xsl:when>
<!-- TODO: if the type was 'defined' then the size should probably come from the typedef -->
<xsl:when test="$base-type = 'string'">VARCHAR( <xsl:value-of select="$base-size"/>)</xsl:when>
<xsl:when test="$base-type = 'image'">VARCHAR( <xsl:value-of select="$base-size"/>)</xsl:when>
<xsl:when test="$base-type = 'text'">TEXT</xsl:when>
<xsl:when test="$base-type = 'boolean'">BIT</xsl:when>
<xsl:when test="$base-type = 'timestamp'">DATETIME</xsl:when>

View file

@ -1,5 +1,8 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:stylesheet version="1.0"
xmlns="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:adl="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- -->
<!-- adl2psql.xsl -->
@ -18,7 +21,7 @@
<!--
JACQUARD 2 APPLICATION DESCRIPTION LANGUAGE FRAMEWORK
$Revision: 1.2 $
$Revision: 1.3 $
NOTES:
@ -35,41 +38,137 @@
two removes (i.e. the 'distinguish' mechanism in ADL
-->
<xsl:output indent="no" encoding="UTF-8" method="text"/>
<xsl:include href="base-type-include.xslt"/>
<xsl:template match="application">
<!--
The convention to use for naming auto-generated abstract primary keys. Known values are
Id - the autogenerated primary key, if any, is called just 'Id'
Name - the autogenerated primary key has the same name as the entity
NameId - the name of the auto generated primary key is the name of the entity followed by 'Id'
Name_Id - the name of the auto generated primary key is the name of the entity followed by '_Id'
-->
<xsl:param name="abstract-key-name-convention" select="Id"/>
<!-- the convention to use for fieldnames in link tables:
Name - the name of the foreign key is the same as the name of the table linked to
NameId - the name of the foreign key is the same as the name of the table linked to, followed by 'Id'
Name_Id - the name of the foreign key is the same as the name of the table linked to, followed by '_Id'
Name_Link - the name of the foreign key is the same as the name of the table linked to, followed by '_Link'
-->
<xsl:param name="linktable-field-name-convention" select="Name"/>
<xsl:param name="database"/>
<!-- the name and version of the product being built -->
<xsl:param name="product-version" select="'Application Description Language Framework'"/>
<!-- define upper and lower case letters to enable case conversion -->
<xsl:variable name="ucase">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:variable name="lcase">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<!-- define SQL keywords to police these out of field names -->
<xsl:variable name="sqlkeywords-multiline">
ADD EXCEPT PERCENT
ALL EXEC PLAN
ALTER EXECUTE PRECISION
AND EXISTS PRIMARY
ANY EXIT PRINT
AS FETCH PROC
ASC FILE PROCEDURE
AUTHORIZATION FILLFACTOR PUBLIC
BACKUP FOR RAISERROR
BEGIN FOREIGN READ
BETWEEN FREETEXT READTEXT
BREAK FREETEXTTABLE RECONFIGURE
BROWSE FROM REFERENCES
BULK FULL REPLICATION
BY FUNCTION RESTORE
CASCADE GOTO RESTRICT
CASE GRANT RETURN
CHECK GROUP REVOKE
CHECKPOINT HAVING RIGHT
CLOSE HOLDLOCK ROLLBACK
CLUSTERED IDENTITY ROWCOUNT
COALESCE IDENTITY_INSERT ROWGUIDCOL
COLLATE IDENTITYCOL RULE
COLUMN IF SAVE
COMMIT IN SCHEMA
COMPUTE INDEX SELECT
CONSTRAINT INNER SESSION_USER
CONTAINS INSERT SET
CONTAINSTABLE INTERSECT SETUSER
CONTINUE INTO SHUTDOWN
CONVERT IS SOME
CREATE JOIN STATISTICS
CROSS KEY SYSTEM_USER
CURRENT KILL TABLE
CURRENT_DATE LEFT TEXTSIZE
CURRENT_TIME LIKE THEN
CURRENT_TIMESTAMP LINENO TO
CURRENT_USER LOAD TOP
CURSOR NATIONAL TRAN
DATABASE NOCHECK TRANSACTION
DBCC NONCLUSTERED TRIGGER
DEALLOCATE NOT TRUNCATE
DECLARE NULL TSEQUAL
DEFAULT NULLIF UNION
DELETE OF UNIQUE
DENY OFF UPDATE
DESC OFFSETS UPDATETEXT
DISK ON USE
DISTINCT OPEN USER
DISTRIBUTED OPENDATASOURCE VALUES
DOUBLE OPENQUERY VARYING
DROP OPENROWSET VIEW
DUMMY OPENXML WAITFOR
DUMP OPTION WHEN
ELSE OR WHERE
END ORDER WHILE
ERRLVL OUTER WITH
ESCAPE OVER WRITETEXT
</xsl:variable>
<xsl:variable name="sqlkeywords" select="concat(' ', normalize-space($sqlkeywords-multiline), ' ')"/>
<xsl:template match="adl:application">
-------------------------------------------------------------------------------------------------
--
-- Database for application <xsl:value-of select="@name"/> version <xsl:value-of select="@version"/>
-- Generated for PostgreSQL [7|8] using adl2psql.xsl $Revision: 1.2 $
-- <xsl:value-of select="$product-version"/>
--
-- Database for application <xsl:value-of select="@name"/> version <xsl:value-of select="@version"/>
-- Generated for PostgreSQL [7|8] using adl2psql.xsl $Revision: 1.3 $
--
-- <xsl:value-of select="@revision"/>
--
-- Code generator (c) 2006 Simon Brooke [simon@weft.co.uk]
-- http://www.weft.co.uk/library/jacquard/
--
-------------------------------------------------------------------------------------------------
<xsl:if test="string-length( $database) &gt; 0">
use "<xsl:value-of select="$database"/>";
</xsl:if>
-------------------------------------------------------------------------------------------------
-- authentication roles
-------------------------------------------------------------------------------------------------
<xsl:apply-templates select="group"/>
<xsl:apply-templates select="adl:group"/>
-------------------------------------------------------------------------------------------------
-- tables, views and permissions
-------------------------------------------------------------------------------------------------
<xsl:apply-templates select="entity"/>
<xsl:apply-templates select="adl:entity"/>
-------------------------------------------------------------------------------------------------
-- referential integrity constraints
-------------------------------------------------------------------------------------------------
<xsl:for-each select="entity">
<xsl:for-each select="adl:entity">
<xsl:variable name="nearside" select="@name"/>
<xsl:for-each select="property[@type='entity']">
<xsl:for-each select="adl:property[@type='entity']">
<xsl:call-template name="referentialintegrity">
<xsl:with-param name="nearside" select="$nearside"/>
</xsl:call-template>
</xsl:for-each>
<xsl:for-each select="property[@type='link']">
<xsl:for-each select="adl:property[@type='link']">
<xsl:call-template name="linkintegrity">
<xsl:with-param name="nearside" select="$nearside"/>
</xsl:call-template>
@ -81,7 +180,15 @@
-------------------------------------------------------------------------------------------------
</xsl:template>
<xsl:template match="group">
<xsl:template match="adl:documentation">
/* <xsl:apply-templates/> */
</xsl:template>
<xsl:template match="adl:group">
-------------------------------------------------------------------------------------------------
-- security group <xsl:value-of select="@name"/>
-------------------------------------------------------------------------------------------------
<xsl:apply-templates select="adl:documentation"/>
CREATE GROUP <xsl:value-of select="@name"/>;
</xsl:template>
@ -108,7 +215,7 @@
</xsl:template>
<xsl:template match="entity">
<xsl:template match="adl:entity">
<xsl:variable name="table" select="@name"/>
-------------------------------------------------------------------------------------------------
@ -116,12 +223,17 @@
-------------------------------------------------------------------------------------------------
CREATE TABLE <xsl:value-of select="@name"/>
(
<xsl:apply-templates select="property[@type!='link']"/>
<xsl:value-of select="@name"/>_id SERIAL NOT NULL PRIMARY KEY
<xsl:for-each select="descendant::adl:property[@type!='link']">
<xsl:apply-templates select="."/><xsl:choose>
<xsl:when test="position() = last()"/>
<xsl:otherwise>,<xsl:text>
</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
);
---- permissions ------------------------------------------------------------------------------
<xsl:for-each select="permission">
<xsl:for-each select="adl:permission">
<xsl:call-template name="permission">
<xsl:with-param name="table" select="$table"/>
</xsl:call-template>
@ -130,7 +242,7 @@
-- convenience view lv<xsl:value-of select="concat( '_', @name)"/> for lists
-------------------------------------------------------------------------------------------------
CREATE VIEW lv<xsl:value-of select="concat( '_', @name)"/> AS
SELECT <xsl:for-each select="property[@type!='link']">
SELECT <xsl:for-each select="adl:property[@type!='link']">
<xsl:choose>
<xsl:when test="@type='entity'">
<xsl:call-template name="distinctfield">
@ -147,10 +259,10 @@
</xsl:choose>
</xsl:for-each>
FROM <xsl:value-of select="@name"/>
<xsl:for-each select="property[@type='entity']">, <xsl:value-of select="@entity"/> AS <xsl:value-of select="@name"/></xsl:for-each>
<xsl:for-each select="adl:property[@type='entity']">, <xsl:value-of select="@entity"/> AS <xsl:value-of select="@name"/></xsl:for-each>
<xsl:text>
</xsl:text>
<xsl:for-each select="property[@type='entity']">
<xsl:for-each select="adl:property[@type='entity']">
<xsl:choose>
<xsl:when test="position() = 1">WHERE </xsl:when>
<xsl:otherwise>AND </xsl:otherwise>
@ -159,14 +271,14 @@
</xsl:for-each>;
---- permissions ------------------------------------------------------------------------------
<xsl:for-each select="permission">
<xsl:for-each select="adl:permission">
<xsl:call-template name="viewpermission">
<xsl:with-param name="table" select="$table"/>
</xsl:call-template>
</xsl:for-each>
<!-- link tables -->
<xsl:for-each select="property[@type='link']">
<xsl:for-each select="adl:property[@type='link']">
<xsl:call-template name="linktable">
<xsl:with-param name="nearside" select="$table"/>
</xsl:call-template>
@ -273,14 +385,13 @@
</xsl:template>
<xsl:template match="property[@type='entity']">
<xsl:template match="adl:property[@type='entity']">
<xsl:value-of select="@name"/> INT<xsl:if
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:if
test="@required='true'"> NOT NULL</xsl:if>,<xsl:text>
</xsl:text>
test="@required='true'"> NOT NULL</xsl:if>
</xsl:template>
<xsl:template match="property[@type='defined']">
<xsl:template match="adl:property[@type='defined']">
<xsl:variable name="name"><xsl:value-of select="@definition"/></xsl:variable>
<xsl:variable name="definitiontype"><xsl:value-of select="/application/definition[@name=$name]/@type"/></xsl:variable>
<xsl:value-of select="@name"/><xsl:text> </xsl:text><xsl:choose>
@ -290,37 +401,40 @@
<xsl:when test="$definitiontype='real'">DOUBLE PRECISION</xsl:when>
<xsl:otherwise><xsl:value-of select="$definitiontype"/></xsl:otherwise>
</xsl:choose><xsl:if
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:if
test="@required='true'"> NOT NULL</xsl:if>,<xsl:text>
</xsl:text>
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:choose>
<xsl:when test="parent::adl:key"> NOT NULL PRIMARY KEY</xsl:when>
<xsl:when test="@required='true'"> NOT NULL</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="property[@type='string']">
<xsl:template match="adl:property[@type='string']">
<xsl:value-of select="@name"/> VARCHAR( <xsl:value-of select="@size"/>)<xsl:if
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:if
test="@required='true'"> NOT NULL</xsl:if>,<xsl:text>
</xsl:text>
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:choose>
<xsl:when test="parent::adl:key"> NOT NULL PRIMARY KEY</xsl:when>
<xsl:when test="@required='true'"> NOT NULL</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="property[@type='integer']">
<xsl:template match="adl:property[@type='integer']">
<xsl:value-of select="@name"/> INT<xsl:if
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:if
test="@required='true'"> NOT NULL</xsl:if>,<xsl:text>
</xsl:text>
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:choose>
<xsl:when test="parent::adl:key"> NOT NULL PRIMARY KEY</xsl:when>
<xsl:when test="@required='true'"> NOT NULL</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="property[@type='real']">
<xsl:template match="adl:property[@type='real']">
<xsl:value-of select="@name"/> DOUBLE PRECISION<xsl:if
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:if
test="@required='true'"> NOT NULL</xsl:if>,<xsl:text>
</xsl:text>
test="@required='true'"> NOT NULL</xsl:if>
</xsl:template>
<xsl:template match="property">
<xsl:template match="adl:property">
<xsl:value-of select="@name"/> <xsl:text> </xsl:text><xsl:value-of select="@type"/><xsl:if
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:if
test="@required='true'"> NOT NULL</xsl:if>,<xsl:text>
</xsl:text>
test="string(@default)"> DEFAULT <xsl:value-of select="@default"/></xsl:if><xsl:choose>
<xsl:when test="parent::adl:key"> NOT NULL PRIMARY KEY</xsl:when>
<xsl:when test="@required='true'"> NOT NULL</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -14,9 +14,9 @@
Transform ADL into velocity view templates
$Author: sb $
$Revision: 1.65 $
$Date: 2010-01-12 17:20:17 $
$Author: simon $
$Revision: 1.66 $
$Date: 2010-07-20 19:53:40 $
-->
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
Whitespace (or lack of it) is significant! -->
@ -1488,6 +1488,15 @@
#end
</xsl:for-each>
</xsl:when>
<xsl:when test="$property/@type = 'image'">
#if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>)
<img class="thumbnail" alt="thumbnail">
<xsl:attribute name="src">
<xsl:value-of select="normalize-space(concat( '../Uploads/$', $entity/@name, '.', $property/@name))"/>
</xsl:attribute>
</img>
#end
</xsl:when>
<xsl:when test="$property/@type = 'date'">
#if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>)
<xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>.ToString( 'd')
@ -1543,7 +1552,7 @@
{
#if ( $instance)
#if ( ! $instance.IsNew)
<xsl:for-each select="$form/ancestor::adl:entity/adl:property[@type='link']">
<xsl:for-each select="$form/ancestor::adl:entity/adl:property[@type='link' or @type='list']">
<xsl:variable name="propname" select="@name"/>
<xsl:choose>
<xsl:when test="$form/@properties='all'">
@ -1771,7 +1780,7 @@
#end
</xsl:when>
<xsl:otherwise>
${<xsl:value-of select="concat( $property/ancestor::adl:entity/@name, 'FieldHelper', '.', $mode, '(')"/> "<xsl:value-of select="concat( 'instance.', $property/@name)"/>", "%{class='<xsl:value-of select="normalize-space($cssclass)"/>',required='<xsl:value-of select="normalize-space( $required)"/>',title='<xsl:value-of select="normalize-space($if-missing)"/>',size='<xsl:value-of select="normalize-space($size)"/>',maxlength='<xsl:value-of select="normalize-space($maxlength)"/>',rows='<xsl:value-of select="normalize-space($rows)"/>',cols='<xsl:value-of select="normalize-space($cols)"/>',href='<xsl:value-of select="normalize-space($href)"/>'}")}
${<xsl:value-of select="concat( $property/ancestor::adl:entity/@name, 'FieldHelper', '.', $mode, '(', '&quot;instance.', $property/@name, '&quot;')"/>, "%{class='<xsl:value-of select="normalize-space($cssclass)"/>',required='<xsl:value-of select="normalize-space( $required)"/>',title='<xsl:value-of select="normalize-space($if-missing)"/>',size='<xsl:value-of select="normalize-space($size)"/>',maxlength='<xsl:value-of select="normalize-space($maxlength)"/>',rows='<xsl:value-of select="normalize-space($rows)"/>',cols='<xsl:value-of select="normalize-space($cols)"/>',href='<xsl:value-of select="normalize-space($href)"/>',adltype='<xsl:value-of select="$property/@type"/>'}")}
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@ -1862,7 +1871,7 @@
Auto generated Velocity macro for <xsl:value-of select="@name"/>,
generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.65 $', 10)"/>
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.66 $', 10)"/>
Generation parameters were:
area-name: <xsl:value-of select="$area-name"/>
default-url: <xsl:value-of select="$default-url"/>

View file

@ -9,9 +9,9 @@
intended to keep lookup of the ADL base type from ADL properties in
one place for ease of maintenance
$Author: sb $
$Revision: 1.4 $
$Date: 2010-01-12 17:20:17 $
$Author: simon $
$Revision: 1.5 $
$Date: 2010-07-20 19:53:40 $
-->
<xsl:stylesheet version="1.0"

View file

@ -9,9 +9,9 @@
intended to keep lookup of the C# type from ADL properties in
one place for ease of maintenance
$Author: sb $
$Revision: 1.4 $
$Date: 2010-01-12 17:20:17 $
$Author: simon $
$Revision: 1.5 $
$Date: 2010-07-20 19:53:40 $
-->
<xsl:stylesheet version="1.0"
@ -77,6 +77,7 @@
<xsl:when test="$base-type = 'time'">DateTime</xsl:when>
<xsl:when test="$base-type = 'string'">String</xsl:when>
<xsl:when test="$base-type = 'text'">String</xsl:when>
<xsl:when test="$base-type = 'image'">String</xsl:when>
<xsl:when test="$base-type = 'boolean'">Boolean</xsl:when>
<xsl:when test="$base-type = 'timestamp'">DateTime</xsl:when>
<xsl:when test="$base-type = 'integer'">int</xsl:when>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://libs.cygnets.co.uk/adl/1.4/"
xmlns:adl="http://libs.cygnets.co.uk/adl/1.4/"
xmlns="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:adl="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
@ -21,9 +21,9 @@
(iii) take arguments which are strings only, not nodesets.
Templates are listed in alphabetical order.
$Author: sb $
$Revision: 1.7 $
$Date: 2010-01-12 17:20:17 $
$Author: simon $
$Revision: 1.8 $
$Date: 2010-07-20 19:53:40 $
-->
<xsl:template name="i18n-add-a-new">

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns="http://libs.cygnets.co.uk/adl/1.4/"
xmlns:adl="http://libs.cygnets.co.uk/adl/1.4/"
xmlns="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:adl="http://bowyer.journeyman.cc/adl/1.4/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:exsl="urn:schemas-microsoft-com:xslt"
@ -14,9 +14,9 @@
Utility templates to find permissions on various things
$Author: sb $
$Revision: 1.6 $
$Date: 2010-01-12 17:20:17 $
$Author: simon $
$Revision: 1.7 $
$Date: 2010-07-20 19:53:40 $
-->
<!-- collect all groups which can edit the specified property -->