diff --git a/.gitignore b/.gitignore index 7c45df2..4bbb548 100644 --- a/.gitignore +++ b/.gitignore @@ -415,3 +415,6 @@ FodyWeavers.xsd # .vscode .vscode +# Mocha CUP output directory +output + diff --git a/README.md b/README.md index be02bdd..7774849 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,22 @@ + + # mocha-dotnet Mocha Advanced Database Infrastructure for .NET Core \ No newline at end of file diff --git a/build b/build new file mode 100755 index 0000000..d104199 --- /dev/null +++ b/build @@ -0,0 +1,19 @@ +if [ ! -d output ]; then + + mkdir output + +fi + +dotnet build +if [ $? -eq 1 ]; then + exit 1 +fi + +ASSET_UIHTML_VERSION=2024.27.5 + +THEME_NAME=avondale + +for each in mocha-dotnet/src/assets/ui-html/css/common/*.less mocha-dotnet/src/assets/ui-html/css/$THEME_NAME/*.less; do cat $each; echo ""; done | lessc --plugin=less-plugin-clean-css=advanced - output/assets/ui-html/$ASSET_UIHTML_VERSION/css/mochaApp.css +cp mocha-dotnet/src/app/Mocha.ServerApplication/bin/Debug/net8.0/* output/ + +exit 0 diff --git a/cup b/cup new file mode 100755 index 0000000..e6293a6 --- /dev/null +++ b/cup @@ -0,0 +1,26 @@ +#!/bin/bash + +AUTO_REBUILD=1 + +# CONFIDENCE_LEVEL=Debug +# DOTNET_VERSION=8.0 +# APP_PATH=mocha-dotnet/src/app/Mocha.ServerApplication/bin/$CONFIDENCE_LEVEL/net$DOTNET_VERSION +APP_PATH=./output/ +APP_NAME=Mocha.ServerApplication + +if [ $AUTO_REBUILD -eq 1 ]; then + + # dotnet build + ./build + + if [ $? -eq 1 ]; then + + echo "There were build errors. Please fix the errors and re-run Mocha CUP." + exit + + fi + +fi + +$APP_PATH/$APP_NAME + diff --git a/framework-dotnet b/framework-dotnet index 8e41ff2..7a884cf 160000 --- a/framework-dotnet +++ b/framework-dotnet @@ -1 +1 @@ -Subproject commit 8e41ff2f82448dba81c97470f7b2cd191430fd52 +Subproject commit 7a884cfd214b4312304bb8c32e75102550740645 diff --git a/mocha-dotnet/src/app/Mocha.ServerApplication/AssetWebHandler.cs b/mocha-dotnet/src/app/Mocha.ServerApplication/AssetWebHandler.cs index 9d7c83f..1f6f352 100644 --- a/mocha-dotnet/src/app/Mocha.ServerApplication/AssetWebHandler.cs +++ b/mocha-dotnet/src/app/Mocha.ServerApplication/AssetWebHandler.cs @@ -1,7 +1,20 @@ -using System.Buffers.Text; -using System.Data.SqlTypes; -using System.Runtime.Intrinsics.X86; -using System.Text; +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using MBS.Web; namespace Mocha.ServerApplication; @@ -65,7 +78,7 @@ public class AssetWebHandler : WebHandler } string basepath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); - string filename = basepath + "/assets/" + assetName + "-" + assetVersion + "/" + assetPath; + string filename = basepath + "/assets/" + assetName + "/" + assetVersion + "/" + assetPath; byte[] data = new byte[0]; if (System.IO.File.Exists(filename)) diff --git a/mocha-dotnet/src/app/Mocha.ServerApplication/AttachmentWebHandler.cs b/mocha-dotnet/src/app/Mocha.ServerApplication/AttachmentWebHandler.cs index 0794269..1747e78 100644 --- a/mocha-dotnet/src/app/Mocha.ServerApplication/AttachmentWebHandler.cs +++ b/mocha-dotnet/src/app/Mocha.ServerApplication/AttachmentWebHandler.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using MBS.Core; using MBS.Web; diff --git a/mocha-dotnet/src/app/Mocha.ServerApplication/Mocha.ServerApplication.csproj b/mocha-dotnet/src/app/Mocha.ServerApplication/Mocha.ServerApplication.csproj index 1b19e8f..76cca44 100644 --- a/mocha-dotnet/src/app/Mocha.ServerApplication/Mocha.ServerApplication.csproj +++ b/mocha-dotnet/src/app/Mocha.ServerApplication/Mocha.ServerApplication.csproj @@ -1,4 +1,23 @@ - + + + diff --git a/mocha-dotnet/src/app/Mocha.ServerApplication/MochaWebApplication.cs b/mocha-dotnet/src/app/Mocha.ServerApplication/MochaWebApplication.cs index 1e6e267..5d6f6d6 100644 --- a/mocha-dotnet/src/app/Mocha.ServerApplication/MochaWebApplication.cs +++ b/mocha-dotnet/src/app/Mocha.ServerApplication/MochaWebApplication.cs @@ -1,21 +1,44 @@ -using System.Net; +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using System.Xml; using MBS.Core; using MBS.Web; using MBS.Web.UI; using MBS.Web.UI.WebControls; using Mocha.Core; +using Mocha.Core.OmsImplementations; using Mocha.Core.OmsImplementations.Mini; namespace Mocha.ServerApplication; +/// +/// Defines the base class for a Web application which provides +/// a Mocha User Interface Service with integrated Object Management +/// Server (OMS). +/// public abstract class MochaWebApplication : WebApplication { /// /// Gets the responsible for hosting data on the Mocha advanced database infrastructure. /// /// - public Oms Oms { get; } + public Oms? Oms { get; private set; } /// /// Gets or sets the name of the tenant which should be navigated to @@ -24,73 +47,157 @@ public abstract class MochaWebApplication : WebApplication /// public string DefaultTenantName { get; set; } = "super"; - public MochaWebApplication() + protected override void OnBeforeStartInternal(System.ComponentModel.CancelEventArgs e) { - Oms = new MiniOms(); - Oms.Initialize(); + base.OnBeforeStartInternal(e); + Oms = CreateOms(); Oms.BasePath = VirtualBasePath; - Oms.TenantName = "super"; + Oms.TenantName = DefaultTenantName; } - class LoginWebPage : WebPage + protected virtual Oms CreateOms() { - - protected override void InitializeInternal() + Oms oms = new MemoryOms(); + + TenantHandle super = oms.CreateTenant("super"); + oms.SelectTenant(super); + + oms.Initialize(); + return oms; + } + + class HomeWebPage : WebPage + { + protected override void OnInit(RenderEventArgs e) { - base.InitializeInternal(); - - MochaWebApplication app = ((MochaWebApplication)Application.Instance); - - InstanceHandle loginHeaderImage = app.Oms.GetInstance(new Guid("{c4f31b1a-aede-4e91-9fa0-511537f098a5}")); + base.OnInit(e); - StyleSheets.Add(WebStyleSheet.FromContent("text/css", @" - table.uwt-formview td.uwt-formview-item-label { padding-top: 10px; } - table.uwt-formview td.uwt-formview-item-content { padding-bottom: 8px; } + string tenantName = e.Context.Request.GetExtraData("TenantName"); + if (!e.Context.Session.ContainsKey(tenantName + ".UserToken")) + { + e.Context.Response.Redirect("~/" + e.Context.Request.PathVariables["tenant"] + "/d/login.htmld"); + } -body > form > div.uwt-panel -{ - margin-right: auto; - margin-left: auto; - width: 600px; - margin-top: 64px; -} - -body > form > div.uwt-panel > div.uwt-content > div:first-child -{ - background-image: url('" + app.Oms.GetAttachmentUrl(loginHeaderImage) + @"'); - background-repeat: no-repeat; - background-size: cover; - - height: 256px; - width: 256px; - margin-left: auto; - margin-right: auto; - - margin-top: 32px; - margin-bottom: 32px; -} -")); + Console.WriteLine("req app path: " + e.Context.Request.Path); } + protected override void CreateChildControls() { base.CreateChildControls(); + + Oms oms = (Oms)((MochaWebApplication)Application.Instance).Oms; + + InstanceHandle c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant); + InstanceHandle i_Tenant = oms.GetInstancesOf(c_Tenant).First(); + + string loginHeaderText = oms.GetTranslationValue(i_Tenant, oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_header__Translation)); + + Controls.Add(new Heading(1, loginHeaderText)); + Controls.Add(new Heading(3, "It works!")); + } + } + + class LoginWebPage : WebPage + { + protected override void InitializeInternal() + { + base.InitializeInternal(); + + MochaWebApplication app = ((MochaWebApplication)Application.Instance); + + InstanceHandle loginHeaderImage; + if (app.Oms.TryGetInstance(new Guid("{c4f31b1a-aede-4e91-9fa0-511537f098a5}"), out loginHeaderImage)) + { + StyleSheets.Add(WebStyleSheet.FromContent("text/css", @" +body > form > div.uwt-panel > div.uwt-content > div:first-child +{ + background-image: url('" + app.Oms.GetAttachmentUrl(loginHeaderImage) + @"'); + width: 256px; + height: 256px; + margin-left: auto; + margin-right: auto; + background-size: cover; +} +body > form > div.uwt-panel { + width: 600px; + margin-left: auto; + margin-right: auto; + margin-top: 128px; +} +h1 +{ +font-weight: lighter; +} +.uwt-copyright-text +{ + padding: 32px; + text-align: center; +} +")); + } + } + + protected override void OnInit(RenderEventArgs e) + { + base.OnInit(e); + + string tenantName = e.Context.Request.GetExtraData("TenantName"); + if (e.Context.Request.Form.ContainsKey("username") && e.Context.Request.Form.ContainsKey("password")) + { + if (e.Context.Request.Form["username"] == "mocha") + { + if (e.Context.Request.Form["password"] == "testing") + { + e.Context.Session[tenantName + ".UserToken"] = (new Guid()).ToString("b"); + e.Context.Response.Redirect(String.Format("~/{0}/d/home.htmld", tenantName)); + return; + } + } + litPasswordWarning.Visible = true; + } + } + + private Literal litPasswordWarning = null; + + protected override void CreateChildControls() + { + base.CreateChildControls(); + + Oms oms = (Oms)((MochaWebApplication)Application.Instance).Oms; + + InstanceHandle c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant); + InstanceHandle i_Tenant = oms.GetInstancesOf(c_Tenant).First(); + + string loginHeaderText = oms.GetTranslationValue(i_Tenant, oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_header__Translation)); + string loginFooterText = oms.GetTranslationValue(i_Tenant, oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_footer__Translation)); + Panel panel = new Panel(); panel.ContentControls.Add(new Container()); + panel.ContentControls.Add(new Heading(1, loginHeaderText)); panel.ContentControls.Add(new FormView(new FormView.FormViewItem[] { new FormView.FormViewItem("User _name", new TextBox() { Name = "username" }), new FormView.FormViewItem("_Password", new TextBox(TextBoxType.Password) { Name = "password" } ) })); - panel.FooterControls.Add(new Button("_Log In")); - Controls.Add(panel); - } - } + panel.ContentControls.Add(new Heading(3, loginFooterText)); - protected override void OnProcessRequest(WebServerProcessRequestEventArgs e) - { - base.OnProcessRequest(e); + litPasswordWarning = new Literal("

The user name or password is incorrect.

"); + litPasswordWarning.Visible = false; + panel.ContentControls.Add(litPasswordWarning); + + panel.FooterControls.Add(new Button("_Log In") { ThemeColorPreset = ThemeColorPreset.Primary, UseSubmitBehavior = true }); + Controls.Add(panel); + + Literal footer = new Literal(""); + Controls.Add(footer); + } + } + + protected override void OnProcessRequest(WebServerProcessRequestEventArgs e) + { + base.OnProcessRequest(e); MochaWebApplication app = ((MochaWebApplication)Application.Instance); @@ -119,6 +226,8 @@ body > form > div.uwt-panel > div.uwt-content > div:first-child } } + e.Context.Request.SetExtraData("TenantName", tenantName); + TenantHandle tenant = app.Oms.GetTenantByName(tenantName); if (tenant == TenantHandle.Empty) { @@ -140,25 +249,44 @@ body > form > div.uwt-panel > div.uwt-content > div:first-child e.Context.Response.Redirect("~/" + parts[1] + "/d/home.htmld"); e.Handled = true; } - } + } - protected override void OnServerCreated(WebServerCreatedEventArgs e) - { - base.OnServerCreated(e); + protected override void OnServerCreated(WebServerCreatedEventArgs e) + { + base.OnServerCreated(e); e.Server.UserAgent = "Mocha User Interface Service"; // set up the routes // e.Server.Routes.Add(new WebRoute("/{tenant}", new RedirectWebHandler("~/{tenant}/d/home.htmld"))); - e.Server.Routes.Add(new WebRoute("/{tenant}/d/home.htmld", new WebHandler(delegate(WebContext ctx) + + // FIXME: these routes should be loaded from the tenant; requires Mocha.Web.mcl + InstanceHandle c_Route = Oms.GetInstance(KnownInstanceGuids.Classes.Route); + IEnumerable routes = Oms.GetInstancesOf(c_Route); + if (routes.Count() > 0) { - Console.WriteLine("req app path: " + ctx.Request.Path); - ctx.Response.Redirect("~/" + ctx.Request.PathVariables["tenant"] + "/d/login.htmld"); - }))); - e.Server.Routes.Add(new WebRoute("/{tenant}/d/login.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/login.htmld"))); - e.Server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/login.htmld", new LoginWebPage())); - e.Server.Routes.Add(new WebRoute("/madi/asset/{name}/{version}/{path}", new AssetWebHandler())); - e.Server.Routes.Add(new WebRoute("/{tenant}/attachment/{iid}/{accesskey}", new AttachmentWebHandler())); - } + Console.WriteLine("cup: using tenanted WebRoutes"); + foreach (InstanceHandle route in routes) + { + + } + } + else + { + Console.WriteLine("cup: no tenanted WebRoutes found; using hardcoded ones for now"); + e.Server.Routes.Add(new WebRoute("/{tenant}/d/home.htmld", new HomeWebPage())); + e.Server.Routes.Add(new WebRoute("/{tenant}/d/login.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/login.htmld"))); + e.Server.Routes.Add(new WebRoute("/{tenant}/d/logout.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/logout.htmld"))); + e.Server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/login.htmld", new LoginWebPage())); + e.Server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/logout.htmld", new WebHandler(delegate (WebContext ctx) + { + ctx.Session.Clear(); + ctx.Response.Redirect("~/" + ctx.Request.PathVariables["tenant"]); + }))); + e.Server.Routes.Add(new WebRoute("/madi/asset/{name}/{version}/{path}", new AssetWebHandler())); + e.Server.Routes.Add(new WebRoute("/{tenant}/attachment/{iid}/{accesskey}", new AttachmentWebHandler())); + } + Console.WriteLine("Mocha User Interface Service started - http://localhost:{0}", DefaultPort); + } } \ No newline at end of file diff --git a/mocha-dotnet/src/app/Mocha.ServerApplication/Program.cs b/mocha-dotnet/src/app/Mocha.ServerApplication/Program.cs index 9ec1ca2..8b9cd21 100644 --- a/mocha-dotnet/src/app/Mocha.ServerApplication/Program.cs +++ b/mocha-dotnet/src/app/Mocha.ServerApplication/Program.cs @@ -1,6 +1,25 @@ -using System.Net; +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using System.Net; using MBS.Core; using MBS.Web; +using Mocha.Core; +using Mocha.Core.OmsImplementations.Mini; namespace Mocha.ServerApplication; @@ -8,12 +27,46 @@ public class Program : MochaWebApplication { protected override int DefaultPort => 10020; - public Program() + public Program() { ShortName = "mocha-server"; } - - public static int Main(string[] args) + + protected override Oms CreateOms() + { + // we can override this here to provide a different default OMS + MiniOms oms = new MiniOms(); + oms.Initialize(); + + TenantHandle t_super = oms.GetTenantByName("super"); + { + oms.SelectTenant(t_super); + InstanceHandle c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant); + InstanceHandle i_Tenant = oms.GetInstancesOf(c_Tenant).First(); + InstanceHandle i_English = oms.GetInstance(KnownInstanceGuids.Languages.English); + InstanceHandle r_Tenant__has_login_header__Translation = oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_header__Translation); + InstanceHandle r_Tenant__has_login_footer__Translation = oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_footer__Translation); + + oms.SetTranslationValue(i_Tenant, r_Tenant__has_login_header__Translation, i_English, "Welcome to your New Tenant"); + oms.SetTranslationValue(i_Tenant, r_Tenant__has_login_footer__Translation, i_English, "Please enter your user name and password to continue."); + } + + TenantHandle t_wdoms = oms.CreateTenant("wdoms"); + { + oms.SelectTenant(t_wdoms); + InstanceHandle c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant); + InstanceHandle i_Tenant = oms.GetInstancesOf(c_Tenant).First(); + InstanceHandle i_English = oms.GetInstance(KnownInstanceGuids.Languages.English); + InstanceHandle r_Tenant__has_login_header__Translation = oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_header__Translation); + InstanceHandle r_Tenant__has_login_footer__Translation = oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_footer__Translation); + + oms.SetTranslationValue(i_Tenant, r_Tenant__has_login_header__Translation, i_English, "OMS Tenant Manager"); + oms.SetTranslationValue(i_Tenant, r_Tenant__has_login_footer__Translation, i_English, "The default credentials are mocha / testing"); + } + return oms; + } + + public static int Main(string[] args) { return (new Program()).Start(); } diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-actionpreviewbutton.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-actionpreviewbutton.less new file mode 100644 index 0000000..19113f3 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-actionpreviewbutton.less @@ -0,0 +1,127 @@ +div.uwt-actionpreviewbutton +{ + + &.uwt-visible > a.apb-button + { + background-color: #129283 !important; + color: #fff !important; + + visibility: visible; + opacity: 1; + } + + &> a.apb-button + { + &:hover + { + background-color: @ThemeColor; + color: #fff !important; + } + + border: solid 1px @ThemeColor; + background-color: #fff; + color: @ThemeColor !important; + } + +} +div.apb-preview +{ + background: #fff; + border: solid 1px #ccc; + + &> a.uwt-button.uwt-button-close + { + right: 0px; + top: 0px; + border: solid 1px; + border-top: none; + border-top-left-radius: 0px; + border-top-right-radius: 0px; + color: #666; + background-color: #fff; + border-color: #ccc; + &:hover + { + background-color: @ThemeColor; + color: #fff; + } + } + &> div.apb-actions + { + background: #eeeeee; + border-right: solid 1px #ccc; + &> h2 + { + margin: 16px; + border-bottom: solid 1px #ccc; + } + &> ul.uwt-menu + { + &> li.uwt-menu-item-popup + { + &::after + { + content: "\f105"; + position: absolute; + right: 8px; + top: 10px; + font-family: FontAwesome; + color: #707478; + } + &> ul.uwt-menu + { + background-color: #fff; + border: solid 1px #ccc; + box-shadow: 2px 2px 4px #ccc; + } + &> a + { + color: #707478; + } + &:hover > a + { + background-color: #ddd; + } + } + } + + } + &> div.uwt-gripper + { + border-bottom: solid 1px #cccccc; + border-right: solid 1px #ccc; + border-left: solid 1px #ccc; + border-bottom-right-radius: 8px; + border-bottom-left-radius: 8px; + + &:hover + { + background-color: @ThemeColor; + &::after + { + color: #fff; + } + } + &::after + { + content: ". . . . . ."; + display: block; + text-align: center; + margin-top: -9px; + font-size: 14pt; + font-weight: bold; + color: #ccc; + } + } + &.uwt-dragging + { + &> div.uwt-gripper + { + background-color: darken(@ThemeColor, 5%); + &::after + { + color: #fff; + } + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-alert.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-alert.less new file mode 100644 index 0000000..9f32be2 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-alert.less @@ -0,0 +1,45 @@ +div.uwt-alert +{ + padding: .9375rem; + + &> div.uwt-title + { + font-weight: 300; + font-size: 24px; + margin-bottom: 16px; + } + + .AlertColor(@color) + { + border: solid 1px hsl(hue(@color), saturation(@color), lightness(@color) + 20); + background-color: hsl(hue(@color), saturation(@color), lightness(@color) + 40); + color: hsl(hue(@color), saturation(@color), lightness(@color) - 20); + } + .AlertColor2(@textColor, @backgroundColor, @borderColor) + { + border: solid 1px @borderColor; + background-color: @backgroundColor; + color: @textColor; + } + + &.uwt-color-primary + { + .AlertColor(@ThemeColorPrimary); + } + &.uwt-color-danger + { + .AlertColor2(#4d1b1a, #ffcecd, #ffcecd); + } + &.uwt-color-success + { + .AlertColor(@ThemeColorSuccess); + } + &.uwt-color-warning + { + .AlertColor(@ThemeColorWarning); + } + &.uwt-color-info + { + .AlertColor(@ThemeColorInfo); + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-applicationmenu.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-applicationmenu.less new file mode 100644 index 0000000..e90ba8e --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-applicationmenu.less @@ -0,0 +1,23 @@ +div.uwt-header > div.uwt-header-item.uwt-applicationmenu > div.uwt-button > button +{ + background-color: transparent; + + border: none; /* solid 1px @ThemeColor; */ + border-radius: 0px; + + color: @ThemeColor; + + padding: (@HeaderHeight / 4) + 1; + + &.Selected + { + background-color: @ThemeColor; + color: #FFFFFF; + } + &:hover + { + /* background-color: @ThemeColor; */ + color: #FFFFFF; + /* box-shadow: 0px 0px 4px @ThemeColor; */ + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-badge.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-badge.less new file mode 100644 index 0000000..3c003e7 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-badge.less @@ -0,0 +1,70 @@ +.uwt-badge +{ + padding: 3px 6px 4px; + font-size: 75%; + font-weight: 600; + + background-color: #e4e7ea; + color: #fff; + + text-align: center; + border-radius: 3px; + + &.uwt-color-danger + { + background-color: #ff5b57; + } + &.uwt-color-warning + { + background-color: #f59c1a; + } + &.uwt-color-yellow + { + color: #2d353c; + background-color: #ffd900; + } + &.uwt-color-lime + { + background-color: #90ca4b; + } + &.uwt-color-green + { + background-color: #32a932; + } + &.uwt-color-success + { + background-color: #00acac; + } + &.uwt-color-primary + { + background-color: #348fe2; + } + &.uwt-color-info + { + background-color: #49b6d6; + } + &.uwt-color-purple + { + background-color: #727cb6; + } + &.uwt-color-indigo + { + background-color: #8753de; + } + &.uwt-color-black + { + background-color: #2d353c; + } + &.uwt-color-pink + { + background-color: #fb5597; + } + &.uwt-color-secondary + { + background-color: #6c757d; + } + &.uwt-color-gray + { + background-color: #f2f3f4; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-blockquote.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-blockquote.less new file mode 100644 index 0000000..1f3b561 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-blockquote.less @@ -0,0 +1,47 @@ +blockquote +{ + border-left: solid 5px rgba(0, 0, 0, 0.08); + font-size: 17.5px; + margin: 0px 0px 20px; + padding: 20px; + &> p + { + margin: 0px 0px 10px; + } + &> small + { + color: rgba(0, 0, 0, 0.5); + display: block; + font-size: 80%; + line-height: 1.42857; + &::before + { + content: "— "; + } + } + + &.Success + { + background-color: #B0EBCA; + border-color: #4A8564; + color: #3C763D; + } + &.Information + { + background-color: #BEE2EF; + border-color: #587C89; + color: #31708F; + } + &.Warning + { + background-color: #FFF2E3; + border-color: #9D9080; + color: #8A6D3B; + } + &.Danger + { + background-color: #FBD1D1; + border-color: #986E6E; + color: #A94442; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-branding.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-branding.less new file mode 100644 index 0000000..95a7d30 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-branding.less @@ -0,0 +1,22 @@ +@ThemeColor: #009A9A; /* #00ACAC; */ + +@ThemeColorPrimary: #348FE2; +@ThemeColorSuccess: @ThemeColor; + +@ThemeColorPrimary: #348FE2; +// @ThemeColorSuccess: #00ACAC; + +@ThemeColorDanger: #FF5B57; +@ThemeColorInfo: #2BBCE0; +@ThemeColorWarning: #F59C1A; + +@ThemeColorRed: @ThemeColorDanger; +@ThemeColorBlue: @ThemeColorPrimary; +@ThemeColorPurple: #727CB6; +@ThemeColorOrange: #F59C1A; +@ThemeColorBlack: #242A30; /* #2D353C; */ + +@HeaderHeight: 64px; +@SidebarWidth: 220px; + +@PageBackgroundColor: #D9E0E7; \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-button.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-button.less new file mode 100644 index 0000000..bb1e2fd --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-button.less @@ -0,0 +1,121 @@ +@ButtonSelector: ~'a.uwt-button, button, input[type=button], input[type=submit], input[type=reset], div.uwt-button > a'; + +// ~'@{ButtonSelector}' +@{ButtonSelector} +{ + + .ButtonColor(@backcolor, @forecolor) + { + background-color: @backcolor; + border-color: @backcolor; + color: @forecolor; + &:hover + { + background-color: darken(@backcolor, 10%); + color: @forecolor; + } + + &:active + { + background-color: darken(@backcolor, 25%); + color: @forecolor; + } + } + + &.Large + { + font-size: 18px; + line-height: 1.33; + padding: 10px 16px; + } + + cursor: pointer; + border: solid 1px transparent; + + border-bottom: solid 2px transparent; + border-radius: 3px; + line-height: 1.42857; + font-size: 14px; + font-weight: 600; + padding: 6px 12px; + text-align: center; + text-decoration: none; + vertical-align: middle; + white-space: nowrap; + + transition: all 0.3s; + + .ButtonColor(#f1f3f4, #2d353c); + + &:hover + { + text-decoration: none; + } + + &:focus + { + border-bottom-color: #2d353c; + } + + &+ input[type=submit], &+ input[type=reset], &+ input[type=button], &+ a.uwt-button, &+ button + { + margin-left: 5px; + } + + &.uwt-color-gray + { + .ButtonColor(#b6c2c9, #fff); + } + &.uwt-color-purple + { + .ButtonColor(#727cb6, #fff); + } + &.uwt-color-indigo + { + .ButtonColor(#8753de, #fff); + } + &.uwt-color-primary + { + .ButtonColor(#348fe2, #fff); + } + &.uwt-color-info + { + .ButtonColor(#49b6d6, #fff); + } + &.uwt-color-yellow + { + .ButtonColor(#ffd900, #2d353c); + } + &.uwt-color-warning + { + .ButtonColor(#f59c1a, #fff); + } + &.uwt-color-pink + { + .ButtonColor(#fb5597, #fff); + } + &.uwt-color-danger + { + .ButtonColor(#ff5b57, #fff); + } + &.uwt-color-success + { + .ButtonColor(#00acac, #fff); + } + &.uwt-color-green + { + .ButtonColor(#32a932, #fff); + } + &.uwt-color-lime + { + .ButtonColor(#90ca4b, #fff); + } + &.uwt-color-inverse + { + .ButtonColor(#2d353c, #fff); + } + &.uwt-color-none + { + .ButtonColor(transparent, inherit); + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-checkbox.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-checkbox.less new file mode 100644 index 0000000..cca6aa2 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-checkbox.less @@ -0,0 +1,16 @@ +div.CheckBox +{ + background-color: #FFFFFF; + border: solid 1px #AAAAAA; + + &:hover, &.Hover, &.Checked + { + border-color: @ThemeColor; + } + + &.Checked + { + background-color: @ThemeColor; + color: #FFFFFF; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-countdown.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-countdown.less new file mode 100644 index 0000000..a9846c9 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-countdown.less @@ -0,0 +1,10 @@ +div.Countdown +{ + &> div.Segment + { + background-color: rgba(0, 0, 0, 0.5); + border: solid 1px @ThemeColor; + border-radius: 4px; + color: #FFFFFF; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-footer.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-footer.less new file mode 100644 index 0000000..88b2055 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-footer.less @@ -0,0 +1,9 @@ +body > div.uwt-footer, body > form > div.uwt-footer +{ + background-color: #242A30; + + color: #707478; + + box-shadow: 0px 100px 80px -80px rgba(0, 0, 0, 0.7) inset; + /* padding: 60px 16px; */ +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-formview.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-formview.less new file mode 100644 index 0000000..b513aaf --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-formview.less @@ -0,0 +1,16 @@ +div.FormView +{ + &> div.Field + { + &> label + { + color: @ThemeColorBlack; + text-align: right; + } + } + &> div.Field + { + /* fake margin-bottom for elements displayed as table-row */ + border-bottom: solid 16px transparent; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-header.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-header.less new file mode 100644 index 0000000..609280e --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-header.less @@ -0,0 +1,184 @@ +body +{ + &> div.uwt-header, &> form > div.uwt-header + { + background-color: #fff; + + &> div.uwt-header-item + { + &> input + { + background-color: #f2f3f4; + border-color: #f2f3f4; + color: #2d353c; + + &::placeholder + { + color: rgba(255,255,255,.5); + } + } + + &.uwt-searchbar + { + &::before + { + content: "\f002"; + display: inline-block; + + font-family: "FontAwesome"; + font-size: 0.75rem; + font-weight: 900; + + position: relative; + margin-left: -16px; + left: 28px; + top: 0; + } + &> input + { + border-radius: 30px; + border: 1px solid #d5dbe0; + + width: 220px; + transition: width 0.2s; + + padding-left: 32px; + + &:focus + { + border-color: #f2f3f4; + width: 300px; + + /* Remove the focus indicator on mouse-focus for browsers + that do support :focus-visible */ + outline: none; + } + } + + div.uwt-textbox-popup + { + &> div.uwt-dropdown-content > ul.uwt-menu > li > a + { + &> span + { + display: block; + padding-top: 4px; + padding-bottom: 4px; + } + &> span.uwt-title + { + font-weight: bold; + } + &> span.uwt-subtitle, &> span.uwt-content + { + font-size: small; + } + } + + background-color: #fff; + } + } + } + + margin-bottom: 20px; + height: @HeaderHeight; + + &> div.uwt-logo + { + color: #FFFFFF; + + font-size: 24px; + padding: (@HeaderHeight / 4); + + width: 128px; + + a + { + text-decoration: none; + color: inherit; + } + + span.Primary + { + color: @ThemeColor; + } + } + + &> ul.uwt-menu + { + position: absolute; + right: 24px; + + &> li + { + &> a + { + text-transform: uppercase; + font-size: 12px; + font-weight: 600; + line-height: 20px; + padding: 26px 16px; + } + &.uwt-selected + { + &> a + { + background-color: #00ACAC; + color: #ffffff; + } + &::after + { + border-bottom: 16px solid @PageBackgroundColor; + border-left: 16px solid rgba(0, 0, 0, 0); + border-radius: 0; + border-right: 16px solid rgba(0, 0, 0, 0); + content: ""; + display: block; + height: 0px; + margin-left: auto; + margin-right: auto; + position: relative; + top: -16px; + width: 0px; + } + } + } + } + } +} +body.uwt-header-inverse +{ + &> div.uwt-header, &> form > div.uwt-header + { + background-color: #1a2229; + + &> div.uwt-header-item + { + &::before + { + color: #fff; + } + &.uwt-searchbar + { + &> input + { + border-color: transparent; + } + div.uwt-textbox-popup + { + background-color: #1a2229; + } + } + &> input + { + background-color: rgba(255,255,255,.25); + color: #fff; + + &::placeholder + { + color: rgba(255,255,255,.5); + } + } + } + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-htmlheading.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-htmlheading.less new file mode 100644 index 0000000..5fe24cd --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-htmlheading.less @@ -0,0 +1,9 @@ +h1, h2, h3, h4, h5, h6 +{ + color: #242A30; + font-weight: 300; +} +h1 +{ + font-size: 36px; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-linkbutton.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-linkbutton.less new file mode 100644 index 0000000..6ede5a2 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-linkbutton.less @@ -0,0 +1,10 @@ +a +{ + color: @ThemeColor; + text-decoration: none; + &:hover + { + color: darken(@ThemeColor, 15%); + text-decoration: underline; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-listview.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-listview.less new file mode 100644 index 0000000..62e83bb --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-listview.less @@ -0,0 +1,134 @@ +@TableBorderColor: #E2E7EB; +@TableGridLineColor: #F5F5F5; + +@TableRowHoverBackgroundColor: @TableGridLineColor; +@TableRowHoverForegroundColor: #000000; + +@TableRowSelectedBackgroundColor: darken(@ThemeColor, 5%); /* #E2E7E9; */ +@TableRowSelectedForegroundColor: #FFFFFF; + +@TableRowSelectedHoverBackgroundColor: lighten(@TableRowSelectedBackgroundColor, 5%); +@TableRowSelectedHoverForegroundColor: @TableRowSelectedForegroundColor; + +table.uwt-listview +{ + background-color: #FFFFFF; + border-collapse: collapse; + + border: solid 1px #ced4da; + + &> thead, &> tbody + { + &> tr + { + &> th, &> td + { + border: solid 1px #cccccc; + } + &:hover + { + &> td + { + background-color: tint(@ThemeColor, 90%); + } + } + } + } + + &> thead + { + border-bottom: solid 2px; + border-bottom-color: @TableGridLineColor; + &> tr + { + &> th + { + border-bottom: solid 2px @TableBorderColor; + color: #242A30; + font-weight: 600; + a + { + color: inherit; + display: block; + text-align: left; + &:hover + { + text-decoration: none; + } + } + &[colspan] + { + font-weight: normal; + background-color: tint(@ThemeColor, 75%); + a + { + text-align: center; + } + } + } + } + } + &> tbody + { + &> tr:nth-of-type(2n+1) + { + background-color: #f2f4f5; + } + &> tr + { + border: solid 1px transparent; + &.uwt-selected + { + border-color: @ThemeColor; + &> td + { + background-color: fade(@ThemeColor, 25%); + } + } + } + } + + &> div.uwt-listview-column-headers > div.uwt-listview-column-header > a, + &> div.uwt-listviewItems > div.uwt-listviewItem > div.uwt-listviewItemColumn + { + padding: 10px 15px; + } + &> div.uwt-listviewItems > div.uwt-listviewItem + { + &.Selected + { + background-color: @TableRowSelectedBackgroundColor; + color: @TableRowSelectedForegroundColor; + } + } + &.HasBorder + { + border-color: @TableBorderColor; + } + &[data-mode="Detail"] + { + &.GridLines + { + &> div.uwt-listview-column-headers > div.uwt-listview-column-header, &> div.uwt-listviewItems > div.uwt-listviewItem > div.uwt-listviewItemColumn + { + border: solid 1px @TableGridLineColor; + } + } + } + &.uwt-hottracking + { + &> div.uwt-listview-items + { + &> div.uwt-listview-item:hover + { + background-color: @TableRowHoverBackgroundColor; + color: @TableRowHoverForegroundColor; + &.Selected + { + background-color: @TableRowSelectedHoverBackgroundColor; + color: @TableRowSelectedHoverForegroundColor; + } + } + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-mainpage.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-mainpage.less new file mode 100644 index 0000000..976d98f --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-mainpage.less @@ -0,0 +1,5 @@ +body.MainPage h1 +{ + font-size: 64px; + font-weight: 600; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-megamenu.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-megamenu.less new file mode 100644 index 0000000..ed021e6 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-megamenu.less @@ -0,0 +1,15 @@ +div.uwt-menu-large +{ + background-color: #ffffff; +} +body.uwt-header-inverse +{ + &> form > div.uwt-header, &> div.uwt-header + { + div.uwt-menu-large + { + background-color: #1a2229; + color: #A8ACB1; + } + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-menu.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-menu.less new file mode 100644 index 0000000..b5ea694 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-menu.less @@ -0,0 +1,105 @@ +ul.uwt-menu +{ + padding: 0px; + margin: 0px; + + &.Popup + { + background: #FFFFFF; + border: solid 1px @ThemeColor; + border-top: none; + box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); + } + + &> li:not(.uwt-section) + { + &> a + { + font-weight: normal; + padding: 8px 16px; + + &:not(:hover) > span.uwt-description + { + color: #aaaaaa; + } + } + &:not(.uwt-disabled) > a + { + &:hover + { + background-color: @ThemeColor; + color: #FFFFFF; + text-decoration: none; + } + } + + &.uwt-disabled > a + { + color: #666; + pointer-events: none; + cursor: not; + } + + &.Header + { + color: #6D7983; + font-size: 11px; + line-height: 20px; + margin: 0; + padding: 10px 20px; + } + &.HasChildren > a + { + &::after + { + content: ""; + font-family: "FontAwesome"; + + position: absolute; + + padding: 8px; + } + } + } + + &.uwt-orientation-vertical + { + &> li + { + display: block; + &.HasChildren + { + &> a + { + &::after + { + right: 0px; + top: 0px; + } + } + } + } + } + &.uwt-orientation-horizontal + { + display: inline-block; + &> li + { + display: inline-block; + &> a + { + color: #8F8E8E; + display: block; + + text-decoration: none; + transition: color linear 0.3s, background-color linear 0.3s; + + &:hover + { + background: none; + color: @ThemeColor; + } + } + } + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-page.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-page.less new file mode 100644 index 0000000..4665e37 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-page.less @@ -0,0 +1,17 @@ +div.uwt-page +{ + &> div.uwt-header + { + border-bottom: 1px solid #d5dbe0; + background: #ffffff; + } + &> div.uwt-footer + { + border-top: 1px solid #d5dbe0; + background: #ffffff; + } +} +body:not(.uwt-hide-header) > div.uwt-page, body:not(.uwt-hide-header) > form > div.uwt-page +{ + margin-top: 64px; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-panel.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-panel.less new file mode 100644 index 0000000..6b51541 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-panel.less @@ -0,0 +1,61 @@ +div.Panel +{ + background-color: #FFFFFF; + border-radius: 3px; + + &> div.Header, &> div.Content, &> div.Footer + { + padding: 10px 15px; + } + &> div.Header + { + background-color: #DDDDDD; + + border-top-left-radius: 3px; + border-top-right-radius: 3px; + + color: #333333; + + font-size: 12px; + font-weight: 500; + + line-height: 20px; + } + &> div.Footer + { + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + } + + &.Danger > div.Header + { + background-color: #CC4946; + } + &.Info > div.Header + { + background-color: #3A92AB; + } + &.Inverse > div.Header + { + background-color: #242A30; + } + &.Primary > div.Header + { + background-color: #2A72B5; + } + &.Success > div.Header + { + background-color: #008A8A; + } + &.Warning > div.Header + { + background-color: #C47D15; + } + &.Danger, &.Info, &.Inverse, &.Primary, &.Success, &.Warning + { + &> div.Header + { + color: #FFFFFF; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-popup.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-popup.less new file mode 100644 index 0000000..44beb90 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-popup.less @@ -0,0 +1,5 @@ +div.uwt-popup +{ + background-color: #ffffff; + box-shadow: 4px 4px 10px rgba(0,0,0,0.5); +} diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-sidebar.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-sidebar.less new file mode 100644 index 0000000..ab4977d --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-sidebar.less @@ -0,0 +1,115 @@ +body > div.uwt-sidebar, body > form > div.uwt-sidebar +{ + background: #2D353C; + + div.UserInfo + { + background-color: #1A2229; + padding: 20px; + + &> div.Icon + { + display: table-cell; + width: 56px; + } + &> div.Text + { + display: table-cell; + font-size: 14px; + + &> span.UserName, span.StatusText + { + display: block; + } + &> span.UserName + { + color: #FFFFFF; + } + &> span.StatusText + { + color: #889097; + font-size: 85%; + } + } + } + + ul.uwt-menu > li + { + &.uwt-section > a + { + color: #707478; + font-size: 85%; + letter-spacing: 2px; + text-transform: uppercase; + padding-top: 16px; + padding-bottom: 16px; + } + &> a + { + display: block; + line-height: 20px; + text-decoration: none; + &> i.fa + { + float: left; + font-size: 14px; + line-height: 20px; + margin-right: 16px; + text-align: center; + width: 14px; + } + } + &> ul.uwt-menu + { + background-color: #1A2229; + height: 0px; + transition: height linear 0.3s; + overflow: hidden; + padding: 0px; + &> li + { + &> a + { + color: #889097; + font-weight: 300; + padding: 5px 20px; + &:hover + { + color: #FFFFFF; + text-decoration: none; + } + } + } + } + &.uwt-opened > ul.uwt-menu + { + height: auto; + padding: 10px 0px 10px 30px; + } + } + + /* first child styles only */ + &> ul.uwt-menu > li + { + &.uwt-opened > a, > a:hover + { + background-color: #232A2F; + text-decoration: none; + } + &> a + { + padding: 8px 20px; + + color: #A8ACB1; + } + &.uwt-selected > a + { + background-color: @ThemeColor; + color: #FFFFFF + } + } + &> ul.uwt-menu > li.uwt-section > a + { + background-color: transparent; + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-slider.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-slider.less new file mode 100644 index 0000000..01b0ce8 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-slider.less @@ -0,0 +1,27 @@ +div.uwt-slider +{ + &.uwt-color-primary > div.uwt-slider-bar > div.uwt-slider-selection + { + background-color: #348fe2; + } + &.uwt-color-danger > div.uwt-slider-bar > div.uwt-slider-selection + { + background-color: #ff5b57; + } + &.uwt-color-teal > div.uwt-slider-bar > div.uwt-slider-selection + { + background-color: #00acac; + } + &.uwt-color-purple > div.uwt-slider-bar > div.uwt-slider-selection + { + background-color: #727cb6; + } + &.uwt-color-orange > div.uwt-slider-bar > div.uwt-slider-selection + { + background-color: #f59c1a; + } + &.uwt-color-black > div.uwt-slider-bar > div.uwt-slider-selection + { + background-color: #2d353c; + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-spinner.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-spinner.less new file mode 100644 index 0000000..c59a355 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-spinner.less @@ -0,0 +1,11 @@ +div.uwt-spinner +{ + border-color: #24b498 #ffffff #ffffff; + border-image: none; + border-radius: 100%; + border-right: solid 2px #ffffff; + border-style: solid; + border-width: 2px; + height: 40px; + width: 40px; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-tabcontainer.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-tabcontainer.less new file mode 100644 index 0000000..a0620f9 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-tabcontainer.less @@ -0,0 +1,37 @@ +div.uwt-tabcontainer +{ + &> ul.uwt-tabcontainer-tabs + { + background-color: #C1CCD1; + &> li + { + &> a + { + color: #6E7179; + font-size: 12px; + padding: 10px 16px; + + &:hover + { + background-color: #FAFAFA; + color: #333333; + } + } + + &.uwt-selected > a + { + background-color: #FFFFFF; + color: #242A30; + } + } + } + + &> div.uwt-tabcontainer-tabpages + { + background-color: #FFFFFF; + &> div.uwt-tabpage + { + padding: 16px; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-textbox.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-textbox.less new file mode 100644 index 0000000..f9ff985 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-textbox.less @@ -0,0 +1,28 @@ +input[type=text], input[type=password], textarea +{ + border: solid 1px #CCD0D4; + border-radius: 3px; + box-shadow: none; + + font: inherit; + font-size: 12px; + + line-height: 1.42857; + padding: 6px 12px; + transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s; + &:hover, &:focus + { + border-color: @ThemeColor; + } + &:focus + { + box-shadow: 0px 0px 4px #00ACAC; + } + &::placeholder + { + color: #6c757d; + opacity: 1; + } + + .UwtColors(); +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-tile.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-tile.less new file mode 100644 index 0000000..56aa6e6 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-tile.less @@ -0,0 +1,24 @@ + +div.uwt-tile +{ + &> div.uwt-footer + { + &> a + { + display: block; + background-color: rgba(0,0,0,.4); + margin: none; + + &:hover + { + background-color: rgba(0,0,0,.6); + } + } + } + + &.uwt-color-alizarin, &.uwt-color-danger, &.uwt-color-red + { + background-color: #ff5b57; + color: #fff; + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-toggle.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-toggle.less new file mode 100644 index 0000000..4a37f15 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-toggle.less @@ -0,0 +1,107 @@ +@ToggleSwitchAnimationLength: 150ms; /* 250ms; */ +@ToggleSwitchSize: 50px; +@ToggleSwitchThumbSize: 30px; + +.ToggleSwitchColors(@color) +{ + &.Checked + { + background-color: @color; + border-color: @color; + box-shadow: 0 0 0 16px @color inset; + } +} + +div.ToggleSwitch +{ + position: relative; + width: @ToggleSwitchSize; + + &[disabled] + { + opacity: 0.5; + } + + .ToggleSwitchColors(@ThemeColor); + &.Primary + { + .ToggleSwitchColors(@ThemeColorPrimary); + } + &.Success + { + .ToggleSwitchColors(@ThemeColorSuccess); + } + &.Danger + { + .ToggleSwitchColors(@ThemeColorDanger); + } + &.Info + { + .ToggleSwitchColors(@ThemeColorInfo); + } + &.Warning + { + .ToggleSwitchColors(@ThemeColorWarning); + } + &.Red + { + .ToggleSwitchColors(@ThemeColorRed); + } + &.Blue + { + .ToggleSwitchColors(@ThemeColorBlue); + } + &.Purple + { + .ToggleSwitchColors(@ThemeColorPurple); + } + &.Orange + { + .ToggleSwitchColors(@ThemeColorOrange); + } + &.Black + { + .ToggleSwitchColors(@ThemeColorBlack); + } + + &.Checked + { + &> div.ToggleSwitchInner > div.ToggleThumb + { + margin-left: (@ToggleSwitchSize - @ToggleSwitchThumbSize); + } + } + &:not(.Checked) + { + background-color: #FFFFFF; + border-color: #DFDFDF; + box-shadow: 0 0 0 0 #DFDFDF inset; + &> div.ToggleSwitchInner > div.ToggleThumb + { + margin-left: 0px; + } + } + &> div.ToggleSwitchInner > div.ToggleThumb + { + transition: margin-left @ToggleSwitchAnimationLength ease-in 0s; + } + + transition: border 0.5s ease 0s, box-shadow 0.5s ease 0s, background-color 1.5s ease 0s; + + border-radius: 20px; + cursor: pointer; + height: 30px; + + div.ToggleOn, div.ToggleOff + { + display: none; + } + div.ToggleThumb + { + background: none repeat scroll 0 0 #FFFFFF; + border-radius: 100%; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); + height: @ToggleSwitchThumbSize; + width: @ToggleSwitchThumbSize; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-trackbar.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-trackbar.less new file mode 100644 index 0000000..321c2db --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-trackbar.less @@ -0,0 +1,130 @@ +@ThumbSize: 30px; +@TrackSize: 8px; +@ThumbOffset: ((@ThumbSize - @TrackSize) / 2); + +div.uwt-trackbar +{ + margin-bottom: 10px; + padding: 16px 30px; + + &> div.uwt-trackbar-track + { + background-color: #A9ACB1; + border-radius: 16px; + + &> div.uwt-trackbar-track-quantity + { + background-color: #017AFD; + border-radius: 15px; + } + &> div.uwt-trackbar-track-thumb + { + background-color: #FFFFFF; + border-radius: 100%; + box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4); + cursor: move; + height: @ThumbSize; + width: @ThumbSize; + } + } + + &.uwt-orientation-horizontal + { + &> div.uwt-trackbar-track + { + height: @TrackSize; + &> div.uwt-trackbar-track-uantity + { + /* transition: width linear 0.1s; */ + } + &> div.uwt-trackbar-track-thumb + { + top: -@ThumbOffset; + /* transition: left linear 0.1s; */ + } + } + } + &.uwt-orientation-vertical + { + &> div.uwt-trackbar-track + { + width: @TrackSize; + &> div.uwt-trackbar-track-quantity + { + /* transition: height linear 0.1s; */ + } + &> div.uwt-trackbar-track-thumb + { + left: -@ThumbOffset; + /* transition: top linear 0.1s; */ + } + } + } + + &> div.uwt-trackbar-track + { + &> div.uwt-trackbar-track-quantity + { + background-color: @ThemeColor; + } + &> div.uwt-trackbar-track-thumb + { + color: @ThemeColor; + } + } + &.uwt-color-red > div.uwt-trackbar-track + { + &> div.uwt-trackbar-track-quantity + { + background-color: @ThemeColorRed; + } + &> div.uwt-trackbar-track-thumb + { + color: @ThemeColorRed; + } + } + &.uwt-color-blue > div.uwt-trackbar-track + { + &> div.uwt-trackbar-track-quantity + { + background-color: @ThemeColorBlue; + } + &> div.uwt-trackbar-track-thumb + { + color: @ThemeColorBlue; + } + } + &.uwt-color-purple > div.uwt-trackbar-track + { + &> div.uwt-trackbar-track-quantity + { + background-color: @ThemeColorPurple; + } + &> div.uwt-trackbar-track-thumb + { + color: @ThemeColorPurple; + } + } + &.uwt-color-orange > div.uwt-trackbar-track + { + &> div.uwt-trackbar-track-quantity + { + background-color: @ThemeColorOrange; + } + &> div.uwt-trackbar-track-thumb + { + color: @ThemeColorOrange; + } + } + &.uwt-color-black > div.uwt-trackbar-track + { + &> div.uwt-trackbar-track-quantity + { + background-color: @ThemeColorBlack; + } + &> div.uwt-trackbar-track-thumb + { + color: @ThemeColorBlack; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-window.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-window.less new file mode 100644 index 0000000..4be7596 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-window.less @@ -0,0 +1,35 @@ +div.uwt-window +{ + background-color: #FFFFFF; + + &> div.uwt-header, &> div.uwt-content, &> div.uwt-footer + { + padding: 16px; + } + &> div.uwt-header + { + border-bottom: solid 1px #E2E7EB; + color: #242A30; + font-size: 18px; + font-weight: 500; + } + &> div.uwt-footer + { + border-top: solid 1px #E2E7EB; + } + &> div.uwt-content + { + &> div.uwt-loading + { + background-color: rgba(255, 255, 255, 0.8); + } + } + + transition: visibility linear 0.3s, opacity linear 0.3s, transform linear 0.3s; + transform-origin: center center; + transform: scale(0.0) scaleX(-2.0); + &.uwt-visible + { + transform: scale(1.0) scaleX(1.0); + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-wizard.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-wizard.less new file mode 100644 index 0000000..13cd705 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt-wizard.less @@ -0,0 +1,77 @@ +div.uwt-wizard +{ + ol + { + background-color: #F0F3F4; + li + { + cursor: pointer; + font-size: 14px; + line-height: 20px; + padding: 16px; + + span.uwt-title, span.uwt-description + { + display: block; + margin-left: 30px; + } + span.uwt-title + { + color: #333333; + } + span.uwt-description + { + color: #999999; + font-size: 85%; + } + span.uwt-wizard-page-number + { + background-color: #6D7479; + color: #FFFFFF; + + border-radius: 50%; + float: left; + height: 20px; + line-height: 20px; + margin-right: 10px; + padding: 0; + text-align: center; + top: 0; + width: 20px; + + font-size: 75%; + font-weight: 600; + } + + &:hover + { + background-color: #D3DADF; + } + &.uwt-selected + { + background-color: @ThemeColor; + cursor: default; + + span.uwt-title + { + color: #FFFFFF; + } + span.uwt-description + { + color: rgba(255, 255, 255, 0.6); + } + } + } + } + div.uwt-wizard-pages + { + margin: 10px 0px -10px; + padding: 16px; + div.uwt-wizard-page + { + border: solid 1px #E3E3E3; + border-radius: 4px; + min-height: 20px; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/avondale/uwt.less b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt.less new file mode 100644 index 0000000..bd2872e --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/avondale/uwt.less @@ -0,0 +1,67 @@ +@import "Fonts/SourceSansPro/SourceSansPro.css"; + +body +{ + background-color: @PageBackgroundColor; + color: #333; + font-family: "Source Sans Pro", "Segoe UI", "Droid Sans", "Tahoma", "Arial", sans-serif; + /* font-size: 14px; */ + font-size: 16px; + + margin: 0px; + + &.Loading + { + background: @PageBackgroundColor !important; + } + + overflow: auto; +} +body > div.Content +{ + padding: 24px; +} + +::selection +{ + background-color: @ThemeColor; + color: #FFFFFF; +} +::-moz-selection +{ + background-color: @ThemeColor; + color: #FFFFFF; +} + +@ThemeColorPrimaryLight: #cce3f8; +@ThemeColorPrimary: #348fe2; + +@ThemeColorInfoLight: #d2edf5; +@ThemeColorInfo: #49b6d6; + +@ThemeColorPurpleLight: #dcdeed; +@ThemeColorPurple: #727cb6; + +@ThemeColorIndigoLight: #e1d4f7; +@ThemeColorIndigo: #8753de; + +@ThemeColorSuccessLight: #bfeaea; +@ThemeColorSuccess: #00acac; + +@ThemeColorGreenLight: #cceacc; +@ThemeColorGreen: #32a932; + +@ThemeColorLimeLight: #e3f2d2; +@ThemeColorLime: #90ca4b; + +@ThemeColorWarningLight: #fde6c6; +@ThemeColorWarning: #f59c1a; + +@ThemeColorYellowLight: #fff6bf; +@ThemeColorYellow: #ffd900; + +@ThemeColorDangerLight: #ffd6d5; +@ThemeColorDanger: #ff5b57; + +@ThemeColorPinkLight: #fed5e5; +@ThemeColorPink: #fb5597; \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-actionpreviewbutton.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-actionpreviewbutton.less new file mode 100644 index 0000000..1b4c905 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-actionpreviewbutton.less @@ -0,0 +1,152 @@ +@ActionPreviewButton_ActionMenu_Width: 180px; + +div.uwt-actionpreviewbutton +{ + display: inline-block; + position: relative; + white-space: nowrap; + + &> a.apb-button + { + opacity: 0; + visibility: hidden; + + display: inline-block; + padding: 0px 2px 0px 6px; + border-radius: 4px; + + margin-left: 8px; + padding-right: 6px; + + &::before + { + content: "..."; + font-family: inherit; + font-weight: bold; + } + } + &:hover + { + &> a.apb-button + { + opacity: 1; + visibility: visible; + &:hover + { + text-decoration: none; + } + } + } + &.uwt-visible > div.apb-preview + { + visibility: visible; + opacity: 1; + } + + &> div.apb-preview + { + display: flex; + visibility: hidden; + opacity: 0; + + float: right; + padding: 8px; + margin-left: 8px; + position: absolute; + + width: max-content; + + &> a.uwt-button.uwt-button-close + { + display: none; + position: absolute; + right: 8px; + top: 8px; + width: 8px; + height: 8px; + padding: 8px; + min-width: unset; + min-height: unset; + &::after + { + content: "\f00d"; + font-family: "FontAwesome"; + position: absolute; + top: 2px; + left: 6px; + } + } + &.uwt-detached + { + &> a.uwt-button.uwt-button-close + { + display: inline-block; + } + visibility: visible; + opacity: 1; + position: fixed; + } + + &> div.uwt-gripper + { + position: absolute; + top: 0px; + width: 64px; + height: 16px; + left: 50%; + } + + &.uwt-loading > div.apb-content, &.uwt-loading > div.apb-actions + { + display: none; + } + &:not(.uwt-loading) > div.uwt-spinner + { + display: none; + } + + &> div.apb-actions + { + margin: -8px; + margin-right: 16px; + + &> h2 + { + cursor: default; + } + &> ul.uwt-menu + { + width: @ActionPreviewButton_ActionMenu_Width; + &> li.uwt-menu-item-popup + { + position: relative; + &> ul.uwt-menu + { + display: none; + position: absolute; + left: @ActionPreviewButton_ActionMenu_Width; + top: 0px; + width: max-content; + z-index: 1; + } + &:hover > ul.uwt-menu + { + display: block; + } + } + } + /* + &> div.apb-preview + { + visibility: hidden; + opacity: 0; + + float: right; + padding: 8px; + margin-left: 8px; + position: absolute; + } + */ + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-alert.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-alert.less new file mode 100644 index 0000000..d494b47 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-alert.less @@ -0,0 +1,9 @@ +body > div.uwt-alert-container +{ + position: fixed; + right: 32px; + top: 32px; + + min-width: 320px; + z-index: 100; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-applicationmenu.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-applicationmenu.less new file mode 100644 index 0000000..77caac8 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-applicationmenu.less @@ -0,0 +1,29 @@ +div.uwt-applicationmenu +{ + &> div.uwt-button + { + &> button.uwt-button-dropdownbutton + { + border: none; + background: none; + padding: 13px 20px; + display: inline-block; + + font-size: 18pt; + color: #fff; + + &::before + { + content: "\f0c9"; + font-family: FontAwesome; + color: #4E5155; + } + } + &> div.uwt-popup + { + /* for some reason there's a weird gap between the button and the dropdown */ + /* margin-top: -4px; */ + margin-top: -10px; + } + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-badge.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-badge.less new file mode 100644 index 0000000..99b69f6 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-badge.less @@ -0,0 +1,14 @@ +div.uwt-badge +{ + cursor: default; + -moz-user-select: none; + + border-radius: 8px; + display: inline-block; + + margin: -8px; + + padding: 8px; + padding-left: 24px; + padding-right: 24px; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-button-group.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-button-group.less new file mode 100644 index 0000000..321a187 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-button-group.less @@ -0,0 +1,42 @@ +div.uwt-button-group +{ + &> div.uwt-button + { + cursor: default; + + &> a + { + display: block; + padding: 16px; + &> span + { + display: block; + &.uwt-title + { + padding-bottom: 8px; + } + } + } + } + + &.uwt-orientation-horizontal + { + &> div.uwt-button + { + display: inline-block; + margin-right: 16px; + } + } + &.uwt-orientation-vertical + { + + display: flex; + flex-direction: column; + + &> a.uwt-button, input[type=submit], input[type=reset], input[type=button], button, div.uwt-button > a + { + text-align: left; + margin-bottom: 8px; + } + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-button.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-button.less new file mode 100644 index 0000000..6856fec --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-button.less @@ -0,0 +1,74 @@ +@ButtonSelector: ~'a.uwt-button, button, input[type=button], input[type=submit], input[type=reset], div.uwt-button > a'; + +// ~'@{ButtonSelector}' +@{ButtonSelector} +{ + display: inline-block; + font-weight: 400; + text-align: center; + vertical-align: middle; + + .user-select(none); + + background-color: transparent; + border: 1px solid transparent; + padding: .438rem 1.125rem; + font-size: .894rem; + line-height: 1.54; + + min-width: 80px; + + + margin-right: 6px; + +} +div.uwt-button-group +{ + // (~'@{ButtonSelector}') + @{ButtonSelector} + { + margin-right: 0px; + } +} + +div.uwt-button +{ + + display: inline-block; + + &> button.uwt-button-dropdownbutton + { + display: none; + } + &.uwt-button-hasdropdown + { + &> button.uwt-button-dropdownbutton + { + padding-left: 8px; + padding-right: 8px; + display: inline-block; + &::before + { + content: "⏷"; + display: block; + } + } + + &.uwt-button-requiredropdown > input:nth-child(1), &.uwt-button-requiredropdown > a:nth-child(1) + { + display: none; + } + &:not(.uwt-button-requiredropdown) + { + /* split dropdown button styles */ + &> input:first-child + { + border-right: none; + } + &> input.uwt-button-dropdownbutton + { + border-left: none; + } + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-calendar.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-calendar.less new file mode 100644 index 0000000..6b7468c --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-calendar.less @@ -0,0 +1,27 @@ +div.uwt-calendar +{ + &> table + { + &> thead + { + } + &> tbody + { + &> tr + { + &> td + { + &> a + { + display: inline-block; + text-align: center; + + line-height: 2rem; + width: 2rem; + height: 2rem; + } + } + } + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-checkbox.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-checkbox.less new file mode 100644 index 0000000..d674674 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-checkbox.less @@ -0,0 +1,32 @@ +div.uwt-checkbox +{ + transition: all 0.3s; + &> i.fa-check + { + margin-left: 4px; + transition: all 0.3s; + } + &:not(.uwt-checked) + { + &> i.fa-check + { + opacity: 0; + } + } + + border: solid 1px #24abf2; + display: inline-block; + width: 22px; + height: 22px; + border-radius: 4px; + color: #ffffff; + &:focus-within + { + box-shadow: 0px 0px 4px #24abf2; + } + &.uwt-checked + { + background-color: #24abf2; + color: #ffffff; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-column.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-column.less new file mode 100644 index 0000000..69d2773 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-column.less @@ -0,0 +1,72 @@ +div.uwt-columns +{ + display: flex; + box-sizing: border-box; + margin-bottom: 20px; + min-height: 1px; + position: relative; + width: 100%; +} +div.uwt-columns > div.uwt-column-row +{ + box-sizing: border-box; +} +div.uwt-columns > div.uwt-column-row +{ + display: flex; +} +div.uwt-columns > div.uwt-column-section +{ + display: flex; + flex-grow: 1; + + &> div.uwt-column + { + flex-grow: 1; + } +} + +@media (max-width: 1000px) +{ + div.uwt-columns + { + flex-direction: column; + } +} + +@media (min-width: 768px) +{ + div.uwt-columns > div.uwt-column-row > div.uwt-column.uwt-column-4 + { + width: 50%; + } +} +@media (min-width: 992px) +{ + div.uwt-columns > div.uwt-column-row > div.uwt-column.uwt-column-4 + { + flex: 0 1 25%; + max-width: 25%; + } +} + +.uwt-column.uwt-column-1 +{ + flex: 0 1 100%; + max-width: 100%; +} +.uwt-column.uwt-column-2 +{ + flex: 0 1 50%; + max-width: 50%; +} +.uwt-column.uwt-column-3 +{ + flex: 0 1 33.333333%; + max-width: 33.333333%; +} +.uwt-column.uwt-column-8 +{ + flex: 0 1 66.666667%; + max-width: 66.666667%; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-dialog.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-dialog.less new file mode 100644 index 0000000..35f030e --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-dialog.less @@ -0,0 +1,90 @@ +div.uwt-dialog-background +{ + position: fixed; + left: 0px; + top: 0px; + right: 0px; + bottom: 0px; + + background-color: rgba(0, 0, 0, 0.8); + + transition: all 0.3s; + &:not(.uwt-visible) + { + opacity: 0; + visibility: hidden; + } + z-index: 10000; +} +div.uwt-dialog +{ + max-width: 35rem; + margin: 1.75rem auto; + z-index: 10001; + position: relative; + top: 0px; + + transition: all 0.3s; + &:not(.uwt-visible) + { + opacity: 0; + visibility: hidden; + } + + &> div.uwt-header + { + padding: 1.25rem 1.5625rem; + + &> div.uwt-dialog-title, &> div.uwt-dialog-controlbox + { + } + &> div.uwt-dialog-title + { + font-size: 1rem; + } + &> div.uwt-dialog-controlbox + { + position: absolute; + right: 24px; + top: 15px; + &> a.uwt-dialog-controlbox-close + { + font-size: 1.341rem; + font-weight: 300; + } + } + } + &> div.uwt-content + { + padding: 1.5625rem; + } + &> div.uwt-footer + { + display: flex; + justify-content: flex-end; + + padding: 1.25rem 1.5625rem; + + &> :not(:first-child) + { + margin-left: .25rem; + } + &> :not(:last-child) + { + margin-right: .25rem; + } + } +} +@media (max-width: 600px) +{ + div.uwt-dialog + { + position: fixed; + top: 0px; + right: 0px; + left: 0px; + bottom: 0px; + margin: 0px; + max-width: none; + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-expand.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-expand.less new file mode 100644 index 0000000..71f3d2f --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-expand.less @@ -0,0 +1,5 @@ +.uwt-expand +{ + box-sizing: border-box; + width: 100%; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-footer.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-footer.less new file mode 100644 index 0000000..629b86b --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-footer.less @@ -0,0 +1,18 @@ +body > div.uwt-footer, body > form > div.uwt-footer +{ + padding: 16px; + z-index: 100; +} + +@media (max-width: 999px) +{ + /* TABLET styles */ + body > div.uwt-footer, body > form > div.uwt-footer + { + left: 0px; + /* + background-color: #111111; + padding: 16px; + */ + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-formview.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-formview.less new file mode 100644 index 0000000..9dca463 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-formview.less @@ -0,0 +1,109 @@ +table.uwt-formview +{ + border-collapse: collapse; + + &:not(.uwt-expand) + { + display: inline-block; + } + + &> tr > td, &> thead > tr > td, &> tbody > tr > td + { + padding: 8px; + padding-left: 0px; + vertical-align: top; + &:first-child + { + font-weight: bold; + padding-right: 24px; + } + } + &.uwt-formview-stacked + { + &> tr, &> td, &> thead > tr, &> thead > tr > td, &> tbody > tr, &> tbody > tr > td + { + display: block; + } + } + input + { + width: 100%; + box-sizing: border-box; + } + tr.uwt-required > td:first-child + { + position: relative; + &::before + { + content: "*"; + color: #f00; + font-size: 18pt; + position: absolute; + right: 4px; + } + } +} + + +/* V2 FormView - now more FLEXible! */ +div.uwt-formview +{ + display: table; + /* + display: flex; + flex-direction: column; + */ + + &> div.uwt-formview-item + { + /* + display: flex; + align-items: center; + align-content: center; + */ + display: table-row; + vertical-align: middle; + + padding: 16px; + &> div.uwt-formview-item-label + { + display: table-cell; + vertical-align: middle; + + padding-right: 32px; + &> label + { + font-weight: bold; + } + &> div.uwt-formview-item-description + { + color: #aaaaaa; + } + } + &> div.uwt-formview-item-content + { + display: table-cell; + vertical-align: middle; + } + } +} + +@media (max-width: 800px) +{ + div.uwt-formview + { + &> div.uwt-formview-item + { + /* + flex-direction: column; + flex-grow: 1; + */ + display: block; + + &> div.uwt-formview-item-label + { + display: block; + } + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-gripper.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-gripper.less new file mode 100644 index 0000000..448a2b6 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-gripper.less @@ -0,0 +1,4 @@ +div.uwt-gripper +{ + cursor: move; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-header.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-header.less new file mode 100644 index 0000000..b0aeb13 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-header.less @@ -0,0 +1,33 @@ +body, body > form +{ + &> div.uwt-header + { + position: fixed; + left: 0px; + top: 0px; + height: 60px; + right: 0px; + z-index: 100; + &> div.uwt-header-item + { + display: inline-block; + } + ul.uwt-menu + { + padding-bottom: 32px; + height: 300px; + overflow-y: auto; + } + } +} + +@media print +{ + body, body > form + { + &> div.uwt-header + { + display: none; + } + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-label.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-label.less new file mode 100644 index 0000000..11de107 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-label.less @@ -0,0 +1,5 @@ +label, span.uwt-label +{ + cursor: default; + -moz-user-select: none; +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-layout-box.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-layout-box.less new file mode 100644 index 0000000..2b5ba9b --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-layout-box.less @@ -0,0 +1,36 @@ +div.uwt-layout.uwt-layout-box +{ + display: flex; + &.uwt-orientation-horizontal + { + flex-direction: row; + } + &.uwt-orientation-vertical + { + flex-direction: column; + } + + &> div.uwt-layout-item + { + flex-grow: 1; + } + + justify-content: center; + + &.uwt-pack-start + { + justify-content: flex-start; + } + &.uwt-pack-end + { + justify-content: flex-end; + } + &.uwt-homogenous + { + justify-content: space-evenly; + } + + &.uwt-layout-box-expand + { + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-listbox.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-listbox.less new file mode 100644 index 0000000..55b4fc6 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-listbox.less @@ -0,0 +1,21 @@ +div.uwt-listbox +{ + &> div.uwt-listitem + { + cursor: pointer; + + &> div.uwt-title, &> div.uwt-detail + { + padding: 8px; + } + &> div.uwt-title + { + padding-bottom: 0px; + font-size: 1.2em; + } + &> div.uwt-detail + { + color: #aaaaaa; + } + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-listview.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-listview.less new file mode 100644 index 0000000..842f703 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-listview.less @@ -0,0 +1,93 @@ +table.uwt-listview +{ + border-collapse: collapse; + margin-top: 10px; + &.uwt-expand + { + box-sizing: border-box; + width: 100%; + } + &> caption + { + text-align: left; + padding-bottom: 8px; + + &> span.uwt-listview-title + { + font-weight: bold; + padding-right: 8px; + } + &> span.uwt-listview-item-count + { + } + &> span.uwt-listview-item-count-label + { + } + } + tr + { + &> th, &> td + { + padding: 10px; + } + &> th:not([colspan]) + { + text-align: left; + } + } + &> thead + { + &> tr > th + { + vertical-align: bottom; + &> a + { + display: block; + + /* remove the padding from the surrounding td */ + margin: -10px; + /* and apply it back for this block-level a element */ + padding: 10px; + } + } + } + &> tbody + { + &> tr + { + &> td + { + vertical-align: top; + } + &.uwt-selected + { + &> td + { + background-color: #08c; + color: #fff; + } + &:hover > td + { + background-color: #0075b0; + } + } + } + } +} +ul.uwt-listview +{ + &> li + { + padding: 8px; + } +} + +div.uwt-listview.uwt-view-thumbnails +{ + &> div.uwt-listview-item + { + display: inline-block; + padding: 8px; + text-align: center; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-megamenu.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-megamenu.less new file mode 100644 index 0000000..4353b3b --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-megamenu.less @@ -0,0 +1,32 @@ +div.uwt-menu-large +{ + &> div.uwt-menu-section + { + display: inline-block; + vertical-align: top; + padding: 16px; + &> div.uwt-title + { + color: #aaaaaa; + text-transform: uppercase; + letter-spacing: 2px; + font-size: 12px; + padding-bottom: 24px; + } + &> div.uwt-content + { + &> ul.uwt-menu + { + &> li + { + &> a + { + cursor: pointer; + display: block; + padding: .438rem 1.25rem; + } + } + } + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-menu.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-menu.less new file mode 100644 index 0000000..abe62e0 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-menu.less @@ -0,0 +1,43 @@ +ul.uwt-menu +{ + list-style-type: none; + padding-left: 0px; + margin: 0px; + &> li + { + &:not(.uwt-visible) + { + display: none; + } + &> a + { + display: block; + padding: .438rem 1.25rem; + + text-decoration: none; + + &> span + { + /* not required, but if used, block-level elements */ + display: block; + &.uwt-title + { + font-weight: bold; + } + } + } + &.uwt-separator + { + border-bottom: solid 1px #eee; + margin-left: 8px; + margin-right: 8px; + margin-top: 4px; + margin-bottom: 4px; + } + } +} + +div.uwt-popup.uwt-contextmenu +{ + position: fixed; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-meter.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-meter.less new file mode 100644 index 0000000..6bc672e --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-meter.less @@ -0,0 +1,11 @@ +div.uwt-meter +{ + &> div.uwt-meter-wrapper + { + &> canvas.uwt-meter-canvas + { + width: 48px; + height: 48px; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-page-header.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-page-header.less new file mode 100644 index 0000000..3658fb8 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-page-header.less @@ -0,0 +1,24 @@ +body +{ + &> div.uwt-page-header, &> form > div.uwt-page-header + { + display: flex; + &> div.uwt-title + { + flex: auto; + } + &> input.uwt-searchbox + { + width: 20%; + margin: 6px; + } + } +} + +body:not(.uwt-header-visible) +{ + &> div.uwt-page-header, &> form > div.uwt-page-header + { + display: none; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-page.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-page.less new file mode 100644 index 0000000..0f04697 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-page.less @@ -0,0 +1,139 @@ +body +{ + margin: 0px; +} + +@media (min-width: 1000px) +{ + body + { + &:not(.uwt-hide-sidebar) + { + &> div.uwt-page, &> form > div.uwt-page + { + margin-left: 260px; + } + } + } +} +body +{ + &:not(.uwt-hide-header) + { + &> div.uwt-page, &> form > div.uwt-page + { + /* margin-top: 60px; */ + } + } + &.uwt-hide-sidebar + { + margin-left: 0px; + &> div.uwt-sidebar, &> form > div.uwt-sidebar + { + display: none; + } + } +} +body, body > form +{ + &> div.uwt-page + { + margin-right: 0px; + margin-bottom: 0px; + &> div.uwt-header, &> div.uwt-footer + { + padding: 32px; + } + &> div.uwt-header + { + position: relative; + &> div.uwt-title + { + font-size: 18pt; + font-weight: 300; + margin: 0px; + } + &> div.uwt-subtitle + { + font-size: 12pt; + font-weight: 300; + margin-top: 16px; + color: rgba(0,0,0,0.6); + } + &> div.uwt-controlbox + { + position: absolute; + top: 48px; + right: 32px; + &> ul + { + list-style-type: none; + margin: 0px; + padding: 0px; + &> li + { + &> a > i + { + font-size: 18pt; + } + display: inline-block; + &+ li + { + margin-left: 16px; + } + } + } + } + } + &> div.uwt-content + { + padding: 40px; + } + } + &> div.uwt-footer + { + position: fixed; + left: 260px; /* get this from uwt-sidebar.less */ + bottom: 0px; + right: 0px; + + border-top: 1px solid #d2d3d6; + background-color: #edeef0; + padding: 16px; + } +} +body:not(.uwt-loading) div#uwt-page-loading +{ + display: none; +} +@media (max-width: 999px) +{ + body + { + &> div.uwt-page, &> form > div.uwt-page + { + margin-left: 0px; + } + &> form > div.uwt-sidebar, body > div.uwt-sidebar + { + display: none; + } + } + +} + +@media print +{ + body, body > form + { + &> div.uwt-page + { + margin-left: 0px; + } + margin: 0px; + &> div.uwt-footer + { + left: 0px; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-panel.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-panel.less new file mode 100644 index 0000000..bbf995c --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-panel.less @@ -0,0 +1,35 @@ +div.uwt-panel +{ + background-color: #FFFFFF; + border: solid 1px #aeaeae; + box-shadow: 0px 0px 24px #aeaeae; + &> div.uwt-header + { + font-size: 18pt; + font-weight: 300; + padding: 24px; + } + &> div.uwt-content + { + padding: 24px; + } + &> div.uwt-footer + { + background-color: #eeeeee; + border-top: solid 1px #cccccc; + padding: 24px; + text-align: right; + } + &.uwt-loading > div.uwt-content::after + { + position: absolute; + content: ""; + background-image: url('data:image/gif;base64,R0lGODlhIAAgAPMAAP///wAAAMbGxoSEhLa2tpqamjY2NlZWVtjY2OTk5Ly8vB4eHgQEBAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBkCEDskxTBDAZwuAkkqIfxIQyhBQBFvAQSDITM5VDW6XNE4KagNh6Bgwe60smQUB3d4Rz1ZBApnFASDd0hihh12BkE9kjAJVlycXIg7CQIFA6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YJvpJivxNaGmLHT0VnOgSYf0dZXS7APdpB309RnHOG5gDqXGLDaC457D1zZ/V/nmOM82XiHRLYKhKP1oZmADdEAAAh+QQJCgAAACwAAAAAIAAgAAAE6hDISWlZpOrNp1lGNRSdRpDUolIGw5RUYhhHukqFu8DsrEyqnWThGvAmhVlteBvojpTDDBUEIFwMFBRAmBkSgOrBFZogCASwBDEY/CZSg7GSE0gSCjQBMVG023xWBhklAnoEdhQEfyNqMIcKjhRsjEdnezB+A4k8gTwJhFuiW4dokXiloUepBAp5qaKpp6+Ho7aWW54wl7obvEe0kRuoplCGepwSx2jJvqHEmGt6whJpGpfJCHmOoNHKaHx61WiSR92E4lbFoq+B6QDtuetcaBPnW6+O7wDHpIiK9SaVK5GgV543tzjgGcghAgAh+QQJCgAAACwAAAAAIAAgAAAE7hDISSkxpOrN5zFHNWRdhSiVoVLHspRUMoyUakyEe8PTPCATW9A14E0UvuAKMNAZKYUZCiBMuBakSQKG8G2FzUWox2AUtAQFcBKlVQoLgQReZhQlCIJesQXI5B0CBnUMOxMCenoCfTCEWBsJColTMANldx15BGs8B5wlCZ9Po6OJkwmRpnqkqnuSrayqfKmqpLajoiW5HJq7FL1Gr2mMMcKUMIiJgIemy7xZtJsTmsM4xHiKv5KMCXqfyUCJEonXPN2rAOIAmsfB3uPoAK++G+w48edZPK+M6hLJpQg484enXIdQFSS1u6UhksENEQAAIfkECQoAAAAsAAAAACAAIAAABOcQyEmpGKLqzWcZRVUQnZYg1aBSh2GUVEIQ2aQOE+G+cD4ntpWkZQj1JIiZIogDFFyHI0UxQwFugMSOFIPJftfVAEoZLBbcLEFhlQiqGp1Vd140AUklUN3eCA51C1EWMzMCezCBBmkxVIVHBWd3HHl9JQOIJSdSnJ0TDKChCwUJjoWMPaGqDKannasMo6WnM562R5YluZRwur0wpgqZE7NKUm+FNRPIhjBJxKZteWuIBMN4zRMIVIhffcgojwCF117i4nlLnY5ztRLsnOk+aV+oJY7V7m76PdkS4trKcdg0Zc0tTcKkRAAAIfkECQoAAAAsAAAAACAAIAAABO4QyEkpKqjqzScpRaVkXZWQEximw1BSCUEIlDohrft6cpKCk5xid5MNJTaAIkekKGQkWyKHkvhKsR7ARmitkAYDYRIbUQRQjWBwJRzChi9CRlBcY1UN4g0/VNB0AlcvcAYHRyZPdEQFYV8ccwR5HWxEJ02YmRMLnJ1xCYp0Y5idpQuhopmmC2KgojKasUQDk5BNAwwMOh2RtRq5uQuPZKGIJQIGwAwGf6I0JXMpC8C7kXWDBINFMxS4DKMAWVWAGYsAdNqW5uaRxkSKJOZKaU3tPOBZ4DuK2LATgJhkPJMgTwKCdFjyPHEnKxFCDhEAACH5BAkKAAAALAAAAAAgACAAAATzEMhJaVKp6s2nIkolIJ2WkBShpkVRWqqQrhLSEu9MZJKK9y1ZrqYK9WiClmvoUaF8gIQSNeF1Er4MNFn4SRSDARWroAIETg1iVwuHjYB1kYc1mwruwXKC9gmsJXliGxc+XiUCby9ydh1sOSdMkpMTBpaXBzsfhoc5l58Gm5yToAaZhaOUqjkDgCWNHAULCwOLaTmzswadEqggQwgHuQsHIoZCHQMMQgQGubVEcxOPFAcMDAYUA85eWARmfSRQCdcMe0zeP1AAygwLlJtPNAAL19DARdPzBOWSm1brJBi45soRAWQAAkrQIykShQ9wVhHCwCQCACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiRMDjI0Fd30/iI2UA5GSS5UDj2l6NoqgOgN4gksEBgYFf0FDqKgHnyZ9OX8HrgYHdHpcHQULXAS2qKpENRg7eAMLC7kTBaixUYFkKAzWAAnLC7FLVxLWDBLKCwaKTULgEwbLA4hJtOkSBNqITT3xEgfLpBtzE/jiuL04RGEBgwWhShRgQExHBAAh+QQJCgAAACwAAAAAIAAgAAAE7xDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfZiCqGk5dTESJeaOAlClzsJsqwiJwiqnFrb2nS9kmIcgEsjQydLiIlHehhpejaIjzh9eomSjZR+ipslWIRLAgMDOR2DOqKogTB9pCUJBagDBXR6XB0EBkIIsaRsGGMMAxoDBgYHTKJiUYEGDAzHC9EACcUGkIgFzgwZ0QsSBcXHiQvOwgDdEwfFs0sDzt4S6BK4xYjkDOzn0unFeBzOBijIm1Dgmg5YFQwsCMjp1oJ8LyIAACH5BAkKAAAALAAAAAAgACAAAATwEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GGl6NoiPOH16iZKNlH6KmyWFOggHhEEvAwwMA0N9GBsEC6amhnVcEwavDAazGwIDaH1ipaYLBUTCGgQDA8NdHz0FpqgTBwsLqAbWAAnIA4FWKdMLGdYGEgraigbT0OITBcg5QwPT4xLrROZL6AuQAPUS7bxLpoWidY0JtxLHKhwwMJBTHgPKdEQAACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GAULDJCRiXo1CpGXDJOUjY+Yip9DhToJA4RBLwMLCwVDfRgbBAaqqoZ1XBMHswsHtxtFaH1iqaoGNgAIxRpbFAgfPQSqpbgGBqUD1wBXeCYp1AYZ19JJOYgH1KwA4UBvQwXUBxPqVD9L3sbp2BNk2xvvFPJd+MFCN6HAAIKgNggY0KtEBAAh+QQJCgAAACwAAAAAIAAgAAAE6BDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfYIDMaAFdTESJeaEDAIMxYFqrOUaNW4E4ObYcCXaiBVEgULe0NJaxxtYksjh2NLkZISgDgJhHthkpU4mW6blRiYmZOlh4JWkDqILwUGBnE6TYEbCgevr0N1gH4At7gHiRpFaLNrrq8HNgAJA70AWxQIH1+vsYMDAzZQPC9VCNkDWUhGkuE5PxJNwiUK4UfLzOlD4WvzAHaoG9nxPi5d+jYUqfAhhykOFwJWiAAAIfkECQoAAAAsAAAAACAAIAAABPAQyElpUqnqzaciSoVkXVUMFaFSwlpOCcMYlErAavhOMnNLNo8KsZsMZItJEIDIFSkLGQoQTNhIsFehRww2CQLKF0tYGKYSg+ygsZIuNqJksKgbfgIGepNo2cIUB3V1B3IvNiBYNQaDSTtfhhx0CwVPI0UJe0+bm4g5VgcGoqOcnjmjqDSdnhgEoamcsZuXO1aWQy8KAwOAuTYYGwi7w5h+Kr0SJ8MFihpNbx+4Erq7BYBuzsdiH1jCAzoSfl0rVirNbRXlBBlLX+BP0XJLAPGzTkAuAOqb0WT5AH7OcdCm5B8TgRwSRKIHQtaLCwg1RAAAOwAAAAAAAAAAAA=='); + display: block; + width: 32px; + height: 32px; + margin-left: auto; + margin-right: auto; + position: relative; + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-popup.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-popup.less new file mode 100644 index 0000000..a0b9f9d --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-popup.less @@ -0,0 +1,33 @@ +div.uwt-popup +{ + opacity: 0; + visibility: hidden; + + position: absolute; + z-index: 150; + + + font-size: initial; + font-weight: initial; + + &.uwt-visible + { + opacity: 1; + visibility: visible; + } + + min-width: 10rem; + /* padding: .3125rem 0; */ + margin: .125rem 0 0; + + box-shadow: 0 1px 6px rgba(0,0,0,0.09); + transition: opacity .3s, visibility .3s; + + &> div.uwt-spinner + { + margin-left: auto; + margin-right: auto; + margin-top: 48px; + margin-bottom: 48px; + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-progressbar.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-progressbar.less new file mode 100644 index 0000000..9ead5af --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-progressbar.less @@ -0,0 +1,31 @@ +div.uwt-progressbar +{ + background-color: rgba(24,28,33,0.03); + border-radius: 10rem; + margin-top: .25rem !important; + margin-bottom: 1.5rem !important; + height: 4px; + overflow: hidden; + position: relative; +} +div.uwt-progressbar > div.uwt-progressbar-value +{ + transition: width 0.6s ease; + width: 0%; +} + +@keyframes progress-marquee +{ + from { left: -25%; } + to { left: 125%; } +} +div.uwt-progressbar.uwt-progressbar-marquee > div.uwt-progressbar-value +{ + position: absolute; + + width: 25% !important; + animation: progress-marquee; + animation-duration: 1s; + animation-timing-function: ease-in; + animation-iteration-count: infinite; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-ribbon-listview.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-ribbon-listview.less new file mode 100644 index 0000000..3d9a204 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-ribbon-listview.less @@ -0,0 +1,113 @@ +div.uwt-ribbon-listview +{ + border: solid 1px #cccccc; + background-color: #ffffff; + display: flex; + &> div.uwt-scrollbar + { + display: flex; + flex-direction: column; + &> a + { + display: block; + width: 10px; + text-decoration: none; + border: solid 1px transparent; + margin: -1px; + padding: 1px; + flex-grow: 1; + &:hover + { + border-color: #eeeeee; + background-color: #eeeeee; + } + + &.uwt-scrollbar-button + { + cursor: default; + &::before + { + content: " "; + display: block; + + margin-top: 10px; + margin-left: 3px; + position: absolute; + width: 5px; + height: 3px; + } + &.uwt-disabled + { + cursor: default; + &::before + { + opacity: 0.3; + } + } + } + &.uwt-scrollbar-button-up + { + &::before + { + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAADCAYAAABbNsX4AAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AYht+2SlUqgnYQcchQdbEgWsRRq1CECqFWaNXB5NI/aNKQpLg4Cq4FB38Wqw4uzro6uAqC4A+Im5uToouU+F1SaBHjHcc9vPe9L3ffAf56malmxwSgapaRSsSFTHZVCL6iG/00xxCTmKnPiWISnuPrHj6+30V5lnfdn6NXyZkM8AnEs0w3LOIN4ulNS+e8TxxmRUkhPiceN+iCxI9cl11+41xw2M8zw0Y6NU8cJhYKbSy3MSsaKnGMOKKoGuX7My4rnLc4q+Uqa96TvzCU01aWuU5rGAksYgkiBMioooQyLERp10gxkaLzuId/yPGL5JLJVQIjxwIqUCE5fvA/+N1bMz816SaF4kDni21/jADBXaBRs+3vY9tunACBZ+BKa/krdWDmk/RaS4scAX3bwMV1S5P3gMsdYPBJlwzJkQK0/Pk88H5G35QFBm6BnjW3b81znD4AaepV8gY4OARGC5S97vHurva+/VvT7N8PwFhyxlX78fMAAAAGYktHRAD/AAAA/x4lk34AAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQflCRIUExeEThINAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAAAB1JREFUCNdjYICCurq6/zA2I7pAU1MTIyOyAAwAACpFCPXLR2gjAAAAAElFTkSuQmCC'); + } + } + &.uwt-scrollbar-button-down + { + &::before + { + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAADCAYAAABbNsX4AAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AYht+2SlUqgnYQcchQdbEgWsRRq1CECqFWaNXB5NI/aNKQpLg4Cq4FB38Wqw4uzro6uAqC4A+Im5uToouU+F1SaBHjHcc9vPe9L3ffAf56malmxwSgapaRSsSFTHZVCL6iG/00xxCTmKnPiWISnuPrHj6+30V5lnfdn6NXyZkM8AnEs0w3LOIN4ulNS+e8TxxmRUkhPiceN+iCxI9cl11+41xw2M8zw0Y6NU8cJhYKbSy3MSsaKnGMOKKoGuX7My4rnLc4q+Uqa96TvzCU01aWuU5rGAksYgkiBMioooQyLERp10gxkaLzuId/yPGL5JLJVQIjxwIqUCE5fvA/+N1bMz816SaF4kDni21/jADBXaBRs+3vY9tunACBZ+BKa/krdWDmk/RaS4scAX3bwMV1S5P3gMsdYPBJlwzJkQK0/Pk88H5G35QFBm6BnjW3b81znD4AaepV8gY4OARGC5S97vHurva+/VvT7N8PwFhyxlX78fMAAAAGYktHRAD/AAAA/x4lk34AAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQflCRIUExAaKoeuAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAAAB5JREFUCNdjrKur+8+ABhgZGBgYkCWampoY4bLIEgAqbwj1ABBIfwAAAABJRU5ErkJggg=='); + } + } + &.uwt-scrollbar-button-expand + { + &::before + { + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAGCAYAAAAPDoR2AAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AYht+2SlUqgnYQcchQdbEgWsRRq1CECqFWaNXB5NI/aNKQpLg4Cq4FB38Wqw4uzro6uAqC4A+Im5uToouU+F1SaBHjHcc9vPe9L3ffAf56malmxwSgapaRSsSFTHZVCL6iG/00xxCTmKnPiWISnuPrHj6+30V5lnfdn6NXyZkM8AnEs0w3LOIN4ulNS+e8TxxmRUkhPiceN+iCxI9cl11+41xw2M8zw0Y6NU8cJhYKbSy3MSsaKnGMOKKoGuX7My4rnLc4q+Uqa96TvzCU01aWuU5rGAksYgkiBMioooQyLERp10gxkaLzuId/yPGL5JLJVQIjxwIqUCE5fvA/+N1bMz816SaF4kDni21/jADBXaBRs+3vY9tunACBZ+BKa/krdWDmk/RaS4scAX3bwMV1S5P3gMsdYPBJlwzJkQK0/Pk88H5G35QFBm6BnjW3b81znD4AaepV8gY4OARGC5S97vHurva+/VvT7N8PwFhyxlX78fMAAAAGYktHRAD/AAAA/x4lk34AAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQflCRIUEie7jBPgAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAAAClJREFUCNdjrKur+89AdcDIwMDAgM3opqYmRkYYB1lBU1MTI4Yx6CYAAJuhDPakghFwAAAAAElFTkSuQmCC'); + width: 7px; + height: 6px; + + margin-left: 1px; + } + } + } + } + &> div.uwt-content + { + height: 80px; + overflow: hidden; + flex-grow: 1; + transition: all 0.3s; + &> div.uwt-listview-item + { + border: solid 1px transparent; + display: inline-block; + padding: 11px 16px; + &:hover + { + background-color: #eeeeee; + border-color: #eeeeee; + } + &> img + { + display: block; + margin-left: auto; + margin-right: auto; + + width: 32px; + height: 32px; + } + &> span.uwt-title + { + display: block; + text-align: center; + font-size: smaller; + } + } + } +} + +div.uwt-ribbon > div.uwt-ribbon-tab-contents > div.uwt-ribbon-tab-content > div.uwt-ribbon-tab-group > div.uwt-content > div.uwt-ribbon-literal > div.uwt-ribbon-listview +{ + margin-top: 20px; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-ribbon.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-ribbon.less new file mode 100644 index 0000000..f522107 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-ribbon.less @@ -0,0 +1,180 @@ +.mso-radial-gradient(@start, @end) +{ + background: radial-gradient(ellipse at top, @start, transparent), radial-gradient(ellipse at bottom, @end, transparent); +} + +div.uwt-ribbon +{ + visibility: hidden; + opacity: 0; + height: 0px; + transition: all 0.3s; + overflow: hidden; + + &.uwt-visible + { + visibility: visible; + opacity: 1; + height: 168px; + + &.uwt-ribbon-collapsed + { + height: 48px; + &> div.uwt-ribbon-tab-contents + { + position: absolute; + + height: 94px; + left: 0px; + right: 0px; + margin-top: 1px; + } + } + } + + -moz-user-select: none; + &> div.uwt-ribbon-application-button + { + padding: 10px 0px; + position: absolute; + left: 0px; + + &> a + { + text-align: center; + padding: 10px 30px; + } + } + + &> ul.uwt-ribbon-tab-buttons + { + list-style-type: none; + padding: 0px; + padding-left: 96px; + + margin: 0px; + margin-top: 2px; + + display: block; + + &> li + { + display: inline-block; + + border: solid 1px transparent; + + border-top-left-radius: 3px; + border-top-right-radius: 3px; + + padding: 10px 20px; + + margin-bottom: -1px; + + &:hover + { + .mso-radial-gradient(#c4ddfe, #e3d198); + border-color: #99bbe8; + } + } + } + &> div.uwt-ribbon-tab-contents + { + &> div.uwt-ribbon-tab-content + { + &:not(.uwt-visible) + { + display: none; + } + &> div.uwt-ribbon-tab-group + { + border-radius: 3px; + display: inline-block; + + height: 120px; + margin-bottom: 4px; + vertical-align: top; + position: relative; + + &> div.uwt-content + { + .uwt-ribbon-command, .uwt-ribbon-command-container + { + display: inline-block; + } + .uwt-ribbon-command + { + margin: 2px; + vertical-align: top; + div.uwt-title + { + padding: 2px 4px; + text-align: center; + } + + img + { + display: block; + margin-left: auto; + margin-right: auto; + + width: 32px; + padding: 4px; + } + &.uwt-button + { + border: solid 1px transparent; + border-radius: 3px; + } + &.uwt-ribbon-hide-title > div.uwt-title + { + display: none; + } + &> div.uwt-title + { + min-width: 40px; + max-width: 70px; + font-size: 10pt; + } + + &.uwt-splitbutton + { + &> div.uwt-button + { + padding: 10px 4px; + } + &> div.uwt-dropdown-button + { + padding: 2px 0px; + } + } + } + .uwt-ribbon-command-container + { + &> .uwt-ribbon-command + { + display: block; + img + { + width: 16px; + } + } + + &.uwt-orientation-vertical > .uwt-ribbon-command + { + &> img { display: inline-block; } + &> div.uwt-title { display: inline-block; text-align: left; } + } + } + } + &> div.uwt-title + { + position: absolute; + bottom: 0px; + left: 0px; + right: 0px; + text-align: center; + } + } + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-searchbar.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-searchbar.less new file mode 100644 index 0000000..7af84e0 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-searchbar.less @@ -0,0 +1,14 @@ +body, body > form +{ + &> div.uwt-header > div.uwt-header-item.uwt-searchbar > div.uwt-popup + { + &:not(.uwt-loading) > div.uwt-spinner + { + display: none; + } + &.uwt-loading > div.uwt-dropdown-content + { + display: none; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-sidebar-profile.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-sidebar-profile.less new file mode 100644 index 0000000..2ff01bf --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-sidebar-profile.less @@ -0,0 +1,9 @@ +div.uwt-sidebar > div.uwt-sidebar-panel > div.uwt-profile-image +{ + padding-right: 5px; + display: inline-block; +} +div.uwt-sidebar > div.uwt-sidebar-panel > div.uwt-profile-image, div.uwt-sidebar > div.uwt-sidebar-panel > div.uwt-profile-details +{ + display: inline-block; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-sidebar.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-sidebar.less new file mode 100644 index 0000000..86b632c --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-sidebar.less @@ -0,0 +1,46 @@ +div.uwt-sidebar +{ + position: fixed; + top: 60px; + left: 0px; + width: 260px; + bottom: 0px; + ul + { + list-style-type: none; + margin: 0px; + padding: 0px; + &> li + { + &> ul + { + background-color: rgba(0, 0, 0, 0.1); + } + &> a + { + display: block; + padding-left: 5px; + line-height: 42px; + &:hover + { + text-decoration: none; + } + } + &> i.fa + { + display: inline-block; + width: 45px; + text-align: center; + } + } + } + +} + +@media print +{ + div.uwt-sidebar + { + display: none; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-slider.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-slider.less new file mode 100644 index 0000000..55b3bdf --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-slider.less @@ -0,0 +1,67 @@ +@uwt-slider-padding: 8px; + +div.uwt-slider +{ + position: relative; + user-select: none; + padding-top: @uwt-slider-padding; + padding-bottom: @uwt-slider-padding; + + &:not(.uwt-disable-animation) + { + &> div.uwt-slider-bar + { + &> div.uwt-slider-selection + { + transition: width 0.2s ease-in; + } + &> div.uwt-slider-button + { + transition: left 0.2s ease-in; + } + } + } + + &> div.uwt-slider-bar + { + height: 2px; + &> div.uwt-slider-selection + { + position: absolute; + left: 0px; + width: 0px; + height: 2px; + } + &> div.uwt-slider-button + { + border-radius: .75rem; + width: .75rem; + height: .75rem; + + position: absolute; + left: 0px; + top: @uwt-slider-padding - 5px; + } + } + &.uwt-large + { + padding-top: @uwt-slider-padding + 8px; + padding-bottom: @uwt-slider-padding + 8px; + + &> div.uwt-slider-bar + { + height: 4px; + &> div.uwt-slider-selection + { + height: 4px; + } + &> div.uwt-slider-button + { + border-radius: 30px; + width: 30px; + height: 30px; + top: (@uwt-slider-padding + 8px) - 15px; + } + } + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-spinbutton.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-spinbutton.less new file mode 100644 index 0000000..4fc961d --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-spinbutton.less @@ -0,0 +1,16 @@ +div.uwt-spinbutton +{ + &> a.uwt-button-up, &> a.uwt-button-down, &> label + { + display: block; + } + &> label + { + padding-top: 16px; + padding-bottom: 16px; + } + &> input + { + display: none; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-spinner.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-spinner.less new file mode 100644 index 0000000..6fee2c4 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-spinner.less @@ -0,0 +1,21 @@ +div.uwt-spinner +{ + animation: rotation .6s infinite linear; +} +div#uwt-page-loading > div.uwt-spinner +{ + position: absolute; + top: 50%; + left: 50%; +} +@keyframes rotation +{ + 0% + { + transform: rotate(0deg); + } + 100% + { + transform: rotate(359deg); + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-splashscreen.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-splashscreen.less new file mode 100644 index 0000000..1aefc12 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-splashscreen.less @@ -0,0 +1,32 @@ +div.uwt-splashscreen +{ + opacity: 0; + visibility: hidden; + transition: all 0.3s; + + position: fixed; + left: 0px; + top: 0px; + right: 0px; + bottom: 0px; + + z-index: 5000; + + &.uwt-visible + { + opacity: 1; + visibility: visible; + } +} + +body.uwt-loading +{ + cursor: wait; + overflow: hidden; + + &> div.uwt-splashscreen + { + opacity: 1; + visibility: visible; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-stack.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-stack.less new file mode 100644 index 0000000..85c1e9f --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-stack.less @@ -0,0 +1,23 @@ +div.uwt-stack-container +{ + position: relative; + &> div.uwt-stack-page + { + position: absolute; + left: 0px; + top: 0px; + right: 0px; + bottom: 0px; + + visibility: hidden; + opacity: 0; + + transition: visibility 0.3s, opacity 0.3s; + + &.uwt-visible + { + visibility: visible; + opacity: 1; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-switch.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-switch.less new file mode 100644 index 0000000..3f5b6be --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-switch.less @@ -0,0 +1,75 @@ +label.uwt-switch +{ + position: relative; + display: inline-block; + margin-right: .75rem; + margin-bottom: 0; + border-radius: 60rem; + vertical-align: middle; + font-weight: normal; + cursor: default; + padding-left: 2.375rem; + min-height: 1.375rem; + font-size: .894rem; + line-height: 1.4; + input.uwt-switch-input + { + display: none; + } + .uwt-switch-indicator::after + { + top: 0; + margin: .25rem 0 0 .25rem; + width: .875rem; + height: .875rem; + } + .uwt-switch-unchecked + { + padding-right: .25rem; + padding-left: 1.125rem; + + left: 100%; + color: transparent; + } + .uwt-switch-checked + { + left: 0; + } + input.uwt-switch-input:checked ~ .uwt-switch-indicator + { + background: #26B4FF; + color: #FFFFFF; + + .uwt-switch-unchecked + { + left: 100%; + color: transparent; + } + .uwt-switch-checked + { + left: 0; + } + } + .uwt-switch-unchecked, .uwt-switch-checked + { + position: absolute; + top: 0; + width: 100%; + height: 100%; + text-align: center; + transition-duration: .2s; + transition-property: left, right; + } +} +.uwt-switch-indicator::after +{ + content: ""; + position: absolute; + left: 0; + display: block; + border-radius: 999px; + background: #fff; + box-shadow: 0 0 0 1px rgba(24,28,33,0.04),0 1px 6px rgba(24,28,33,0.09); + transition-duration: .2s; + transition-property: left, right, background; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-tabcontainer.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-tabcontainer.less new file mode 100644 index 0000000..ddb28ad --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-tabcontainer.less @@ -0,0 +1,89 @@ +div.uwt-tabcontainer +{ + box-sizing: border-box; + /* display: table; */ + &.uwt-expand + { + width: 100%; + } + &> ul.uwt-tabcontainer-tabs + { + &> li + { + display: none; + margin-bottom: -1px; + &.uwt-visible + { + display: inline-block; + } + &> a + { + text-decoration: none; + padding: 10px 15px; + } + &.uwt-visible > a + { + display: block; + } + } + list-style-type: none; + margin: 0px; + padding: 0px; + } + &> div.uwt-tabcontainer-tabpages + { + position: relative; + &> div.uwt-tabpage + { + /*display: none;*/ + + /* + position: absolute; + left: 0px; + top: 0px; + right: 0px; + + */ + /* + opacity: 0; + visibility: hidden; + */ + display: none; + + opacity: 0; + visibility: hidden; + + padding: 10px 15px; + &.uwt-selected + { + + display: block; + /* + opacity: 1; + visibility: visible; + */ + + /*display: block;*/ + opacity: 1; + visibility: visible; + } + } + } + + &.uwt-position-bottom + { + position: relative; + &> ul.uwt-tabcontainer-tabs + { + position: absolute; + bottom: 0px; + left: 0px; + right: 0px; + } + &> ul.uwt-tabcontainer-tabpages + { + left: 0px; + right: 0px; + } + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-textbox.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-textbox.less new file mode 100644 index 0000000..c3f652f --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-textbox.less @@ -0,0 +1,32 @@ +input[type=text], input[type=password], textarea +{ + padding: 10px; +} +div.uwt-textbox +{ + &.uwt-selection-required + { + &> div > input + { + cursor: default; + &:focus + { + cursor: text; + } + } + } + &> select + { + display: none; + } +} +div.uwt-popup.uwt-textbox-popup +{ + background: #ffff; + + &> div.uwt-dropdown-content > ul.uwt-menu + { + max-height: 186px; + overflow-y: scroll; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-tile.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-tile.less new file mode 100644 index 0000000..e716b91 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-tile.less @@ -0,0 +1,63 @@ +div.uwt-tile-container +{ + display: flex; + &> div.uwt-tile + { + display: flex; + flex-direction: column; + flex-grow: 1; + &:first-child + { + margin-right: 8px; + } + &+ div.uwt-tile + { + margin-left: 8px; + } + + &> div.uwt-header + { + letter-spacing: 0.1em; + padding: 6px 10px; + border-top-right-radius: 1px; + border-top-left-radius: 1px; + text-transform: uppercase; + text-align: center; + font-size: 11px; + } + &> div.uwt-content + { + flex-grow: 1; + padding: 10px 20px; + font-weight: 300; + font-size: 48px; + text-align: center; + &> small + { + display: block; + font-size: 14px; + } + + } + &> div.uwt-footer + { + padding: 5px 10px; + border-bottom-right-radius: 1px; + border-bottom-left-radius: 1px; + &> a + a + { + margin-left: 8px; + } + } + } +} + +@media (max-width: 1000px) +{ + div.uwt-tile-container + { + &> div.uwt-tile + { + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-toolbar.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-toolbar.less new file mode 100644 index 0000000..848d840 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-toolbar.less @@ -0,0 +1,35 @@ +div.uwt-toolbar +{ + &> a + { + margin: 4px; + } + &> span.uwt-separator + { + width: 0px; + + display: inline-block; + -moz-user-select: none; + + height: 30px; + top: -4px; + position: relative; + } + +} +@media (max-width: 600px) +{ + div.uwt-toolbar + { + &> div.uwt-button + { + display: block; + margin-bottom: 8px; + + &> a + { + display: block; + } + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-tooltip.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-tooltip.less new file mode 100644 index 0000000..e8ac8c1 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-tooltip.less @@ -0,0 +1,29 @@ +div.uwt-tooltip +{ + max-width: 400px; + padding: .25rem .5rem; + text-align: left; + border-radius: .25rem; + position: fixed; + + opacity: 0; + transition: opacity 0.3s; + z-index: 1000; + + &.uwt-visible + { + opacity: 1; + } + + &> div.uwt-title + { + font-weight: bold; + padding: 8px; + padding-bottom: 4px; + } + &> div.uwt-content + { + padding: 8px; + padding-top: 4px; + } +} diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-treeview.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-treeview.less new file mode 100644 index 0000000..ecaa64d --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-treeview.less @@ -0,0 +1,31 @@ +ul.uwt-treeview, ul.uwt-treeview ul +{ + list-style-type: none; + margin: 0px; + padding: 0px; + padding-left: 32px; + + li + { + position: relative; + + &:not(.uwt-expanded) ul + { + display: none; + } + + &> span.uwt-treeview-item + { + &> span.uwt-treeview-toggler + { + display: inline-block; + position: absolute; + top: 8px; + left: 16px; + } + display: block; + padding: 8px; + padding-left: 32px; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-uml-diagram.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-uml-diagram.less new file mode 100644 index 0000000..d76f24a --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-uml-diagram.less @@ -0,0 +1,21 @@ +div.uwt-uml-diagram +{ + &> div.uwt-uml-class + { + background-color: #ffffff; + border: solid 1px #cccccc; + box-shadow: 4px 4px 8px #aaaaaa; + + display: inline-block; + + &> div.uwt-title, &> div.uwt-content + { + padding: 16px; + } + &> div.uwt-title + { + border-bottom: solid 1px #cccccc; + font-weight: bold; + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-window.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-window.less new file mode 100644 index 0000000..525f153 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-window.less @@ -0,0 +1,23 @@ +div.uwt-window +{ + &> div.uwt-header + { + -moz-user-select: none; + } + + &.uwt-footer-hidden > div.uwt-footer + { + display: none; + } +} + +div.uwt-modal-background +{ + background-color: rgba(0, 0, 0, 0.5); + position: fixed; + left: 0px; + right: 0px; + bottom: 0px; + top: 0px; + z-index: -1; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt-wunderbar.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt-wunderbar.less new file mode 100644 index 0000000..0b03224 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt-wunderbar.less @@ -0,0 +1,75 @@ +div.uwt-wunderbar +{ + position: absolute; + bottom: 0px; + top: 0px; + left: 0px; + right: 0px; + &> div.uwt-content + { + position: relative; + height: 100%; + &> div.uwt-wunderbar-content + { + position: absolute; + left: 0px; + top: 0px; + right: 0px; + bottom: 0px; + &:not(.uwt-visible) + { + opacity: 0; + visibility: hidden; + } + } + } + &> div.uwt-wunderbar-buttons + { + position: absolute; + bottom: 0px; + right: 0px; + left: 0px; + &> div.uwt-wunderbar-gripper + { + height: 18px; + display: block; + cursor: ns-resize; + -moz-user-select: none; + &> div.uwt-gripper + { + margin-left: auto; + margin-right: auto; + + display: block; + width: 38px; + } + } + &> div.uwt-wunderbar-overflow + { + height: 28px; + } + &> ul + { + list-style-type: none; + margin: 0px; + padding: 0px; + &> li + { + &> a + { + display: block; + + margin-top: -1px; + margin-bottom: -1px; + padding: 8px; + + text-decoration: none; + } + } + } + } +} +div.uwt-sidebar > div.uwt-wunderbar ul li a +{ + line-height: initial; +} \ No newline at end of file diff --git a/mocha-dotnet/src/assets/ui-html/css/common/uwt.less b/mocha-dotnet/src/assets/ui-html/css/common/uwt.less new file mode 100644 index 0000000..cd39364 --- /dev/null +++ b/mocha-dotnet/src/assets/ui-html/css/common/uwt.less @@ -0,0 +1,146 @@ +/* +@import "uwt-button.less"; +@import "uwt-column.less"; +@import "uwt-expand.less"; +@import "uwt-formview.less"; +@import "uwt-header.less"; +@import "uwt-panel.less"; +@import "uwt-page.less"; +@import "uwt-sidebar.less"; +@import "uwt-sidebar-profile.less"; +@import "uwt-textbox.less"; +@import "uwt-tile.less"; +*/ +// @import "Fonts/FontAwesome/FontAwesome.css"; + +html +{ + height: 100%; +} +body +{ + height: 100%; + overflow: hidden; +} +h1 +{ + font-size: 42px; + font-weight: 300; +} +h1, h2, h3 +{ + font-weight: 300; +} +h4 +{ + font-size: 18px; +} +h4, h5, h6 +{ + font-weight: 400; +} + +div.uwt-container.uwt-layout-box-horizontal +{ + &> * + { + display: inline-block; + } +} +div.uwt-center +{ + margin-left: auto; + margin-right: auto; +} + +.linear-gradient-twostop(@start, @end) +{ + /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#dcfcff+0,7cc2ec+50,5bacdc+51,bcf8ff+100 */ + background: @start; /* Old browsers */ + background: -moz-linear-gradient(top, @start 0%, @end 100%); /* FF3.6-15 */ + background: -webkit-linear-gradient(top, @start 0%,@end 100%); /* Chrome10-25,Safari5.1-6 */ + background: linear-gradient(to bottom, @start 0%,@end 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='@{start}', endColorstr='@{end}',GradientType=0 ); /* IE6-9 */ +} +.linear-gradient-fourstop(@start, @startmid, @endmid, @end) +{ + /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#dcfcff+0,7cc2ec+50,5bacdc+51,bcf8ff+100 */ + background: @start; /* Old browsers */ + background: -moz-linear-gradient(top, @start 0%, @startmid 50%, @endmid 51%, @end 100%); /* FF3.6-15 */ + background: -webkit-linear-gradient(top, @start 0%,@startmid 50%,@endmid 51%,@end 100%); /* Chrome10-25,Safari5.1-6 */ + background: linear-gradient(to bottom, @start 0%,@startmid 50%,@endmid 51%,@end 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='@{start}', endColorstr='@{end}',GradientType=0 ); /* IE6-9 */ +} +.user-select(@param) +{ + -webkit-user-select: @param; + -moz-user-select: @param; + -ms-user-select: @param; + user-select: @param; +} + +.UwtColors() +{ + + &.uwt-color-primary + { + background-color: @ThemeColorPrimaryLight; + border-color: @ThemeColorPrimary; + } + &.uwt-color-info + { + background-color: @ThemeColorInfoLight; + border-color: @ThemeColorInfo; + } + &.uwt-color-purple + { + background-color: @ThemeColorPurpleLight; + border-color: @ThemeColorPurple; + } + &.uwt-color-indigo + { + background-color: @ThemeColorIndigoLight; + border-color: @ThemeColorIndigo; + } + &.uwt-color-success + { + background-color: @ThemeColorSuccessLight; + border-color: @ThemeColorSuccess; + } + &.uwt-color-green + { + background-color: @ThemeColorGreenLight; + border-color: @ThemeColorGreen; + } + &.uwt-color-lime + { + background-color: @ThemeColorLimeLight; + border-color: @ThemeColorLime; + } + &.uwt-color-warning + { + background-color: @ThemeColorWarningLight; + border-color: @ThemeColorWarning; + } + &.uwt-color-yellow + { + background-color: @ThemeColorYellowLight; + border-color: @ThemeColorYellow; + } + &.uwt-color-danger + { + background-color: @ThemeColorDangerLight; + border-color: @ThemeColorDanger; + } + &.uwt-color-pink + { + background-color: @ThemeColorPinkLight; + border-color: @ThemeColorPink; + } + +} + +.uwt-nonexistent +{ + display: none; +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/AttributeValue.cs b/mocha-dotnet/src/lib/Mocha.Core/AttributeValue.cs index 8f10748..953920d 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/AttributeValue.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/AttributeValue.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core; public struct AttributeValue diff --git a/mocha-dotnet/src/lib/Mocha.Core/ExportEntitiesAttribute.cs b/mocha-dotnet/src/lib/Mocha.Core/ExportEntitiesAttribute.cs index 58a67e1..e173200 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/ExportEntitiesAttribute.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/ExportEntitiesAttribute.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // ExportEntitiesAttribute.cs // diff --git a/mocha-dotnet/src/lib/Mocha.Core/InstanceHandle.cs b/mocha-dotnet/src/lib/Mocha.Core/InstanceHandle.cs index 9102e18..eef28b9 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/InstanceHandle.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/InstanceHandle.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // InstanceReference.cs // @@ -79,6 +96,10 @@ namespace Mocha.Core if (IsEmpty) return "(empty) "; + if (Oms.DebugOms != null) + { + return Oms.DebugOms.GetInstanceText(this); + } return _ID.ToString(); } diff --git a/mocha-dotnet/src/lib/Mocha.Core/InstanceKey.cs b/mocha-dotnet/src/lib/Mocha.Core/InstanceKey.cs index 894feb1..1307ac8 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/InstanceKey.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/InstanceKey.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // InstanceKey.cs // diff --git a/mocha-dotnet/src/lib/Mocha.Core/KnownAttributeGuids.cs b/mocha-dotnet/src/lib/Mocha.Core/KnownAttributeGuids.cs index 885bd2f..c8c77c4 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/KnownAttributeGuids.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/KnownAttributeGuids.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using System; namespace Mocha.Core { @@ -10,7 +27,8 @@ namespace Mocha.Core public static Guid Value { get; } = new Guid("{041DD7FD-2D9C-412B-8B9D-D7125C166FE0}"); public static Guid CSSValue { get; } = new Guid("{C0DD4A42-F503-4EB3-8034-7C428B1B8803}"); public static Guid RelationshipType { get; } = new Guid("{71106B12-1934-4834-B0F6-D894637BAEED}"); - + public static Guid Order { get; } = new Guid("{49423f66-8837-430d-8cac-7892ebdcb1fe}"); + public static Guid TargetURL { get; } = new Guid("{970F79A0-9EFE-4E7D-9286-9908C6F06A67}"); public static Guid UserName { get; } = new Guid("{960FAF02-5C59-40F7-91A7-20012A99D9ED}"); @@ -28,6 +46,7 @@ namespace Mocha.Core } public static class Boolean { + public static Guid MethodIsOfTypeSpecified { get; } = new Guid("{6e9df667-0f95-4320-a4be-5cdb00f1d4ee}"); public static Guid DisplayVersionInBadge { get; } = new Guid("{BE5966A4-C4CA-49A6-B504-B6E8759F392D}"); public static Guid Editable { get; } = new Guid("{957fd8b3-fdc4-4f35-87d6-db1c0682f53c}"); public static Guid Static { get; } = new Guid("{9A3A0719-64C2-484F-A55E-22CD4597D9FD}"); @@ -41,6 +60,7 @@ namespace Mocha.Core } public static class Numeric { + public static Guid Seed { get; } = new Guid("{ee6f8b91-e471-4281-8bbe-ad858388bcc2}"); public static Guid Index { get; } = new Guid("{0f31b9ca-e3e2-4c62-8c9e-b55f16eafbf9}"); public static Guid Level { get; } = new Guid("{8C528FB0-4063-47B0-BC56-85E387A41BD2}"); public static Guid DebugDefinitionLineNumber { get; } = new Guid("{822be9b7-531d-4aa1-818a-6e4de1609057}"); @@ -51,6 +71,7 @@ namespace Mocha.Core public static Guid MinimumValue { get; } = new Guid("{bc90ffdf-9b6e-444a-a484-f9d06d7f3c31}"); public static Guid MaximumValue { get; } = new Guid("{b9353b1c-2597-4097-96eb-449a6fafcdab}"); + public static Guid RandomNumber { get; } = new Guid("{1e18b839-5a53-495e-a240-8ec03b6b9c0d}"); } } } diff --git a/mocha-dotnet/src/lib/Mocha.Core/KnownInstanceGuids.cs b/mocha-dotnet/src/lib/Mocha.Core/KnownInstanceGuids.cs index 018621c..3d16ca9 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/KnownInstanceGuids.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/KnownInstanceGuids.cs @@ -1,4 +1,22 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using System; +using System.Data; namespace Mocha.Core { public static class KnownInstanceGuids @@ -23,8 +41,11 @@ namespace Mocha.Core public static Guid Element { get; } = new Guid("{91929595-3dbd-4eae-8add-6120a49797c7}"); public static Guid ElementContent { get; } = new Guid("{f85d4f5e-c69f-4498-9913-7a8554e233a4}"); + public static Guid OMS { get; } = new Guid("{1ddf9a56-ebb8-4992-ab68-1820acf6bfc8}"); + public static Guid File { get; } = new Guid("{5D081079-E136-406A-A728-7472937A6E5E}"); + public static Guid Language { get; } = new Guid("{61102B47-9B2F-4CF3-9840-D168B84CF1E5}"); public static Guid Translation { get; } = new Guid("{04A53CC8-3206-4A97-99C5-464DB8CAA6E6}"); public static Guid TranslationValue { get; } = new Guid("{6D38E757-EC18-43AD-9C35-D15BB446C0E1}"); @@ -41,10 +62,15 @@ namespace Mocha.Core public static Guid Method { get; } = new Guid("{D2813913-80B6-4DD6-9AD6-56D989169734}"); + public static Guid AccumulationFunction { get; } = new Guid("{64f1b972-63c8-46c9-94a5-17a3cab957fe}"); + public static Guid SelectionFunction { get; } = new Guid("{bdaef55d-9905-4d24-84c2-7439d43a79df}"); + // public static Guid MethodCall { get; } = new Guid("{084A6D58-32C9-4A5F-9D2B-86C46F74E522}"); + public static Guid ConditionGroup { get; } = new Guid("{df2059e6-650c-49a8-8188-570ccbe4fd2d}"); public static Guid ConditionalEvaluationCase { get; } = new Guid("{ba18abdc-11ae-46af-850a-eb30280b0ffa}"); public static Guid ConditionalSelectAttributeCase { get; } = new Guid("{a1115690-c400-4e3e-9c8f-24e2a9477e8f}"); + public static Guid ConditionalSelectFromInstanceSetCase { get; } = new Guid("{d799b07a-3f9e-4cb2-bd91-40ffa688ccb1}"); public static Guid AccessModifier { get; } = new Guid("{ca4fcc11-16c8-4872-a712-82e589d382ce}"); @@ -80,6 +106,10 @@ namespace Mocha.Core public static Guid Module { get; } = new Guid("{e009631d-6b9d-445c-95df-79f4ef8c8fff}"); + public static Guid SystemRoutine { get; } = new Guid("{6e5265af-f73d-420c-b9d5-cf2fdc90363d}"); + public static Guid SystemInstanceSetRoutine { get; } = new Guid("{d17a6d27-da03-4b5d-9256-f67f978f403d}"); + public static Guid SystemAttributeRoutine { get; } = new Guid("{117f4b9c-2678-4747-aced-78d93c25dcd7}"); + public static Guid Report { get; } = new Guid("{19D947B6-CE82-4EEE-92EC-A4E01E27F2DB}"); public static Guid ReportColumn { get; } = new Guid("{BEFE99A1-B2EB-4365-A2C9-061C6609037B}"); public static Guid StandardReport { get; } = new Guid("{FDF4A498-DE83-417D-BA01-707372125C8D}"); @@ -127,8 +157,22 @@ namespace Mocha.Core public static Guid Theme { get; } = new Guid("{7c2cc4b5-8323-4478-863b-1759d7adf62e}"); + public static Guid CommonText { get; } = new Guid("{a48a5fb2-f80c-47f9-bc47-7adef34d061b}"); public static Guid CommonBoolean { get; } = new Guid("{5b025da3-b7bd-45a9-b084-48c4a922bf72}"); + public static Guid CommonNumeric { get; } = new Guid("{553c196e-0439-4be9-b8fb-4dee6f0530fd}"); + public static Guid CommonDate { get; } = new Guid("{cb077f5b-f58d-4f6a-aa01-659bea754b6e}"); // {d6c033a0-b781-46d4-9515-64183f2902f5} + public static Guid CommonInstanceSet { get; } = new Guid("{3382da21-4fc5-45dc-bbd1-f7ba3ece1a1b}"); + + public static Guid BooleanOperator { get; } = new Guid("{fb85933c-e2ad-4b1c-ac2a-f92c9cc57e1c}"); + public static Guid RelationalOperator { get; } = new Guid("{f1b5d26f-2347-49cb-8aae-d80dd706fce2}"); + public static Guid LogicalOperator { get; } = new Guid("{340d464a-b47d-40a2-a185-be4d974b5899}"); + public static Guid ArithmeticOperator { get; } = new Guid("{8196e8b1-849d-4b18-a78b-5684dca7b7f4}"); + + + + public static Guid Route { get; } = new Guid("{6c589422-3f1e-4402-afc7-27b6956aa588}"); + public static Guid RouteTable { get; } = new Guid("{76e5ce90-5f64-4355-a0ee-f659cf615a63}"); } public static class Methods { @@ -141,6 +185,21 @@ namespace Mocha.Core public static Guid Tenant__get__Current_Tenant { get; } = new Guid("{22ec44d5-bede-48bb-96ca-03481611422c}"); public static Guid Instance__get__This_Instance { get; } = new Guid("{d78fe3ca-3c15-41a0-bccf-0a701b4712a4}"); } + public static class GetRelationship + { + public static Guid Instance__get__Parent_Class { get; } = new Guid("{bac8c59f-8994-41e8-b0c0-659ec8efc4e2}"); + // public static Guid Method__get__Parent_Class__HACK { get; } = new Guid("{89034a1c-50e5-47a1-abb8-076ece5343a8}"); + } + public static class ConditionalSelectAttribute + { + public static Guid Method__get__Method_Abbreviation { get; } = new Guid("{f0c64709-385d-481b-8f58-83e507fb261c}"); + public static Guid Method_Binding__get__Method_Binding_Abbreviation { get; } = new Guid("{7154cb08-0f80-4af4-bca5-c2c12e54479a}"); + } + public static class GetAttributeBySystemRoutine + { + public static Guid OMS__get__Runtime_Version { get; } = new Guid("{58835bd3-21e2-43bb-a069-7f8befe9bf5d}"); + public static Guid Common_Numeric__get__Random_Number { get; } = new Guid("{84b8b8eb-a2a5-4f87-9e7e-237658fa1c1f}"); + } } [ExportEntities(Prefix = "IDC_", Suffix = null)] @@ -172,9 +231,18 @@ namespace Mocha.Core // GEP - Get Element from Parameters Method - 63 // GAP - Get Attribute from Parameters Method - 64 public static Guid GetInstanceSetBySystemRoutineMethod { get; } = new Guid("{7bdc53a1-81f0-458d-96f4-5637e6e1cf49}"); // 65 - // GAS - Get Attribute by System Routine Method - 66 + /// + /// GAS - Get Attribute by System Routine Method [1$66] + /// + /// + public static Guid GetAttributeBySystemRoutineMethod { get; } = new Guid("{9d45eb8c-1fb5-4260-a69c-f99a8f7a70b8}"); // GES - Get Element by System Routine Method - 67 // US - Update by System Routine Method - 68 + /// + /// AA - Asssign Attribute Method - 73 + /// + /// + public static Guid AssignAttributeMethod { get; } = new Guid("{3312A789-3B7A-4478-B329-4FF781504F9C}"); // CS - Compare Instance Sets Method - 91 public static Guid CalculateDateMethod { get; } = new Guid("{1e58e284-56eb-42b4-88b9-e0a691559fa6}"); // 92 // EC - Evaluate Conditions Method - 94 @@ -186,6 +254,19 @@ namespace Mocha.Core public static Guid InstanceOpMethod { get; } = new Guid("{4c814982-938f-4116-bdc1-827bae6a5f71}"); public static Guid ConditionalSelectAttributeMethod { get; } = new Guid("{d534a369-321e-4c32-bd7f-8ff2017f191e}"); // 13038 // SSC - Conditional Select from Instance Set Method - 13039 + public static Guid ConditionalSelectFromInstanceSetMethod { get; } = new Guid("{ffea8e52-06e5-4e95-8c40-da3ba54ce95f}"); // 13039 + + } + public static class SystemAttributeRoutines + { + public static Guid GetRuntimeVersion { get; } = new Guid("{dc4e6c8d-936d-457f-90e9-af47e229b80c}"); + // public static Guid SystemInstanceSetRoutine { get; } = new Guid("{d17a6d27-da03-4b5d-9256-f67f978f403d}"); + public static Guid GetRandomNumber { get; } = new Guid("{8f7945da-4cad-49cb-9838-85f3524a5adb}"); + } + public static class SystemInstanceSetRoutines + { + public static Guid GetRuntimeVersion { get; } = new Guid("{dc4e6c8d-936d-457f-90e9-af47e229b80c}"); + // public static Guid SystemInstanceSetRoutine { get; } = new Guid("{d17a6d27-da03-4b5d-9256-f67f978f403d}"); } public static class PromptValueClasses { @@ -257,6 +338,15 @@ namespace Mocha.Core public static Guid Width { get; } = new Guid("{7a84cf37-c445-4e75-ab1a-075bb99067f2}"); } + [ExportEntities(Prefix = "IDI_AccessModifier_", Suffix = null)] + public static class AccessModifiers + { + public static Guid Private { get; } = new Guid("{82bef402-2a8b-45d2-bfef-0de3a355bd22}"); + public static Guid Protected { get; } = new Guid("{23e264b2-e8a0-4d0c-96c2-308586a46eaa}"); + public static Guid Public { get; } = new Guid("{68be791f-f64b-4eeb-bc6a-2f040c4e90d2}"); + public static Guid RootA2 { get; } = new Guid("{286bcf7a-9dcb-4c83-9a5c-09a31dc8f10b}"); + } + [ExportEntities(Prefix = "IDI_Orientation_", Suffix = null)] public static class Orientation { @@ -297,5 +387,46 @@ namespace Mocha.Core /// The GUID of the `Obscured Text` EC Display Option. public static Guid ObscuredText { get; } = new Guid("{e42fb627-6559-42e7-a8fe-59c9d674eec4}"); } + + public static class AccumulationFunctions + { + public static Guid Sum { get; } = new Guid("{c84c3615-c418-4273-8212-cb7766d95ee4}"); + public static Guid Average { get; } = new Guid("{57eb3ded-96fe-4faa-98af-3edd9ed13ab4}"); + } + public static class SelectionFunctions + { + public static Guid Minimum { get; } = new Guid("{1ff7be8c-fe48-4154-9028-8ee84b7dc367}"); + public static Guid Maximum { get; } = new Guid("{dda6c31d-5bea-41a9-a6bc-0e5c189784da}"); + } + public static class RelationalOperators + { + public static Guid SubsetOfSelectionList { get; } = new Guid("{76d42d7c-f7da-4df6-92cc-b362e3a87d7b}"); + public static Guid IsEmpty { get; } = new Guid("{b416747b-537f-46f9-b855-e71ca361d265}"); + public static Guid CountGreaterThan { get; } = new Guid("{dbc516aa-0fd9-47a9-bab5-8cede4102af6}"); + public static Guid CountLessThan { get; } = new Guid("{5101eb0d-bce3-4f1e-b4b1-e75f68a42829}"); + public static Guid CountEqualTo { get; } = new Guid("{beef419c-4375-41f2-909a-af8dded51d04}"); + public static Guid CountGreaterThanOrEqualTo { get; } = new Guid("{3579168f-52bc-49f3-be6f-a548ac74f502}"); + public static Guid CountLessThanOrEqualTo { get; } = new Guid("{bc05d0b7-59ee-42cc-91e9-90a1e0b3ed85}"); + public static Guid SupersetOfSelectionList { get; } = new Guid("{67d2da4e-d147-4526-9a94-526f0d79ec9c}"); + public static Guid CountNotEqualTo { get; } = new Guid("{92ac4ea4-b034-4b09-be67-c39608ae2ecf}"); + public static Guid IsNotEmpty { get; } = new Guid("{aeb5a45f-2aff-4b2b-8f6d-f05f50bc8f8c}"); + public static Guid NotInSelectionList { get; } = new Guid("{7fde8600-680b-4c07-be3b-2660f00b01c2}"); + public static Guid InSelectionList { get; } = new Guid("{824417e6-61e5-4e74-9e95-514905c01846}"); + public static Guid NotSupersetOfSelectionList { get; } = new Guid("{8e695935-548a-4177-a474-581fc960eddb}"); + public static Guid NotSubsetOfSelectionList { get; } = new Guid("{ef7726d6-2feb-426c-bf2c-770014d35f68}"); + public static Guid NotExactMatchWithSelectionList { get; } = new Guid("{f08a632a-1f3e-4979-8ec5-17fefc33b865}"); + public static Guid ExactMatchWithSelectionList { get; } = new Guid("{93611da1-e21e-4021-9ddd-f7575e0c79ec}"); + } + public static class Languages + { + public static Guid English { get; } = new Guid ("{68BB6038-A4B5-4EE1-AAE9-326494942062}"); + public static Guid Spanish { get; } = new Guid ("{6dc357cb-37c3-43ed-ae13-6259fb109213}"); + public static Guid French { get; } = new Guid ("{6bf0cf09-87c9-4e21-b360-7eb5a1c279de}"); + public static Guid German { get; } = new Guid ("{c7c1d740-0d3c-493f-ab0b-fe1b42546d0a}"); + public static Guid Italian { get; } = new Guid ("{cf165170-0680-4a41-8f88-88f34b2b1986}"); + public static Guid Chinese { get; } = new Guid ("{6f908a9b-7464-4a16-aed9-7eccb8d39032}"); + public static Guid Japanese { get; } = new Guid ("{1e16de9d-0e49-4a79-b690-4905c46a94cc}"); + public static Guid Korean { get; } = new Guid ("{d03a795e-906b-49ee-87ea-c1bef4b8ee9a}"); + } } } diff --git a/mocha-dotnet/src/lib/Mocha.Core/KnownRelationshipGuids.cs b/mocha-dotnet/src/lib/Mocha.Core/KnownRelationshipGuids.cs index a21680b..fe98dd3 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/KnownRelationshipGuids.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/KnownRelationshipGuids.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // KnownRelationshipGuids.cs // @@ -57,14 +74,16 @@ namespace Mocha.Core public static Guid Relationship__has_sibling__Relationship { get; } = new Guid("{656110FF-4502-48B8-A7F3-D07F017AEA3F}"); public static Guid Translation__has__Translation_Value { get; } = new Guid("{F9B60C00-FF1D-438F-AC74-6EDFA8DD7324}"); + public static Guid Translation_Value__for__Translation { get; } = new Guid("{458c218a-9965-44ba-884b-deda5bf2931d}"); public static Guid Translation_Value__has__Language { get; } = new Guid("{3655AEC2-E2C9-4DDE-8D98-0C4D3CE1E569}"); + public static Guid Language__for__Translation_Value { get; } = new Guid("{bf885bb1-da84-447c-95dc-143ce9deac65}"); public static Guid String__has__String_Component { get; } = new Guid("{3B6C4C25-B7BC-4242-8ED1-BA6D01B834BA}"); public static Guid Extract_Single_Instance_String_Component__has__Relationship { get; } = new Guid("{5E499753-F50F-4A9E-BF53-DC013820499C}"); public static Guid Instance_Attribute_String_Component__has__Attribute { get; } = new Guid("{E15D4277-69FB-4F19-92DB-8D087F361484}"); public static Guid String_Component__has_source__Method { get; } = new Guid("{1ef1c965-e120-48be-b682-aa040573b5fb}"); - public static Guid Class__instance_labeled_by__String { get; } = new Guid("{F52FC851-D655-48A9-B526-C5FE0D7A29D2}"); + public static Guid Class__instance_labeled_by__Return_Attribute_Method_Binding { get; } = new Guid("{F52FC851-D655-48A9-B526-C5FE0D7A29D2}"); public static Guid Class__has_summary__Report_Field { get; } = new Guid("{D11050AD-7376-4AB7-84DE-E8D0336B74D2}"); public static Guid Class__has_related__Task { get; } = new Guid("{4D8670E1-2AF1-4E7C-9C87-C910BD7B319B}"); @@ -101,8 +120,10 @@ namespace Mocha.Core public static Guid Parameter_Assignment__assigns_to__Parameter { get; } = new Guid("{a6d30e78-7bff-4fcc-b109-ee96681b0a9e}"); public static Guid Parameter__assigned_from__Parameter_Assignment { get; } = new Guid("{2085341e-5e7e-4a7f-bb8d-dfa58f6030d9}"); - public static Guid Method_Binding__assigned_to__Parameter_Assignment { get; } = new Guid("{cbcb23b7-10c4-49eb-a1ca-b9da73fe8b83}"); - public static Guid Parameter_Assignment__assigns_from__Method_Binding { get; } = new Guid("{1e055d30-a968-49d8-93fe-541994fc0c51}"); + public static Guid Executable_returning_Work_Data__assigned_from__Parameter_Assignment { get; } = new Guid("{40540642-69b3-4713-ac55-6946060bd385}"); + public static Guid Parameter_Assignment__assigns_from__Executable_returning_Work_Data { get; } = new Guid("{6f3687ed-7d88-4ece-914e-c47c57c1146d}"); + public static Guid Parameter_Assignment__assigns_to__Work_Data { get; } = new Guid("{51c37636-35d2-4528-99ca-50cf09fa1427}"); + public static Guid Work_Data__assigned_by__Parameter_Assignment { get; } = new Guid("{b9e0cc99-ef20-435f-b7b2-e19c5cd44916}"); public static Guid Method_Call__has__Method { get; } = new Guid("{3D3B601B-4EF0-49F3-AF05-86CEA0F00619}"); public static Guid Method_Call__has__Prompt_Value { get; } = new Guid("{765BD0C9-117D-4D0E-88C9-2CEBD4898135}"); @@ -114,18 +135,40 @@ namespace Mocha.Core public static Guid Validation__has_failure_message__Translation { get; } = new Guid("{E15A97DD-2A1D-4DC0-BD6B-A957B63D9802}"); public static Guid Translation__failure_message_for__Validation { get; } = new Guid("{46a7dfcb-8848-47d5-9ad3-d27fbd8b423f}"); + public static Guid Build_Attribute_Method__returns__Attribute { get; } = new Guid("{dadbf0f3-7af0-4387-a6b7-a1724a216d88}"); + public static Guid Attribute__returned_by__Build_Attribute_Method { get; } = new Guid("{d5a6062b-2e84-46a1-8f54-da630ef6a48c}"); + public static Guid Get_Attribute_Method__returns__Attribute { get; } = new Guid("{5eca9b3f-be75-4f6e-8495-781480774833}"); public static Guid Attribute__returned_by__Get_Attribute_Method { get; } = new Guid("{e82ace2e-84b7-4912-89ed-7b8efd63bb5d}"); + public static Guid Get_Attribute_by_System_Routine_Method__returns__Attribute { get; } = new Guid("{e19cf181-b5bf-4595-b5c6-b9098a7a41bb}"); + public static Guid Attribute__returned_by__Get_Attribute_by_System_Routine_Method { get; } = new Guid("{b6f2981f-d324-4d4a-b2df-1d866825e75e}"); + public static Guid Get_Attribute_by_System_Routine_Method__uses__System_Attribute_Routine { get; } = new Guid("{f7aaac2c-0bfd-4b31-8c8c-3a76e9522574}"); + public static Guid System_Attribute_Routine__used_by__Get_Attribute_by_System_Routine_Method { get; } = new Guid("{57b3a574-9f0c-4723-a32f-bde523d7e773}"); + public static Guid Get_Referenced_Instance_Set_Method__loop_on__Instance_Set { get; } = new Guid("{2978238f-7cb0-4ba3-8c6f-473df782cfef}"); public static Guid Get_Referenced_Instance_Set_Method__has_relationship__Method { get; } = new Guid("{6a65819e-c8cb-4575-9af8-ee221364049b}"); - public static Guid Get_Referenced_Attribute_Method__has__Attribute { get; } = new Guid("{87f90fe9-5ec6-4b09-8f51-b8a4d1544cae}"); - public static Guid Get_Referenced_Attribute_Method__loop_on__Instance_Set { get; } = new Guid("{c7ecd498-6d05-4e07-b1bc-f7127d0d6666}"); + public static Guid Get_Referenced_Attribute_Method__returns__Attribute { get; } = new Guid("{87f90fe9-5ec6-4b09-8f51-b8a4d1544cae}"); + public static Guid Attribute__returned_by__Get_Referenced_Attribute_Method { get; } = new Guid("{80e4ffd8-77d8-4835-a4e0-73a176e7f646}"); + public static Guid Get_Referenced_Attribute_Method__uses_reference__Executable_returning_Instance_Set { get; } = new Guid("{c7ecd498-6d05-4e07-b1bc-f7127d0d6666}"); + public static Guid Executable_returning_Instance_Set__reference_used_by__Get_Referenced_Attribute_Method { get; } = new Guid("{b9a44398-e6c5-48f9-8ec5-a8b158a7adf5}"); + public static Guid Get_Referenced_Attribute_Method__uses_answer__Executable_returning_Attribute { get; } = new Guid("{022ccde3-2b9e-4573-a8fc-e7568f420cd3}"); + public static Guid Executable_returning_Attribute__answer_used_by__Get_Referenced_Attribute_Method { get; } = new Guid("{738ff9a4-eb71-476e-a0a4-524f1de56add}"); + + public static Guid Get_Referenced_Attribute_Method__uses__Accumulation_Function { get; } = new Guid("{68888355-a162-40b3-8dd6-532bf84d219a}"); + public static Guid Accumulation_Function__used_by__Get_Referenced_Attribute_Method { get; } = new Guid("{a3af2e78-78ab-4c99-a2d2-f359aa7966cd}"); + public static Guid Get_Referenced_Attribute_Method__uses_order__Executable_returning_Attribute { get; } = new Guid("{ee8e21c4-1afc-403a-a3f0-4c1544285f5c}"); + public static Guid Executable_returning_Attribute__order_used_by__Get_Referenced_Attribute_Method { get; } = new Guid("{dec00186-e3c8-4440-ae23-dc9e91bccb49}"); public static Guid Evaluate_Boolean_Expression_Method__has_source_attribute__Method { get; } = new Guid("{45d76d56-01ed-4641-9f68-cfe0c7d0d265}"); public static Guid Evaluate_Boolean_Expression_Method__equal_to_attribute__Method { get; } = new Guid("{0646df91-7e3e-4d59-be71-b978a22ced8e}"); + public static Guid Assign_Attribute_Method__uses__Executable_returning_Attribute { get; } = new Guid("{9313f96e-58af-416f-852e-ef83725057fc}"); + public static Guid Executable_returning_Attribute__used_by__Assign_Attribute_Method { get; } = new Guid("{cd8fd04c-dcdd-4dc8-9d5c-e8f83d080cb8}"); + public static Guid Assign_Attribute_Method__assigns__Attribute { get; } = new Guid("{74061875-8a27-403b-9456-02e52cfd13b2}"); + public static Guid Attribute__assigned_by__Assign_Attribute_Method { get; } = new Guid("{d3b540e8-0f52-4595-bf52-1968637da59a}"); + public static Guid Prompt_Value__has__Prompt { get; } = new Guid("{7CD62362-DDCE-4BFC-87B9-B5499B0BC141}"); public static Guid User__has_display_name__Translatable_Text_Constant { get; } = new Guid("{6C29856C-3B10-4F5B-A291-DD3CA4C04A2F}"); @@ -200,8 +243,8 @@ namespace Mocha.Core public static Guid Tenant__has_logo_image__File { get; } = new Guid("{4C399E80-ECA2-4A68-BFB4-26A5E6E97047}"); public static Guid Tenant__has_background_image__File { get; } = new Guid("{39B0D963-4BE0-49C8-BFA2-607051CB0101}"); public static Guid Tenant__has_icon_image__File { get; } = new Guid("{CC4E65BD-7AAA-40DA-AECA-C607D7042CE3}"); - public static Guid Tenant__has_login_header__Translatable_Text_Constant { get; } = new Guid("{41D66ACB-AFDE-4B6F-892D-E66255F10DEB}"); - public static Guid Tenant__has_login_footer__Translatable_Text_Constant { get; } = new Guid("{A6203B6B-5BEB-4008-AE49-DB5E7DDBA45B}"); + public static Guid Tenant__has_login_header__Translation { get; } = new Guid("{41D66ACB-AFDE-4B6F-892D-E66255F10DEB}"); + public static Guid Tenant__has_login_footer__Translation { get; } = new Guid("{A6203B6B-5BEB-4008-AE49-DB5E7DDBA45B}"); public static Guid Tenant__has_application_title__Translation { get; } = new Guid("{76683437-67ba-46d9-a5e7-2945be635345}"); public static Guid Tenant__has_mega__Menu { get; } = new Guid("{cdd743cb-c74a-4671-9922-652c7db9f2d8}"); @@ -217,7 +260,9 @@ namespace Mocha.Core public static Guid Method__provides_content_for__Content_Page_Component { get; } = new Guid("{5E75000D-2421-4AD4-9E5F-B9FDD9CB4744}"); public static Guid Securable_Item__secured_by__Method { get; } = new Guid("{15199c49-9595-4288-846d-13b0ad5dcd4b}"); - public static Guid Get_Relationship_Method__has__Relationship { get; } = new Guid("{321581d6-60c1-4547-8344-9d5bda027adc}"); + + public static Guid Get_Relationship_Method__returns__Relationship { get; } = new Guid("{321581d6-60c1-4547-8344-9d5bda027adc}"); + public static Guid Relationship__returned_by__Get_Relationship_Method { get; } = new Guid("{174242ec-7615-42d9-9639-c70ff6e84e0d}"); public static Guid Integration_ID__has__Integration_ID_Usage { get; } = new Guid("{6cd30735-df83-4253-aabe-360d6e1a3701}"); public static Guid Integration_ID_Usage__for__Integration_ID { get; } = new Guid("{d8d981ec-7686-40da-b89f-006c85042444}"); @@ -228,11 +273,11 @@ namespace Mocha.Core public static Guid Conditional_Method_Case__has_return_attribute__Method_Binding { get; } = new Guid("{b6715132-b438-4073-b81d-3ecf19584b7d}"); public static Guid Method_Binding__returns_attribute_for__Conditional_Method_Case { get; } = new Guid("{1c868a06-8fb7-432d-839b-7a5a02a50eb6}"); - public static Guid Conditional_Method_Case__has_true_condition__Method_Binding { get; } = new Guid("{d955da3f-7ef4-4374-8b86-167c73434f75}"); - public static Guid Method_Binding__true_condition_for__Conditional_Method_Case { get; } = new Guid("{1acdefd1-e1b4-45bb-99e1-bf73dea71da5}"); + public static Guid Condition_Group__has_true_condition__Executable_returning_Work_Data { get; } = new Guid("{d955da3f-7ef4-4374-8b86-167c73434f75}"); + public static Guid Executable_returning_Work_Data__true_condition_for__Condition_Group { get; } = new Guid("{1acdefd1-e1b4-45bb-99e1-bf73dea71da5}"); - public static Guid Conditional_Method_Case__has_false_condition__Method_Binding { get; } = new Guid("{e46dbc4f-ae8d-4ad8-b9e6-10cedfa68b73}"); - public static Guid Method_Binding__false_condition_for__Conditional_Method_Case { get; } = new Guid("{633af008-bf7f-4da1-94d6-67a9a80586d6}"); + public static Guid Condition_Group__has_false_condition__Executable_returning_Work_Data { get; } = new Guid("{e46dbc4f-ae8d-4ad8-b9e6-10cedfa68b73}"); + public static Guid Executable_returning_Work_Data__false_condition_for__Condition_Group { get; } = new Guid("{633af008-bf7f-4da1-94d6-67a9a80586d6}"); public static Guid Audit_Line__has__Instance { get; } = new Guid("{c91807ed-0d73-4729-990b-d90750764fb5}"); public static Guid Audit_Line__has__User { get; } = new Guid("{7c1e048d-3dcb-4473-9f2e-e21014a76aa5}"); @@ -285,5 +330,43 @@ namespace Mocha.Core public static Guid Style__implements__Style { get; } = new Guid("{99b1c16a-f2cb-4cc5-a3bb-82a96335aa39}"); public static Guid Style__implemented_for__Style { get; } = new Guid("{271ef816-1e94-4f02-a805-4f9536c28dca}"); + + public static Guid Select_From_Instance_Set_Method__returns__Work_Set { get; } = new Guid("{e7805b49-0eb3-46ea-bc8a-a5ed676a7726}"); + public static Guid Work_Set__returned_by__Select_from_Instance_Set_Method { get; } = new Guid("{df12608a-e157-4a1b-bae2-0224a18f5b94}"); + public static Guid Select_from_Instance_Set_Method__uses__Executable_returning_Instance_Set { get; } = new Guid("{a907f814-b996-4294-b347-ca16ccaf1f5b}"); + public static Guid Executable_returning_Instance_Set__used_by__Select_from_Instance_Set_Method { get; } = new Guid("{a3ec06f9-54e8-4279-a31d-d221f8697a6a}"); + public static Guid Select_from_Instance_Set_Method__uses__Set_Function { get; } = new Guid("{abda76ae-a969-40e3-aed2-1a20fcec8b31}"); + public static Guid Set_Function__used_by__Select_from_Instance_Set_Method { get; } = new Guid("{753f9f4f-3fe3-470a-890d-d799c24e47af}"); + public static Guid Select_from_Instance_Set_Method__uses__Selection_Function { get; } = new Guid("{6498e72e-f321-4be2-acfd-dfd6f916ce54}"); + public static Guid Selection_Function__used_by__Select_from_Instance_Set_Method { get; } = new Guid("{e5e6a392-a436-41f7-bc80-cb6603503be1}"); + public static Guid Select_from_Instance_Set_Method__uses_function__Executable_returning_Attribute { get; } = new Guid("{30905c53-0d64-4332-9023-12a03e60cd09}"); + public static Guid Executable_returning_Attribute__function_used_by__Select_from_Instance_Set_Method { get; } = new Guid("{79adb5ea-0257-445b-9f7c-e5f8508a59a2}"); + public static Guid Select_from_Instance_Set_Method__uses_order__Executable_returning_Attribute { get; } = new Guid("{c7a5ef47-fce3-4e7c-87b8-f5cab93b1b10}"); + public static Guid Executable_returning_Attribute__order_used_by__Select_from_Instance_Set_Method { get; } = new Guid("{48c984ea-f4da-4090-bdd0-fd659b9be13d}"); + public static Guid Select_from_Instance_Set_Method__uses_subset_index__Executable_returning_Attribute { get; } = new Guid("{b5ef8d8b-683a-4cb9-9e6c-bc470324f4e3}"); + public static Guid Executable_returning_Attribute__as_subset_index_for__Select_from_Instance_Set_Method { get; } = new Guid("{7d03574f-db28-4aff-a96c-8013832b8269}"); + public static Guid Select_from_Instance_Set_Method__uses_comparator__Executable_returning_Work_Data { get; } = new Guid("{974c6e8b-b04f-4e3c-8719-298052afa9c7}"); + public static Guid Executable_returning_Work_Data__comparator_for__Select_from_Instance_Set_Method { get; } = new Guid("{c877ea85-ee9f-4e22-bae7-4a0d7b9272e1}"); + + public static Guid Conditional_Select_From_Instance_Set_Method__returns__Work_Set { get; } = new Guid("{49396bd0-b5a9-4384-99f4-2126d80b3b66}"); + public static Guid Work_Set__returned_by__Conditional_Select_from_Instance_Set_Method { get; } = new Guid("{221a23dd-1230-4690-a15a-26345b111b0d}"); + public static Guid Conditional_Select_from_Instance_Set_Method__has__Conditional_Select_from_Instance_Set_Case { get; } = new Guid("{b6715132-b438-4073-b81d-3ecf19584b7d}"); + public static Guid Conditional_Select_from_Instance_Set_Case__for__Conditional_Select_from_Instance_Set_Method { get; } = new Guid("{8fde1baa-ce2e-4245-a775-bc4c66eac7b5}"); + + public static Guid Conditional_Select_Attribute_Method__returns__Attribute { get; } = new Guid("{b2b9d9cc-c4dd-491b-853e-e3669ea4e66a}"); + public static Guid Attribute__returned_by__Conditional_Select_Attribute_Method { get; } = new Guid("{e3e734ce-953b-49b8-b50d-b1826b519053}"); + public static Guid Conditional_Select_Attribute_Method__has__Conditional_Select_Attribute_Case { get; } = new Guid("{49396bd0-b5a9-4384-99f4-2126d80b3b66}"); + public static Guid Conditional_Select_Attribute_Case__for__Conditional_Select_Attribute_Method { get; } = new Guid("{38e2816e-ccb4-4e89-86ab-4981f5c2d7ac}"); + + + public static Guid Evaluate_Boolean_Expression_Method__returns__Boolean_Attribute { get; } = new Guid("{53cf2cb6-f5f2-499f-9f18-26b86bf671c4}"); + public static Guid Boolean_Attribute__returned_by__Evaluate_Boolean_Expression_Method { get; } = new Guid("{24397b98-65da-4f5a-93a3-e933bab1f59b}"); + public static Guid Evaluate_Boolean_Expression_Method__has_source__Executable_returning_Work_Data { get; } = new Guid("{45d76d56-01ed-4641-9f68-cfe0c7d0d265}"); + public static Guid Executable_returning_Work_Data__source_for__Evaluate_Boolean_Expression_Method { get; } = new Guid("{eef048af-179e-4375-8a85-2856bb14aea3}"); + public static Guid Evaluate_Boolean_Expression_Method__has_target__Executable_returning_Work_Data { get; } = new Guid("{0646df91-7e3e-4d59-be71-b978a22ced8e}"); + public static Guid Executable_returning_Work_Data__target_for__Evaluate_Boolean_Expression_Method { get; } = new Guid("{be7a6285-d700-40f3-868e-c0878a3e94a6}"); + public static Guid Evaluate_Boolean_Expression_Method__uses__Boolean_Operator { get; } = new Guid("{aa9e17a2-e4d9-4598-bcfc-2d729031d11c}"); + public static Guid Boolean_Operator__used_by__Evaluate_Boolean_Expression_Method { get; } = new Guid("{1e9915a9-3c91-4532-ab9c-82419660e31a}"); + } } diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementation.cs new file mode 100644 index 0000000..d890ebe --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementation.cs @@ -0,0 +1,46 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core; + +public abstract class MethodImplementation +{ + public abstract Guid MethodClassGuid { get; } + + protected abstract InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method); + public InstanceHandle Execute(Oms oms, OmsContext context, InstanceHandle method) + { + return ExecuteInternal(oms, context, method); + } + + protected InstanceHandle r_Method__for__Class; + + public bool Initialized { get; private set; } = false; + protected virtual void InitializeInternal(Oms oms) + { + r_Method__for__Class = oms.GetInstance(KnownRelationshipGuids.Method__for__Class); + } + public void Initialize(Oms oms) + { + if (Initialized) + return; + + InitializeInternal(oms); + Initialized = true; + } + +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/AssignAttributeMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/AssignAttributeMethodImplementation.cs new file mode 100644 index 0000000..9659cde --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/AssignAttributeMethodImplementation.cs @@ -0,0 +1,43 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.MethodImplementations; + +public class AssignAttributeMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.AssignAttributeMethod; + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class)); + InstanceHandle irForInstance = (InstanceHandle) context.GetWorkData(irForClass); + + InstanceHandle assignsAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Assign_Attribute_Method__assigns__Attribute)); + + if (assignsAttribute == InstanceHandle.Empty) + { + throw new InvalidOperationException("no assigns Attribute specified for method"); + } + + InstanceHandle assignsFrom = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Assign_Attribute_Method__uses__Executable_returning_Attribute)); + InstanceHandle assignsFromValue = oms.Execute(context, assignsFrom); + + // InstanceHandle forInstance = (InstanceHandle) context.GetWorkData(irForClass); + object? value = context.GetWorkData(assignsFromValue); + oms.SetAttributeValue(irForInstance, assignsAttribute, value); + return InstanceHandle.Empty; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/BuildAttributeMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/BuildAttributeMethodImplementation.cs new file mode 100644 index 0000000..4a5ab0b --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/BuildAttributeMethodImplementation.cs @@ -0,0 +1,38 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.MethodImplementations; + +public class BuildAttributeMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.BuildAttributeMethod; + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class)); + InstanceHandle returnsAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Build_Attribute_Method__returns__Attribute)); + + if (returnsAttribute == InstanceHandle.Empty) + { + throw new InvalidOperationException("no return Attribute specified for method"); + } + + // InstanceHandle forInstance = (InstanceHandle) context.GetWorkData(irForClass); + object? value = oms.UnsafeGetAttributeValue(method, oms.GetInstance(KnownAttributeGuids.Text.Value)); + context.SetWorkData(returnsAttribute, value); + return returnsAttribute; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/ConditionalSelectAttributeMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/ConditionalSelectAttributeMethodImplementation.cs new file mode 100644 index 0000000..08b6d5d --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/ConditionalSelectAttributeMethodImplementation.cs @@ -0,0 +1,77 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.MethodImplementations; + +public class ConditionalSelectAttributeMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.ConditionalSelectAttributeMethod; + + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + InstanceHandle returnsAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Conditional_Select_Attribute_Method__returns__Attribute)); + + IReadOnlyCollection cases = oms.GetRelatedInstances(method, oms.GetInstance(KnownRelationshipGuids.Conditional_Select_Attribute_Method__has__Conditional_Select_Attribute_Case)); + foreach (InstanceHandle cas in cases) + { + bool value = false; + + IEnumerable trueConditions = oms.GetRelatedInstances(cas, oms.GetInstance(KnownRelationshipGuids.Condition_Group__has_true_condition__Executable_returning_Work_Data)); + IEnumerable falseConditions = oms.GetRelatedInstances(cas, oms.GetInstance(KnownRelationshipGuids.Condition_Group__has_false_condition__Executable_returning_Work_Data)); + bool useAnyCondition = oms.GetAttributeValue(cas, oms.GetInstance(KnownAttributeGuids.Boolean.UseAnyCondition)); + if (trueConditions != null) + { + foreach (InstanceHandle trueCondition in trueConditions) + { + InstanceHandle ret = oms.Execute(context, trueCondition); + object? retval = context.GetWorkData(ret); + if (retval is bool && ((bool)retval)) + { + value = true; + break; + } + } + } + if (falseConditions != null) + { + foreach (InstanceHandle falseCondition in falseConditions) + { + InstanceHandle ret = oms.Execute(context, falseCondition); + object? retval = context.GetWorkData(ret); + if (retval is bool && (!(bool)retval)) + { + value = true; + break; + } + } + } + + if (value) + { + InstanceHandle execAttr = oms.GetRelatedInstance(cas, oms.GetInstance(KnownRelationshipGuids.Conditional_Select_Attribute_Case__invokes__Executable_returning_Attribute)); + InstanceHandle hwd = oms.Execute(context, execAttr); + object? val = context.GetWorkData(hwd); + + context.SetWorkData(returnsAttribute, val); + break; // we don't need to check another case do we? + } + } + + return returnsAttribute; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/ConditionalSelectFromInstanceSetMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/ConditionalSelectFromInstanceSetMethodImplementation.cs new file mode 100644 index 0000000..82d1142 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/ConditionalSelectFromInstanceSetMethodImplementation.cs @@ -0,0 +1,29 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.MethodImplementations; + +public class ConditionalSelectFromInstanceSetMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.ConditionalSelectFromInstanceSetMethod; + + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/EvaluateBooleanExpressionMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/EvaluateBooleanExpressionMethodImplementation.cs new file mode 100644 index 0000000..9690531 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/EvaluateBooleanExpressionMethodImplementation.cs @@ -0,0 +1,83 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using System.Formats.Asn1; +using MBS.Core.Collections; + +namespace Mocha.Core.MethodImplementations; + +public class EvaluateBooleanExpressionMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.EvaluateBooleanExpressionMethod; + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + InstanceHandle c_Class = oms.GetInstance(KnownInstanceGuids.Classes.Class); + + InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class)); + InstanceHandle returnsAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__returns__Boolean_Attribute)); + + if (returnsAttribute == InstanceHandle.Empty) + { + throw new InvalidOperationException("no return Attribute specified for method"); + } + + + /* + IEnumerable source = oms.GetRelatedInstances(method, oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_source__Executable_returning_Work_Data)); + InstanceHandle comparison = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__uses__Boolean_Operator)); + IEnumerable target = oms.GetRelatedInstances(method, oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_target__Executable_returning_Work_Data)); + */ + + InstanceHandle source = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_source__Executable_returning_Work_Data)); + InstanceHandle comparison = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__uses__Boolean_Operator)); + InstanceHandle target = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_target__Executable_returning_Work_Data)); + + InstanceHandle[] rtarget_value = new InstanceHandle[0]; + + InstanceHandle rsource = oms.Execute(context, source); + object? rsource_valueraw = context.GetWorkData(rsource); + + InstanceHandle[] rsource_value = new InstanceHandle[0]; + if (rsource_valueraw is InstanceHandle[]) + { + rsource_value = (InstanceHandle[])rsource_valueraw; + } + + if (oms.IsInstanceOf(target, c_Class)) + { + rtarget_value = new InstanceHandle[] { target }; + } + else + { + InstanceHandle rtarget = oms.Execute(context, target); + object? rtarget_valueraw = context.GetWorkData(rtarget); + } + + bool value = false; + + if (comparison == oms.GetInstance(KnownInstanceGuids.RelationalOperators.InSelectionList)) + { + if (rtarget_value.ContainsAny(rsource_value)) + { + value = true; + } + } + + context.SetWorkData(returnsAttribute, value); + return returnsAttribute; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetAttributeBySystemRoutineMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetAttributeBySystemRoutineMethodImplementation.cs new file mode 100644 index 0000000..eb3c808 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetAttributeBySystemRoutineMethodImplementation.cs @@ -0,0 +1,38 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.MethodImplementations; + +public class GetAttributeBySystemRoutineMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.GetAttributeBySystemRoutineMethod; + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class)); + InstanceHandle returnsAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Get_Attribute_by_System_Routine_Method__returns__Attribute)); + InstanceHandle usesSystemAttributeRoutine = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Get_Attribute_by_System_Routine_Method__uses__System_Attribute_Routine)); + + if (returnsAttribute == InstanceHandle.Empty) + { + throw new InvalidOperationException("no return Attribute specified for method"); + } + + object? value = oms.ExecuteSystemRoutine(context, usesSystemAttributeRoutine); + context.SetWorkData(returnsAttribute, value); + return returnsAttribute; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetAttributeMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetAttributeMethodImplementation.cs new file mode 100644 index 0000000..968e53c --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetAttributeMethodImplementation.cs @@ -0,0 +1,43 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.MethodImplementations; + +public class GetAttributeMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.GetAttributeMethod; + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class)); + InstanceHandle returnsAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Get_Attribute_Method__returns__Attribute)); + + if (returnsAttribute == InstanceHandle.Empty) + { + throw new InvalidOperationException("no Work Set specified for method"); + } + + InstanceHandle? forInstance = (InstanceHandle?) context.GetWorkData(irForClass); + if (forInstance == null) + { + throw new NullReferenceException(String.Format("non-static method call without instance reference {0}", oms.GetGlobalIdentifier(irForClass))); + } + + object? value = oms.UnsafeGetAttributeValue((InstanceHandle) forInstance, returnsAttribute); + context.SetWorkData(returnsAttribute, value); + return returnsAttribute; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetReferencedAttributeMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetReferencedAttributeMethodImplementation.cs new file mode 100644 index 0000000..e6b7312 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetReferencedAttributeMethodImplementation.cs @@ -0,0 +1,97 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.MethodImplementations; + +public class GetReferencedAttributeMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.GetReferencedAttributeMethod; + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + Guid methodId = oms.GetGlobalIdentifier(method); + + InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class)); + + InstanceHandle returnsAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__returns__Attribute)); + InstanceHandle referenceInstanceSet = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_reference__Executable_returning_Instance_Set)); + InstanceHandle answerAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_answer__Executable_returning_Attribute)); + InstanceHandle usesAccumulationFunction = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses__Accumulation_Function)); + InstanceHandle usesOrderAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_order__Executable_returning_Attribute)); + + if (returnsAttribute == InstanceHandle.Empty) + { + throw new InvalidOperationException(String.Format("no return Attribute specified for method {0}", methodId)); + } + + InstanceHandle referenceInstanceSetWS = oms.Execute(context, referenceInstanceSet); + object? referenceInstanceSetValue = context.GetWorkData(referenceInstanceSetWS); + if (referenceInstanceSetValue is IReadOnlyCollection) + { + IReadOnlyCollection list = (IReadOnlyCollection)referenceInstanceSetValue; + object? retval = null; + int avg_c = 0; + + foreach (InstanceHandle inst in list) + { + InstanceHandle pclass = oms.GetParentClass(inst); + context.SetWorkData(pclass, inst); + + InstanceHandle answerAttributeValueWD = oms.Execute(context, answerAttribute); + object? answerAttributeValue = context.GetWorkData(answerAttributeValueWD); + + if (usesAccumulationFunction == oms.GetInstance(KnownInstanceGuids.AccumulationFunctions.Sum)) + { + if (retval == null) + { + retval = 0M; + } + if (retval is decimal && answerAttributeValue is decimal) + { + retval = (decimal)retval + (decimal)answerAttributeValue; + } + } + else if (usesAccumulationFunction == oms.GetInstance(KnownInstanceGuids.AccumulationFunctions.Average)) + { + if (retval == null) + { + retval = 0M; + } + if (retval is decimal && answerAttributeValue is decimal) + { + retval = (decimal)retval + (decimal)answerAttributeValue; + avg_c++; + } + } + else + { + retval = answerAttributeValue; + } + } + + if (avg_c > 0) + { + retval = (decimal)retval / avg_c; + } + context.SetWorkData(returnsAttribute, retval); + } + + // 1$12740 NIM - Native Instance Set Method + // 1$12741 NAM - Native Attribute Method + // 1$12742 NUM - Native Update Method + return returnsAttribute; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetRelationshipMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetRelationshipMethodImplementation.cs new file mode 100644 index 0000000..80d1296 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetRelationshipMethodImplementation.cs @@ -0,0 +1,66 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using System.ComponentModel.Design; + +namespace Mocha.Core.MethodImplementations; + +public class GetRelationshipMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.GetRelationshipMethod; + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + Guid methodId = oms.GetGlobalIdentifier(method); + + InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class)); + + InstanceHandle? forClassInstanceV = context.GetWorkData(irForClass); + + bool singular = oms.GetAttributeValue(method, oms.GetInstance(KnownAttributeGuids.Boolean.Singular), false); + + InstanceHandle returnsRelationship = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Get_Relationship_Method__returns__Relationship)); + if (returnsRelationship == InstanceHandle.Empty) + { + throw new InvalidOperationException(String.Format("no return Relationship specified for method {0}", methodId)); + } + + IEnumerable ihs = new InstanceHandle[0]; + + // HACK: there is no `GR - Get Relationship Method.returns Work Set` + if (forClassInstanceV != null) + { + ihs = oms.GetRelatedInstances((InstanceHandle)forClassInstanceV, returnsRelationship); + } + + if (singular) + { + if (ihs.Count() > 0) + { + context.SetWorkData(returnsRelationship, ihs.First()); + } + else + { + context.SetWorkData(returnsRelationship, null); + } + } + else + { + context.SetWorkData(returnsRelationship, ihs); + } + return returnsRelationship; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetSpecifiedInstancesMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetSpecifiedInstancesMethodImplementation.cs new file mode 100644 index 0000000..6750e33 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/GetSpecifiedInstancesMethodImplementation.cs @@ -0,0 +1,44 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.MethodImplementations; + +public class GetSpecifiedInstancesMethodImplementation : MethodImplementation +{ + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.GetSpecifiedInstancesMethod; + protected InstanceHandle r_Get_Specified_Instances_Method__returns__Work_Set, r_Get_Specified_Instances_Method__uses__Instance; + protected override void InitializeInternal(Oms oms) + { + base.InitializeInternal(oms); + r_Get_Specified_Instances_Method__returns__Work_Set = oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__returns__Work_Set); + r_Get_Specified_Instances_Method__uses__Instance = oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__uses__Instance); + } + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + InstanceHandle irForClass = oms.GetRelatedInstance(method, r_Method__for__Class); + InstanceHandle returnsWorkSet = oms.GetRelatedInstance(method, r_Get_Specified_Instances_Method__returns__Work_Set); + IReadOnlyCollection irUsesInstance = oms.GetRelatedInstances(method, r_Get_Specified_Instances_Method__uses__Instance); + + if (returnsWorkSet == InstanceHandle.Empty) + { + throw new InvalidOperationException("no Work Set specified for method"); + } + + context.SetWorkData(returnsWorkSet, irUsesInstance); + return returnsWorkSet; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/SelectFromInstanceSetMethodImplementation.cs b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/SelectFromInstanceSetMethodImplementation.cs new file mode 100644 index 0000000..fd17044 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/MethodImplementations/SelectFromInstanceSetMethodImplementation.cs @@ -0,0 +1,96 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using System.ComponentModel.Design; +using Mocha.Core.Oop; + +namespace Mocha.Core.MethodImplementations; + +public class SelectFromInstanceSetMethodImplementation : MethodImplementation +{ + private struct OrderableData + { + public string Order; + public object Data; + } + + public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.SelectFromInstanceSetMethod; + protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method) + { + Guid methodId = oms.GetGlobalIdentifier(method); + + InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class)); + InstanceHandle? forClassInstanceV = context.GetWorkData(irForClass); + + InstanceHandle returnsWorkSet = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Select_From_Instance_Set_Method__returns__Work_Set)); + if (returnsWorkSet == InstanceHandle.Empty) + { + throw new InvalidOperationException(String.Format("no return Work Set specified for method {0}", methodId)); + } + + InstanceHandle usesInstanceSet = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Executable_returning_Instance_Set)); + object? instanceSetValues = context.GetWorkData(usesInstanceSet); + + InstanceHandle selectionFunction = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Selection_Function)); + InstanceHandle setFunction = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Set_Function)); + InstanceHandle orderAttribute = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses_order__Executable_returning_Attribute)); + + List list = new List(); + + if (instanceSetValues is IEnumerable) + { + + } + else if (instanceSetValues is IEnumerable) + { + IEnumerable vals = (IEnumerable)instanceSetValues; + foreach (InstanceWrapper inst in vals) + { + OrderableData od = new OrderableData(); + od.Data = inst.Handle; + if (orderAttribute != InstanceHandle.Empty) + { + InstanceHandle ihWorkData = oms.Execute(context, orderAttribute, inst.Handle); + string order = context.GetWorkData(ihWorkData); + + od.Order = order; + } + else + { + od.Order = String.Empty; + } + list.Add(od); + } + + list.Sort((c, d) => c.Order.CompareTo(d.Order)); + } + + if (list.Count > 0) + { + // FIXME: this assumes a hardcoded singular work set + if (selectionFunction == oms.GetInstance(KnownInstanceGuids.SelectionFunctions.Minimum)) + { + context.SetWorkData(returnsWorkSet, list[0].Data); + } + else if (selectionFunction == oms.GetInstance(KnownInstanceGuids.SelectionFunctions.Maximum)) + { + context.SetWorkData(returnsWorkSet, list[list.Count - 1].Data); + } + } + return returnsWorkSet; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Mocha.Core.csproj b/mocha-dotnet/src/lib/Mocha.Core/Mocha.Core.csproj index 192a048..8725fb7 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Mocha.Core.csproj +++ b/mocha-dotnet/src/lib/Mocha.Core/Mocha.Core.csproj @@ -1,3 +1,22 @@ + + diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsClass.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsClass.cs index 76931d3..f92a4b2 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsClass.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsClass.cs @@ -1,19 +1,102 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using System.Diagnostics; +using System.Reflection; +using MBS.Core.Reflection; namespace Mocha.Core.Modeling; public class OmsClass { + internal OmsDatabase omsdb { get; set; } public Guid GlobalIdentifier { get; internal set; } = Guid.Empty; + + private Dictionary _attributeValuesTemp = new Dictionary(); - protected object GetAttributeValue() + protected object GetAttributeValue(object defaultValue = null) { StackTrace st = new StackTrace(); - StackFrame frame = st.GetFrame(0); - return 1; + if (st.FrameCount > 1) + { + StackFrame frame0 = st.GetFrame(0); + StackFrame frame1 = st.GetFrame(1); + + MethodBase mi = frame1.GetMethod(); + PropertyInfo? pi = mi.GetProperty(); + if (pi != null) + { + Guid propertyGlobalIdentifier = OmsDatabase.GetGlobalIdentifierForProperty(pi); + if (propertyGlobalIdentifier != Guid.Empty) + { + if (GlobalIdentifier != Guid.Empty) + { + if (pi.PropertyType == typeof(string)) + { + return omsdb.Oms.GetAttributeValue(omsdb.Oms.GetInstance(GlobalIdentifier), omsdb.Oms.GetInstance(propertyGlobalIdentifier)); + } + } + else + { + if (_attributeValuesTemp.ContainsKey(propertyGlobalIdentifier)) + { + return _attributeValuesTemp[propertyGlobalIdentifier]; + } + else + { + return defaultValue; + } + } + } + } + } + throw new InvalidOperationException(); } protected void SetAttributeValue(object value) { + StackTrace st = new StackTrace(); + if (st.FrameCount > 1) + { + StackFrame frame0 = st.GetFrame(0); + StackFrame frame1 = st.GetFrame(1); + MethodBase mi = frame1.GetMethod(); + PropertyInfo? pi = mi.GetProperty(); + if (pi != null) + { + Guid propertyGlobalIdentifier = OmsDatabase.GetGlobalIdentifierForProperty(pi); + if (propertyGlobalIdentifier != Guid.Empty) + { + if (GlobalIdentifier != Guid.Empty) + { + if (pi.PropertyType == typeof(string)) + { + omsdb.Oms.SetAttributeValue(omsdb.Oms.GetInstance(GlobalIdentifier), omsdb.Oms.GetInstance(propertyGlobalIdentifier), value); + return; + } + } + else + { + _attributeValuesTemp[propertyGlobalIdentifier] = value; + return; + } + } + } + } + throw new InvalidOperationException(); } } \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsDatabase.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsDatabase.cs index 9b977b1..4a4f9bc 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsDatabase.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsDatabase.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using System.Globalization; using System.Reflection; using MBS.Core.Reflection; @@ -267,4 +284,17 @@ public class OmsDatabase _classesByHandle[ih] = item; _handlesByClass[item] = ih; } + + public static Guid GetGlobalIdentifierForProperty(PropertyInfo pi) + { + object[] attrs = pi.GetCustomAttributes(false); + foreach (object attr in attrs) + { + if (attr is OmsGlobalIdentifierAttribute) + { + return ((OmsGlobalIdentifierAttribute)attr).GlobalIdentifier; + } + } + return Guid.Empty; + } } \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsGlobalIdentifierAttribute.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsGlobalIdentifierAttribute.cs index 2745c8b..b2ef2e3 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsGlobalIdentifierAttribute.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsGlobalIdentifierAttribute.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling; public class OmsGlobalIdentifierAttribute : Attribute diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsInstanceList.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsInstanceList.cs index 08c4381..1a39492 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsInstanceList.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsInstanceList.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using System.Collections; namespace Mocha.Core.Modeling; @@ -90,6 +107,7 @@ public class OmsInstanceList : OmsInstanceList, IList where T : OmsClass item.GlobalIdentifier = localInstanceGuid; omsdb.CreateClass(item, localClassGuid, localInstanceGuid); + item.omsdb = omsdb; } } diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNameAttribute.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNameAttribute.cs index 99bb583..7ff15f2 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNameAttribute.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNameAttribute.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling; public class OmsNameAttribute : Attribute diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNativeAttribute.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNativeAttribute.cs index abc5bea..c808755 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNativeAttribute.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNativeAttribute.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling; public abstract class OmsNativeAttribute : Attribute diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNativeRelationship.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNativeRelationship.cs index 9aa03ba..fa290c7 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNativeRelationship.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsNativeRelationship.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling; public abstract class OmsNativeRelationship : Attribute diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationship.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationship.cs index 9e785c5..1c90a53 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationship.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationship.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling; public class OmsRelationship where TSource : OmsClass where TDestination : OmsClass diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationshipTargetAttribute.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationshipTargetAttribute.cs index dc51ec7..415649d 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationshipTargetAttribute.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationshipTargetAttribute.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling; public class OmsRelationshipTargetAttribute : OmsNativeRelationship diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationshipTypeAttribute.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationshipTypeAttribute.cs index efb77ce..3cad9ae 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationshipTypeAttribute.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsRelationshipTypeAttribute.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling; public class OmsRelationshipTypeAttribute : OmsNativeAttribute diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsSIngular.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsSIngular.cs index ac8e891..d07dc54 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsSIngular.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/OmsSIngular.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling; public class OmsSingularAttribute : OmsNativeAttribute diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/PropertyImplementations/OmsNonsingularRelationshipProperty.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/PropertyImplementations/OmsNonsingularRelationshipProperty.cs index 3cd6900..2c6b4a3 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/PropertyImplementations/OmsNonsingularRelationshipProperty.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/PropertyImplementations/OmsNonsingularRelationshipProperty.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling.PropertyImplementations; public class OmsNonsingularRelationshipProperty : OmsRelationshipProperty diff --git a/mocha-dotnet/src/lib/Mocha.Core/Modeling/PropertyImplementations/OmsRelationshipProperty.cs b/mocha-dotnet/src/lib/Mocha.Core/Modeling/PropertyImplementations/OmsRelationshipProperty.cs index 76be6f6..3717e0f 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Modeling/PropertyImplementations/OmsRelationshipProperty.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Modeling/PropertyImplementations/OmsRelationshipProperty.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Modeling.PropertyImplementations; public abstract class OmsRelationshipProperty diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oms.cs b/mocha-dotnet/src/lib/Mocha.Core/Oms.cs index d8cd60f..b3fa1c7 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/Oms.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Oms.cs @@ -1,14 +1,41 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core; using System.Collections.Frozen; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Data.SqlTypes; +using System.Net; using System.Numerics; +using System.Reflection; using System.Runtime.CompilerServices; +using System.Text; using MBS.Core; +using Mocha.Core.MethodImplementations; +using Mocha.Core.Oop; public abstract class Oms { + public static Oms DebugOms { get; private set; } + + public Version RuntimeVersion { get; } = new Version(2, 0, 38762, 5); + /// /// Gets or sets the base path to which URLs are made relative. /// @@ -17,7 +44,7 @@ public abstract class Oms public string TenantName { get; set; } = String.Empty; - protected bool ValidateConstraints { get; set; } = true; + public bool ValidateConstraints { get; protected set; } = true; protected virtual void InitializeInternal() { @@ -25,6 +52,19 @@ public abstract class Oms public void Initialize() { InitializeInternal(); + DebugOms = this; + + MethodImplementation[] methodImplementations = MBS.Core.Reflection.TypeLoader.GetAvailableTypes(new System.Reflection.Assembly[] { Assembly.GetExecutingAssembly() }); + foreach (MethodImplementation impl in methodImplementations) + { + if (TryGetInstance(impl.MethodClassGuid, out InstanceHandle methodClassInstance)) + { + RegisterMethodImplementation(methodClassInstance, impl); + } + else{ + Console.WriteLine("failed to load method type '{0}' from instance {1} (inst not found)", impl.GetType().FullName, impl.MethodClassGuid); + } + } } private Dictionary _tenantsByName = new Dictionary(); @@ -36,7 +76,15 @@ public abstract class Oms protected abstract TenantHandle CreateTenantInternal(string tenantName); public TenantHandle CreateTenant(string tenantName) { - return CreateTenantInternal(tenantName); + Console.WriteLine("oms: creating tenant '{0}'", tenantName); + + TenantHandle tenant = CreateTenantInternal(tenantName); + RegisterTenant(tenantName, tenant); + + SelectTenant(tenant); + InitializeTenant(); + + return tenant; } public TenantHandle GetTenantByName(string tenantName) @@ -75,7 +123,10 @@ public abstract class Oms { return GetGlobalIdentifierInternal(instance); } - + public Guid GetGlobalIdentifier(InstanceWrapper wrapper) + { + return GetGlobalIdentifier(wrapper.Handle); + } protected abstract void AssignRelationshipInternal(InstanceHandle source, InstanceHandle relationship, IEnumerable targets, DateTime effectiveDate); public void AssignRelationship(InstanceHandle source, InstanceHandle relationship, IEnumerable targets, DateTime effectiveDate) @@ -132,15 +183,61 @@ public abstract class Oms ClearRelationshipInternal(source, relationship); } - protected abstract InstanceHandle GetInstanceInternal(Guid globalIdentifier); - protected abstract InstanceHandle GetInstanceInternal(InstanceKey ik); + protected abstract bool TryGetInstanceInternal(Guid globalIdentifier, out InstanceHandle inst); + public bool TryGetInstance(Guid globalIdentifier, out InstanceHandle inst) + { + return TryGetInstanceInternal(globalIdentifier, out inst); + } + protected abstract bool TryGetInstanceInternal(InstanceKey ik, out InstanceHandle inst); + public bool TryGetInstance(InstanceKey ik, out InstanceHandle inst) + { + return TryGetInstanceInternal(ik, out inst); + } public InstanceHandle GetInstance(Guid globalIdentifier) { - return GetInstanceInternal(globalIdentifier); + if (TryGetInstance(globalIdentifier, out InstanceHandle ih)) + { + return ih; + } + throw new KeyNotFoundException(String.Format("inst not found: {0}", globalIdentifier)); } public InstanceHandle GetInstance(InstanceKey ik) { - return GetInstanceInternal(ik); + if (TryGetInstance(ik, out InstanceHandle ih)) + { + return ih; + } + throw new KeyNotFoundException(String.Format("inst not found: {0}", ik)); + } + + public bool TryGetInstance(Guid globalIdentifier, out T instance) where T : ConcreteInstanceWrapper + { + if (TryGetInstance(globalIdentifier, out InstanceHandle ih)) + { + InstanceHandle parentClass = GetParentClass(ih); + + Type tType = typeof(T); + ConcreteInstanceWrapper ci = (ConcreteInstanceWrapper) tType.Assembly.CreateInstance(tType.FullName, false, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, new object[] { ih }, null, null); + if (ci != null) + { + if (ci.ClassId == GetGlobalIdentifier(parentClass)) + { + instance = (T)ci; + return true; + } + } + } + instance = null; + return false; + } + + public T GetInstance(Guid globalIdentifier) where T : ConcreteInstanceWrapper + { + if (TryGetInstance(globalIdentifier, out T ih)) + { + return ih; + } + throw new KeyNotFoundException(); } protected abstract IReadOnlyCollection GetRelatedInstancesInternal(InstanceHandle source, InstanceHandle relationship, DateTime effectiveDate); @@ -237,7 +334,7 @@ public abstract class Oms return HasAttributeValueInternal(source, attribute, effectiveDate.GetValueOrDefault(DateTime.Now)); } protected abstract object? GetAttributeValueInternal(InstanceHandle source, InstanceHandle attribute, DateTime effectiveDate); - protected object? UnsafeGetAttributeValue(InstanceHandle source, InstanceHandle attribute, DateTime? effectiveDate = null) + protected internal object? UnsafeGetAttributeValue(InstanceHandle source, InstanceHandle attribute, DateTime? effectiveDate = null) { object? val = GetAttributeValueInternal(source, attribute, effectiveDate.GetValueOrDefault(DateTime.Now)); return val; @@ -279,19 +376,21 @@ public abstract class Oms private void ValidateConstraintsForAttribute(InstanceHandle source, InstanceHandle attribute, object value) { + if (!ValidateConstraints) + return; + InstanceHandle a_TextAttribute = GetInstance(KnownInstanceGuids.Classes.TextAttribute); InstanceHandle a_BooleanAttribute = GetInstance(KnownInstanceGuids.Classes.BooleanAttribute); InstanceHandle a_NumericAttribute = GetInstance(KnownInstanceGuids.Classes.NumericAttribute); InstanceHandle a_DateAttribute = GetInstance(KnownInstanceGuids.Classes.DateAttribute); - if (ValidateConstraints) - { - InstanceHandle sourceParentClass = GetParentClass(source); + InstanceHandle sourceParentClass = GetParentClass(source); - if (!RecursiveClassHasAttribute(sourceParentClass, attribute)) - { - throw new ArgumentException("The specified attribute is not defined for the given instance."); - } + if (!RecursiveClassHasAttribute(sourceParentClass, attribute)) + { + string name = GetAttributeValue(attribute, GetInstance(KnownAttributeGuids.Text.Name)); + string sourceParentClassName = GetAttributeValue(sourceParentClass, GetInstance(KnownAttributeGuids.Text.Name)); + throw new ArgumentException(String.Format("Undefined attribute `{0}` on class `{1}`", name, sourceParentClassName)); } if (IsInstanceOf(attribute, a_TextAttribute)) @@ -370,10 +469,32 @@ public abstract class Oms return false; } - public bool IsInstanceOf(InstanceHandle instance, InstanceHandle parentClass) + private bool RecursiveClassHasSuperclass(InstanceHandle clasz, InstanceHandle superclasz) + { + IEnumerable inheritedClasses = GetRelatedInstances(clasz, GetInstance(KnownRelationshipGuids.Class__has_super__Class)); + foreach (InstanceHandle ih in inheritedClasses) + { + if (ih.Equals(superclasz)) + { + return true; + } + if (RecursiveClassHasSuperclass(ih, superclasz)) + { + return true; + } + } + return false; + } + + public bool IsInstanceOf(InstanceHandle instance, InstanceHandle parentClass, bool exactMatch = false) { InstanceHandle parentClass1 = GetParentClass(instance); - return Object.Equals(parentClass1, parentClass); + bool value = Object.Equals(parentClass1, parentClass); + if (!value && !exactMatch) + { + return RecursiveClassHasSuperclass(parentClass1, parentClass); + } + return value; } public string GetAttachmentUrl(InstanceHandle fileInstance) @@ -418,6 +539,11 @@ public abstract class Oms return CreateRelationship(sourceClass, relationshipName, destinationClass, relationshipGuid, singular, null, Guid.Empty); } public InstanceHandle CreateRelationship(InstanceHandle sourceClass, string relationshipName, InstanceHandle destinationClass, Guid relationshipGuid, bool singular, string siblingRelationshipName, Guid siblingRelationshipGuid) + { + InstanceHandle relationshipInstance = CreateRelationship(sourceClass, relationshipName, destinationClass, relationshipGuid, singular, siblingRelationshipName, siblingRelationshipGuid, out InstanceHandle siblingRelationshipInstance); + return relationshipInstance; + } + public InstanceHandle CreateRelationship(InstanceHandle sourceClass, string relationshipName, InstanceHandle destinationClass, Guid relationshipGuid, bool singular, string siblingRelationshipName, Guid siblingRelationshipGuid, out InstanceHandle siblingRelationshipInstance) { InstanceHandle c_Relationship = GetInstance(KnownInstanceGuids.Classes.Relationship); if (c_Relationship == InstanceHandle.Empty) @@ -460,6 +586,7 @@ public abstract class Oms SetAttributeValue(irRelationship, a_Singular, singular); AssignRelationship(irRelationship, r_Relationship__has_destination__Class, destinationClass); + siblingRelationshipInstance = InstanceHandle.Empty; if (siblingRelationshipName != null) { if (siblingRelationshipGuid == Guid.Empty) @@ -467,13 +594,13 @@ public abstract class Oms siblingRelationshipGuid = Guid.NewGuid(); } - InstanceHandle irSiblingRelationship = CreateInstanceOf(c_Relationship, siblingRelationshipGuid); - AssignRelationship(irSiblingRelationship, r_Relationship__has_source__Class, destinationClass); - SetAttributeValue(irSiblingRelationship, a_RelationshipType, siblingRelationshipName); - AssignRelationship(irSiblingRelationship, r_Relationship__has_destination__Class, sourceClass); + siblingRelationshipInstance = CreateInstanceOf(c_Relationship, siblingRelationshipGuid); + AssignRelationship(siblingRelationshipInstance, r_Relationship__has_source__Class, destinationClass); + SetAttributeValue(siblingRelationshipInstance, a_RelationshipType, siblingRelationshipName); + AssignRelationship(siblingRelationshipInstance, r_Relationship__has_destination__Class, sourceClass); - AssignRelationship(irRelationship, r_Relationship__has_sibling__Relationship, irSiblingRelationship); - AssignRelationship(irSiblingRelationship, r_Relationship__has_sibling__Relationship, irRelationship); + AssignRelationship(irRelationship, r_Relationship__has_sibling__Relationship, siblingRelationshipInstance); + AssignRelationship(siblingRelationshipInstance, r_Relationship__has_sibling__Relationship, irRelationship); } return irRelationship; } @@ -512,60 +639,87 @@ public abstract class Oms return c_new; } - public InstanceHandle ExecuteInstanceMethod(OmsContext context, InstanceHandle instance, InstanceHandle methodBinding) + public InstanceHandle ExecuteInstanceMethod(OmsContext context, InstanceHandle instance, MethodBinding methodBinding) { - InstanceHandle method = GetRelatedInstance(methodBinding, GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method)); + InstanceHandle method = GetRelatedInstance(methodBinding.Handle, GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method)); InstanceHandle forClass = GetRelatedInstance(method, GetInstance(KnownRelationshipGuids.Method__for__Class)); context.SetWorkData(forClass, instance); - return Execute(context, methodBinding); + return Execute(context, methodBinding.Handle); } - public object? ExecuteInstanceMethodReturningAttribute(OmsContext context, InstanceHandle instance, InstanceHandle methodBinding) + public object? ExecuteInstanceMethodReturningAttribute(OmsContext context, InstanceHandle instance, MethodBinding methodBinding) { InstanceHandle workSet = ExecuteInstanceMethod(context, instance, methodBinding); object? value = context.GetWorkData(workSet); return value; } - public InstanceHandle Execute(OmsContext context, InstanceHandle methodOrMethodBinding) + private Dictionary methodImplementations = new Dictionary(); + private void RegisterMethodImplementation(InstanceHandle methodClass, MethodImplementation implementation) { + methodImplementations[methodClass] = implementation; + implementation.Initialize(this); + } + + public InstanceHandle Execute(OmsContext context, MethodBinding methodBinding, InstanceHandle? targetInstance = null) + { + return Execute(context, methodBinding.Handle, targetInstance); + } + public InstanceHandle Execute(OmsContext context, Method method, InstanceHandle? targetInstance = null) + { + return Execute(context, method.Handle, targetInstance); + } + public InstanceHandle Execute(OmsContext context, MethodBinding methodBinding) + { + return Execute(context, methodBinding.Handle); + } + public object? ExecuteReturningAttributeValue(OmsContext context, ReturnAttributeMethodBinding methodBinding) + { + InstanceHandle workData = Execute(context, methodBinding.Handle); + return context.GetWorkData(workData); + } + public T ExecuteReturningAttributeValue(OmsContext context, ReturnAttributeMethodBinding methodBinding, T defaultValue = default(T)) + { + object? value = ExecuteReturningAttributeValue(context, methodBinding); + if (value is T) + { + return (T)value; + } + return defaultValue; + } + public InstanceHandle Execute(OmsContext context, InstanceHandle methodOrMethodBinding, InstanceHandle? targetInstance = null) + { + InstanceHandle parentClass = GetParentClass(methodOrMethodBinding); if (IsInstanceOf(methodOrMethodBinding, GetInstance(KnownInstanceGuids.Classes.ReturnAttributeMethodBinding)) || IsInstanceOf(methodOrMethodBinding, GetInstance(KnownInstanceGuids.Classes.ReturnInstanceSetMethodBinding))) { + IEnumerable parameterAssignments = GetRelatedInstances(methodOrMethodBinding, GetInstance(KnownRelationshipGuids.Method_Binding__has__Parameter_Assignment)); + foreach (InstanceHandle parm in parameterAssignments) + { + InstanceHandle assignsToParm = GetRelatedInstance(parm, GetInstance(KnownRelationshipGuids.Parameter_Assignment__assigns_to__Work_Data)); + + InstanceHandle assignsFromWorkData = GetRelatedInstance(parm, GetInstance(KnownRelationshipGuids.Parameter_Assignment__assigns_from__Executable_returning_Work_Data)); + if (IsInstanceOf(assignsFromWorkData, GetInstance(KnownInstanceGuids.Classes.Class))) + { + assignsFromWorkData = context.GetWorkData(assignsFromWorkData); + } + context.SetWorkData(assignsToParm, assignsFromWorkData); + } return ExecuteMethodBinding(context, methodOrMethodBinding); } else { - if (IsInstanceOf(methodOrMethodBinding, GetInstance(KnownInstanceGuids.MethodClasses.GetAttributeMethod))) + if (methodImplementations.ContainsKey(parentClass)) { - InstanceHandle irForClass = GetRelatedInstance(methodOrMethodBinding, GetInstance(KnownRelationshipGuids.Method__for__Class)); - InstanceHandle returnsAttribute = GetRelatedInstance(methodOrMethodBinding, GetInstance(KnownRelationshipGuids.Get_Attribute_Method__returns__Attribute)); - - if (returnsAttribute == InstanceHandle.Empty) + if (targetInstance != null) { - throw new InvalidOperationException("no Work Set specified for method"); + InstanceHandle hh = targetInstance.GetValueOrDefault(); + InstanceHandle pclassInstance = GetParentClass(hh); + context.SetWorkData(pclassInstance, hh); } - - InstanceHandle forInstance = (InstanceHandle) context.GetWorkData(irForClass); - object? value = UnsafeGetAttributeValue(forInstance, returnsAttribute); - context.SetWorkData(returnsAttribute, value); - return returnsAttribute; - } - else if (IsInstanceOf(methodOrMethodBinding, GetInstance(KnownInstanceGuids.MethodClasses.GetSpecifiedInstancesMethod))) - { - InstanceHandle irForClass = GetRelatedInstance(methodOrMethodBinding, GetInstance(KnownRelationshipGuids.Method__for__Class)); - InstanceHandle returnsWorkSet = GetRelatedInstance(methodOrMethodBinding, GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__returns__Work_Set)); - IReadOnlyCollection irUsesInstance = GetRelatedInstances(methodOrMethodBinding, GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__uses__Instance)); - - if (returnsWorkSet == InstanceHandle.Empty) - { - throw new InvalidOperationException("no Work Set specified for method"); - } - - context.SetWorkData(returnsWorkSet, irUsesInstance); - return returnsWorkSet; + return methodImplementations[parentClass].Execute(this, context, methodOrMethodBinding); } } - throw new NotImplementedException(); + throw new NotImplementedException(String.Format("method implementation not found for method class {0}", GetGlobalIdentifier(parentClass))); } private InstanceHandle ExecuteMethodBinding(OmsContext context, InstanceHandle methodBinding) @@ -579,9 +733,9 @@ public abstract class Oms return new OmsContext(this); } - public IReadOnlyCollection ExecuteStaticMethodReturningInstanceSet(OmsContext context, InstanceHandle methodBinding) + public IReadOnlyCollection ExecuteStaticMethodReturningInstanceSet(OmsContext context, ReturnInstanceSetMethodBinding methodBinding) { - InstanceHandle method = GetRelatedInstance(methodBinding, GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method)); + InstanceHandle method = GetRelatedInstance(methodBinding.Handle, GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method)); if (TryGetAttributeValue(method, GetInstance(KnownAttributeGuids.Boolean.Static), out bool is_static)) { if (is_static) @@ -598,21 +752,23 @@ public abstract class Oms throw new InvalidOperationException("cannot call a non-static Method in a static context"); } - public InstanceHandle CreateWorkSet(string name) + public WorkSet CreateWorkSet(string name) { return CreateWorkSet(name, false, new InstanceHandle[0]); } - public InstanceHandle CreateWorkSet(string name, bool singular, ICollection validClasses) + public WorkSet CreateWorkSet(string name, bool singular, ICollection validClasses = null) { InstanceHandle workSet = CreateInstanceOf(GetInstance(KnownInstanceGuids.Classes.WorkSet)); SetAttributeValue(workSet, GetInstance(KnownAttributeGuids.Text.Name), name); SetAttributeValue(workSet, GetInstance(KnownAttributeGuids.Boolean.Singular), singular); - - if (validClasses.Count > 0) + if (validClasses != null) { - AssignRelationship(workSet, GetInstance(KnownRelationshipGuids.Work_Set__has_valid__Class), validClasses); + if (validClasses.Count > 0) + { + AssignRelationship(workSet, GetInstance(KnownRelationshipGuids.Work_Set__has_valid__Class), validClasses); + } } - return workSet; + return new WorkSet(workSet); } public void AddAttribute(InstanceHandle targetInstance, InstanceHandle attributeInstance) @@ -634,4 +790,232 @@ public abstract class Oms IReadOnlyCollection insts = GetRelatedInstances(classInstance, GetInstance(KnownRelationshipGuids.Class__has__Instance)); return insts; } + + public string GetInstanceText(InstanceWrapper inst) + { + return GetInstanceText(inst.Handle); + } + public string GetInstanceText(InstanceHandle inst) + { + InstanceHandle parentClass = GetParentClass(inst); + InstanceHandle ihLabeledByRAMB = InstanceHandle.Empty; + + if (TryGetInstance(KnownRelationshipGuids.Class__instance_labeled_by__Return_Attribute_Method_Binding, out ihLabeledByRAMB)) + { + InstanceHandle ramb = GetRelatedInstance(parentClass, ihLabeledByRAMB); + + OmsContext context = CreateContext(); + InstanceHandle wd = Execute(context, ramb); + + string value = context.GetWorkData(wd); + return value; + } + + // FIXME: remove when we have Class@get Instance Text implemented + return _GetInstanceTextHack(inst); + } + private string _GetInstanceTextHack(InstanceHandle inst) + { + StringBuilder sb = new StringBuilder(); + if (IsInstanceOf(inst, GetInstance(KnownInstanceGuids.Classes.Class))) + { + string name = GetAttributeValue(inst, GetInstance(KnownAttributeGuids.Text.Name)); + sb.Append(name); + } + else if (IsInstanceOf(inst, GetInstance(KnownInstanceGuids.Classes.Attribute))) + { + string name = GetAttributeValue(inst, GetInstance(KnownAttributeGuids.Text.Name)); + sb.Append(name); + } + else if (IsInstanceOf(inst, GetInstance(KnownInstanceGuids.Classes.Relationship))) + { + InstanceHandle sourceClass = GetRelatedInstance(inst, GetInstance(KnownRelationshipGuids.Relationship__has_source__Class)); + string relationshipType = GetAttributeValue(inst, GetInstance(KnownAttributeGuids.Text.RelationshipType)); + InstanceHandle destinationClass = GetRelatedInstance(inst, GetInstance(KnownRelationshipGuids.Relationship__has_destination__Class)); + + string sourceClassName = GetInstanceText(sourceClass); + string destinationClassName = GetInstanceText(destinationClass); + sb.Append(sourceClassName); + sb.Append('.'); + sb.Append(relationshipType); + sb.Append(' '); + sb.Append(destinationClassName); + } + else if (IsInstanceOf(inst, GetInstance(KnownInstanceGuids.Classes.Method))) + { + InstanceHandle forClass = GetRelatedInstance(inst, GetInstance(KnownRelationshipGuids.Method__for__Class)); + string verb = GetAttributeValue(inst, GetInstance(KnownAttributeGuids.Text.Verb)); + string name = GetAttributeValue(inst, GetInstance(KnownAttributeGuids.Text.Name)); + bool is_static = GetAttributeValue(inst, GetInstance(KnownAttributeGuids.Boolean.Static)); + + sb.Append(GetInstanceText(forClass)); + sb.Append('@'); + sb.Append(verb); + sb.Append(' '); + sb.Append(name); + if (is_static) + { + sb.Append("*S"); + } + } + else if (IsInstanceOf(inst, GetInstance(KnownInstanceGuids.Classes.ReturnAttributeMethodBinding))) + { + InstanceHandle executesMethod = GetRelatedInstance(inst, GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method)); + sb.Append(GetInstanceText(executesMethod)); + sb.Append("[ramb]"); + } + else if (IsInstanceOf(inst, GetInstance(KnownInstanceGuids.Classes.ReturnInstanceSetMethodBinding))) + { + InstanceHandle executesMethod = GetRelatedInstance(inst, GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method)); + sb.Append(GetInstanceText(executesMethod)); + sb.Append("[rsmb]"); + } + return sb.ToString(); + } + + public Dictionary _systemRoutinesByInstance = new Dictionary(); + internal void RegisterSystemRoutine(InstanceHandle handle, SystemRoutine routine) + { + _systemRoutinesByInstance[handle] = routine; + } + + internal object? ExecuteSystemRoutine(OmsContext context, InstanceHandle handle) + { + object? value = _systemRoutinesByInstance[handle].Execute(this, context); + return value; + } + + public Method GetMethod(InstanceHandle forClass, string verb, string name, AccessModifier? accessModifier = null, bool? is_static = null) + { + // this really needs to be super fast... + InstanceHandle a_Verb = GetInstance(KnownAttributeGuids.Text.Verb); + InstanceHandle a_Name = GetInstance(KnownAttributeGuids.Text.Name); + + IEnumerable methods = GetRelatedInstances(forClass, GetInstance(KnownRelationshipGuids.Class__has__Method)); + foreach (InstanceHandle method in methods) + { + string _verb = GetAttributeValue(method, a_Verb); + string _name = GetAttributeValue(method, a_Name); + if (_verb.Equals(verb) && _name.Equals(name)) + { + return (Method)ConcreteInstanceWrapper.Wrap(this, method); + } + } + return null; + } + + /// + /// Convenience function to create an enumeration of instances based on global identifiers. + /// + /// The global identifier of the resulting enumeration class. + /// The global identifiers of the instances (members) of the enumeration class. + /// + public InstanceHandle CreateEnumeration(Guid globalIdentifier, Guid[] memberGlobalIdentifiers) + { + InstanceHandle c_Enum = CreateEnumeration(globalIdentifier, memberGlobalIdentifiers, out InstanceHandle[] memberInstanceHandles); + return c_Enum; + } + public InstanceHandle CreateEnumeration(Guid globalIdentifier, Guid[] memberGlobalIdentifiers, out InstanceHandle[] memberInstanceHandles) + { + if (!TryGetInstance(globalIdentifier, out InstanceHandle c_Enum)) + { + c_Enum = CreateInstanceOf(GetInstance(KnownInstanceGuids.Classes.Class), globalIdentifier); + } + memberInstanceHandles = new InstanceHandle[memberGlobalIdentifiers.Length]; + for (int i = 0; i < memberGlobalIdentifiers.Length; i++) + { + memberInstanceHandles[i] = CreateInstanceOf(c_Enum, memberGlobalIdentifiers[i]); + } + return c_Enum; + } + + public string GetTranslationValue(InstanceHandle sourceInstance, InstanceHandle relationshipInstance, string defaultValue = "") + { + //FIXME: do not hardcode hat is supposed to be a result of a call to `User@get preferred display Language` + InstanceHandle languageInstance = GetInstance(KnownInstanceGuids.Languages.English); + return GetTranslationValue(sourceInstance, relationshipInstance, languageInstance, defaultValue); + } + public string GetTranslationValue(InstanceHandle sourceInstance, InstanceHandle relationshipInstance, InstanceHandle languageInstance, string defaultValue = "") + { + InstanceHandle c_Translation = GetInstance(KnownInstanceGuids.Classes.Translation); + InstanceHandle c_TranslationValue = GetInstance(KnownInstanceGuids.Classes.TranslationValue); + InstanceHandle a_Value = GetInstance(KnownAttributeGuids.Text.Value); + InstanceHandle r_Translation__has__Translation_Value = GetInstance(KnownRelationshipGuids.Translation__has__Translation_Value); + InstanceHandle r_Translation_Value__has__Language = GetInstance(KnownRelationshipGuids.Translation_Value__has__Language); + + InstanceHandle translation = GetRelatedInstance(sourceInstance, relationshipInstance); + if (translation != InstanceHandle.Empty) + { + if (!IsInstanceOf(translation, c_Translation)) + { + // the relationship was found, but it is not a Translation, so fail hard - something's wrong + throw new InvalidOperationException(); + } + + // find the translation value for the given language and update it if found + IEnumerable translationValues = GetRelatedInstances(translation, r_Translation__has__Translation_Value); + foreach (InstanceHandle translationValue in translationValues) + { + InstanceHandle language = GetRelatedInstance(translationValue, r_Translation_Value__has__Language); + if (language == languageInstance) + { + string value = GetAttributeValue(translationValue, a_Value); + return value; + } + } + } + return defaultValue; + } + + public void SetTranslationValue(InstanceHandle sourceInstance, InstanceHandle relationshipInstance, InstanceHandle languageInstance, string value) + { + InstanceHandle c_Translation = GetInstance(KnownInstanceGuids.Classes.Translation); + InstanceHandle c_TranslationValue = GetInstance(KnownInstanceGuids.Classes.TranslationValue); + InstanceHandle a_Value = GetInstance(KnownAttributeGuids.Text.Value); + InstanceHandle r_Translation__has__Translation_Value = GetInstance(KnownRelationshipGuids.Translation__has__Translation_Value); + InstanceHandle r_Translation_Value__has__Language = GetInstance(KnownRelationshipGuids.Translation_Value__has__Language); + + InstanceHandle translation = GetRelatedInstance(sourceInstance, relationshipInstance); + if (translation != InstanceHandle.Empty) + { + if (!IsInstanceOf(translation, c_Translation)) + { + // the relationship was found, but it is not a Translation, so fail hard - something's wrong + throw new InvalidOperationException(); + } + + // find the translation value for the given language and update it if found + IEnumerable translationValues = GetRelatedInstances(translation, r_Translation__has__Translation_Value); + foreach (InstanceHandle translationValue in translationValues) + { + InstanceHandle language = GetRelatedInstance(translationValue, r_Translation_Value__has__Language); + if (language == languageInstance) + { + SetAttributeValue(translationValue, a_Value, value); + return; + } + } + } + else + { + translation = CreateInstanceOf(c_Translation); + AssignRelationship(sourceInstance, relationshipInstance, translation); + } + + // if we reach here, we didn't find a `Translation Value` for the given language, so create it + InstanceHandle newTranslationValue = CreateInstanceOf(c_TranslationValue); + AssignRelationship(newTranslationValue, r_Translation_Value__has__Language, languageInstance); + AssignRelationship(translation, r_Translation__has__Translation_Value, newTranslationValue); + SetAttributeValue(newTranslationValue, a_Value, value); + } + + public void InitializeTenant() + { + ValidateConstraints = false; + InitializeTenantInternal(); + ValidateConstraints = true; + } + protected virtual void InitializeTenantInternal() + { + } } diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsContext.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsContext.cs index 4137aa0..aab3529 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/OmsContext.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsContext.cs @@ -1,5 +1,23 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using System.Linq.Expressions; +using Mocha.Core.Oop; namespace Mocha.Core; @@ -12,6 +30,10 @@ public class OmsContext } private Dictionary _WorkData = new Dictionary(); + public object? GetWorkData(WorkSet parm) + { + return GetWorkData(parm.Handle); + } public object? GetWorkData(InstanceHandle parm) { if (_WorkData.ContainsKey(parm)) @@ -20,6 +42,25 @@ public class OmsContext Console.Error.WriteLine("work data not found for parm {0}", oms.GetGlobalIdentifier(parm)); return null; } + + public T GetWorkData(InstanceHandle parm, T defaultValue = default(T)) + { + object? val = GetWorkData(parm); + if (val is T) + { + return (T)val; + } + return defaultValue; + } + + public void SetWorkData(WorkSet parm, object? value) + { + SetWorkData(parm.Handle, value); + } + public void SetWorkData(InstanceHandle parm, IInstanceWrapper value) + { + SetWorkData(parm, value.Handle); + } public void SetWorkData(InstanceHandle parm, object? value) { if (oms.IsInstanceOf(parm, oms.GetInstance(KnownInstanceGuids.Classes.WorkSet))) @@ -43,14 +84,14 @@ public class OmsContext } } } - else if (value is IReadOnlyCollection) + else if (value is IEnumerable) { - IReadOnlyCollection insts = (IReadOnlyCollection)value; - if (singular && insts.Count > 1) + IEnumerable insts = (IEnumerable)value; + if (singular && insts.Count() > 1) { throw new InvalidOperationException("Singular Work Set must only contain a single InstanceReference or be an array of InstanceReference that contains exactly zero or one item."); } - IReadOnlyCollection irs = oms.GetRelatedInstances(parm, oms.GetInstance(KnownRelationshipGuids.Work_Set__has_valid__Class)); + IEnumerable irs = oms.GetRelatedInstances(parm, oms.GetInstance(KnownRelationshipGuids.Work_Set__has_valid__Class)); if (irs != null) { foreach (InstanceHandle ir in insts) @@ -63,9 +104,33 @@ public class OmsContext } } } + else if (value is IEnumerable) + { + IEnumerable insts = (IEnumerable)value; + if (singular && insts.Count() > 1) + { + throw new InvalidOperationException("Singular Work Set must only contain a single InstanceReference or be an array of InstanceReference that contains exactly zero or one item."); + } + IEnumerable irs = oms.GetRelatedInstances(parm, oms.GetInstance(KnownRelationshipGuids.Work_Set__has_valid__Class)); + if (irs != null) + { + if (irs.Count() > 0) + { + foreach (InstanceWrapper iw in insts) + { + InstanceHandle ir = iw.Handle; + InstanceHandle parentClass = oms.GetParentClass(ir); + if (!irs.Contains(parentClass)) + { + throw new ArgumentException("instance reference must be an instance of appropriate class"); + } + } + } + } + } else { - throw new ArgumentException("cannot assign literal data to a Work Set"); + throw new ArgumentException(String.Format("cannot assign literal data '{0}' to a Work Set", value)); } } _WorkData[parm] = value; diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsException.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsException.cs index 8244a1e..5809eda 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/OmsException.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsException.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // OmsException.cs // diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/MemoryOms.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/MemoryOms.cs index d588478..a53e186 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/MemoryOms.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/MemoryOms.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . +  using System.Data; @@ -29,13 +46,25 @@ public class MemoryOms : Oms return InstanceKey.Empty; } - public InstanceHandle GetInstance(Guid globalIdentifier) + public bool TryGetInstance(Guid globalIdentifier, out InstanceHandle ih) { - return _instancesByGuid[globalIdentifier]; + if (_instancesByGuid.ContainsKey(globalIdentifier)) + { + ih = _instancesByGuid[globalIdentifier]; + return true; + } + ih = InstanceHandle.Empty; + return false; } - public InstanceHandle GetInstance(InstanceKey ik) + public bool TryGetInstance(InstanceKey ik, out InstanceHandle ih) { - return _instancesByKey[ik]; + if (_instancesByKey.ContainsKey(ik)) + { + ih = _instancesByKey[ik]; + return true; + } + ih = InstanceHandle.Empty; + return false; } public void SetInstanceKey(InstanceHandle c_File, InstanceKey instanceKey) @@ -171,8 +200,6 @@ public class MemoryOms : Oms { TenantHandle th = TenantHandle.Create(); _tenantData[th] = new _Tenant(); - - RegisterTenant(tenantName, th); return th; } protected override void SelectTenantInternal(TenantHandle tenant) @@ -226,19 +253,19 @@ public class MemoryOms : Oms return ik; } - protected override InstanceHandle GetInstanceInternal(Guid globalIdentifier) + protected override bool TryGetInstanceInternal(Guid globalIdentifier, out InstanceHandle ih) { if (_CurrentTenant == null) throw new InvalidOperationException("Please select a tenant first."); - return _CurrentTenant.GetInstance(globalIdentifier); + return _CurrentTenant.TryGetInstance(globalIdentifier, out ih); } - protected override InstanceHandle GetInstanceInternal(InstanceKey ik) + protected override bool TryGetInstanceInternal(InstanceKey ik, out InstanceHandle ih) { if (_CurrentTenant == null) throw new InvalidOperationException("Please select a tenant first."); - return _CurrentTenant.GetInstance(ik); + return _CurrentTenant.TryGetInstance(ik, out ih); } protected override void SetInstanceKeyInternal(InstanceHandle source, InstanceKey instanceKey) diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/MiniOms.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/MiniOms.cs index f4f6cd9..24954b4 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/MiniOms.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/MiniOms.cs @@ -1,5 +1,23 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.OmsImplementations.Mini; +using System; using MBS.Core; /// @@ -9,10 +27,11 @@ using MBS.Core; public class MiniOms : MemoryOms { private TenantHandle t_super; - private InstanceHandle c_Class, c_Attribute, c_Relationship, c_TextAttribute, c_BooleanAttribute, c_NumericAttribute, c_DateAttribute, c_WorkSet, c_Instance, c_File; + private InstanceHandle c_Class, c_Attribute, c_Relationship, c_TextAttribute, c_BooleanAttribute, c_NumericAttribute, c_DateAttribute, c_WorkSet, c_Instance, c_OMS, c_File; + private InstanceHandle c_CommonText, c_CommonBoolean, c_CommonNumeric, c_CommonDate, c_CommonInstanceSet; private InstanceHandle r_Class__has__Instance, r_Instance__for__Class; private InstanceHandle r_Relationship__has_source__Class, r_Relationship__has_destination__Class, r_Relationship__has_sibling__Relationship; - private InstanceHandle a_Name, a_Value, a_ContentType, a_RelationshipType, a_Singular; + private InstanceHandle a_Name, a_Order, a_Value, a_ContentType, a_RelationshipType, a_Singular; private InstanceHandle a_MinimumLength, a_MaximumLength, a_MinimumValue, a_MaximumValue; private InstanceHandle i_SignonLogo; @@ -22,7 +41,7 @@ public class MiniOms : MemoryOms { if (modules == null) { - modules = MBS.Core.Reflection.TypeLoader.GetAvailableTypes(new System.Reflection.Assembly[] { System.Reflection.Assembly.GetExecutingAssembly() }); + modules = MBS.Core.Reflection.TypeLoader.GetAvailableTypes(new System.Reflection.Assembly[] { System.Reflection.Assembly.GetCallingAssembly(), System.Reflection.Assembly.GetEntryAssembly(), System.Reflection.Assembly.GetExecutingAssembly() }); } Modules.AddRange(modules); } @@ -30,11 +49,12 @@ public class MiniOms : MemoryOms protected override void InitializeInternal() { base.InitializeInternal(); - - ValidateConstraints = false; - t_super = CreateTenant("super"); - SelectTenant(t_super); + } + + protected override void InitializeTenantInternal() + { + base.InitializeTenantInternal(); c_Class = CreateInstance(KnownInstanceGuids.Classes.Class); @@ -63,10 +83,12 @@ public class MiniOms : MemoryOms c_DateAttribute = CreateInstanceOf(c_Class, KnownInstanceGuids.Classes.DateAttribute); a_Name = CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.Name); + a_Order = CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.Order); a_Value = CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.Value); a_ContentType = CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.ContentType); a_RelationshipType = CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.RelationshipType); a_Singular = CreateInstanceOf(c_BooleanAttribute, KnownAttributeGuids.Boolean.Singular); + CreateInstanceOf(c_BooleanAttribute, KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified); a_MinimumLength = CreateInstanceOf(c_NumericAttribute, KnownAttributeGuids.Numeric.MinimumLength); a_MaximumLength = CreateInstanceOf(c_NumericAttribute, KnownAttributeGuids.Numeric.MaximumLength); @@ -139,6 +161,18 @@ public class MiniOms : MemoryOms c_Instance = CreateClass("Instance", KnownInstanceGuids.Classes.Instance); SetInstanceKey(c_Instance, new InstanceKey(1, 17)); + CreateClass("Work Data", KnownInstanceGuids.Classes.WorkData); + c_OMS = CreateClass("OMS", KnownInstanceGuids.Classes.OMS); + + InstanceHandle c_Tenant = CreateInstanceOf(c_Class, KnownInstanceGuids.Classes.Tenant); + CreateInstanceOf(c_Tenant); + + c_CommonText = CreateClass("Common Text", KnownInstanceGuids.Classes.CommonText); + c_CommonBoolean = CreateClass("Common Boolean", KnownInstanceGuids.Classes.CommonBoolean); + c_CommonNumeric = CreateClass("Common Numeric", KnownInstanceGuids.Classes.CommonNumeric); + c_CommonDate = CreateClass("Common Date", KnownInstanceGuids.Classes.CommonDate); + c_CommonInstanceSet = CreateClass("Common Instance Set", KnownInstanceGuids.Classes.CommonInstanceSet); + // ?============ MODULES ============? foreach (MiniOmsModule module in Modules) { @@ -152,7 +186,5 @@ public class MiniOms : MemoryOms string filedata = "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZzpzdmcKICAgdmVyc2lvbj0iMS4xIgogICBpZD0ic3ZnODcwIgogICB3aWR0aD0iMjMwLjE1OTg4bW0iCiAgIGhlaWdodD0iMjMwLjA3MjY2bW0iCiAgIHZpZXdCb3g9IjAgMCA4NjkuODk1NjMgODY5LjU2NTk5IgogICBzb2RpcG9kaTpkb2NuYW1lPSJsb2dvLnN2ZyIKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHNjcmlwdAogICAgIHR5cGU9InRleHQvamF2YXNjcmlwdCIgLz4KICA8c3ZnOmRlZnMKICAgICBpZD0iZGVmczg3NCI+CiAgICA8c3ZnOmxpbmVhckdyYWRpZW50CiAgICAgICBpbmtzY2FwZTpjb2xsZWN0PSJhbHdheXMiCiAgICAgICBpZD0ibGluZWFyR3JhZGllbnQ4NjkiPgogICAgICA8c3ZnOnN0b3AKICAgICAgICAgc3R5bGU9InN0b3AtY29sb3I6I2ZmYzA2MTtzdG9wLW9wYWNpdHk6MTsiCiAgICAgICAgIG9mZnNldD0iMCIKICAgICAgICAgaWQ9InN0b3A4NjUiIC8+CiAgICAgIDxzdmc6c3RvcAogICAgICAgICBzdHlsZT0ic3RvcC1jb2xvcjojODA0YjAwO3N0b3Atb3BhY2l0eToxOyIKICAgICAgICAgb2Zmc2V0PSIxIgogICAgICAgICBpZD0ic3RvcDg2NyIgLz4KICAgIDwvc3ZnOmxpbmVhckdyYWRpZW50PgogICAgPHN2ZzpyYWRpYWxHcmFkaWVudAogICAgICAgaW5rc2NhcGU6Y29sbGVjdD0iYWx3YXlzIgogICAgICAgeGxpbms6aHJlZj0iI2xpbmVhckdyYWRpZW50ODY5IgogICAgICAgaWQ9InJhZGlhbEdyYWRpZW50ODcxIgogICAgICAgY3g9IjYzMC43MjUxIgogICAgICAgY3k9IjQxMi40ODM0OSIKICAgICAgIGZ4PSI2MzAuNzI1MSIKICAgICAgIGZ5PSI0MTIuNDgzNDkiCiAgICAgICByPSI0MTYuMDUwMTYiCiAgICAgICBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDAuOTk5NjAzODcsMCwwLjE5Mzc0NjA1KSIKICAgICAgIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiAvPgogIDwvc3ZnOmRlZnM+CiAgPHNvZGlwb2RpOm5hbWVkdmlldwogICAgIGlkPSJuYW1lZHZpZXc4NzIiCiAgICAgcGFnZWNvbG9yPSIjZmZmZmZmIgogICAgIGJvcmRlcmNvbG9yPSIjNjY2NjY2IgogICAgIGJvcmRlcm9wYWNpdHk9IjEuMCIKICAgICBpbmtzY2FwZTpwYWdlc2hhZG93PSIyIgogICAgIGlua3NjYXBlOnBhZ2VvcGFjaXR5PSIwLjAiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iMCIKICAgICBzaG93Z3JpZD0iZmFsc2UiCiAgICAgZml0LW1hcmdpbi10b3A9IjUiCiAgICAgZml0LW1hcmdpbi1sZWZ0PSI1IgogICAgIGZpdC1tYXJnaW4tcmlnaHQ9IjUiCiAgICAgZml0LW1hcmdpbi1ib3R0b209IjUiCiAgICAgdW5pdHM9Im1tIgogICAgIGlua3NjYXBlOnpvb209IjAuNTczOTY2NjgiCiAgICAgaW5rc2NhcGU6Y3g9IjM5Ni4zNjQ0NyIKICAgICBpbmtzY2FwZTpjeT0iMzc1LjQ1NzM0IgogICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iMTQ1MiIKICAgICBpbmtzY2FwZTp3aW5kb3ctaGVpZ2h0PSI3NTIiCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEzNCIKICAgICBpbmtzY2FwZTp3aW5kb3cteT0iMTE0IgogICAgIGlua3NjYXBlOndpbmRvdy1tYXhpbWl6ZWQ9IjAiCiAgICAgaW5rc2NhcGU6Y3VycmVudC1sYXllcj0iZzg3NiIKICAgICBpbmtzY2FwZTpkb2N1bWVudC11bml0cz0ibW0iCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIiAvPgogIDxzdmc6ZwogICAgIGlua3NjYXBlOmdyb3VwbW9kZT0ibGF5ZXIiCiAgICAgaW5rc2NhcGU6bGFiZWw9IkltYWdlIgogICAgIGlkPSJnODc2IgogICAgIHRyYW5zZm9ybT0idHJhbnNsYXRlKC05Ny45NDkwMjUsLTU0LjMxNzA1KSI+CiAgICA8c3ZnOnBhdGgKICAgICAgIHN0eWxlPSJmaWxsOnVybCgjcmFkaWFsR3JhZGllbnQ4NzEpO2ZpbGwtb3BhY2l0eToxO3N0cm9rZS13aWR0aDoxLjMzMzMzIgogICAgICAgZD0iTSA0ODYuMjQ5NzUsOTAzLjEyMDY1IEMgMzUzLjQ2NjIxLDg4Ny45MDg1MiAyMzcuOTE3OTUsODExLjQzMTg0IDE3MC4yNTkyLDY5My45NzkzNyAxNDguMjM3NjgsNjU1Ljc1MTAxIDEzMC41MjAxMSw2MDYuNTg2NDEgMTIyLjg4NTcxLDU2Mi41MjIzNCBjIC04LjA1MTQ0LC00Ni40NzExIC04LjA1MjAyLC0xMDAuMTY3OTEgLTAuMDAyLC0xNDYuNjY2NjYgMjMuMTk5LC0xMzMuOTk1NzEgMTE1LjQ4NDA3LC0yNTEuNjAxOTYgMjQxLjE1ODA0LC0zMDcuMzI2OTYgNTQuNTUxMTgsLTI0LjE4ODUxMiAxMDcuNzU0MjMsLTM1LjMxNDAzMiAxNjguODc0MjUsLTM1LjMxNDAzMiA2MS4xMjAwMSwwIDExNC4zMjMwNiwxMS4xMjU1MiAxNjguODc0MjMsMzUuMzE0MDMyIDEyNS42NzM5Nyw1NS43MjUgMjE3Ljk1OTA0LDE3My4zMzEyNSAyNDEuMTU4MDQsMzA3LjMyNjk2IDguMDU0MjIsNDYuNTIwNTEgNy45OTM4LDEwMy42MTcxMiAtMC4xNTY1OCwxNDggLTE0LjkzNDc1LDgxLjMyNjkzIC01My4wNjI2NywxNTUuMTAzODQgLTExMS4yMDUzNSwyMTUuMTgwNTEgLTY3LjU3MDM0LDY5LjgxNzkyIC0xNTYuNjMzNTIsMTEzLjQ2MDM4IC0yNTMuMzM3MDEsMTI0LjEzOTM2IC0yMi4wNjQxMywyLjQzNjYgLTcwLjUwNDY0LDIuNDA3NiAtOTIuMDAwMDEsLTAuMDU1IHogbSA5Ni4xNjY0OSwtNjMuNzg3OTQgYyA4MC40NDc3NiwtMTIuNzE1NiAxNDYuNTA4NywtNDYuMDUxOTUgMjAxLjQ2MDE1LC0xMDEuNjYyODcgNTMuNjQ5MDEsLTU0LjI5Mjg1IDg2LjAwMDEsLTExOC40MDk0NiA5OC42ODQ1NCwtMTk1LjU4Mjc5IDQuMjAxLC0yNS41NTkyOCA0LjIwMSwtODAuMjM2OCAwLC0xMDUuNzk2MDggQyA4NjkuODc2NDksMzU5LjExNzY0IDgzNy41MjU0LDI5NS4wMDEwMiA3ODMuODc2MzksMjQwLjcwODE4IDcyNy45NTM3NiwxODQuMTE0NDIgNjU5LjYxMjU1LDE1MC4xODU2MiA1NzcuNTgzMSwxMzguMjkxNDQgYyAtMTUuOTQ1NDcsLTIuMzEyMDggLTczLjM4Nzg3LC0yLjMxMjA4IC04OS4zMzMzNSwwIC04Mi4wMjk0NSwxMS44OTQxOCAtMTUwLjM3MDY3LDQ1LjgyMjk4IC0yMDYuMjkzMywxMDIuNDE2NzQgLTUzLjY0OTAxLDU0LjI5Mjg0IC04Ni4wMDAxLDExOC40MDk0NiAtOTguNjg0NTQsMTk1LjU4Mjc5IC00LjIwMSwyNS41NTkyOCAtNC4yMDEsODAuMjM2OCAwLDEwNS43OTYwOCAxMi42ODQ0NCw3Ny4xNzMzMyA0NS4wMzU1MywxNDEuMjg5OTQgOTguNjg0NTQsMTk1LjU4Mjc5IDU5Ljk0MDA1LDYwLjY1OTM5IDEzMy4xODk5Myw5NC45NDM1NSAyMjIuMjkzMzEsMTA0LjA0MzAzIDExLjg2NTM1LDEuMjExNzIgNjUuODM5NzUsLTAuNDMxOCA3OC4xNjY0OCwtMi4zODAxNiB6IG0gLTg0LjgzMzE1LC01NS41MDQyNyBjIC03OS42ODY3NiwtNS4zOTgzNiAtMTM1LjQzOTM3LC0yMC4yOTg4NSAtMTQ0LjgxNzA1LC0zOC43MDM5MyAtMy4wMjExOSwtNS45Mjk1NSAtMi4wMzY2LC0xMC42NDc0NSAzLjM4NzYsLTE2LjIzMjU5IDcuMTg2MzMsLTcuMzk5NTIgMjkuMjM1NDgsLTE3LjM1OTUgNDQuNzYyNzgsLTIwLjIyMDEyIDQuMTAwNDcsLTAuNzU1NDQgNC4zNDkzOSwtMC42NTQ4OSAyLjA1MTY0LDAuODI4NzIgLTEwLjY2Njk2LDYuODg3NDcgLTEzLjA3NjI0LDE0Ljk1ODQ4IC02LjM4MDI2LDIxLjM3MzY0IDcuNjk1MDQsNy4zNzIzMSAzMS4yODM4NCwxNS41MTcyNyA1OC42MjYxNCwyMC4yNDI5OCA0My40MzY4NCw3LjUwNzQxIDExNC43NDM0Miw4LjMzNjIyIDE2NS43MDI0OSwxLjkyNiAyNS42NjU2NSwtMy4yMjg1MiA1NC40MTA2MiwtMTAuOTkxODIgNjYuMTMwNzMsLTE3Ljg2MDI2IDEzLjI2ODY4LC03Ljc3NTk2IDEzLjIyOTYsLTE1LjMyNTM0IC0wLjEzMDY3LC0yNS4yNTk1NyAtMy44NjExNywtMi44NzEwMyAtMC45MjM0OCwtMi41MjA1MyAxMS41OTc4NCwxLjM4MzcxIDUxLjg1OTg4LDE2LjE3MDI5IDUyLjg1NzE4LDM4Ljk4MzI1IDIuNDAyMTYsNTQuOTQ5NDQgLTIyLjk4Mzk0LDcuMjczMTMgLTQ4LjQyMTA0LDExLjkxNDEgLTg1LjY1ODA5LDE1LjYyODI0IC0yNC40MzY1NywyLjQzNzM3IC05My41Mzk1OCwzLjU3ODggLTExNy42NzUyNSwxLjk0Mzc0IHogbSAyMi41MzE3LC01OS4yNDc5IGMgLTM3LjQzNjY1LC01LjgxNTU0IC02OC45MjY5MSwtMjQuOTQ3OTkgLTg3Ljc1ODc1LC01My4zMTkzNyAtMy43NDMxOSwtNS42MzkzNCAtNi4zNzI4OCwtOC4wNTcwMiAtMTAuNTQ2NDIsLTkuNjk2MTEgLTIyLjk2NjI5LC05LjAxOTY0IC00OS4yMDI2NCwtMjUuOTk5NDQgLTY1LjU1OTg2LC00Mi40Mjk0MyAtMTIuODY3NDYsLTEyLjkyNDY5IC0xOC45ODU2MywtMjIuMDEwNjEgLTI0LjQzNzMxLC0zNi4yOTEyMiAtMy4wMDU2MiwtNy44NzMxOSAtMy40Mzk2NCwtMTEuMDYxMDUgLTMuNDk3MDksLTI1LjY4Njg0IC0wLjA2MDMsLTE1LjMyNjE1IDAuMjEyODcsLTE3LjI0MzI4IDMuMzIzNiwtMjMuMzMzMzMgMy43OTU1LC03LjQzMDcgMTIuNTgxNjksLTE0LjIzOTE1IDIxLjczNDM0LC0xNi44NDIwMyA2LjA2MjA0LC0xLjcyMzk1IDI3LjQ2MDc1LC0yLjIwNTY1IDMzLjA0MDI4LC0wLjc0Mzc2IDMuMzY3ODIsMC44ODIzOSAzLjUzMDk1LDAuNjYxNjggNC40MTAyOCwtNS45NjcwNSAwLjczNzcyLC01LjU2MTI3IDEuODkyNTYsLTcuODYyNzggNi4wMTI2NCwtMTEuOTgyODYgbCA1LjA5OTU0LC01LjA5OTUzIGggMTQ0LjIyMzA3IGMgMTU2LjU0Mjc2LDAgMTQ3LjUzODA5LC0wLjQyNjI4IDE1NC43NTczMiw3LjMyNjE2IDMuMTc4NDksMy40MTMyOCAzLjMyNzQ4LDQuMzAxNjcgMy4yMDc1NSwxOS4xMjY2OSAtMC4xOTc5NiwyNC40NzE2NiAtNi4xMDk2Miw1Ny43MTk4NCAtMTUuNDQ3NjksODYuODgwNDggLTE1Ljk5MzA4LDQ5Ljk0MjY3IC00NC4zMTQ1NCw4Ny40OTQ0MSAtNzkuMzg5OTgsMTA1LjI2NDA4IC0yNS40NTAzMywxMi44OTM0NSAtNTguMjQzNjEsMTcuNTk4NTYgLTg5LjE3MTUyLDEyLjc5NDEyIHogbSA5Ni44MDE2OCwtNTMuNjAzNzcgYyAxNS42OTY5NiwtMTYuNzgwMTEgMjcuNDUxMzIsLTM3LjcxOTAzIDM2LjczOTMyLC02NS40NDY1MSA3LjIxMDE4LC0yMS41MjQ1NiAxMy44ODQ2MiwtNTguMjk4NTIgMTMuOTE2MzcsLTc2LjY3NDU4IGwgMC4wMTA5LC02LjMzMzM0IGggLTguNjY2NjYgLTguNjY2NjcgdiAxOS45MzE3MSBjIDAsNDAuMjM5MDcgLTcuMzA5LDczLjYzNzA0IC0yMi44NTg4NCwxMDQuNDUxODkgLTUuMDg4OTMsMTAuMDg0NjUgLTE1LjcyMTAzLDI2LjAwOTExIC0yMi4yOTE0NywzMy4zODc1NSAtNC44MDEwOCw1LjM5MTQ5IC00LjgwODI5LDUuNDE3MTMgLTAuNzE5ODQsMi41NTgyNCAyLjI3MTQyLC0xLjU4ODMyIDcuOTEzLC02LjkzMjA2IDEyLjUzNjg2LC0xMS44NzQ5NiB6IG0gLTIwMC41NDYxNSwtNTAuNzEyNCBjIC0xLjEyODA2LC0xMS4wMTA1NSAtMTAuODk0NTIsLTQ5LjkxNDQxIC0xNC40MDU4MywtNTcuMzg0NCAtMS40OTIsLTMuMTc0MDggLTUuMzUxNDEsLTguNzA1OTMgLTguNTc2NDksLTEyLjI5Mjk5IC0xMC40OTcxOCwtMTEuNjc1MzggLTIyLjU5MzE0LC0xNC45NzI2MiAtMzMuMDk4ODIsLTkuMDIyNCAtMTIuMzk3NDIsNy4wMjE2NyAtMTUuMDkyMTgsMjEuMDc2ODQgLTcuMTA4ODYsMzcuMDc4MTQgOC4yMjk2NSwxNi40OTUwMyA0MS40NjMyNSw0Ni40NDA4MiA1NS43MzYxLDUwLjIyMjEgNy42MzgxOCwyLjAyMzU3IDguNDQ2NzgsMS4wOTA2IDcuNDUzOSwtOC42MDA0NSB6IG0gMTIyLjU0NjExLC0xNDcuMDE4OCBjIC0zMS4zNTA0NCwtOC4yNzQwNSAtNTIuMDc1NiwtMjIuMTEyNzcgLTYwLjgzMDAxLC00MC42MTc3NyAtOS45Nzg3NSwtMjEuMDkyOTcgLTAuOTU5NzEsLTM1LjU3NTg5IDQ2LjgzMDAxLC03NS4yMDAzNiA1NS45NjY3OSwtNDYuNDA0NDMgNjcuNTgwMzcsLTY0LjI3MzY5IDU2Ljg4MTE1LC04Ny41MjAxOSAtNy40NjI2NCwtMTYuMjE0MjggLTIzLjEzOTgzLC0zMS44OTE3NSAtNDguMTM2OTUsLTQ4LjEzNzc5IC0xMi4zNzQyNSwtOC4wNDIyNCAtNDAuNjk2OTQsLTIzLjAxODg4IC00OC42MjcwOSwtMjUuNzEzMzMgLTIuNTAyMjQsLTAuODUwMiAtNC4yMzI1NywtMS44NjI3NyAtMy44NDUxNywtMi4yNTAxNyAwLjk5OTczLC0wLjk5OTc1IDI0LjMwMDA2LDQuMTkyMzggNDIuNDUwNjksOS40NTk1IDcxLjgyNzk3LDIwLjg0MzcyIDEwOC43ODM0Nyw1Mi42MTg2OCA5OS4zMDkxNSw4NS4zODc3MiAtNi4yODI1NywyMS43Mjk3MSAtMjYuNTQ3NTQsNDIuODc3NTcgLTg2LjY5ODQ1LDkwLjQ3NTYzIC0yMy4zODYwMiwxOC41MDU2MyAtMzcuNjY0NjUsMzIuNDg3NDMgLTQxLjE2NDE1LDQwLjMwODQ4IC00LjkwNjksMTAuOTY2NDIgMC41NDA2MiwyNC4zMzE0NCAxNC4yMDE0NywzNC44NDIxIDcuNDMzMjQsNS43MTkxMyAyNC44NDgwNywxNC44MTM3NCAzMy42MjkzNSwxNy41NjIzNyA1LjEzOTEyLDEuNjA4NiA5LjMwNzcxLDQuMDk3NDQgNi42LDMuOTQwNSAtMC42OTY2NywtMC4wNDA0IC01LjQ2NjY3LC0xLjE4MTg5IC0xMC42LC0yLjUzNjY5IHogbSAtNC4wNTE5MywtMjAuMzg5ODkgYyAtOC45MDI3LC0xMC4yNDA0NyAtMTEuMjgzMzEsLTIwLjk3MzQgLTYuNzY0MjgsLTMwLjQ5NjUzIDMuNDU5MzcsLTcuMjkwMDggMjAuMTQwODgsLTIyLjk3ODU4IDQ4LjgxNjIxLC00NS45MTAzMSA0OC44MzUzNiwtMzkuMDUzNzMgNjUuMDM4NTIsLTU1LjEzMTEzIDc0LjMyNjUyLC03My43NDk2NSA2LjcyMDgsLTEzLjQ3MjM4IDcuNDIwNzcsLTIzLjQ1MDg1IDIuNDEzMDYsLTM0LjM5OTc2IC0xLjk1NjM2LC00LjI3NzQgLTQuOTAzMSwtOS4yNzcwOSAtNi41NDgzMiwtMTEuMTEwNDIgLTEuNjQ1MjEsLTEuODMzMzQgLTMuODYxMjksLTQuNTA0NyAtNC45MjQ2MSwtNS45MzYzOCAtNC4yNjgyOCwtNS43NDY4MiA0LjQ2MjkzLDEuNzcxOSAxMC4zMTgyLDguODg1MzQgMjYuNTg4MTksMzIuMzAxNDYgMTIuMjY4NTYsNTguNTAzNDkgLTY2LjI1MTUyLDEyMS4yMjY4OCAtNTMuODM3NjksNDMuMDA2NjIgLTU5Ljk2NTk4LDUyLjA3NDM2IC00Ny45NzM2NCw3MC45ODQzNCA0Ljg5OTE4LDcuNzI1MTcgMy4wOTY2OCw3Ljk5Mjc4IC0zLjQxMTYyLDAuNTA2NDkgeiBtIC03Ny45MDQzLC0xOS44NDk2MyBjIC0zLjk5MzU5LC02LjQ3MjI1IC02Ljk4MTQzLC0xNy41NjU4OCAtNS45MzEzNCwtMjIuMDIyNjEgMy4zMTIwMywtMTQuMDU2NzUgMTguNjI3NjUsLTMxLjA4MDI3IDU1LjIwNjk0LC02MS4zNjMyNiAyNi40OTM3NCwtMjEuOTMzNDYgMzcuMTkzOTksLTMyLjA2NjkyIDQ1LjM3NzA0LC00Mi45NzM0NCAxMC40MjkxLC0xMy45MDAwOSAxMy4xMjc5OCwtMjUuODQ0NjcgOC40NzAwMiwtMzcuNDg2MDcgLTMuNDc1MzQsLTguNjg1NzMgLTEuMDY4OTgsLTcuNjcxNyAzLjcwMjE4LDEuNTYwMDggMy43MjIyNCw3LjIwMjIyIDQuMzc2ODMsOS44NjM2MyA0LjM3ODM2LDE3LjgwMTU5IDAuMDAzLDExLjMxOTczIC0zLjEzNDUsMTguMDkzMTcgLTE0Ljc4MzQ2LDMxLjkyMzY0IC03LjE0Myw4LjQ4MDcgLTE2LjQyNTI0LDE2LjgwNzY0IC02MC42ODU4NSw1NC40NDAyMyAtMjkuNjY1ODQsMjUuMjIzMzkgLTM5LjgxNjY4LDQyLjA1NTA2IC0zMy45MDEwNSw1Ni4yMTMxNiAyLjc2OTA1LDYuNjI3MjggMS43NDAyOCw3LjY5NzUgLTEuODMyODQsMS45MDY2OCB6IgogICAgICAgaWQ9InBhdGgxNDgyIgogICAgICAgc29kaXBvZGk6bm9kZXR5cGVzPSJjc3Njc3Nzc3Nzc2Njc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3NzY2Nzc3NzY3Nzc3Nzc3Nzc2NjY3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc2Nzc3NzIiAvPgogIDwvc3ZnOmc+Cjwvc3ZnOnN2Zz4K"; i_SignonLogo = CreateFile("Signon Logo", "image/svg+xml", new MemoryStream(Convert.FromBase64String(filedata)), new Guid("{c4f31b1a-aede-4e91-9fa0-511537f098a5}")); - - ValidateConstraints = true; - } + } } diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/MiniOmsModule.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/MiniOmsModule.cs index 2549ddb..2892008 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/MiniOmsModule.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/MiniOmsModule.cs @@ -1,14 +1,32 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.OmsImplementations.Mini; public abstract class MiniOmsModule { - protected InstanceHandle c_Class, c_Attribute, c_TextAttribute, c_BooleanAttribute, c_NumericAttribute, c_DateAttribute, c_WorkSet, c_Instance; + protected InstanceHandle c_Class, c_Attribute, c_Relationship, c_TextAttribute, c_BooleanAttribute, c_NumericAttribute, c_DateAttribute, c_WorkSet, c_Instance; protected abstract void BuildInternal(Oms oms); public void Build(Oms oms) { c_Class = oms.GetInstance(KnownInstanceGuids.Classes.Class); c_Attribute = oms.GetInstance(KnownInstanceGuids.Classes.Attribute); + c_Relationship = oms.GetInstance(KnownInstanceGuids.Classes.Relationship); c_TextAttribute = oms.GetInstance(KnownInstanceGuids.Classes.TextAttribute); c_BooleanAttribute = oms.GetInstance(KnownInstanceGuids.Classes.BooleanAttribute); c_NumericAttribute = oms.GetInstance(KnownInstanceGuids.Classes.NumericAttribute); diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/MethodsModule.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/MethodsModule.cs index c271f86..5047097 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/MethodsModule.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/MethodsModule.cs @@ -1,7 +1,27 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.OmsImplementations.Mini; using System; using MBS.Core; +using Microsoft.VisualBasic; +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; /// /// Builds additional support for Executables and Methods. These must be defined in order to call @@ -9,24 +29,84 @@ using MBS.Core; /// public class MethodsModule : MiniOmsModule { - private InstanceHandle c_Method, c_MethodBinding; - private InstanceHandle a_Name, a_Verb, a_Static; + private InstanceHandle c_WorkData, c_OMS; + private InstanceHandle c_ParameterAssignment, c_Method, c_MethodBinding; + private InstanceHandle a_Name, a_Order, a_Singular, a_Verb, a_Static, a_UseAnyCondition, a_Value; private InstanceHandle c_ReturnAttributeMethodBinding, c_ReturnInstanceSetMethodBinding; - private InstanceHandle c_GetAttributeMethod, c_GetSpecifiedInstancesMethod; + private InstanceHandle c_CommonText, c_CommonBoolean, c_CommonNumeric, c_CommonDate, c_CommonInstanceSet; + private InstanceHandle c_ConditionGroup; + private InstanceHandle c_BuildAttributeMethod, c_GetAttributeMethod, c_GetSpecifiedInstancesMethod, c_GetAttributeBySystemRoutineMethod, c_AssignAttributeMethod, c_GetRelationshipMethod, c_GetReferencedAttributeMethod, c_SelectFromInstanceSetMethod, c_ConditionalSelectFromInstanceSetCase, c_ConditionalSelectFromInstanceSetMethod, c_ConditionalSelectAttributeMethod, c_ConditionalSelectAttributeCase, c_EvaluateBooleanExpressionMethod; + private InstanceHandle c_AccessModifier, i_AccessModifier_Private, i_AccessModifier_Protected, i_AccessModifier_Public, i_AccessModifier_RootA2; + private InstanceHandle c_SystemRoutine, c_SystemAttributeRoutine, c_SystemInstanceSetRoutine; + private InstanceHandle c_AccumulationFunction, c_SelectionFunction, c_SetFunction; - protected override void BuildInternal(Oms oms) - { - c_Method = oms.CreateInstanceOf(c_Class, KnownInstanceGuids.Classes.Method); + protected override void BuildInternal(Oms oms) + { + c_WorkData = oms.GetInstance(KnownInstanceGuids.Classes.WorkData); + c_ParameterAssignment = oms.CreateClass("Parameter Assignment", KnownInstanceGuids.Classes.ParameterAssignment); + oms.CreateRelationship(c_ParameterAssignment, "assigns from", c_Instance, KnownRelationshipGuids.Parameter_Assignment__assigns_from__Executable_returning_Work_Data, true, "assigned from", KnownRelationshipGuids.Executable_returning_Work_Data__assigned_from__Parameter_Assignment); + oms.CreateRelationship(c_ParameterAssignment, "assigns to", c_WorkData, KnownRelationshipGuids.Parameter_Assignment__assigns_to__Work_Data, true, "assigned to", KnownRelationshipGuids.Work_Data__assigned_by__Parameter_Assignment); + + c_Method = oms.CreateClass("Method", KnownInstanceGuids.Classes.Method); c_MethodBinding = oms.CreateClass("Method Binding", KnownInstanceGuids.Classes.MethodBinding); c_ReturnAttributeMethodBinding = oms.CreateClass("Return Attribute Method Binding", KnownInstanceGuids.Classes.ReturnAttributeMethodBinding); c_ReturnInstanceSetMethodBinding = oms.CreateClass("Return Instance Set Method Binding", KnownInstanceGuids.Classes.ReturnInstanceSetMethodBinding); + c_AccumulationFunction = oms.CreateEnumeration(KnownInstanceGuids.Classes.AccumulationFunction, new Guid[] + { + KnownInstanceGuids.AccumulationFunctions.Sum, + KnownInstanceGuids.AccumulationFunctions.Average + }); + c_SelectionFunction = oms.CreateEnumeration(KnownInstanceGuids.Classes.SelectionFunction, new Guid[] + { + KnownInstanceGuids.SelectionFunctions.Maximum, + KnownInstanceGuids.SelectionFunctions.Minimum + }); + a_Name = oms.GetInstance(KnownAttributeGuids.Text.Name); + a_Order = oms.GetInstance(KnownAttributeGuids.Text.Order); a_Verb = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.Verb); a_Static = oms.CreateInstanceOf(c_BooleanAttribute, KnownAttributeGuids.Boolean.Static); + a_Singular = oms.GetInstance(KnownAttributeGuids.Boolean.Singular); + a_Value = oms.GetInstance(KnownAttributeGuids.Text.Value); + + a_UseAnyCondition = oms.CreateInstanceOf(oms.GetInstance(KnownInstanceGuids.Classes.BooleanAttribute), KnownAttributeGuids.Boolean.UseAnyCondition); + oms.SetAttributeValue(a_UseAnyCondition, a_Name, "Use Any Condition"); + + c_AccessModifier = oms.CreateInstanceOf(c_Class, KnownInstanceGuids.Classes.AccessModifier); + oms.AddAttribute(c_AccessModifier, a_Name); + oms.AddAttribute(c_AccessModifier, a_Order); + + i_AccessModifier_Private = oms.CreateInstanceOf(c_AccessModifier, KnownInstanceGuids.AccessModifiers.Private); + oms.SetAttributeValue(i_AccessModifier_Private, a_Name, "Private"); + oms.SetAttributeValue(i_AccessModifier_Private, a_Order, "a"); + + i_AccessModifier_Protected = oms.CreateInstanceOf(c_AccessModifier, KnownInstanceGuids.AccessModifiers.Protected); + oms.SetAttributeValue(i_AccessModifier_Protected, a_Name, "Protected"); + oms.SetAttributeValue(i_AccessModifier_Protected, a_Order, "b"); + + i_AccessModifier_Public = oms.CreateInstanceOf(c_AccessModifier, KnownInstanceGuids.AccessModifiers.Public); + oms.SetAttributeValue(i_AccessModifier_Public, a_Name, "Public"); + oms.SetAttributeValue(i_AccessModifier_Public, a_Order, "c"); + + i_AccessModifier_RootA2 = oms.CreateInstanceOf(c_AccessModifier, KnownInstanceGuids.AccessModifiers.RootA2); + oms.SetAttributeValue(i_AccessModifier_RootA2, a_Name, "Root (A2)"); + oms.SetAttributeValue(i_AccessModifier_RootA2, a_Order, "z"); + + AccessModifier.Private = new AccessModifier(i_AccessModifier_Private); + AccessModifier.Protected = new AccessModifier(i_AccessModifier_Protected); + AccessModifier.Public = new AccessModifier(i_AccessModifier_Public); + AccessModifier.RootA2 = new AccessModifier(i_AccessModifier_RootA2); oms.CreateRelationship(c_Class, "has", c_Method, KnownRelationshipGuids.Class__has__Method, false, "for", KnownRelationshipGuids.Method__for__Class); + oms.CreateRelationship(c_MethodBinding, "executes", c_Method, KnownRelationshipGuids.Method_Binding__executes__Method, true, "executed by", KnownRelationshipGuids.Method__executed_by__Method_Binding); + oms.CreateRelationship(c_MethodBinding, "has", c_ParameterAssignment, KnownRelationshipGuids.Method_Binding__has__Parameter_Assignment, false, "for", KnownRelationshipGuids.Parameter_Assignment__for__Method_Binding); + + c_BuildAttributeMethod = oms.CreateClass("BA - Build Attribute Method", KnownInstanceGuids.MethodClasses.BuildAttributeMethod); + oms.AddAttribute(c_BuildAttributeMethod, oms.GetInstance(KnownAttributeGuids.Text.Value)); + oms.CreateRelationship(c_BuildAttributeMethod, "returns", c_Attribute, KnownRelationshipGuids.Build_Attribute_Method__returns__Attribute, true, "returned by", KnownRelationshipGuids.Attribute__returned_by__Build_Attribute_Method); + oms.AddSuperClass(c_BuildAttributeMethod, c_Method); c_GetAttributeMethod = oms.CreateClass("GA - Get Attribute Method", KnownInstanceGuids.MethodClasses.GetAttributeMethod); oms.CreateRelationship(c_GetAttributeMethod, "returns", c_Attribute, KnownRelationshipGuids.Get_Attribute_Method__returns__Attribute, true, "returned by", KnownRelationshipGuids.Attribute__returned_by__Get_Attribute_Method); @@ -37,8 +117,186 @@ public class MethodsModule : MiniOmsModule oms.CreateRelationship(c_GetSpecifiedInstancesMethod, "uses", c_Instance, KnownRelationshipGuids.Get_Specified_Instances_Method__uses__Instance, false, "used by", KnownRelationshipGuids.Instance__used_by__Get_Specified_Instances_Method); oms.AddSuperClass(c_GetSpecifiedInstancesMethod, c_Method); + c_SystemRoutine = oms.CreateClass("System Routine", KnownInstanceGuids.Classes.SystemRoutine); + + c_SystemAttributeRoutine = oms.CreateClass("System Attribute Routine", KnownInstanceGuids.Classes.SystemAttributeRoutine); + oms.AddSuperClass(c_SystemAttributeRoutine, c_SystemRoutine); + + c_SystemInstanceSetRoutine = oms.CreateClass("System Instance Set Routine", KnownInstanceGuids.Classes.SystemInstanceSetRoutine); + oms.AddSuperClass(c_SystemInstanceSetRoutine, c_SystemRoutine); + + c_GetAttributeBySystemRoutineMethod = oms.CreateClass("GAS - Get Attribute by System Routine Method", KnownInstanceGuids.MethodClasses.GetAttributeBySystemRoutineMethod); + oms.CreateRelationship(c_GetAttributeBySystemRoutineMethod, "returns", c_Attribute, KnownRelationshipGuids.Get_Attribute_by_System_Routine_Method__returns__Attribute, true, "returned by", KnownRelationshipGuids.Attribute__returned_by__Get_Attribute_by_System_Routine_Method); + oms.CreateRelationship(c_GetAttributeBySystemRoutineMethod, "uses", c_Instance, KnownRelationshipGuids.Get_Attribute_by_System_Routine_Method__uses__System_Attribute_Routine, false, "used by", KnownRelationshipGuids.System_Attribute_Routine__used_by__Get_Attribute_by_System_Routine_Method); + oms.AddSuperClass(c_GetAttributeBySystemRoutineMethod, c_Method); + + c_AssignAttributeMethod = oms.CreateClass("AA - Assign Attribute Method", KnownInstanceGuids.MethodClasses.AssignAttributeMethod); + oms.CreateRelationship(c_AssignAttributeMethod, "uses", c_Attribute, KnownRelationshipGuids.Assign_Attribute_Method__uses__Executable_returning_Attribute, true, "used by", KnownRelationshipGuids.Executable_returning_Attribute__used_by__Assign_Attribute_Method); + oms.CreateRelationship(c_AssignAttributeMethod, "assigns", c_Attribute, KnownRelationshipGuids.Assign_Attribute_Method__assigns__Attribute, false, "assigned by", KnownRelationshipGuids.Attribute__assigned_by__Assign_Attribute_Method); + oms.AddSuperClass(c_AssignAttributeMethod, c_Method); + + c_GetRelationshipMethod = oms.CreateClass("GR - Get Relationship Method", KnownInstanceGuids.MethodClasses.GetRelationshipMethod); + oms.CreateRelationship(c_GetRelationshipMethod, "returns", c_Relationship, KnownRelationshipGuids.Get_Relationship_Method__returns__Relationship, true, "returned by", KnownRelationshipGuids.Relationship__returned_by__Get_Relationship_Method); + oms.AddSuperClass(c_GetRelationshipMethod, c_Method); + oms.AddAttribute(c_GetRelationshipMethod, a_Singular); + + c_GetReferencedAttributeMethod = oms.CreateClass("GRA - Get Referenced Attribute Method", KnownInstanceGuids.MethodClasses.GetReferencedAttributeMethod); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "returns", c_Attribute, KnownRelationshipGuids.Get_Referenced_Attribute_Method__returns__Attribute, true, "returned by", KnownRelationshipGuids.Attribute__returned_by__Get_Referenced_Attribute_Method); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "uses reference", c_Instance, KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_reference__Executable_returning_Instance_Set, true, "reference used by", KnownRelationshipGuids.Executable_returning_Instance_Set__reference_used_by__Get_Referenced_Attribute_Method); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "uses answer", c_Instance, KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_answer__Executable_returning_Attribute, true, "reference used by", KnownRelationshipGuids.Executable_returning_Attribute__answer_used_by__Get_Referenced_Attribute_Method); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "uses", c_AccumulationFunction, KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses__Accumulation_Function, true, "used by", KnownRelationshipGuids.Accumulation_Function__used_by__Get_Referenced_Attribute_Method); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "uses order", c_Attribute, KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_order__Executable_returning_Attribute, true, "order used by", KnownRelationshipGuids.Executable_returning_Attribute__order_used_by__Get_Referenced_Attribute_Method); + oms.AddSuperClass(c_GetReferencedAttributeMethod, c_Method); + + c_SelectFromInstanceSetMethod = oms.CreateClass("SS - Select from Instance Set Method", KnownInstanceGuids.MethodClasses.SelectFromInstanceSetMethod); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "returns", c_Attribute, KnownRelationshipGuids.Select_From_Instance_Set_Method__returns__Work_Set, true, "returned by", KnownRelationshipGuids.Work_Set__returned_by__Select_from_Instance_Set_Method); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "uses", c_Instance, KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Executable_returning_Instance_Set, true, "used by", KnownRelationshipGuids.Executable_returning_Instance_Set__used_by__Select_from_Instance_Set_Method); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "uses", c_Instance, KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Selection_Function, true, "used by", KnownRelationshipGuids.Selection_Function__used_by__Select_from_Instance_Set_Method); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "uses", c_AccumulationFunction, KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Set_Function, true, "used by", KnownRelationshipGuids.Set_Function__used_by__Select_from_Instance_Set_Method); + oms.CreateRelationship(c_GetReferencedAttributeMethod, "uses order", c_Attribute, KnownRelationshipGuids.Select_from_Instance_Set_Method__uses_order__Executable_returning_Attribute, true, "order used by", KnownRelationshipGuids.Executable_returning_Attribute__order_used_by__Get_Referenced_Attribute_Method); + oms.AddSuperClass(c_SelectFromInstanceSetMethod, c_Method); + + c_ConditionGroup = oms.CreateClass("Condition Group", KnownInstanceGuids.Classes.ConditionGroup); + oms.CreateRelationship(c_ConditionGroup, "has true condition", c_Instance, KnownRelationshipGuids.Condition_Group__has_true_condition__Executable_returning_Work_Data, false, "true condition for", KnownRelationshipGuids.Executable_returning_Work_Data__true_condition_for__Condition_Group); + oms.CreateRelationship(c_ConditionGroup, "has false condition", c_Instance, KnownRelationshipGuids.Condition_Group__has_false_condition__Executable_returning_Work_Data, false, "false condition for", KnownRelationshipGuids.Executable_returning_Work_Data__false_condition_for__Condition_Group); + oms.AddAttribute(c_ConditionGroup, a_UseAnyCondition); + + c_ConditionalSelectFromInstanceSetCase = oms.CreateClass("Conditional Select from Instance Set Case", KnownInstanceGuids.Classes.ConditionalSelectFromInstanceSetCase); + oms.AddSuperClass(c_ConditionalSelectFromInstanceSetCase, c_ConditionGroup); + + c_ConditionalSelectFromInstanceSetMethod = oms.CreateClass("SSC - Conditional Select from Instance Set Method", KnownInstanceGuids.MethodClasses.ConditionalSelectFromInstanceSetMethod); + oms.CreateRelationship(c_ConditionalSelectFromInstanceSetMethod, "returns", c_WorkSet, KnownRelationshipGuids.Conditional_Select_From_Instance_Set_Method__returns__Work_Set, true, "returned by", KnownRelationshipGuids.Work_Set__returned_by__Conditional_Select_from_Instance_Set_Method); + oms.CreateRelationship(c_ConditionalSelectFromInstanceSetMethod, "has", c_ConditionalSelectFromInstanceSetCase, KnownRelationshipGuids.Conditional_Select_from_Instance_Set_Method__has__Conditional_Select_from_Instance_Set_Case, false, "for", KnownRelationshipGuids.Conditional_Select_from_Instance_Set_Case__for__Conditional_Select_from_Instance_Set_Method); + oms.AddSuperClass(c_ConditionalSelectFromInstanceSetMethod, c_Method); + + c_ConditionalSelectAttributeCase = oms.CreateClass("Conditional Select Attribute Case", KnownInstanceGuids.Classes.ConditionalSelectAttributeCase); + oms.CreateRelationship(c_ConditionalSelectAttributeCase, "invokes", c_Attribute, KnownRelationshipGuids.Conditional_Select_Attribute_Case__invokes__Executable_returning_Attribute, true, "invoked by", KnownRelationshipGuids.Executable_returning_Attribute__invoked_by__Conditional_Select_Attribute_Case); + oms.AddSuperClass(c_ConditionalSelectAttributeCase, c_ConditionGroup); + + c_ConditionalSelectAttributeMethod = oms.CreateClass("SAC - Conditional Select Attribute Method", KnownInstanceGuids.MethodClasses.ConditionalSelectAttributeMethod); + oms.CreateRelationship(c_ConditionalSelectAttributeMethod, "returns", c_Attribute, KnownRelationshipGuids.Conditional_Select_Attribute_Method__returns__Attribute, true, "returned by", KnownRelationshipGuids.Attribute__returned_by__Conditional_Select_Attribute_Method); + oms.CreateRelationship(c_ConditionalSelectAttributeMethod, "has", c_ConditionalSelectAttributeCase, KnownRelationshipGuids.Conditional_Select_Attribute_Method__has__Conditional_Select_Attribute_Case, false, "for", KnownRelationshipGuids.Conditional_Select_Attribute_Case__for__Conditional_Select_Attribute_Method); + oms.AddSuperClass(c_ConditionalSelectAttributeMethod, c_Method); + + InstanceHandle c_BooleanOperator = oms.CreateClass("Boolean Operator", KnownInstanceGuids.Classes.BooleanOperator); + InstanceHandle c_RelationalOperator = oms.CreateClass("Relational Operator", KnownInstanceGuids.Classes.RelationalOperator); + + RelationalOperator.CountEqualTo = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.CountEqualTo)); + RelationalOperator.CountGreaterThan = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.CountGreaterThan)); + RelationalOperator.CountGreaterThanOrEqualTo = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.CountGreaterThanOrEqualTo)); + RelationalOperator.CountLessThan = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.CountLessThan)); + RelationalOperator.CountLessThanOrEqualTo = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.CountLessThanOrEqualTo)); + RelationalOperator.CountNotEqualTo = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.CountNotEqualTo)); + RelationalOperator.ExactMatchWithSelectionList = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.ExactMatchWithSelectionList)); + RelationalOperator.InSelectionList = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.InSelectionList)); + RelationalOperator.IsEmpty = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.IsEmpty)); + RelationalOperator.IsNotEmpty = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.IsNotEmpty)); + RelationalOperator.NotExactMatchWithSelectionList = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.NotExactMatchWithSelectionList)); + RelationalOperator.NotInSelectionList = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.NotInSelectionList)); + RelationalOperator.NotSubsetOfSelectionList = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.NotSubsetOfSelectionList)); + RelationalOperator.NotSupersetOfSelectionList = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.NotSupersetOfSelectionList)); + RelationalOperator.SubsetOfSelectionList = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.SubsetOfSelectionList)); + RelationalOperator.SupersetOfSelectionList = new RelationalOperator(oms.CreateInstanceOf(c_RelationalOperator, KnownInstanceGuids.RelationalOperators.SupersetOfSelectionList)); + + c_EvaluateBooleanExpressionMethod = oms.CreateClass("EBE - Evaluate Boolean Expression Method", KnownInstanceGuids.MethodClasses.EvaluateBooleanExpressionMethod); + oms.CreateRelationship(c_EvaluateBooleanExpressionMethod, "returns", c_BooleanAttribute, KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__returns__Boolean_Attribute, true, "returned by", KnownRelationshipGuids.Boolean_Attribute__returned_by__Evaluate_Boolean_Expression_Method); + oms.CreateRelationship(c_EvaluateBooleanExpressionMethod, "has source", c_Instance, KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_source__Executable_returning_Work_Data, true, "source for", KnownRelationshipGuids.Executable_returning_Work_Data__source_for__Evaluate_Boolean_Expression_Method); + oms.CreateRelationship(c_EvaluateBooleanExpressionMethod, "uses", c_BooleanOperator, KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__uses__Boolean_Operator, true, "source for", KnownRelationshipGuids.Executable_returning_Work_Data__source_for__Evaluate_Boolean_Expression_Method); + oms.CreateRelationship(c_EvaluateBooleanExpressionMethod, "has target", c_Instance, KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_target__Executable_returning_Work_Data, true, "target for", KnownRelationshipGuids.Executable_returning_Work_Data__target_for__Evaluate_Boolean_Expression_Method); + oms.AddSuperClass(c_EvaluateBooleanExpressionMethod, c_Method); + + c_CommonText = oms.CreateClass("Common Text", KnownInstanceGuids.Classes.CommonText); + c_CommonBoolean = oms.CreateClass("Common Boolean", KnownInstanceGuids.Classes.CommonBoolean); + c_CommonNumeric = oms.CreateClass("Common Numeric", KnownInstanceGuids.Classes.CommonNumeric); + c_CommonDate = oms.CreateClass("Common Date", KnownInstanceGuids.Classes.CommonDate); + c_CommonInstanceSet = oms.CreateClass("Common Instance Set", KnownInstanceGuids.Classes.CommonInstanceSet); + oms.AddAttribute(c_Method, a_Name); oms.AddAttribute(c_Method, a_Verb); oms.AddAttribute(c_Method, a_Static); + + c_OMS = oms.GetInstance(KnownInstanceGuids.Classes.OMS); + OmsMethodBuilder mb = new OmsMethodBuilder(oms); + OmsSystemRoutineBuilder srb = new OmsSystemRoutineBuilder(oms); + SystemAttributeRoutine sr = srb.CreateSystemAttributeRoutine(KnownInstanceGuids.SystemAttributeRoutines.GetRuntimeVersion, new Func(delegate (Oms oms, OmsContext context) { return oms.RuntimeVersion.ToString(); })); + mb.CreateGetAttributeBySystemRoutineMethod(c_OMS, "get", "Runtime Version", null, true, KnownInstanceGuids.Methods.GetAttributeBySystemRoutine.OMS__get__Runtime_Version, oms.GetInstance(KnownAttributeGuids.Text.Value), sr); + + mb.CreateGetRelationshipMethod(c_Instance, "get", "Parent Class", AccessModifier.Public, false, KnownInstanceGuids.Methods.GetRelationship.Instance__get__Parent_Class, oms.GetInstance(KnownRelationshipGuids.Instance__for__Class)); + + InstanceHandle a_Seed = oms.CreateInstanceOf(oms.GetInstance(KnownInstanceGuids.Classes.NumericAttribute), KnownAttributeGuids.Numeric.Seed); + oms.SetAttributeValue(a_Seed, a_Name, "Seed"); + + InstanceHandle a_RandomNumber = oms.CreateInstanceOf(oms.GetInstance(KnownInstanceGuids.Classes.NumericAttribute), KnownAttributeGuids.Numeric.RandomNumber); + mb.CreateGetAttributeBySystemRoutineMethod(c_CommonNumeric, "get", "Random Number", AccessModifier.Public, true, KnownInstanceGuids.Methods.GetAttributeBySystemRoutine.Common_Numeric__get__Random_Number, a_RandomNumber, srb.CreateSystemAttributeRoutine(KnownInstanceGuids.SystemAttributeRoutines.GetRandomNumber, new Func(delegate (Oms oms, OmsContext context) + { + object? seedO = context.GetWorkData(a_Seed); + if (seedO is decimal) + { + decimal seed = (decimal)seedO; + return (decimal)(new Random((int)seed)).NextDouble(); + } + return (decimal)(new Random()).NextDouble(); + }))); + + CreateGetMethodAbbreviation(oms); + CreateGetMethodBindingAbbreviation(oms); + } + + private void CreateGetMethodAbbreviation(Oms oms) + { + OmsMethodBuilder mb = new OmsMethodBuilder(oms); + GetRelationshipMethod Instance__get__Parent_Class = oms.GetInstance(KnownInstanceGuids.Methods.GetRelationship.Instance__get__Parent_Class); + + ReturnInstanceSetMethodBinding Instance__get__Parent_Class_rsmb = Instance__get__Parent_Class.CreateMethodBinding(oms, new KeyValuePair[] + { + new KeyValuePair(c_Instance, c_Method) + }); + + BuildAttributeMethod Method__get__SAC_Method_Suffix = mb.CreateBuildAttributeMethod(c_Method, "get", "SAC Method Suffix", AccessModifier.Public, true, a_Value, "SAC"); + EvaluateBooleanExpressionMethod Method__is__Conditional_Select_Attribute_Method = mb.CreateEvaluateBooleanExpressionMethod(c_Method, "is", "SAC", AccessModifier.Public, false, oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, oms.GetInstance(KnownInstanceGuids.MethodClasses.ConditionalSelectAttributeMethod)); + + BuildAttributeMethod Method__get__GAS_Method_Suffix = mb.CreateBuildAttributeMethod(c_Method, "get", "GAS Method Suffix", AccessModifier.Public, true, a_Value, "GAS"); + EvaluateBooleanExpressionMethod Method__is__Get_Attribute_by_System_Routine_Method = mb.CreateEvaluateBooleanExpressionMethod(c_Method, "is", "GAS", AccessModifier.Public, false, oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, oms.GetInstance(KnownInstanceGuids.MethodClasses.GetAttributeBySystemRoutineMethod)); + + BuildAttributeMethod Method__get__GR_Method_Suffix = mb.CreateBuildAttributeMethod(c_Method, "get", "GR Method Suffix", AccessModifier.Public, true, a_Value, "GR"); + EvaluateBooleanExpressionMethod Method__is__Get_Relationship_Method = mb.CreateEvaluateBooleanExpressionMethod(c_Method, "is", "GR", AccessModifier.Public, false, oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, oms.GetInstance(KnownInstanceGuids.MethodClasses.GetRelationshipMethod)); + + mb.CreateConditionalSelectAttributeMethod(c_Method, "get", "Method Abbreviation", AccessModifier.Public, false, KnownInstanceGuids.Methods.ConditionalSelectAttribute.Method__get__Method_Abbreviation, a_Value, new ConditionalSelectAttributeCase[] + { + new ConditionalSelectAttributeCase(new IExecutableReturningAttribute[] { Method__is__Get_Attribute_by_System_Routine_Method.CreateMethodBinding(oms) }, null, false, Method__get__GAS_Method_Suffix.CreateMethodBinding(oms)), + new ConditionalSelectAttributeCase(new IExecutableReturningAttribute[] { Method__is__Get_Relationship_Method.CreateMethodBinding(oms) }, null, false, Method__get__GR_Method_Suffix.CreateMethodBinding(oms)), + new ConditionalSelectAttributeCase(new IExecutableReturningAttribute[] { Method__is__Conditional_Select_Attribute_Method.CreateMethodBinding(oms) }, null, false, Method__get__SAC_Method_Suffix.CreateMethodBinding(oms)) + }); + } + + private void CreateGetMethodBindingAbbreviation(Oms oms) + { + OmsMethodBuilder mb = new OmsMethodBuilder(oms); + + GetRelationshipMethod Instance__get__Parent_Class = oms.GetInstance(KnownInstanceGuids.Methods.GetRelationship.Instance__get__Parent_Class); + ReturnInstanceSetMethodBinding Instance__get__Parent_Class_rsmb = Instance__get__Parent_Class.CreateMethodBinding(oms, new KeyValuePair[] + { + new KeyValuePair(c_Instance, c_MethodBinding) + }); + + // RAMB + BuildAttributeMethod Method_Binding__get__RAMB_Method_Binding_Suffix = mb.CreateBuildAttributeMethod(c_MethodBinding, "get", "RAMB Method Suffix", AccessModifier.Public, true, a_Value, "ramb"); + ReturnAttributeMethodBinding Method_Binding__get__RAMB_Method_Binding_Suffix_ramb = Method_Binding__get__RAMB_Method_Binding_Suffix.CreateMethodBinding(oms); + + EvaluateBooleanExpressionMethod Method_Binding__is__Return_Attribute_Method_Binding = mb.CreateEvaluateBooleanExpressionMethod(c_MethodBinding, "is", "RAMB", AccessModifier.Public, false, oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, oms.GetInstance(KnownInstanceGuids.Classes.ReturnAttributeMethodBinding)); + ReturnAttributeMethodBinding Method_Binding__is__Return_Attribute_Method_Binding_ramb = Method_Binding__is__Return_Attribute_Method_Binding.CreateMethodBinding(oms); + + // RSMB + BuildAttributeMethod Method_Binding__get__RSMB_Method_Binding_Suffix = mb.CreateBuildAttributeMethod(c_MethodBinding, "get", "RSMB Method Suffix", AccessModifier.Public, true, a_Value, "rsmb"); + ReturnAttributeMethodBinding Method_Binding__get__RSMB_Method_Binding_Suffix_ramb = Method_Binding__get__RSMB_Method_Binding_Suffix.CreateMethodBinding(oms); + + EvaluateBooleanExpressionMethod Method_Binding__is__Return_Instance_Set_Method_Binding = mb.CreateEvaluateBooleanExpressionMethod(c_MethodBinding, "is", "RSMB", AccessModifier.Public, false, oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, oms.GetInstance(KnownInstanceGuids.Classes.ReturnInstanceSetMethodBinding)); + ReturnAttributeMethodBinding Method_Binding__is__Return_Instance_Set_Method_Binding_ramb = Method_Binding__is__Return_Instance_Set_Method_Binding.CreateMethodBinding(oms); + + mb.CreateConditionalSelectAttributeMethod(c_MethodBinding, "get", "Method Binding Abbreviation", AccessModifier.Public, false, KnownInstanceGuids.Methods.ConditionalSelectAttribute.Method_Binding__get__Method_Binding_Abbreviation, a_Value, new ConditionalSelectAttributeCase[] + { + new ConditionalSelectAttributeCase(new IExecutableReturningAttribute[] { Method_Binding__is__Return_Attribute_Method_Binding_ramb }, null, false, Method_Binding__get__RAMB_Method_Binding_Suffix_ramb), + new ConditionalSelectAttributeCase(new IExecutableReturningAttribute[] { Method_Binding__is__Return_Instance_Set_Method_Binding_ramb }, null, false, Method_Binding__get__RSMB_Method_Binding_Suffix_ramb) + }); } } \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/SecurityModule.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/SecurityModule.cs index 2f9df60..8066aa4 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/SecurityModule.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/SecurityModule.cs @@ -1,14 +1,34 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.OmsImplementations.Mini.Modules; public class SecurityModule : MiniOmsModule { private InstanceHandle c_User, c_UserLogin, c_Role; private InstanceHandle r_User__has__Role; + private InstanceHandle a_Token; protected override void BuildInternal(Oms oms) { c_User = oms.CreateClass("User", KnownInstanceGuids.Classes.User); c_UserLogin = oms.CreateClass("User Login", KnownInstanceGuids.Classes.UserLogin); + a_Token = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.Token); + // c_Role = oms.CreateClass("Role", KnownInstanceGuids.Classes.Role); } diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/TranslationModule.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/TranslationModule.cs new file mode 100644 index 0000000..b41c9ad --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/TranslationModule.cs @@ -0,0 +1,55 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.OmsImplementations.Mini.Modules; + +public class TranslationModule : MiniOmsModule +{ + private InstanceHandle c_Tenant, c_Translation, c_TranslationValue, c_Language; + private InstanceHandle a_Name, a_Value; + private InstanceHandle r_Translation__has__Translation_Value, r_Translation_Value__has__Language; + private InstanceHandle r_Tenant__has_login_header__Translation, r_Tenant__has_login_footer__Translation; + + protected override void BuildInternal(Oms oms) + { + a_Name = oms.GetInstance(KnownAttributeGuids.Text.Name); + a_Value = oms.GetInstance(KnownAttributeGuids.Text.Value); + + c_Language = oms.CreateClass("Language", KnownInstanceGuids.Classes.Language); + oms.AddAttribute(c_Language, a_Name); + + oms.CreateInstanceOf(c_Language, KnownInstanceGuids.Languages.English); + oms.CreateInstanceOf(c_Language, KnownInstanceGuids.Languages.Spanish); + oms.CreateInstanceOf(c_Language, KnownInstanceGuids.Languages.French); + oms.CreateInstanceOf(c_Language, KnownInstanceGuids.Languages.German); + oms.CreateInstanceOf(c_Language, KnownInstanceGuids.Languages.Italian); + oms.CreateInstanceOf(c_Language, KnownInstanceGuids.Languages.Chinese); + oms.CreateInstanceOf(c_Language, KnownInstanceGuids.Languages.Japanese); + oms.CreateInstanceOf(c_Language, KnownInstanceGuids.Languages.Korean); + + c_Translation = oms.CreateClass("Translation", KnownInstanceGuids.Classes.Translation); + c_TranslationValue = oms.CreateClass("Translation Value", KnownInstanceGuids.Classes.TranslationValue); + oms.AddAttribute(c_TranslationValue, a_Value); + + r_Translation__has__Translation_Value = oms.CreateRelationship(c_Translation, "has", c_TranslationValue, KnownRelationshipGuids.Translation__has__Translation_Value, false, "for", KnownRelationshipGuids.Translation_Value__for__Translation); + r_Translation_Value__has__Language = oms.CreateRelationship(c_TranslationValue, "has", c_Language, KnownRelationshipGuids.Translation_Value__has__Language, true, "for", KnownRelationshipGuids.Language__for__Translation_Value); + + c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant); + r_Tenant__has_login_header__Translation = oms.CreateRelationship(c_Tenant, "has login header", c_Translation, KnownRelationshipGuids.Tenant__has_login_header__Translation, true); + r_Tenant__has_login_footer__Translation = oms.CreateRelationship(c_Tenant, "has login footer", c_Translation, KnownRelationshipGuids.Tenant__has_login_footer__Translation, true); + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/WebModule.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/WebModule.cs new file mode 100644 index 0000000..ea058a4 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsImplementations/Mini/Modules/WebModule.cs @@ -0,0 +1,28 @@ +namespace Mocha.Core.OmsImplementations.Mini.Modules; + +public class WebModule : MiniOmsModule +{ + private InstanceHandle c_Route; + private InstanceHandle a_TargetURL; + + private InstanceHandle CreateRoute(Oms oms, string targetUrl, InstanceHandle processedByControlTransactionMethod) + { + InstanceHandle rt = oms.CreateInstanceOf(c_Route); + oms.SetAttributeValue(rt, a_TargetURL, "/{tenant}/d/home.htmld"); + return rt; + } + + protected override void BuildInternal(Oms oms) + { + a_TargetURL = oms.CreateInstanceOf(c_Attribute, KnownAttributeGuids.Text.TargetURL); + + c_Route = oms.CreateClass("Route", KnownInstanceGuids.Classes.Route); + oms.AddAttribute(c_Route, a_TargetURL); + + // oms.CreateRelationship(c_Route, "processed by", c_ControlTransactionMethod, KnownRelationshipGuids.Route__processed_by__Control_Transaction_Method, true, "processes", KnownRelationshipGuids.Control_Transaction_Method__processes__Route); + + // Route.processed by CT - Control Transaction Method + // CT - Control Transaction Method.uses Build Response Method Binding + // Build Response Method Binding.executes Method -- Build UI Response Method + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsMethodBuilder.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsMethodBuilder.cs index 10878eb..1b5ef8b 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/OmsMethodBuilder.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsMethodBuilder.cs @@ -1,5 +1,26 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + namespace Mocha.Core; public class OmsMethodBuilder @@ -15,48 +36,259 @@ public class OmsMethodBuilder c_ReturnInstanceSetMethodBinding = Oms.GetInstance(KnownInstanceGuids.Classes.ReturnInstanceSetMethodBinding); } - public InstanceHandle CreateReturnAttributeMethodBinding(InstanceHandle method) + public ReturnAttributeMethodBinding CreateReturnAttributeMethodBinding(Method method) { InstanceHandle methodBinding = Oms.CreateInstanceOf(c_ReturnAttributeMethodBinding); - Oms.AssignRelationship(methodBinding, Oms.GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method), method); - return methodBinding; + Oms.AssignRelationship(methodBinding, Oms.GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method), method.Handle); + return new ReturnAttributeMethodBinding(methodBinding); } - public InstanceHandle CreateReturnInstanceSetMethodBinding(InstanceHandle method) - { + public ReturnInstanceSetMethodBinding CreateReturnInstanceSetMethodBinding(Method method) + { InstanceHandle methodBinding = Oms.CreateInstanceOf(c_ReturnInstanceSetMethodBinding); - Oms.AssignRelationship(methodBinding, Oms.GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method), method); - return methodBinding; - } + Oms.AssignRelationship(methodBinding, Oms.GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method), method.Handle); + return new ReturnInstanceSetMethodBinding(methodBinding); + } - public InstanceHandle CreateGetAttributeMethod(InstanceHandle forClassInstance, string verb, string name, InstanceHandle attributeInstance) + public GetAttributeMethod CreateGetAttributeMethod(InstanceHandle forClassInstance, string verb, string name, InstanceHandle attributeInstance) { return CreateGetAttributeMethod(forClassInstance, verb, name, null, false, attributeInstance); } - public InstanceHandle CreateGetAttributeMethod(InstanceHandle forClassInstance, string verb, string name, object accessModifier, bool isStatic, InstanceHandle attributeInstance) - { - InstanceHandle method = Oms.CreateInstanceOf(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetAttributeMethod)); - Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Method__for__Class), forClassInstance); - Oms.SetAttributeValue(method, Oms.GetInstance(KnownAttributeGuids.Text.Verb), verb); - Oms.SetAttributeValue(method, Oms.GetInstance(KnownAttributeGuids.Text.Name), name); - Oms.SetAttributeValue(method, Oms.GetInstance(KnownAttributeGuids.Boolean.Static), isStatic); - Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Attribute_Method__returns__Attribute), attributeInstance); - return method; - } - - public InstanceHandle CreateGetSpecifiedInstancesMethod(InstanceHandle forClassInstance, string verb, string name, InstanceHandle returnsWorkSet, InstanceHandle[] specifiedInstances) - { - return CreateGetSpecifiedInstancesMethod(forClassInstance, verb, name, null, false, returnsWorkSet, specifiedInstances); - } - public InstanceHandle CreateGetSpecifiedInstancesMethod(InstanceHandle forClassInstance, string verb, string name, object accessModifier, bool isStatic, InstanceHandle returnsWorkSet, InstanceHandle[] specifiedInstances) + public GetAttributeMethod CreateGetAttributeMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle attributeInstance) { - InstanceHandle method = Oms.CreateInstanceOf(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetSpecifiedInstancesMethod)); + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetAttributeMethod), forClassInstance, verb, name, accessModifier, isStatic); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Attribute_Method__returns__Attribute), attributeInstance); + return new GetAttributeMethod(method); + } + + public GetSpecifiedInstancesMethod CreateGetSpecifiedInstancesMethod(InstanceHandle forClassInstance, string verb, string name, WorkSet returnsWorkSet, InstanceHandle[] specifiedInstances) + { + return CreateGetSpecifiedInstancesMethod(forClassInstance, verb, name, null, false, returnsWorkSet, specifiedInstances); + } + public GetSpecifiedInstancesMethod CreateGetSpecifiedInstancesMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, WorkSet returnsWorkSet, InstanceHandle[] specifiedInstances) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetSpecifiedInstancesMethod), forClassInstance, verb, name, accessModifier, isStatic); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__returns__Work_Set), returnsWorkSet.Handle); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__uses__Instance), specifiedInstances); + return new GetSpecifiedInstancesMethod(method); + } + + private InstanceHandle CreateMethodBase(InstanceHandle methodClassInstance, InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic) + { + return CreateMethodBase(methodClassInstance, forClassInstance, verb, name, accessModifier, isStatic, Guid.NewGuid()); + } + private InstanceHandle CreateMethodBase(InstanceHandle methodClassInstance, InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, Guid globalIdentifier) + { + InstanceHandle method = Oms.CreateInstanceOf(methodClassInstance, globalIdentifier); Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Method__for__Class), forClassInstance); + if (!Oms.ValidateConstraints) + { + // sibling relationships aren't being generated automatically + Oms.AssignRelationship(forClassInstance, Oms.GetInstance(KnownRelationshipGuids.Class__has__Method), method); + } Oms.SetAttributeValue(method, Oms.GetInstance(KnownAttributeGuids.Text.Verb), verb); Oms.SetAttributeValue(method, Oms.GetInstance(KnownAttributeGuids.Text.Name), name); Oms.SetAttributeValue(method, Oms.GetInstance(KnownAttributeGuids.Boolean.Static), isStatic); - Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__returns__Work_Set), returnsWorkSet); - Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Specified_Instances_Method__uses__Instance), specifiedInstances); return method; } + + public BuildAttributeMethod CreateBuildAttributeMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, string initialValue = "") + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.BuildAttributeMethod), forClassInstance, verb, name, accessModifier, isStatic); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Build_Attribute_Method__returns__Attribute), returnsAttribute); + Oms.SetAttributeValue(method, Oms.GetInstance(KnownAttributeGuids.Text.Value), initialValue); + return new BuildAttributeMethod(method); + } + + public GetAttributeBySystemRoutineMethod CreateGetAttributeBySystemRoutineMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, SystemAttributeRoutine usesSystemAttributeRoutine) + { + return CreateGetAttributeBySystemRoutineMethod(forClassInstance, verb, name, accessModifier, isStatic, Guid.NewGuid(), returnsAttribute, usesSystemAttributeRoutine); + } + public GetAttributeBySystemRoutineMethod CreateGetAttributeBySystemRoutineMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, Guid globalIdentifier, InstanceHandle returnsAttribute, SystemAttributeRoutine usesSystemAttributeRoutine) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetAttributeBySystemRoutineMethod), forClassInstance, verb, name, accessModifier, isStatic, globalIdentifier); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Attribute_by_System_Routine_Method__returns__Attribute), returnsAttribute); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Attribute_by_System_Routine_Method__uses__System_Attribute_Routine), usesSystemAttributeRoutine.Handle); + return new GetAttributeBySystemRoutineMethod(method); + } + + public AssignAttributeMethod CreateAssignAttributeMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, ReturnAttributeMethodBinding assignsFromExecutableReturningAttribute, InstanceHandle assignsToAttribute) + { + return CreateAssignAttributeMethod(forClassInstance, verb, name, accessModifier, isStatic, assignsFromExecutableReturningAttribute.Handle, assignsToAttribute); + } + public AssignAttributeMethod CreateAssignAttributeMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle assignsFromExecutableReturningAttribute, InstanceHandle assignsToAttribute) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.AssignAttributeMethod), forClassInstance, verb, name, accessModifier, isStatic); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Assign_Attribute_Method__uses__Executable_returning_Attribute), assignsFromExecutableReturningAttribute); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Assign_Attribute_Method__assigns__Attribute), assignsToAttribute); + return new AssignAttributeMethod(method); + } + + public GetRelationshipMethod CreateGetRelationshipMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsRelationship) + { + return CreateGetRelationshipMethod(forClassInstance, verb, name, accessModifier, isStatic, Guid.NewGuid(), returnsRelationship); + } + public GetRelationshipMethod CreateGetRelationshipMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, Guid globalIdentifier, InstanceHandle returnsRelationship) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetRelationshipMethod), forClassInstance, verb, name, accessModifier, isStatic, globalIdentifier); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Relationship_Method__returns__Relationship), returnsRelationship); + return new GetRelationshipMethod(method); + } + + public GetReferencedAttributeMethod CreateGetReferencedAttributeMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, IExecutableReturningInstanceSet usesReferenceInstanceSet, IExecutableReturningAttribute usesAnswerExecutableReturningAttribute, InstanceHandle? usesAccumulationFunction = null, InstanceHandle? usesOrderExecutableReturningAttribute = null) + { + return CreateGetReferencedAttributeMethod(forClassInstance, verb, name, accessModifier, isStatic, returnsAttribute, usesReferenceInstanceSet.Handle, usesAnswerExecutableReturningAttribute.Handle, usesAccumulationFunction, usesOrderExecutableReturningAttribute); + } + public GetReferencedAttributeMethod CreateGetReferencedAttributeMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, InstanceHandle usesReferenceInstanceSet, InstanceHandle usesAnswerExecutableReturningAttribute, InstanceHandle? usesAccumulationFunction = null, InstanceHandle? usesOrderExecutableReturningAttribute = null) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetReferencedAttributeMethod), forClassInstance, verb, name, accessModifier, isStatic); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__returns__Attribute), returnsAttribute); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_reference__Executable_returning_Instance_Set), usesReferenceInstanceSet); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_answer__Executable_returning_Attribute), usesAnswerExecutableReturningAttribute); + if (usesAccumulationFunction != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses__Accumulation_Function), usesAccumulationFunction.GetValueOrDefault()); + } + if (usesOrderExecutableReturningAttribute != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_order__Executable_returning_Attribute), usesOrderExecutableReturningAttribute.GetValueOrDefault()); + } + return new GetReferencedAttributeMethod(method); + } + + public SelectFromInstanceSetMethod CreateSelectFromInstanceSetMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, WorkSet returnsWorkSet, InstanceWrapper usesExecutableReturningInstanceSet, InstanceHandle? usesSetFunction = null, InstanceHandle? usesSelectionFunction = null, InstanceHandle? usesOrderExecutableReturningAttribute = null) + { + return CreateSelectFromInstanceSetMethod(forClassInstance, verb, name, accessModifier, isStatic, returnsWorkSet.Handle, usesExecutableReturningInstanceSet.Handle, usesSetFunction, usesSelectionFunction, usesOrderExecutableReturningAttribute); + } + public SelectFromInstanceSetMethod CreateSelectFromInstanceSetMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsWorkSet, InstanceHandle usesExecutableReturningInstanceSet, InstanceHandle? usesSetFunction = null, InstanceHandle? usesSelectionFunction = null, InstanceHandle? usesOrderExecutableReturningAttribute = null) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.SelectFromInstanceSetMethod), forClassInstance, verb, name, accessModifier, isStatic); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Select_From_Instance_Set_Method__returns__Work_Set), returnsWorkSet); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Executable_returning_Instance_Set), usesExecutableReturningInstanceSet); + if (usesSetFunction != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Set_Function), usesSetFunction.GetValueOrDefault()); + } + if (usesSelectionFunction != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Selection_Function), usesSelectionFunction.GetValueOrDefault()); + } + if (usesOrderExecutableReturningAttribute != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses_order__Executable_returning_Attribute), usesOrderExecutableReturningAttribute.GetValueOrDefault()); + } + /* + if (usesAccumulationFunction != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses__Accumulation_Function), usesAccumulationFunction.GetValueOrDefault()); + } + if (usesOrderExecutableReturningAttribute != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_order__Executable_returning_Attribute), usesOrderExecutableReturningAttribute.GetValueOrDefault()); + } + */ + return new SelectFromInstanceSetMethod(method); + } + + + public ConditionalSelectFromInstanceSetMethod CreateConditionalSelectFromInstanceSetMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, WorkSet returnsWorkSet, InstanceWrapper[] cases, InstanceHandle? usesSetFunction = null, InstanceHandle? usesSelectionFunction = null, InstanceHandle? usesOrderExecutableReturningAttribute = null) + { + List cases2 = new List(); + foreach (InstanceWrapper wrapper in cases) + { + cases2.Add(wrapper.Handle); + } + return CreateConditionalSelectFromInstanceSetMethod(forClassInstance, verb, name, accessModifier, isStatic, returnsWorkSet.Handle, cases2.ToArray(), usesSetFunction, usesSelectionFunction, usesOrderExecutableReturningAttribute); + } + public ConditionalSelectFromInstanceSetMethod CreateConditionalSelectFromInstanceSetMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsWorkSet, InstanceHandle[] cases, InstanceHandle? usesSetFunction = null, InstanceHandle? usesSelectionFunction = null, InstanceHandle? usesOrderExecutableReturningAttribute = null) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.ConditionalSelectFromInstanceSetMethod), forClassInstance, verb, name, accessModifier, isStatic); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Conditional_Select_From_Instance_Set_Method__returns__Work_Set), returnsWorkSet); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Conditional_Select_from_Instance_Set_Method__has__Conditional_Select_from_Instance_Set_Case), cases); + if (usesSetFunction != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Set_Function), usesSetFunction.GetValueOrDefault()); + } + if (usesSelectionFunction != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses__Selection_Function), usesSelectionFunction.GetValueOrDefault()); + } + if (usesOrderExecutableReturningAttribute != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Select_from_Instance_Set_Method__uses_order__Executable_returning_Attribute), usesOrderExecutableReturningAttribute.GetValueOrDefault()); + } + /* + if (usesAccumulationFunction != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses__Accumulation_Function), usesAccumulationFunction.GetValueOrDefault()); + } + if (usesOrderExecutableReturningAttribute != null) + { + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Referenced_Attribute_Method__uses_order__Executable_returning_Attribute), usesOrderExecutableReturningAttribute.GetValueOrDefault()); + } + */ + return new ConditionalSelectFromInstanceSetMethod(method); + } + + public ConditionalSelectAttributeMethod CreateConditionalSelectAttributeMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, ConditionalSelectAttributeCase[] cases, InstanceHandle? usesSetFunction = null, InstanceHandle? usesSelectionFunction = null, InstanceHandle? usesOrderExecutableReturningAttribute = null) + { + return CreateConditionalSelectAttributeMethod(forClassInstance, verb, name, accessModifier, isStatic, Guid.NewGuid(), returnsAttribute, cases, usesSetFunction, usesSelectionFunction, usesOrderExecutableReturningAttribute); + } + public ConditionalSelectAttributeMethod CreateConditionalSelectAttributeMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, Guid globalIdentifier, InstanceHandle returnsAttribute, ConditionalSelectAttributeCase[] cases, InstanceHandle? usesSetFunction = null, InstanceHandle? usesSelectionFunction = null, InstanceHandle? usesOrderExecutableReturningAttribute = null) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.ConditionalSelectAttributeMethod), forClassInstance, verb, name, accessModifier, isStatic, globalIdentifier); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Conditional_Select_Attribute_Method__returns__Attribute), returnsAttribute); + + InstanceHandle[] ihCases = new InstanceHandle[cases.Length]; + for (int i = 0; i < cases.Length; i++) + { + ihCases[i] = CreateConditionalSelectAttributeCase(cases[i]); + } + + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Conditional_Select_Attribute_Method__has__Conditional_Select_Attribute_Case), ihCases); + return new ConditionalSelectAttributeMethod(method); + } + + private InstanceHandle CreateConditionalSelectAttributeCase(ConditionalSelectAttributeCase sacCase) + { + InstanceHandle ih = Oms.CreateInstanceOf(Oms.GetInstance(KnownInstanceGuids.Classes.ConditionalSelectAttributeCase)); + + Oms.SetAttributeValue(ih, Oms.GetInstance(KnownAttributeGuids.Boolean.UseAnyCondition), sacCase.UseAnyCondition); + + IEnumerable trueConditions = sacCase.TrueConditions.ToInstanceHandleArray(); + if (trueConditions != null) + { + Oms.AssignRelationship(ih, Oms.GetInstance(KnownRelationshipGuids.Condition_Group__has_true_condition__Executable_returning_Work_Data), trueConditions); + } + IEnumerable falseConditions = sacCase.FalseConditions.ToInstanceHandleArray(); + if (falseConditions != null) + { + Oms.AssignRelationship(ih, Oms.GetInstance(KnownRelationshipGuids.Condition_Group__has_false_condition__Executable_returning_Work_Data), falseConditions); + } + + Oms.AssignRelationship(ih, Oms.GetInstance(KnownRelationshipGuids.Conditional_Select_Attribute_Case__invokes__Executable_returning_Attribute), sacCase.UsesExecutableReturningAttribute.Handle); + return ih; + } + + public EvaluateBooleanExpressionMethod CreateEvaluateBooleanExpressionMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, IInstanceWrapper sourceWorkData, BooleanOperator booleanOperator, IInstanceWrapper compareToWorkData) + { + return CreateEvaluateBooleanExpressionMethod(forClassInstance, verb, name, accessModifier, isStatic, returnsAttribute, sourceWorkData.Handle, booleanOperator, compareToWorkData.Handle); + } + + public EvaluateBooleanExpressionMethod CreateEvaluateBooleanExpressionMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, InstanceHandle sourceWorkData, BooleanOperator booleanOperator, InstanceHandle compareToWorkData) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.EvaluateBooleanExpressionMethod), forClassInstance, verb, name, accessModifier, isStatic); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__returns__Boolean_Attribute), returnsAttribute); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_source__Executable_returning_Work_Data), sourceWorkData); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__uses__Boolean_Operator), booleanOperator.Handle); + Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_target__Executable_returning_Work_Data), compareToWorkData); + return new EvaluateBooleanExpressionMethod(method); + } + + public CalculateDateMethod CreateCalculateDateMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, InstanceHandle initialDateAttribute, InstanceHandle timeZoneRsmb, CalculateDateMethodIncrement preIncrement, InstanceHandle? startInterval, InstanceHandle? endInterval, CalculateDateMethodIncrement postIncrement) + { + InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.CalculateDateMethod), forClassInstance, verb, name, accessModifier, isStatic); + + return new CalculateDateMethod(method); + } } \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/OmsSystemRoutineBuilder.cs b/mocha-dotnet/src/lib/Mocha.Core/OmsSystemRoutineBuilder.cs new file mode 100644 index 0000000..d703d38 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/OmsSystemRoutineBuilder.cs @@ -0,0 +1,54 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; + +namespace Mocha.Core; + +public class OmsSystemRoutineBuilder +{ + public Oms Oms { get; } + public OmsSystemRoutineBuilder(Oms oms) + { + Oms = oms; + } + + public SystemAttributeRoutine CreateSystemAttributeRoutine(Guid globalIdentifier, Func func) + { + InstanceHandle handle = Oms.CreateInstanceOf(Oms.GetInstance(KnownInstanceGuids.Classes.SystemAttributeRoutine), globalIdentifier); + + SystemAttributeRoutine routine = new SystemAttributeRoutine(handle, func); + Oms.RegisterSystemRoutine(handle, routine); + return routine; + } + public SystemAttributeRoutine CreateSystemAttributeRoutine(Guid globalIdentifier, Func func) + { + InstanceHandle handle = Oms.CreateInstanceOf(Oms.GetInstance(KnownInstanceGuids.Classes.SystemAttributeRoutine), globalIdentifier); + + SystemAttributeRoutine routine = new SystemAttributeRoutine(handle, func); + Oms.RegisterSystemRoutine(handle, routine); + return routine; + } + public SystemInstanceSetRoutine CreateSystemInstanceSetRoutine(Guid globalIdentifier, Func> func) + { + InstanceHandle handle = Oms.CreateInstanceOf(Oms.GetInstance(KnownInstanceGuids.Classes.SystemInstanceSetRoutine), globalIdentifier); + + SystemInstanceSetRoutine routine = new SystemInstanceSetRoutine(handle, func); + Oms.RegisterSystemRoutine(handle, routine); + return routine; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/AccessModifier.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/AccessModifier.cs new file mode 100644 index 0000000..271b118 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/AccessModifier.cs @@ -0,0 +1,31 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop; + +public class AccessModifier : ConcreteInstanceWrapper +{ + public override Guid ClassId => KnownInstanceGuids.Classes.AccessModifier; + + internal AccessModifier(InstanceHandle handle) : base(handle) { } + + public static AccessModifier Public { get; internal set; } = null; + public static AccessModifier Private { get; internal set; } = null; + public static AccessModifier Protected { get; internal set; } = null; + public static AccessModifier RootA2 { get; internal set; } = null; +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/ArithmeticOperator.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/ArithmeticOperator.cs new file mode 100644 index 0000000..205602c --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/ArithmeticOperator.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop; + +public class ArithmeticOperator : ConcreteInstanceWrapper +{ + public override Guid ClassId => KnownInstanceGuids.Classes.ArithmeticOperator; + internal ArithmeticOperator(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/BooleanOperator.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/BooleanOperator.cs new file mode 100644 index 0000000..253985d --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/BooleanOperator.cs @@ -0,0 +1,23 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public abstract class BooleanOperator : ConcreteInstanceWrapper +{ + internal BooleanOperator(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/ConcreteInstanceWrapper.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/ConcreteInstanceWrapper.cs new file mode 100644 index 0000000..0fa0888 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/ConcreteInstanceWrapper.cs @@ -0,0 +1,69 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public abstract class ConcreteInstanceWrapper : InstanceWrapper +{ + public abstract Guid ClassId { get; } + + private InstanceHandle TheHandle { get; } + internal ConcreteInstanceWrapper(InstanceHandle handle) + { + TheHandle = handle; + } + + protected override InstanceHandle GetHandleInternal() + { + return TheHandle; + } + + internal static ConcreteInstanceWrapper? Wrap(Oms oms, InstanceHandle methodInstance) + { + Type[] methodTypes = MBS.Core.Reflection.TypeLoader.GetAvailableTypes(new Type[] { typeof(ConcreteInstanceWrapper) }, new System.Reflection.Assembly[] { System.Reflection.Assembly.GetExecutingAssembly() }); + InstanceHandle parentClass = oms.GetParentClass(methodInstance); + + foreach (Type methodType in methodTypes) + { + if (methodType.IsAbstract) + continue; + + ConcreteInstanceWrapper m = null; + try + { + m = (ConcreteInstanceWrapper)methodType.Assembly.CreateInstance(methodType.FullName, false, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, new object[] { methodInstance }, null, null); + } + catch (Exception ex) + { + + } + if (m != null) + { + if (m.ClassId == oms.GetGlobalIdentifier(parentClass)) + { + return m; + } + } + } + return null; + } + + public override string ToString() + { + return TheHandle.ToString(); + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/ConditionGroup.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/ConditionGroup.cs new file mode 100644 index 0000000..04d46fe --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/ConditionGroup.cs @@ -0,0 +1,32 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public abstract class ConditionGroup +{ + public IInstanceWrapper[] TrueConditions { get; } + public IInstanceWrapper[] FalseConditions { get; } + public bool UseAnyCondition { get; set; } = false; + + public ConditionGroup(IInstanceWrapper[] trueConditions, IInstanceWrapper[] falseConditions, bool useAnyCondition) + { + TrueConditions = trueConditions; + FalseConditions = falseConditions; + UseAnyCondition = useAnyCondition; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/DeferredInstanceWrapper.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/DeferredInstanceWrapper.cs new file mode 100644 index 0000000..06c72ac --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/DeferredInstanceWrapper.cs @@ -0,0 +1,34 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public class DeferredInstanceWrapper : InstanceWrapper +{ + private Oms oms; + private Guid globalIdentifier; + public DeferredInstanceWrapper(Oms oms, Guid globalIdentifier) + { + this.oms = oms; + this.globalIdentifier = globalIdentifier; + } + + protected override InstanceHandle GetHandleInternal() + { + return oms.GetInstance(globalIdentifier); + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/IExecutableReturningAttribute.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/IExecutableReturningAttribute.cs new file mode 100644 index 0000000..d730caf --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/IExecutableReturningAttribute.cs @@ -0,0 +1,23 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public interface IExecutableReturningAttribute : IInstanceWrapper +{ + +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/IExecutableReturningInstanceSet.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/IExecutableReturningInstanceSet.cs new file mode 100644 index 0000000..83b88a4 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/IExecutableReturningInstanceSet.cs @@ -0,0 +1,23 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public interface IExecutableReturningInstanceSet : IInstanceWrapper +{ + +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/IInstanceWrapper.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/IInstanceWrapper.cs new file mode 100644 index 0000000..3f40789 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/IInstanceWrapper.cs @@ -0,0 +1,40 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public interface IInstanceWrapper +{ + InstanceHandle Handle { get; } +} +public static class InstanceWrapperArrayExtensions +{ + public static InstanceHandle[] ToInstanceHandleArray(this IInstanceWrapper[] z) + { + if (z == null) + { + return null; + } + + InstanceHandle[] array = new InstanceHandle[z.Length]; + for (int i = 0; i < z.Length; i++) + { + array[i] = z[i].Handle; + } + return array; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/InstanceWrapper.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/InstanceWrapper.cs new file mode 100644 index 0000000..0a24532 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/InstanceWrapper.cs @@ -0,0 +1,45 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public abstract class InstanceWrapper : IInstanceWrapper +{ + private InstanceHandle _Handle = InstanceHandle.Empty; + protected abstract InstanceHandle GetHandleInternal(); + + public InstanceHandle Handle + { + get + { + if (_Handle == InstanceHandle.Empty) + { + _Handle = GetHandleInternal(); + } + return _Handle; + } + } + + public override bool Equals(object? obj) + { + if (obj is InstanceWrapper) + { + return Handle.Equals(((InstanceWrapper)obj).Handle); + } + return base.Equals(obj); + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/LogicalOperator.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/LogicalOperator.cs new file mode 100644 index 0000000..d4cd3bf --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/LogicalOperator.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop; + +public class LogicalOperator : BooleanOperator +{ + public override Guid ClassId => KnownInstanceGuids.Classes.LogicalOperator; + internal LogicalOperator(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Method.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Method.cs new file mode 100644 index 0000000..5547cee --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Method.cs @@ -0,0 +1,60 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Oop; + +public abstract class Method : ConcreteInstanceWrapper +{ + internal Method(InstanceHandle handle) : base(handle) { } + + protected void SetupMethodBinding(Oms oms, MethodBinding mb, IEnumerable> parameterAssignments) + { + if (parameterAssignments != null) + { + InstanceHandle c_ParameterAssignment = oms.GetInstance(KnownInstanceGuids.Classes.ParameterAssignment); + InstanceHandle r_Method_Binding__has__Parameter_Assignment = oms.GetInstance(KnownRelationshipGuids.Method_Binding__has__Parameter_Assignment); + InstanceHandle r_Parameter_Assignment__assigns_from__Executable_returning_Work_Data = oms.GetInstance(KnownRelationshipGuids.Parameter_Assignment__assigns_from__Executable_returning_Work_Data); + InstanceHandle r_Parameter_Assignment__assigns_to__Work_Data = oms.GetInstance(KnownRelationshipGuids.Parameter_Assignment__assigns_to__Work_Data); + + List parms = new List(); + foreach (KeyValuePair kvp in parameterAssignments) + { + InstanceHandle parm = oms.CreateInstanceOf(c_ParameterAssignment); + + InstanceHandle assignsToParm = kvp.Key; + InstanceHandle assignsFromWorkData = InstanceHandle.Empty; + if (kvp.Value is InstanceHandle) + { + assignsFromWorkData = (InstanceHandle)kvp.Value; + } + else if (kvp.Value is InstanceWrapper) + { + assignsFromWorkData = ((InstanceWrapper)kvp.Value).Handle; + } + + oms.AssignRelationship(parm, r_Parameter_Assignment__assigns_to__Work_Data, assignsToParm); + oms.AssignRelationship(parm, r_Parameter_Assignment__assigns_from__Executable_returning_Work_Data, assignsFromWorkData); + parms.Add(parm); + } + + oms.AssignRelationship(mb.Handle, r_Method_Binding__has__Parameter_Assignment, parms.ToArray()); + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/MethodBinding.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/MethodBinding.cs new file mode 100644 index 0000000..4bbbf29 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/MethodBinding.cs @@ -0,0 +1,34 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop; + +public abstract class MethodBinding : ConcreteInstanceWrapper +{ + internal MethodBinding(InstanceHandle handle) : base(handle) { } +} +public class ReturnAttributeMethodBinding : MethodBinding, IExecutableReturningAttribute +{ + public override Guid ClassId => KnownInstanceGuids.Classes.ReturnAttributeMethodBinding; + internal ReturnAttributeMethodBinding(InstanceHandle handle) : base(handle) { } +} +public class ReturnInstanceSetMethodBinding : MethodBinding, IExecutableReturningInstanceSet +{ + public override Guid ClassId => KnownInstanceGuids.Classes.ReturnInstanceSetMethodBinding; + internal ReturnInstanceSetMethodBinding(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/MethodReturningAttribute.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/MethodReturningAttribute.cs new file mode 100644 index 0000000..e947da9 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/MethodReturningAttribute.cs @@ -0,0 +1,31 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public abstract class MethodReturningAttribute : Method, IExecutableReturningAttribute +{ + public MethodReturningAttribute(InstanceHandle handle) : base(handle) { } + + public ReturnAttributeMethodBinding CreateMethodBinding(Oms oms, IEnumerable> parameterAssignments = null) + { + OmsMethodBuilder builder = new OmsMethodBuilder(oms); + ReturnAttributeMethodBinding mb = builder.CreateReturnAttributeMethodBinding(this); + SetupMethodBinding(oms, mb, parameterAssignments); + return mb; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/MethodReturningInstanceSet.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/MethodReturningInstanceSet.cs new file mode 100644 index 0000000..b9f2b40 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/MethodReturningInstanceSet.cs @@ -0,0 +1,31 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public abstract class MethodReturningInstanceSet : Method +{ + public MethodReturningInstanceSet(InstanceHandle handle) : base(handle) { } + + public ReturnInstanceSetMethodBinding CreateMethodBinding(Oms oms, IEnumerable> parameterAssignments = null) + { + OmsMethodBuilder builder = new OmsMethodBuilder(oms); + ReturnInstanceSetMethodBinding mb = builder.CreateReturnInstanceSetMethodBinding(this); + SetupMethodBinding(oms, mb, parameterAssignments); + return mb; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/AssignAttributeMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/AssignAttributeMethod.cs new file mode 100644 index 0000000..1fd6e18 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/AssignAttributeMethod.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class AssignAttributeMethod : Method +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.AssignAttributeMethod; + public AssignAttributeMethod(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/BuildAttributeMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/BuildAttributeMethod.cs new file mode 100644 index 0000000..04bb625 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/BuildAttributeMethod.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class BuildAttributeMethod : MethodReturningAttribute +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.BuildAttributeMethod; + internal BuildAttributeMethod(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/CalculateDateMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/CalculateDateMethod.cs new file mode 100644 index 0000000..9ccd274 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/CalculateDateMethod.cs @@ -0,0 +1,22 @@ + +namespace Mocha.Core.Oop.Methods; + +public class CalculateDateMethod : Method +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.CalculateDateMethod; + internal CalculateDateMethod(InstanceHandle handle) : base(handle) { } +} + +public struct CalculateDateMethodIncrement +{ + public InstanceHandle AmountRAMB { get; } + public InstanceHandle DateIntervalOrDateIntervalRSMB { get; } + public bool Subtract { get; } + + public CalculateDateMethodIncrement(InstanceHandle amountRAMB, InstanceHandle dateIntervalOrDateIntervalRSMB, bool subtract) + { + AmountRAMB = amountRAMB; + DateIntervalOrDateIntervalRSMB = dateIntervalOrDateIntervalRSMB; + Subtract = subtract; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/ConditionalSelectAttributeMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/ConditionalSelectAttributeMethod.cs new file mode 100644 index 0000000..11aac8b --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/ConditionalSelectAttributeMethod.cs @@ -0,0 +1,35 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class ConditionalSelectAttributeMethod : MethodReturningAttribute +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.ConditionalSelectAttributeMethod; + internal ConditionalSelectAttributeMethod(InstanceHandle handle) : base(handle) { } +} +public class ConditionalSelectAttributeCase : ConditionGroup +{ + public IExecutableReturningAttribute UsesExecutableReturningAttribute { get; } + + public ConditionalSelectAttributeCase(IExecutableReturningAttribute[] trueConditions, IExecutableReturningAttribute[] falseConditions, bool useAnyCondition, IExecutableReturningAttribute usesExecutableReturningAttribute) + : base(trueConditions, falseConditions, useAnyCondition) + { + UsesExecutableReturningAttribute = usesExecutableReturningAttribute; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/ConditionalSelectFromInstanceSetMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/ConditionalSelectFromInstanceSetMethod.cs new file mode 100644 index 0000000..8d26814 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/ConditionalSelectFromInstanceSetMethod.cs @@ -0,0 +1,35 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class ConditionalSelectFromInstanceSetMethod : MethodReturningInstanceSet +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.ConditionalSelectFromInstanceSetMethod; + internal ConditionalSelectFromInstanceSetMethod(InstanceHandle handle) : base(handle) { } +} +public class ConditionalSelectFromInstanceSetCase : ConditionGroup +{ + public IExecutableReturningInstanceSet UsesExecutableReturningInstanceSet { get; } + + public ConditionalSelectFromInstanceSetCase(IExecutableReturningAttribute[] trueConditions, IExecutableReturningAttribute[] falseConditions, bool useAnyCondition, IExecutableReturningInstanceSet usesExecutableReturningInstanceSet) + : base(trueConditions, falseConditions, useAnyCondition) + { + UsesExecutableReturningInstanceSet = usesExecutableReturningInstanceSet; + } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/EvaluateBooleanExpressionMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/EvaluateBooleanExpressionMethod.cs new file mode 100644 index 0000000..e90695d --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/EvaluateBooleanExpressionMethod.cs @@ -0,0 +1,24 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop.Methods; + +public class EvaluateBooleanExpressionMethod : MethodReturningAttribute +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.EvaluateBooleanExpressionMethod; + internal EvaluateBooleanExpressionMethod(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetAttributeBySystemRoutineMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetAttributeBySystemRoutineMethod.cs new file mode 100644 index 0000000..8b531c1 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetAttributeBySystemRoutineMethod.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class GetAttributeBySystemRoutineMethod : MethodReturningAttribute +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.GetAttributeBySystemRoutineMethod; + internal GetAttributeBySystemRoutineMethod(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetAttributeMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetAttributeMethod.cs new file mode 100644 index 0000000..ea1f1a3 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetAttributeMethod.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class GetAttributeMethod : MethodReturningAttribute +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.GetAttributeMethod; + internal GetAttributeMethod(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetReferencedAttributeMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetReferencedAttributeMethod.cs new file mode 100644 index 0000000..6c26417 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetReferencedAttributeMethod.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class GetReferencedAttributeMethod : MethodReturningAttribute +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.GetReferencedAttributeMethod; + public GetReferencedAttributeMethod(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetRelationshipMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetRelationshipMethod.cs new file mode 100644 index 0000000..535cbeb --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetRelationshipMethod.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class GetRelationshipMethod : MethodReturningInstanceSet +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.GetRelationshipMethod; + public GetRelationshipMethod(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetSpecifiedInstancesMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetSpecifiedInstancesMethod.cs new file mode 100644 index 0000000..7dfa46e --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/GetSpecifiedInstancesMethod.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class GetSpecifiedInstancesMethod : MethodReturningInstanceSet +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.GetSpecifiedInstancesMethod; + internal GetSpecifiedInstancesMethod(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/SelectFromInstanceSetMethod.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/SelectFromInstanceSetMethod.cs new file mode 100644 index 0000000..d0c52ed --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/Methods/SelectFromInstanceSetMethod.cs @@ -0,0 +1,25 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + + +namespace Mocha.Core.Oop.Methods; + +public class SelectFromInstanceSetMethod : MethodReturningInstanceSet +{ + public override Guid ClassId => KnownInstanceGuids.MethodClasses.SelectFromInstanceSetMethod; + internal SelectFromInstanceSetMethod(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/RelationalOperator.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/RelationalOperator.cs new file mode 100644 index 0000000..7330968 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/RelationalOperator.cs @@ -0,0 +1,41 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public class RelationalOperator : BooleanOperator +{ + public override Guid ClassId => KnownInstanceGuids.Classes.RelationalOperator; + internal RelationalOperator(InstanceHandle handle) : base(handle) { } + + public static RelationalOperator SubsetOfSelectionList { get; internal set; } = null; + public static RelationalOperator IsEmpty { get; internal set; } = null; + public static RelationalOperator CountGreaterThan { get; internal set; } = null; + public static RelationalOperator CountLessThan { get; internal set; } = null; + public static RelationalOperator CountEqualTo { get; internal set; } = null; + public static RelationalOperator CountGreaterThanOrEqualTo { get; internal set; } = null; + public static RelationalOperator CountLessThanOrEqualTo { get; internal set; } = null; + public static RelationalOperator SupersetOfSelectionList { get; internal set; } = null; + public static RelationalOperator CountNotEqualTo { get; internal set; } = null; + public static RelationalOperator IsNotEmpty { get; internal set; } = null; + public static RelationalOperator NotInSelectionList { get; internal set; } = null; + public static RelationalOperator InSelectionList { get; internal set; } = null; + public static RelationalOperator NotSupersetOfSelectionList { get; internal set; } = null; + public static RelationalOperator NotSubsetOfSelectionList { get; internal set; } = null; + public static RelationalOperator NotExactMatchWithSelectionList { get; internal set; } = null; + public static RelationalOperator ExactMatchWithSelectionList { get; internal set; } = null; +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/SystemRoutine.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/SystemRoutine.cs new file mode 100644 index 0000000..84b2c29 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/SystemRoutine.cs @@ -0,0 +1,39 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public abstract class SystemRoutine : ConcreteInstanceWrapper +{ + internal SystemRoutine(InstanceHandle handle) : base(handle) { } + + protected abstract object? ExecuteInternal(Oms oms, OmsContext context); + public object? Execute(Oms oms, OmsContext context) + { + return ExecuteInternal(oms, context); + } + + public T Execute(Oms oms, OmsContext context, T defaultValue = default(T)) + { + object? value = Execute(oms, context); + if (value is T) + { + return (T)value; + } + return defaultValue; + } +} diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/SystemRoutines/SystemAttributeRoutine.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/SystemRoutines/SystemAttributeRoutine.cs new file mode 100644 index 0000000..bdf35fb --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/SystemRoutines/SystemAttributeRoutine.cs @@ -0,0 +1,40 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public class SystemAttributeRoutine : SystemRoutine +{ + public override Guid ClassId => KnownInstanceGuids.Classes.SystemAttributeRoutine; + private Func Func { get; } + internal SystemAttributeRoutine(InstanceHandle handle, Func func) : base(handle) + { + Func = func; + } + + protected override object? ExecuteInternal(Oms oms, OmsContext context) + { + object? value = Func?.Invoke(oms, context); + return value; + } +} +public class SystemAttributeRoutine : SystemAttributeRoutine +{ + internal SystemAttributeRoutine(InstanceHandle handle, Func func) : base(handle, new Func(delegate(Oms oms, OmsContext context) { return func(oms, context); })) + { + } +} diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/SystemRoutines/SystemInstanceSetRoutine.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/SystemRoutines/SystemInstanceSetRoutine.cs new file mode 100644 index 0000000..1cec3e9 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/SystemRoutines/SystemInstanceSetRoutine.cs @@ -0,0 +1,34 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public class SystemInstanceSetRoutine : SystemRoutine +{ + public override Guid ClassId => KnownInstanceGuids.Classes.SystemInstanceSetRoutine; + private Func> Func { get; } + internal SystemInstanceSetRoutine(InstanceHandle handle, Func> func) : base(handle) + { + Func = func; + } + + protected override object? ExecuteInternal(Oms oms, OmsContext context) + { + object? value = Func?.Invoke(oms, context); + return value; + } +} diff --git a/mocha-dotnet/src/lib/Mocha.Core/Oop/WorkSet.cs b/mocha-dotnet/src/lib/Mocha.Core/Oop/WorkSet.cs new file mode 100644 index 0000000..ae30f71 --- /dev/null +++ b/mocha-dotnet/src/lib/Mocha.Core/Oop/WorkSet.cs @@ -0,0 +1,24 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +namespace Mocha.Core.Oop; + +public class WorkSet : ConcreteInstanceWrapper +{ + public override Guid ClassId => KnownInstanceGuids.Classes.WorkSet; + internal WorkSet(InstanceHandle handle) : base(handle) { } +} \ No newline at end of file diff --git a/mocha-dotnet/src/lib/Mocha.Core/Relationship.cs b/mocha-dotnet/src/lib/Mocha.Core/Relationship.cs index b70d7aa..87d3bda 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/Relationship.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Relationship.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using System; using System.Collections.Generic; diff --git a/mocha-dotnet/src/lib/Mocha.Core/RelationshipKey.cs b/mocha-dotnet/src/lib/Mocha.Core/RelationshipKey.cs index 9b5ebc8..b3e1d21 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/RelationshipKey.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/RelationshipKey.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // RelationshipKey.cs // diff --git a/mocha-dotnet/src/lib/Mocha.Core/RelationshipValue.cs b/mocha-dotnet/src/lib/Mocha.Core/RelationshipValue.cs index 5ae4708..eb1bbb3 100644 --- a/mocha-dotnet/src/lib/Mocha.Core/RelationshipValue.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/RelationshipValue.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core; public struct RelationshipValue diff --git a/mocha-dotnet/src/lib/Mocha.Core/Tenant.cs b/mocha-dotnet/src/lib/Mocha.Core/Tenant.cs index a79ccee..546ae0b 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/Tenant.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Tenant.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // Tenant.cs // diff --git a/mocha-dotnet/src/lib/Mocha.Core/TenantHandle.cs b/mocha-dotnet/src/lib/Mocha.Core/TenantHandle.cs index 04262b5..af5560f 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/TenantHandle.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/TenantHandle.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // InstanceHandle.cs // diff --git a/mocha-dotnet/src/lib/Mocha.Core/Transaction.cs b/mocha-dotnet/src/lib/Mocha.Core/Transaction.cs index a32527d..6c9bdea 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/Transaction.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/Transaction.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // Transaction.cs // diff --git a/mocha-dotnet/src/lib/Mocha.Core/TransactionOperation.cs b/mocha-dotnet/src/lib/Mocha.Core/TransactionOperation.cs index 4971d2c..247d0f2 100755 --- a/mocha-dotnet/src/lib/Mocha.Core/TransactionOperation.cs +++ b/mocha-dotnet/src/lib/Mocha.Core/TransactionOperation.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + // // TransactionOperation.cs // diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/BasicTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/BasicTests.cs index dcd71e8..6e15455 100644 --- a/mocha-dotnet/tests/Mocha.Core.Tests/BasicTests.cs +++ b/mocha-dotnet/tests/Mocha.Core.Tests/BasicTests.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using System.Runtime.CompilerServices; using Mocha.Core.OmsImplementations.Mini; diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/GlobalUsings.cs b/mocha-dotnet/tests/Mocha.Core.Tests/GlobalUsings.cs index cefced4..2c8ac18 100644 --- a/mocha-dotnet/tests/Mocha.Core.Tests/GlobalUsings.cs +++ b/mocha-dotnet/tests/Mocha.Core.Tests/GlobalUsings.cs @@ -1 +1,18 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + global using NUnit.Framework; \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests.cs deleted file mode 100644 index 8b27a25..0000000 --- a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests.cs +++ /dev/null @@ -1,94 +0,0 @@ - -using Mocha.Core.OmsImplementations.Mini; - -namespace Mocha.Core.Tests; - -public class MethodTests : OmsTestsBase -{ - protected override Oms CreateOms() - { - return new MiniOms(new MiniOmsModule[] { new MethodsModule() }); - } - - [Test] - public void GetAttributeMethodTest() - { - InstanceHandle irTestClass = Oms.GetInstance(TEST_CLASS_GUID); - Assert.That(irTestClass, Is.Not.EqualTo(InstanceHandle.Empty)); - - InstanceHandle irTestClassInstance = Oms.CreateInstanceOf(irTestClass); - Assert.That(irTestClassInstance, Is.Not.EqualTo(InstanceHandle.Empty)); - - InstanceHandle irTestAttribute = Oms.CreateInstanceOf(Oms.GetInstance(KnownInstanceGuids.Classes.TextAttribute), TEST_ATTR_GUID); - Assert.That(irTestAttribute, Is.Not.EqualTo(InstanceHandle.Empty)); - Oms.AddAttribute(irTestClass, irTestAttribute); - - Oms.SetAttributeValue(irTestClassInstance, irTestAttribute, TEST_ATTR_VALUE); - - string testAttributeValue = Oms.GetAttributeValue(irTestClassInstance, irTestAttribute); - Assert.That(testAttributeValue, Is.EqualTo(TEST_ATTR_VALUE)); - - // here, the test attribute has a particular value. - // let's make sure that calling a GA- Get Attribute method on TestClass returns the same - OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); - - InstanceHandle gaMethod = methodBuilder.CreateGetAttributeMethod(irTestClass, "get", "Test Attribute", irTestAttribute); - // Method is: `Test Class@get Test Attribute(GA)` - - InstanceHandle gaMethodRamb = methodBuilder.CreateReturnAttributeMethodBinding(gaMethod); - - OmsContext context = Oms.CreateContext(); - - object? testAttributeValue2 = Oms.ExecuteInstanceMethodReturningAttribute(context, irTestClassInstance, gaMethodRamb); - Assert.That(testAttributeValue2, Is.TypeOf()); - Assert.That(testAttributeValue2, Is.EqualTo(testAttributeValue)); - } - - [Test] - public void NonStaticMethodInStaticContext() - { - InstanceHandle irTestClass = Oms.GetInstance(TEST_CLASS_GUID); - Assert.That(irTestClass, Is.Not.EqualTo(InstanceHandle.Empty)); - - // create a Work Set to hold our data - InstanceHandle ws = Oms.CreateWorkSet("Test Work Set"); - - OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); - - InstanceHandle dummyMethod = methodBuilder.CreateGetSpecifiedInstancesMethod(irTestClass, "get", "Empty Set", null, false, ws, new InstanceHandle[0]); - InstanceHandle dummyMethodRsmb = methodBuilder.CreateReturnInstanceSetMethodBinding(dummyMethod); - - OmsContext context = Oms.CreateContext(); - - Assert.That(delegate () - { - IReadOnlyCollection specifiedInstances = Oms.ExecuteStaticMethodReturningInstanceSet(context, dummyMethodRsmb); - }, Throws.InvalidOperationException); - } - - [Test] - public void GetSpecifiedInstancesMethodTest() - { - InstanceHandle irTestClass = Oms.GetInstance(TEST_CLASS_GUID); - Assert.That(irTestClass, Is.Not.EqualTo(InstanceHandle.Empty)); - - InstanceHandle irTestClassInstance = Oms.CreateInstanceOf(irTestClass); - Assert.That(irTestClassInstance, Is.Not.EqualTo(InstanceHandle.Empty)); - - OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); - - // create a Work Set to hold our data - InstanceHandle ws = Oms.CreateWorkSet("Test Work Set", true, new InstanceHandle[] { irTestClass }); - - InstanceHandle gsiMethod = methodBuilder.CreateGetSpecifiedInstancesMethod(irTestClass, "get", "Test Class Instance", null, true, ws, new InstanceHandle[] { irTestClassInstance }); - // Method is: `Test Class@get Test Class Instance(GSI)*S` - - InstanceHandle gsiMethodRsmb = methodBuilder.CreateReturnInstanceSetMethodBinding(gsiMethod); - - OmsContext context = Oms.CreateContext(); - IReadOnlyCollection specifiedInstances = Oms.ExecuteStaticMethodReturningInstanceSet(context, gsiMethodRsmb); - - Assert.That(specifiedInstances, Contains.Item(irTestClassInstance)); - } - -} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/AssignAttributeMethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/AssignAttributeMethodTests.cs new file mode 100644 index 0000000..27a1c0f --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/AssignAttributeMethodTests.cs @@ -0,0 +1,54 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class AssignAttributeMethodTests : MethodTestsBase +{ + + [Test] + public void AssignAttributeMethodTest() + { + InstanceHandle irTestClass = Oms.GetInstance(TEST_CLASS_GUID); + InstanceHandle irTestClassInstance = Oms.CreateInstanceOf(irTestClass); + + InstanceHandle a_Name = Oms.GetInstance(KnownAttributeGuids.Text.Name); + Oms.AddAttribute(irTestClass, a_Name); + + string test_value = "Jackdaws love my big sphinx of quartz."; + + string value = Oms.GetAttributeValue(irTestClassInstance, a_Name); + Assert.That(value, Is.Not.EqualTo(test_value)); + + OmsMethodBuilder builder = new OmsMethodBuilder(Oms); + + BuildAttributeMethod ih_BA = builder.CreateBuildAttributeMethod(irTestClass, "build", "Test Attribute", AccessModifier.Public, true, a_Name, test_value); + ReturnAttributeMethodBinding ramb1 = builder.CreateReturnAttributeMethodBinding(ih_BA); + + AssignAttributeMethod ih_AA = builder.CreateAssignAttributeMethod(irTestClass, "set", "Test Attribute Value to `Jackdaws...`", AccessModifier.Public, true, ramb1, a_Name); + + OmsContext context = Oms.CreateContext(); + Oms.Execute(context, ih_AA, irTestClassInstance); + + value = Oms.GetAttributeValue(irTestClassInstance, a_Name); + Assert.That(value, Is.EqualTo(test_value)); + } + +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/BuildAttributeMethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/BuildAttributeMethodTests.cs new file mode 100644 index 0000000..12ee2bf --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/BuildAttributeMethodTests.cs @@ -0,0 +1,45 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests +{ + + public class BuildAttributeMethodTests : MethodTestsBase + { + [Test] + public void BuildAttributeMethodTest() + { + InstanceHandle irTestClass = Oms.GetInstance(TEST_CLASS_GUID); + InstanceHandle irTestClassInstance = Oms.CreateInstanceOf(irTestClass); + string test_value = "Jackdaws love my big sphinx of quartz."; + + OmsMethodBuilder builder = new OmsMethodBuilder(Oms); + + BuildAttributeMethod ih_BA = builder.CreateBuildAttributeMethod(irTestClass, "build", "Test Attribute", AccessModifier.Public, true, Oms.GetInstance(KnownAttributeGuids.Text.Name), test_value); + + OmsContext context = Oms.CreateContext(); + InstanceHandle ih_test = Oms.Execute(context, ih_BA); + object value = context.GetWorkData(ih_test); + + Assert.That(value, Is.EqualTo(test_value)); + } + } + +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/CalculateDateMethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/CalculateDateMethodTests.cs new file mode 100644 index 0000000..1e4dc8a --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/CalculateDateMethodTests.cs @@ -0,0 +1,26 @@ + +using System.ComponentModel.DataAnnotations; +using Mocha.Core.OmsImplementations.Mini; +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests; + +public class CalculateDateMethodTests : MethodTestsBase +{ + /* + [Test] + public void CalculateDateMethodTest() + { + InstanceHandle c_CommonDate = Oms.GetInstance(KnownInstanceGuids.Classes.CommonDate); + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + CalculateDateMethod cdMethod = methodBuilder.CreateCalculateDateMethod(c_CommonDate, "adjust", "Date And Time parm to 'Nth of month'", AccessModifier.RootA2, true, Oms.GetInstance(KnownAttributeGuids.Date.DateAndTime), Oms.GetInstance(KnownAttributeGuids.Date.DateAndTime)); + ReturnAttributeMethodBinding gasMethodRamb = methodBuilder.CreateReturnAttributeMethodBinding(gasMethod); + + OmsContext context = Oms.CreateContext(); + string value = Oms.ExecuteReturningAttributeValue(context, gasMethodRamb); + + Assert.That(value, Is.EqualTo(TEST_SYSTEM_ATTRIBUTE_ROUTINE_VALUE)); + } + */ +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/CommonTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/CommonTests.cs new file mode 100644 index 0000000..4d31987 --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/CommonTests.cs @@ -0,0 +1,64 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class CommonTests : MethodTestsBase +{ + + [Test] + public void NonStaticMethodInStaticContext() + { + InstanceHandle irTestClass = Oms.GetInstance(TEST_CLASS_GUID); + Assert.That(irTestClass, Is.Not.EqualTo(InstanceHandle.Empty)); + + // create a Work Set to hold our data + WorkSet ws = Oms.CreateWorkSet("Test Work Set"); + + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + + GetSpecifiedInstancesMethod dummyMethod = methodBuilder.CreateGetSpecifiedInstancesMethod(irTestClass, "get", "Empty Set", null, false, ws, new InstanceHandle[0]); + ReturnInstanceSetMethodBinding dummyMethodRsmb = methodBuilder.CreateReturnInstanceSetMethodBinding(dummyMethod); + + OmsContext context = Oms.CreateContext(); + + Assert.That(delegate () + { + IReadOnlyCollection specifiedInstances = Oms.ExecuteStaticMethodReturningInstanceSet(context, dummyMethodRsmb); + }, Throws.InvalidOperationException); + } + + [Test] + public void RuntimeVersionMatches() + { + InstanceHandle c_OMS = Oms.GetInstance(KnownInstanceGuids.Classes.OMS); + + //*** Wow, this actually works!!! ***// + // ... but I wonder how long it would actually take to sift through 1000s of methods... + Method m = Oms.GetMethod(c_OMS, "get", "Runtime Version"); + + OmsContext context = Oms.CreateContext(); + InstanceHandle workData = Oms.Execute(context, m); + object? value = context.GetWorkData(workData); + + Assert.That(value is string); + Assert.That((string?)value, Is.EqualTo(Oms.RuntimeVersion.ToString())); + } +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/ConditionalSelectAttributeMethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/ConditionalSelectAttributeMethodTests.cs new file mode 100644 index 0000000..8f1b2ac --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/ConditionalSelectAttributeMethodTests.cs @@ -0,0 +1,127 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class ConditionalSelectAttributeMethodTests : MethodTestsBase +{ + [Test] + public void Test__Get_Method_Abbreviation__SAC() + { + InstanceHandle c_Method = Oms.GetInstance(KnownInstanceGuids.Classes.Method); + + ConditionalSelectAttributeMethod sac = Oms.GetInstance(KnownInstanceGuids.Methods.ConditionalSelectAttribute.Method__get__Method_Abbreviation); + ReturnAttributeMethodBinding ramb = sac.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(c_Method, sac); + + InstanceHandle wd = Oms.Execute(context, ramb); + object? value = context.GetWorkData(wd); + + Assert.That(value, Is.EqualTo("SAC")); + Assert.That(value, Is.Not.EqualTo("GR")); + } + + [Test] + public void Test__Get_Method_Abbreviation__GR() + { + InstanceHandle c_Method = Oms.GetInstance(KnownInstanceGuids.Classes.Method); + + ConditionalSelectAttributeMethod sac = Oms.GetInstance(KnownInstanceGuids.Methods.ConditionalSelectAttribute.Method__get__Method_Abbreviation); + ReturnAttributeMethodBinding ramb = sac.CreateMethodBinding(Oms); + + GetRelationshipMethod Instance__get__Class = Oms.GetInstance(KnownInstanceGuids.Methods.GetRelationship.Instance__get__Parent_Class); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(c_Method, Instance__get__Class); + + InstanceHandle wd = Oms.Execute(context, ramb); + object? value = context.GetWorkData(wd); + + Assert.That(value, Is.EqualTo("GR")); + Assert.That(value, Is.Not.EqualTo("SAC")); + } + + [Test] + public void Test__Get_Method_Abbreviation__GAS() + { + InstanceHandle c_Method = Oms.GetInstance(KnownInstanceGuids.Classes.Method); + + ConditionalSelectAttributeMethod sac = Oms.GetInstance(KnownInstanceGuids.Methods.ConditionalSelectAttribute.Method__get__Method_Abbreviation); + ReturnAttributeMethodBinding ramb = sac.CreateMethodBinding(Oms); + + GetAttributeBySystemRoutineMethod OMS__get__Runtime_Version = Oms.GetInstance(KnownInstanceGuids.Methods.GetAttributeBySystemRoutine.OMS__get__Runtime_Version); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(c_Method, OMS__get__Runtime_Version); + + InstanceHandle wd = Oms.Execute(context, ramb); + object? value = context.GetWorkData(wd); + + Assert.That(value, Is.EqualTo("GAS")); + Assert.That(value, Is.Not.EqualTo("SAC")); + } + + [Test] + public void Test__Get_Method_Binding_Abbreviation__RAMB() + { + InstanceHandle c_MethodBinding = Oms.GetInstance(KnownInstanceGuids.Classes.MethodBinding); + + ConditionalSelectAttributeMethod sac = Oms.GetInstance(KnownInstanceGuids.Methods.ConditionalSelectAttribute.Method_Binding__get__Method_Binding_Abbreviation); + ReturnAttributeMethodBinding ramb = sac.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(c_MethodBinding, ramb); + + InstanceHandle wd = Oms.Execute(context, ramb); + object? value = context.GetWorkData(wd); + + Assert.That(value, Is.EqualTo("ramb")); + Assert.That(value, Is.Not.EqualTo("rsmb")); + } + + [Test] + public void Test__Get_Method_Binding_Abbreviation__RSMB() + { + InstanceHandle c_MethodBinding = Oms.GetInstance(KnownInstanceGuids.Classes.MethodBinding); + + ConditionalSelectAttributeMethod sac = Oms.GetInstance(KnownInstanceGuids.Methods.ConditionalSelectAttribute.Method_Binding__get__Method_Binding_Abbreviation); + ReturnAttributeMethodBinding ramb = sac.CreateMethodBinding(Oms); + + GetRelationshipMethod Instance__get__Class = Oms.GetInstance(KnownInstanceGuids.Methods.GetRelationship.Instance__get__Parent_Class); + ReturnInstanceSetMethodBinding rsmb = Instance__get__Class.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(c_MethodBinding, rsmb); + + InstanceHandle wd = Oms.Execute(context, ramb); + object? value = context.GetWorkData(wd); + + Assert.That(value, Is.EqualTo("rsmb")); + Assert.That(value, Is.Not.EqualTo("ramb")); + } + + // TODO: create a method to return a randomly-selected value from a Set + // e.g. Set@select random singular Instance + // using a GAS - Get Attribute by System Routine method + + +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/ConditionalSelectFromInstanceSetMethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/ConditionalSelectFromInstanceSetMethodTests.cs new file mode 100644 index 0000000..6758449 --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/ConditionalSelectFromInstanceSetMethodTests.cs @@ -0,0 +1,64 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class ConditionalSelectFromInstanceSetMethodTests : MethodTestsBase +{ + + /* + [Test] + public void Test() + { + InstanceHandle c_AccessModifier = Oms.GetInstance(KnownInstanceGuids.Classes.AccessModifier); + // MethodReturningInstanceSet m_Access_Modifier__get__Most_Restrictive_from_Set = (MethodReturningInstanceSet) Oms.GetMethod(c_AccessModifier, "get", "Most Restrictive from Set"); + + InstanceHandle a_Order = Oms.GetInstance(KnownAttributeGuids.Text.Order); + + WorkSet ws_Access_Modifier__Nonsingular = Oms.CreateWorkSet("Access Modifier [Nonsingular]", false); + WorkSet ws_Access_Modifier__Singular = Oms.CreateWorkSet("Access Modifier [Singular]", true); + + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + GetAttributeMethod get_Order = methodBuilder.CreateGetAttributeMethod(c_AccessModifier, "get", "Order", a_Order); + + SelectFromInstanceSetMethod m_Access_Modifier__get__Most_Restrictive_from_Set = methodBuilder.CreateSelectFromInstanceSetMethod(c_AccessModifier, "get", "Most Restrictive from Set", AccessModifier.Public, true, ws_Access_Modifier__Singular, ws_Access_Modifier__Nonsingular, null, Oms.GetInstance(KnownInstanceGuids.SelectionFunctions.Minimum), get_Order.Handle); + + if (m_Access_Modifier__get__Most_Restrictive_from_Set != null) + { + ReturnInstanceSetMethodBinding rsmb = m_Access_Modifier__get__Most_Restrictive_from_Set.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(ws_Access_Modifier__Nonsingular, new InstanceWrapper[] + { + AccessModifier.Private, + AccessModifier.Protected, + AccessModifier.Public, + AccessModifier.RootA2 + }); + + InstanceHandle workData = Oms.Execute(context, rsmb, null); + object? value = context.GetWorkData(workData); + + Assert.That(value is InstanceHandle); + Assert.That((InstanceHandle?)value, Is.EqualTo(AccessModifier.Private.Handle)); + } + } + */ +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/EvaluateBooleanExpressionMethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/EvaluateBooleanExpressionMethodTests.cs new file mode 100644 index 0000000..333c6d4 --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/EvaluateBooleanExpressionMethodTests.cs @@ -0,0 +1,95 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class EvaluateBooleanExpressionMethodTests : MethodTestsBase +{ + [Test] + public void Test_EBE_Returns_False_if_Method_is_NOT_Get_Attribute_Method() + { + InstanceHandle c_Instance = Oms.GetInstance(KnownInstanceGuids.Classes.Instance); + InstanceHandle c_Method = Oms.GetInstance(KnownInstanceGuids.Classes.Method); + + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + + GetRelationshipMethod Instance__get__Parent_Class = new GetRelationshipMethod(Oms.GetInstance(KnownInstanceGuids.Methods.GetRelationship.Instance__get__Parent_Class)); + ReturnInstanceSetMethodBinding Instance__get__Parent_Class_rsmb = Instance__get__Parent_Class.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(c_Instance, Instance__get__Parent_Class); + InstanceHandle wsRet = Oms.Execute(context, Instance__get__Parent_Class); + + // FIXME: this should be singular + InstanceHandle[] pclass = (InstanceHandle[])context.GetWorkData(wsRet); + + Assert.That(pclass[0], Is.EqualTo(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetRelationshipMethod))); + + + EvaluateBooleanExpressionMethod Method__is__Conditional_Select_Attribute_Method = methodBuilder.CreateEvaluateBooleanExpressionMethod(c_Method, "is", "SAC", AccessModifier.Public, false, Oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, Oms.GetInstance(KnownInstanceGuids.MethodClasses.ConditionalSelectAttributeMethod)); + ReturnAttributeMethodBinding Method__is__Conditional_Select_Attribute_Method_ramb = Method__is__Conditional_Select_Attribute_Method.CreateMethodBinding(Oms); + + EvaluateBooleanExpressionMethod Method__is__Get_Relationship_Method = methodBuilder.CreateEvaluateBooleanExpressionMethod(c_Method, "is", "GR", AccessModifier.Public, false, Oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetRelationshipMethod)); + ReturnAttributeMethodBinding Method__is__Get_Relationship_Method_ramb = Method__is__Get_Relationship_Method.CreateMethodBinding(Oms); + + context.SetWorkData(Oms.GetInstance(KnownInstanceGuids.Classes.Method), Instance__get__Parent_Class.Handle); + + InstanceHandle workData = Oms.Execute(context, Method__is__Conditional_Select_Attribute_Method_ramb); + object? value = context.GetWorkData(workData); + + Assert.That(value, Is.EqualTo(false)); + } + + + [Test] + public void Test_EBE_Returns_True_if_Method_is_Get_Attribute_Method() + { + InstanceHandle c_Instance = Oms.GetInstance(KnownInstanceGuids.Classes.Instance); + InstanceHandle c_Method = Oms.GetInstance(KnownInstanceGuids.Classes.Method); + + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + + GetRelationshipMethod Instance__get__Parent_Class = new GetRelationshipMethod(Oms.GetInstance(KnownInstanceGuids.Methods.GetRelationship.Instance__get__Parent_Class)); + ReturnInstanceSetMethodBinding Instance__get__Parent_Class_rsmb = Instance__get__Parent_Class.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(c_Instance, Instance__get__Parent_Class); + InstanceHandle wsRet = Oms.Execute(context, Instance__get__Parent_Class); + + // FIXME: this should be singular + InstanceHandle[] pclass = (InstanceHandle[]) context.GetWorkData(wsRet); + + Assert.That(pclass[0], Is.EqualTo(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetRelationshipMethod))); + + EvaluateBooleanExpressionMethod Method__is__Conditional_Select_Attribute_Method = methodBuilder.CreateEvaluateBooleanExpressionMethod(c_Method, "is", "SAC", AccessModifier.Public, false, Oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, Oms.GetInstance(KnownInstanceGuids.MethodClasses.ConditionalSelectAttributeMethod)); + ReturnAttributeMethodBinding Method__is__Conditional_Select_Attribute_Method_ramb = Method__is__Conditional_Select_Attribute_Method.CreateMethodBinding(Oms); + + EvaluateBooleanExpressionMethod Method__is__Get_Relationship_Method = methodBuilder.CreateEvaluateBooleanExpressionMethod(c_Method, "is", "GR", AccessModifier.Public, false, Oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetRelationshipMethod)); + ReturnAttributeMethodBinding Method__is__Get_Relationship_Method_ramb = Method__is__Get_Relationship_Method.CreateMethodBinding(Oms); + + context.SetWorkData(Oms.GetInstance(KnownInstanceGuids.Classes.Method), Instance__get__Parent_Class.Handle); + + InstanceHandle workData = Oms.Execute(context, Method__is__Get_Relationship_Method_ramb); + object? value = context.GetWorkData(workData); + + Assert.That(value, Is.EqualTo(true)); + } + +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetAttributeMethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetAttributeMethodTests.cs new file mode 100644 index 0000000..564137b --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetAttributeMethodTests.cs @@ -0,0 +1,58 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests +{ + public class GetAttributeMethodTests : MethodTestsBase + { + + [Test] + public void GetAttributeMethodTest() + { + InstanceHandle irTestClass = Oms.GetInstance(TEST_CLASS_GUID); + InstanceHandle irTestClassInstance = Oms.CreateInstanceOf(irTestClass); + + InstanceHandle irTestAttribute = Oms.CreateInstanceOf(Oms.GetInstance(KnownInstanceGuids.Classes.TextAttribute), TEST_ATTR_GUID); + Assert.That(irTestAttribute, Is.Not.EqualTo(InstanceHandle.Empty)); + Oms.AddAttribute(irTestClass, irTestAttribute); + + Oms.SetAttributeValue(irTestClassInstance, irTestAttribute, TEST_ATTR_VALUE); + + string testAttributeValue = Oms.GetAttributeValue(irTestClassInstance, irTestAttribute); + Assert.That(testAttributeValue, Is.EqualTo(TEST_ATTR_VALUE)); + + // here, the test attribute has a particular value. + // let's make sure that calling a GA- Get Attribute method on TestClass returns the same + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + + GetAttributeMethod gaMethod = methodBuilder.CreateGetAttributeMethod(irTestClass, "get", "Test Attribute", irTestAttribute); + // Method is: `Test Class@get Test Attribute(GA)` + + ReturnAttributeMethodBinding gaMethodRamb = methodBuilder.CreateReturnAttributeMethodBinding(gaMethod); + + OmsContext context = Oms.CreateContext(); + + object? testAttributeValue2 = Oms.ExecuteInstanceMethodReturningAttribute(context, irTestClassInstance, gaMethodRamb); + Assert.That(testAttributeValue2, Is.TypeOf()); + Assert.That(testAttributeValue2, Is.EqualTo(testAttributeValue)); + } + + } +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetReferencedAttributeTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetReferencedAttributeTests.cs new file mode 100644 index 0000000..92f1b71 --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetReferencedAttributeTests.cs @@ -0,0 +1,183 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class GetReferencedAttributeTests : MethodTestsBase +{ + protected InstanceHandle c_Nurse, c_Patient; + protected InstanceHandle a_Name, a_Acuity; + protected InstanceHandle r_Nurse__has__Patient, r_Patient__for__Nurse; + + protected override void AfterSetup() + { + base.AfterSetup(); + + c_Nurse = Oms.GetInstance(TEST_CLASS_GUID); + c_Patient = Oms.GetInstance(TEST_CLASS2_GUID); + a_Name = Oms.GetInstance(KnownAttributeGuids.Text.Name); + + a_Acuity = Oms.CreateInstanceOf(Oms.GetInstance(KnownInstanceGuids.Classes.NumericAttribute)); + Oms.SetAttributeValue(a_Acuity, a_Name, "Acuity"); + Oms.AddAttribute(c_Patient, a_Acuity); + + Oms.SetAttributeValue(c_Nurse, a_Name, "Nurse"); + Oms.SetAttributeValue(c_Patient, a_Name, "Patient"); + + r_Nurse__has__Patient = Oms.CreateRelationship(c_Nurse, "has", c_Patient, new Guid("{0558fc58-7504-4f6c-a63f-4a710ec0bbb9}"), false, "for", new Guid("{4a132262-0d5c-43d5-9308-5021dad070f8}"), out r_Patient__for__Nurse); + } + + [Test] + public void GetReferencedAttributeTest() + { + OmsMethodBuilder builder = new OmsMethodBuilder(Oms); + + InstanceHandle c_TestClass = Oms.GetInstance(TEST_CLASS_GUID); + InstanceHandle c_TestClass2 = Oms.GetInstance(TEST_CLASS2_GUID); + + Oms.AddAttribute(c_TestClass, a_Name); + Oms.AddAttribute(c_TestClass2, a_Name); + + GetAttributeMethod Test_Class__get__Name = builder.CreateGetAttributeMethod(c_TestClass, "get", "Name", a_Name); + + GetRelationshipMethod Test_Class_2__get__Test_Class_2__for__Test_Class = builder.CreateGetRelationshipMethod(c_TestClass2, "get", "Test Class 2.for Test Class", AccessModifier.Public, false, r_Test_Class_2__for__Test_Class); + + ReturnInstanceSetMethodBinding Test_Class_2__get__parent_Test_Class__ramb = Test_Class_2__get__Test_Class_2__for__Test_Class.CreateMethodBinding(Oms); + + GetReferencedAttributeMethod ih_GRA = builder.CreateGetReferencedAttributeMethod(c_TestClass2, "get", "Test Attribute from parent Test Class", AccessModifier.Public, false, a_Name, Test_Class_2__get__parent_Test_Class__ramb, Test_Class__get__Name); + ReturnAttributeMethodBinding ramb = ih_GRA.CreateMethodBinding(Oms); + + InstanceHandle i_TestClass_inst1 = Oms.CreateInstanceOf(c_TestClass); + Oms.SetAttributeValue(i_TestClass_inst1, a_Name, "This is Test Name"); + + InstanceHandle i_TestClass2_inst1 = Oms.CreateInstanceOf(c_TestClass2); + Oms.AssignRelationship(i_TestClass_inst1, r_Test_Class__has__Test_Class_2, i_TestClass2_inst1); + + OmsContext context = Oms.CreateContext(); + + // Get Referenced Attribute + // From a given instance (e.g. Test Class 2 Instance 1) + // Test Class 2@get Test Attribute from parent Test Class + // looks at the Test Class 2@get Test Class 2.for Test Class (loop on instance set) + // and then on THAT instance, gets teh attribute value and puts it into the returnsAttribute + + InstanceHandle valueWD = Oms.Execute(context, ih_GRA, i_TestClass2_inst1); + string value = context.GetWorkData(valueWD); + + Assert.That(value, Is.EqualTo("This is Test Name")); + } + + + [Test] + public void GetReferencedAttributeAccumulationSumTest() + { + OmsMethodBuilder builder = new OmsMethodBuilder(Oms); + + InstanceHandle i_Nurse1 = Oms.CreateInstanceOf(c_Nurse); + + InstanceHandle i_Patient1 = Oms.CreateInstanceOf(c_Patient); + Oms.SetAttributeValue(i_Patient1, a_Acuity, (decimal)10); + + InstanceHandle i_Patient2 = Oms.CreateInstanceOf(c_Patient); + Oms.SetAttributeValue(i_Patient2, a_Acuity, (decimal)20); + + InstanceHandle i_Patient3 = Oms.CreateInstanceOf(c_Patient); + Oms.SetAttributeValue(i_Patient3, a_Acuity, (decimal)30); + + decimal expectedValue = 60; + + // Patient@get Acuity(GA)*P*S + GetAttributeMethod Patient__get__Acuity = builder.CreateGetAttributeMethod(c_Patient, "get", "Acuity", a_Acuity); + ReturnAttributeMethodBinding Patient__get__Acuity_ramb = Patient__get__Acuity.CreateMethodBinding(Oms); + + Oms.AssignRelationship(i_Nurse1, r_Nurse__has__Patient, new InstanceHandle[] { i_Patient1, i_Patient2, i_Patient3 }); + + GetRelationshipMethod Nurse__get__Patients = builder.CreateGetRelationshipMethod(c_Nurse, "get", "Nurse.has Patient", AccessModifier.Public, false, r_Nurse__has__Patient); + ReturnInstanceSetMethodBinding Nurse__get__Patients_rsmb = Nurse__get__Patients.CreateMethodBinding(Oms); + + GetReferencedAttributeMethod ih_GRA = builder.CreateGetReferencedAttributeMethod(c_Nurse, "get", "Patient Acuity Levels Sum", AccessModifier.Public, false, a_Acuity, Nurse__get__Patients_rsmb, Patient__get__Acuity_ramb, Oms.GetInstance(KnownInstanceGuids.AccumulationFunctions.Sum)); + ReturnAttributeMethodBinding ramb = ih_GRA.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + + InstanceHandle valueWD = Oms.Execute(context, ih_GRA, i_Nurse1); + decimal value = context.GetWorkData(valueWD); + + Assert.That(value, Is.EqualTo(expectedValue)); + } + + + [Test] + public void GetReferencedAttributeAccumulationSumTestNative() + { + decimal expectedValue = 60; + decimal[] values = new decimal[] { 10, 20, 30 }; + decimal sum = values.Sum(); + Assert.That(sum, Is.EqualTo(expectedValue)); + } + + [Test] + public void GetReferencedAttributeAccumulationAverageTestNative() + { + decimal expectedValue = 20; + decimal[] values = new decimal[] { 10, 20, 30 }; + decimal sum = values.Average(); + Assert.That(sum, Is.EqualTo(expectedValue)); + } + + [Test] + public void GetReferencedAttributeAccumulationAverageTest() + { + OmsMethodBuilder builder = new OmsMethodBuilder(Oms); + + InstanceHandle i_Nurse1 = Oms.CreateInstanceOf(c_Nurse); + + InstanceHandle i_Patient1 = Oms.CreateInstanceOf(c_Patient); + Oms.SetAttributeValue(i_Patient1, a_Acuity, (decimal)10); + + InstanceHandle i_Patient2 = Oms.CreateInstanceOf(c_Patient); + Oms.SetAttributeValue(i_Patient2, a_Acuity, (decimal)20); + + InstanceHandle i_Patient3 = Oms.CreateInstanceOf(c_Patient); + Oms.SetAttributeValue(i_Patient3, a_Acuity, (decimal)30); + + decimal expectedValue = 20; + + // Patient@get Acuity(GA)*P*S + GetAttributeMethod Patient__get__Acuity = builder.CreateGetAttributeMethod(c_Patient, "get", "Acuity", a_Acuity); + ReturnAttributeMethodBinding Patient__get__Acuity_ramb = Patient__get__Acuity.CreateMethodBinding(Oms); + + Oms.AssignRelationship(i_Nurse1, r_Nurse__has__Patient, new InstanceHandle[] { i_Patient1, i_Patient2, i_Patient3 }); + + GetRelationshipMethod Nurse__get__Patients = builder.CreateGetRelationshipMethod(c_Nurse, "get", "Nurse.has Patient", AccessModifier.Public, false, r_Nurse__has__Patient); + ReturnInstanceSetMethodBinding Nurse__get__Patients_rsmb = Nurse__get__Patients.CreateMethodBinding(Oms); + + GetReferencedAttributeMethod ih_GRA = builder.CreateGetReferencedAttributeMethod(c_Nurse, "get", "Patient Acuity Levels Average", AccessModifier.Public, false, a_Acuity, Nurse__get__Patients_rsmb, Patient__get__Acuity_ramb, Oms.GetInstance(KnownInstanceGuids.AccumulationFunctions.Average)); + ReturnAttributeMethodBinding ramb = ih_GRA.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + + InstanceHandle valueWD = Oms.Execute(context, ih_GRA, i_Nurse1); + decimal value = context.GetWorkData(valueWD); + + Assert.That(value, Is.EqualTo(expectedValue)); + } + +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetRelationshipTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetRelationshipTests.cs new file mode 100644 index 0000000..76ab7e0 --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetRelationshipTests.cs @@ -0,0 +1,64 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class GetRelationshipTests : MethodTestsBase +{ + + [Test] + public void GetRelationshipTest() + { + InstanceHandle c_TestClass = Oms.GetInstance(TEST_CLASS_GUID); + InstanceHandle c_TestClass2 = Oms.GetInstance(TEST_CLASS2_GUID); + + OmsMethodBuilder builder = new OmsMethodBuilder(Oms); + + GetRelationshipMethod method = builder.CreateGetRelationshipMethod(c_TestClass, "get", "Test Class.has Test Class 2", AccessModifier.Public, true, r_Test_Class__has__Test_Class_2); + ReturnInstanceSetMethodBinding rsmb = builder.CreateReturnInstanceSetMethodBinding(method); + + OmsContext context = Oms.CreateContext(); + object? value = Oms.Execute(context, rsmb); + Assert.That(value, Is.EqualTo(r_Test_Class__has__Test_Class_2)); + } + + [Test] + public void GetParentClassMatchesActualParentClass() + { + InstanceHandle c_Instance = Oms.GetInstance(KnownInstanceGuids.Classes.Instance); + InstanceHandle c_TestClass = Oms.GetInstance(TEST_CLASS_GUID); + InstanceHandle c_TestClassInstance = Oms.CreateInstanceOf(c_TestClass); + + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + + GetRelationshipMethod Instance__get__Parent_Class = methodBuilder.CreateGetRelationshipMethod(c_Instance, "get", "Parent Class", AccessModifier.Public, false, Oms.GetInstance(KnownRelationshipGuids.Instance__for__Class)); + Oms.SetAttributeValue(Instance__get__Parent_Class.Handle, Oms.GetInstance(KnownAttributeGuids.Boolean.Singular), true); + + ReturnInstanceSetMethodBinding Instance__get__Parent_Class_rsmb = Instance__get__Parent_Class.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(c_Instance, c_TestClassInstance); + + InstanceHandle workSet = Oms.Execute(context, Instance__get__Parent_Class_rsmb); + + object? value = context.GetWorkData(workSet); + Assert.That(value, Is.EqualTo(c_TestClass)); + } +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetSpecifiedInstancesMethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetSpecifiedInstancesMethodTests.cs new file mode 100644 index 0000000..71d9bf3 --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/GetSpecifiedInstancesMethodTests.cs @@ -0,0 +1,51 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class GetSpecifiedInstancesMethodTests : MethodTestsBase +{ + [Test] + public void GetSpecifiedInstancesMethodTest() + { + InstanceHandle irTestClass = Oms.GetInstance(TEST_CLASS_GUID); + Assert.That(irTestClass, Is.Not.EqualTo(InstanceHandle.Empty)); + + InstanceHandle irTestClassInstance = Oms.CreateInstanceOf(irTestClass); + Assert.That(irTestClassInstance, Is.Not.EqualTo(InstanceHandle.Empty)); + + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + + // create a Work Set to hold our data + WorkSet ws = Oms.CreateWorkSet("Test Work Set", true, new InstanceHandle[] { irTestClass }); + + GetSpecifiedInstancesMethod gsiMethod = methodBuilder.CreateGetSpecifiedInstancesMethod(irTestClass, "get", "Test Class Instance", AccessModifier.Public, true, ws, new InstanceHandle[] { irTestClassInstance }); + string nom = Oms.GetInstanceText(gsiMethod); + // Method is: `Test Class@get Test Class Instance(GSI)*S` + + ReturnInstanceSetMethodBinding gsiMethodRsmb = methodBuilder.CreateReturnInstanceSetMethodBinding(gsiMethod); + nom = Oms.GetInstanceText(gsiMethodRsmb); + + OmsContext context = Oms.CreateContext(); + IReadOnlyCollection specifiedInstances = Oms.ExecuteStaticMethodReturningInstanceSet(context, gsiMethodRsmb); + + Assert.That(specifiedInstances, Contains.Item(irTestClassInstance)); + } +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/SelectFromInstanceSetMethodTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/SelectFromInstanceSetMethodTests.cs new file mode 100644 index 0000000..8447004 --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/SelectFromInstanceSetMethodTests.cs @@ -0,0 +1,62 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class SelectFromInstanceSetMethodTests : MethodTestsBase +{ + + [Test] + public void Access_Modifier__get__Most_Restrictive_from_Set() + { + InstanceHandle c_AccessModifier = Oms.GetInstance(KnownInstanceGuids.Classes.AccessModifier); + // MethodReturningInstanceSet m_Access_Modifier__get__Most_Restrictive_from_Set = (MethodReturningInstanceSet) Oms.GetMethod(c_AccessModifier, "get", "Most Restrictive from Set"); + + InstanceHandle a_Order = Oms.GetInstance(KnownAttributeGuids.Text.Order); + + WorkSet ws_Access_Modifier__Nonsingular = Oms.CreateWorkSet("Access Modifier [Nonsingular]", false); + WorkSet ws_Access_Modifier__Singular = Oms.CreateWorkSet("Access Modifier [Singular]", true); + + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + GetAttributeMethod get_Order = methodBuilder.CreateGetAttributeMethod(c_AccessModifier, "get", "Order", a_Order); + + SelectFromInstanceSetMethod m_Access_Modifier__get__Most_Restrictive_from_Set = methodBuilder.CreateSelectFromInstanceSetMethod(c_AccessModifier, "get", "Most Restrictive from Set", AccessModifier.Public, true, ws_Access_Modifier__Singular, ws_Access_Modifier__Nonsingular, null, Oms.GetInstance(KnownInstanceGuids.SelectionFunctions.Minimum), get_Order.Handle); + + if (m_Access_Modifier__get__Most_Restrictive_from_Set != null) + { + ReturnInstanceSetMethodBinding rsmb = m_Access_Modifier__get__Most_Restrictive_from_Set.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(ws_Access_Modifier__Nonsingular, new InstanceWrapper[] + { + AccessModifier.Private, + AccessModifier.Protected, + AccessModifier.Public, + AccessModifier.RootA2 + }); + + InstanceHandle workData = Oms.Execute(context, rsmb, null); + object? value = context.GetWorkData(workData); + + Assert.That(value is InstanceHandle); + Assert.That((InstanceHandle?)value, Is.EqualTo(AccessModifier.Private.Handle)); + } + } +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/SystemRoutineTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/SystemRoutineTests.cs new file mode 100644 index 0000000..b96e61b --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTests/SystemRoutineTests.cs @@ -0,0 +1,62 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests.MethodTests; + +public class SystemRoutineTests : MethodTestsBase +{ + private Guid TEST_SYSTEM_ATTRIBUTE_ROUTINE_GUID = new Guid("{fd726a89-86b3-46ea-b65b-20681358ea92}"); + private string TEST_SYSTEM_ATTRIBUTE_ROUTINE_VALUE = "Picadilly Circus"; + + [Test] + public void GetAttributeBySystemRoutineTest() + { + InstanceHandle irTestClass = Oms.GetInstance(TEST_CLASS_GUID); + OmsMethodBuilder methodBuilder = new OmsMethodBuilder(Oms); + OmsSystemRoutineBuilder systemRoutineBuilder = new OmsSystemRoutineBuilder(Oms); + + SystemAttributeRoutine testSystemAttributeRoutine = systemRoutineBuilder.CreateSystemAttributeRoutine(TEST_SYSTEM_ATTRIBUTE_ROUTINE_GUID, delegate (Oms oms, OmsContext context) + { + return TEST_SYSTEM_ATTRIBUTE_ROUTINE_VALUE; + }); + + GetAttributeBySystemRoutineMethod gasMethod = methodBuilder.CreateGetAttributeBySystemRoutineMethod(irTestClass, "get", "Test System Routine Text Attribute", AccessModifier.Public, true, Oms.GetInstance(KnownAttributeGuids.Text.Value), testSystemAttributeRoutine); + ReturnAttributeMethodBinding gasMethodRamb = methodBuilder.CreateReturnAttributeMethodBinding(gasMethod); + + OmsContext context = Oms.CreateContext(); + string value = Oms.ExecuteReturningAttributeValue(context, gasMethodRamb); + + Assert.That(value, Is.EqualTo(TEST_SYSTEM_ATTRIBUTE_ROUTINE_VALUE)); + } + + [Test] + public void GetRandomNumberTest() + { + GetAttributeBySystemRoutineMethod Common_Numeric__get__Random_Number = Oms.GetInstance(KnownInstanceGuids.Methods.GetAttributeBySystemRoutine.Common_Numeric__get__Random_Number); + ReturnAttributeMethodBinding ramb = Common_Numeric__get__Random_Number.CreateMethodBinding(Oms); + + OmsContext context = Oms.CreateContext(); + context.SetWorkData(Oms.GetInstance(KnownAttributeGuids.Numeric.Seed), (decimal)25112); + decimal value = Oms.ExecuteReturningAttributeValue(context, ramb); + + // we respect the value of the `Seed` attribute, so we can unit test this + Assert.That(value, Is.EqualTo(0.87073318747372M)); + } +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/MethodTestsBase.cs b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTestsBase.cs new file mode 100644 index 0000000..85a099d --- /dev/null +++ b/mocha-dotnet/tests/Mocha.Core.Tests/MethodTestsBase.cs @@ -0,0 +1,43 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + +using System.ComponentModel.DataAnnotations; +using System.Security.Principal; +using Mocha.Core.OmsImplementations.Mini; +using Mocha.Core.Oop; +using Mocha.Core.Oop.Methods; + +namespace Mocha.Core.Tests; + +public abstract class MethodTestsBase : OmsTestsBase +{ + Guid gid_r_Test_Class__has__Test_Class_2 = new Guid("{a5b67aad-e46f-4673-b339-77417396b2fe}"); + Guid gid_r_Test_Class_2__for__Test_Class = new Guid("{2864dfd9-0313-4801-96bf-b9be99ea172d}"); + + protected InstanceHandle c_TestClass, c_TestClass2; + protected InstanceHandle r_Test_Class__has__Test_Class_2, r_Test_Class_2__for__Test_Class; + + protected override void AfterSetup() + { + base.AfterSetup(); + + c_TestClass = Oms.GetInstance(TEST_CLASS_GUID); + c_TestClass2 = Oms.GetInstance(TEST_CLASS2_GUID); + + r_Test_Class__has__Test_Class_2 = Oms.CreateRelationship(c_TestClass, "has", c_TestClass2, gid_r_Test_Class__has__Test_Class_2, true, "for", gid_r_Test_Class_2__for__Test_Class, out r_Test_Class_2__for__Test_Class); + } +} \ No newline at end of file diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/Mocha.Core.Tests.csproj b/mocha-dotnet/tests/Mocha.Core.Tests/Mocha.Core.Tests.csproj index 40d26d8..f275ffa 100644 --- a/mocha-dotnet/tests/Mocha.Core.Tests/Mocha.Core.Tests.csproj +++ b/mocha-dotnet/tests/Mocha.Core.Tests/Mocha.Core.Tests.csproj @@ -1,3 +1,22 @@ + + diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/Modeling/OmsModelingTestsBase.cs b/mocha-dotnet/tests/Mocha.Core.Tests/Modeling/OmsModelingTestsBase.cs index 28e479e..b6e6edd 100644 --- a/mocha-dotnet/tests/Mocha.Core.Tests/Modeling/OmsModelingTestsBase.cs +++ b/mocha-dotnet/tests/Mocha.Core.Tests/Modeling/OmsModelingTestsBase.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using Mocha.Core.Modeling; namespace Mocha.Core.Tests.Modeling; diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/OmsTestsBase.cs b/mocha-dotnet/tests/Mocha.Core.Tests/OmsTestsBase.cs index 267006b..98a9190 100644 --- a/mocha-dotnet/tests/Mocha.Core.Tests/OmsTestsBase.cs +++ b/mocha-dotnet/tests/Mocha.Core.Tests/OmsTestsBase.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using Mocha.Core.OmsImplementations.Mini; namespace Mocha.Core.Tests; diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/RelationshipTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/RelationshipTests.cs index 8cf8d8c..11daf71 100644 --- a/mocha-dotnet/tests/Mocha.Core.Tests/RelationshipTests.cs +++ b/mocha-dotnet/tests/Mocha.Core.Tests/RelationshipTests.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using Mocha.Core.OmsImplementations.Mini; diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/SampleDatabases/MovieRentalTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/SampleDatabases/MovieRentalTests.cs index 5050d2e..33f6a2a 100644 --- a/mocha-dotnet/tests/Mocha.Core.Tests/SampleDatabases/MovieRentalTests.cs +++ b/mocha-dotnet/tests/Mocha.Core.Tests/SampleDatabases/MovieRentalTests.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + namespace Mocha.Core.Tests.SampleDatabases; diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/SampleDatabases/VehicleForHireTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/SampleDatabases/VehicleForHireTests.cs index 5b5fff6..1203e73 100644 --- a/mocha-dotnet/tests/Mocha.Core.Tests/SampleDatabases/VehicleForHireTests.cs +++ b/mocha-dotnet/tests/Mocha.Core.Tests/SampleDatabases/VehicleForHireTests.cs @@ -1,3 +1,20 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using Mocha.Core.Modeling; using Mocha.Core.Tests.Modeling; @@ -15,7 +32,7 @@ public class VehicleForHireDB : OmsDatabase } [OmsGlobalIdentifier("{9153A637-992E-4712-ADF2-B03F0D9EDEA6}")] - public readonly string Name; + public string Name { get { return (string)GetAttributeValue(""); } set { SetAttributeValue(value); } } /// /// Business.has Driver diff --git a/mocha-dotnet/tests/Mocha.Core.Tests/WorkSetTests.cs b/mocha-dotnet/tests/Mocha.Core.Tests/WorkSetTests.cs index 7014e05..e272870 100644 --- a/mocha-dotnet/tests/Mocha.Core.Tests/WorkSetTests.cs +++ b/mocha-dotnet/tests/Mocha.Core.Tests/WorkSetTests.cs @@ -1,6 +1,24 @@ +// Copyright (C) 2024 Michael Becker +// +// This file is part of Mocha.NET. +// +// Mocha.NET is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Mocha.NET is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Mocha.NET. If not, see . + using System.Xml.Serialization; using Mocha.Core.OmsImplementations.Mini; +using Mocha.Core.Oop; namespace Mocha.Core.Tests; @@ -19,7 +37,7 @@ public class WorkSetTests : OmsTestsBase InstanceHandle c_Class = Oms.GetInstance(KnownInstanceGuids.Classes.Class); InstanceHandle c_Attribute = Oms.GetInstance(KnownInstanceGuids.Classes.Class); - InstanceHandle workSet = Oms.CreateWorkSet("Dummy Work Set"); + WorkSet workSet = Oms.CreateWorkSet("Dummy Work Set"); OmsContext context = Oms.CreateContext(); Assert.That(delegate () @@ -35,7 +53,7 @@ public class WorkSetTests : OmsTestsBase InstanceHandle c_Class = Oms.GetInstance(KnownInstanceGuids.Classes.Class); InstanceHandle c_TextAttribute = Oms.GetInstance(KnownInstanceGuids.Classes.TextAttribute); - InstanceHandle workSet = Oms.CreateWorkSet("Dummy Work Set", true, new InstanceHandle[] + WorkSet workSet = Oms.CreateWorkSet("Dummy Work Set", true, new InstanceHandle[] { c_TextAttribute }); @@ -58,7 +76,7 @@ public class WorkSetTests : OmsTestsBase InstanceHandle a_Value = Oms.GetInstance(KnownAttributeGuids.Text.Value); InstanceHandle a_Singular = Oms.GetInstance(KnownAttributeGuids.Boolean.Singular); - InstanceHandle workSet = Oms.CreateWorkSet("Dummy Work Set", true, new InstanceHandle[] + WorkSet workSet = Oms.CreateWorkSet("Dummy Work Set", true, new InstanceHandle[] { c_TextAttribute, c_BooleanAttribute @@ -98,7 +116,7 @@ public class WorkSetTests : OmsTestsBase InstanceHandle a_Value = Oms.GetInstance(KnownAttributeGuids.Text.Value); InstanceHandle a_Singular = Oms.GetInstance(KnownAttributeGuids.Boolean.Singular); - InstanceHandle workSet = Oms.CreateWorkSet("Dummy Work Set", false, new InstanceHandle[] + WorkSet workSet = Oms.CreateWorkSet("Dummy Work Set", false, new InstanceHandle[] { c_TextAttribute, c_BooleanAttribute @@ -130,7 +148,7 @@ public class WorkSetTests : OmsTestsBase public void LiteralValueAssignedToWorkSet() { // no valid class constraints - we should be able to put anything in here - InstanceHandle workSet = Oms.CreateWorkSet("Dummy Work Set"); + WorkSet workSet = Oms.CreateWorkSet("Dummy Work Set"); OmsContext context = Oms.CreateContext(); Assert.That(delegate () diff --git a/web-framework-dotnet b/web-framework-dotnet index 21fa2c5..3569914 160000 --- a/web-framework-dotnet +++ b/web-framework-dotnet @@ -1 +1 @@ -Subproject commit 21fa2c5af0d4caf38b7acfed97c4e5e94038efa7 +Subproject commit 3569914d3f1dd85d92fc3ac7a8c9342bea287f88