begin working on CTs/BUIRs
This commit is contained in:
parent
6d4094da2a
commit
ecf3c1be1d
@ -0,0 +1,26 @@
|
||||
using System.Xml;
|
||||
using MBS.Core;
|
||||
using MBS.Web;
|
||||
using MBS.Web.UI;
|
||||
using MBS.Web.UI.HtmlControls;
|
||||
using MBS.Web.UI.WebControls;
|
||||
using Mocha.Core;
|
||||
using Mocha.ServerApplication.Controls;
|
||||
|
||||
namespace Mocha.ServerApplication.HardcodedPages;
|
||||
|
||||
public class TenantedRoutingPage : BaseWebPage
|
||||
{
|
||||
public InstanceHandle ProcessedByCT { get; }
|
||||
public TenantedRoutingPage(InstanceHandle processedByCT)
|
||||
{
|
||||
this.ProcessedByCT = processedByCT;
|
||||
}
|
||||
|
||||
protected override void RenderContents(XmlWriter writer)
|
||||
{
|
||||
base.RenderContents(writer);
|
||||
writer.WriteRaw(String.Format("<h1>Processed by CT: {0}</h1>", ((MochaWebApplication)Application.Instance).Oms.GetInstanceText(ProcessedByCT)));
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace Mocha.ServerApplication.HardcodedPages;
|
||||
|
||||
public class WelcomePage : BaseWebPage
|
||||
{
|
||||
protected override void CreateChildControls()
|
||||
protected override void CreateChildControls()
|
||||
{
|
||||
base.CreateChildControls();
|
||||
|
||||
|
||||
@ -142,14 +142,29 @@ public abstract class MochaWebApplication : WebApplication
|
||||
Console.WriteLine("cup: using tenanted WebRoutes");
|
||||
foreach (InstanceHandle route in routes)
|
||||
{
|
||||
|
||||
string targetUrl = Oms.GetAttributeValue<string>(route, Oms.GetInstance(KnownAttributeGuids.Text.TargetURL));
|
||||
InstanceHandle processedByCT = Oms.GetRelatedInstance(route, Oms.GetInstance(KnownRelationshipGuids.Route__processed_by__Control_Transaction_Method));
|
||||
e.Server.Routes.Add(new WebRoute(targetUrl, new TenantedRoutingPage(processedByCT)));
|
||||
}
|
||||
|
||||
// FIXME: hack
|
||||
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}/signup.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()));
|
||||
}
|
||||
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/welcome.htmld", new WelcomePage()));
|
||||
// e.Server.Routes.Add(new WebRoute("/{tenant}/d/welcome.htmld", new WelcomePage()));
|
||||
e.Server.Routes.Add(new WebRoute("/{tenant}/d/signup.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/signup.htmld")));
|
||||
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")));
|
||||
|
||||
@ -20,6 +20,8 @@ using MBS.Core;
|
||||
using MBS.Web;
|
||||
using Mocha.Core;
|
||||
using Mocha.Core.OmsImplementations.Mini;
|
||||
using Mocha.Core.Oop;
|
||||
using Mocha.Core.Oop.Methods;
|
||||
|
||||
namespace Mocha.ServerApplication;
|
||||
|
||||
@ -122,16 +124,28 @@ public class Program : MochaWebApplication
|
||||
InstanceHandle r_Element__has__Element_Content = oms.GetInstance(KnownRelationshipGuids.Element__has__Element_Content);
|
||||
InstanceHandle r_Element_Content__has__Instance = oms.GetInstance(KnownRelationshipGuids.Element_Content__has__Instance);
|
||||
|
||||
InstanceHandle ihElement = oms.CreateInstanceOf(c_Element);
|
||||
InstanceHandle ihElementContent = oms.CreateInstanceOf(c_ElementContent);
|
||||
oms.AssignRelationship(ihElementContent, r_Element_Content__has__Instance, a_AlerynnWelcome1);
|
||||
oms.AssignRelationship(ihElement, r_Element__has__Element_Content, ihElementContent);
|
||||
InstanceHandle el_AlerynnWelcome1 = oms.CreateInstanceOf(c_Element);
|
||||
InstanceHandle ec_AlerynnWelcome1 = oms.CreateInstanceOf(c_ElementContent);
|
||||
oms.AssignRelationship(ec_AlerynnWelcome1, r_Element_Content__has__Instance, a_AlerynnWelcome1);
|
||||
oms.AssignRelationship(el_AlerynnWelcome1, r_Element__has__Element_Content, ec_AlerynnWelcome1);
|
||||
|
||||
OmsMethodBuilder mb = new OmsMethodBuilder(oms);
|
||||
|
||||
BuildUIResponseMethod buir = mb.CreateBuildUIResponseMethod();
|
||||
BuildResponseMethodBinding brmb = buir.CreateMethodBinding();
|
||||
BuildUIResponseMethod buir = mb.CreateBuildUIResponseMethod(c_Tenant, String.Empty, "Welcome Page", AccessModifier.Public, true, el_AlerynnWelcome1);
|
||||
BuildResponseMethodBinding brmb = buir.CreateMethodBinding(oms);
|
||||
|
||||
ControlTransactionMethod ct = mb.CreateControlTransactionMethod(c_Tenant, String.Empty, "Welcome Page", AccessModifier.Public, true, el_AlerynnWelcome1, brmb);
|
||||
|
||||
InstanceHandle r_Route__processed_by__Control_Transaction_Method = oms.GetInstance(KnownRelationshipGuids.Route__processed_by__Control_Transaction_Method);
|
||||
|
||||
InstanceHandle a_TargetURL = oms.GetInstance(KnownAttributeGuids.Text.TargetURL);
|
||||
InstanceHandle c_Route = oms.GetInstance(KnownInstanceGuids.Classes.Route);
|
||||
|
||||
InstanceHandle route = oms.CreateInstanceOf(c_Route);
|
||||
|
||||
oms.SetAttributeValue(route, a_TargetURL, "/{tenant}/d/welcome.htmld");
|
||||
|
||||
oms.AssignRelationship(route, r_Route__processed_by__Control_Transaction_Method, ct.Handle);
|
||||
}
|
||||
return oms;
|
||||
}
|
||||
|
||||
@ -77,6 +77,8 @@ namespace Mocha.Core
|
||||
public static Guid MethodBinding { get; } = new Guid("{CB36098E-B9BF-4D22-87FA-4186EC632C89}");
|
||||
public static Guid ReturnAttributeMethodBinding { get; } = new Guid("{30FB6BA6-2BBB-41D2-B91A-709C00A07790}");
|
||||
public static Guid ReturnInstanceSetMethodBinding { get; } = new Guid("{AADC20F9-7559-429B-AEF0-97E059295C76}");
|
||||
public static Guid ReturnElementMethodBinding { get; } = new Guid("{f8944cc1-1306-4c60-8079-93448ca01fd0}");
|
||||
public static Guid BuildResponseMethodBinding { get; } = new Guid("{b457f34f-1f54-4cda-be03-2da48ec747ab}");
|
||||
|
||||
public static Guid Executable { get; } = new Guid("{6A1F66F7-8EA6-43D1-B2AF-198F63B84710}");
|
||||
public static Guid ExecutableReturningAttribute { get; } = new Guid("{50b2db7a-3623-4be4-b40d-98fab89d3ff5}");
|
||||
@ -227,7 +229,10 @@ namespace Mocha.Core
|
||||
// GSP - Get Instance Set from Parameters Method - 51
|
||||
// SA - Select Attribute Method - 52
|
||||
// PRU - Process Related Updates Method - 54
|
||||
// BUIR - Build UI Response Method - 62
|
||||
/// <summary>
|
||||
/// BUIR - Build UI Response Method [1$62]
|
||||
/// </summary>
|
||||
public static Guid BuildUIResponseMethod { get; } = new Guid("{b05bbf07-7a4f-4701-ae53-e7ecc60bd2c8}");
|
||||
// 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
|
||||
|
||||
@ -368,5 +368,16 @@ namespace Mocha.Core
|
||||
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}");
|
||||
|
||||
public static Guid Build_UI_Response_Method__uses__Executable_returning_Element { get; } = new Guid("{6f066ec6-b978-4627-81da-78fee1bed5e5}");
|
||||
public static Guid Executable_returning_Element__used_by__Build_UI_Response_Method { get; } = new Guid("{0e662556-ca79-43fe-9a50-57ad22df65de}");
|
||||
|
||||
public static Guid Control_Transaction_Method__processes__Element { get; } = new Guid("{24bc1dc0-d6cc-44ff-86ba-1360ebd59f3a}");
|
||||
public static Guid Element__processed_by__Control_Transaction_Method { get; } = new Guid("{0f182291-6784-47b3-a8d3-d2f6ebf3950c}");
|
||||
public static Guid Control_Transaction_Method__uses__Build_Response_Method_Binding { get; } = new Guid("{d8f2f0cc-54a2-4004-a383-8c1321495531}");
|
||||
public static Guid Build_Response_Method_Binding__used_by__Control_Transaction_Method { get; } = new Guid("{9b83d1f3-6569-4e98-9d88-765684abfd18}");
|
||||
|
||||
public static Guid Route__processed_by__Control_Transaction_Method { get; } = new Guid("{6b9ad17e-69a2-42bf-8197-5ab266c76cd1}");
|
||||
public static Guid Control_Transaction_Method__processes__Route { get; } = new Guid("{d1c3aa8a-0928-4c46-9aba-9a368b3dea5a}");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2024 Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
namespace Mocha.Core.MethodImplementations;
|
||||
|
||||
public class BuildUIResponseMethodImplementation : MethodImplementation
|
||||
{
|
||||
public override Guid MethodClassGuid => KnownInstanceGuids.MethodClasses.BuildUIResponseMethod;
|
||||
protected override InstanceHandle ExecuteInternal(Oms oms, OmsContext context, InstanceHandle method)
|
||||
{
|
||||
InstanceHandle irForClass = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Method__for__Class));
|
||||
InstanceHandle returnsElement = oms.GetRelatedInstance(method, oms.GetInstance(KnownRelationshipGuids.Build_UI_Response_Method__uses__Executable_returning_Element));
|
||||
|
||||
if (returnsElement == InstanceHandle.Empty)
|
||||
{
|
||||
throw new InvalidOperationException("no return Element specified for method");
|
||||
}
|
||||
|
||||
return returnsElement;
|
||||
}
|
||||
}
|
||||
@ -869,6 +869,8 @@ public abstract class Oms
|
||||
sb.Append(verb);
|
||||
sb.Append(' ');
|
||||
sb.Append(name);
|
||||
sb.Append('(');
|
||||
sb.Append(')');
|
||||
if (is_static)
|
||||
{
|
||||
sb.Append("*S");
|
||||
|
||||
@ -166,7 +166,7 @@ public class MiniOms : MemoryOms
|
||||
CreateClass("Work Data", KnownInstanceGuids.Classes.WorkData);
|
||||
c_OMS = CreateClass("OMS", KnownInstanceGuids.Classes.OMS);
|
||||
|
||||
InstanceHandle c_Tenant = CreateInstanceOf(c_Class, KnownInstanceGuids.Classes.Tenant);
|
||||
InstanceHandle c_Tenant = CreateClass("Tenant", KnownInstanceGuids.Classes.Tenant);
|
||||
CreateInstanceOf(c_Tenant);
|
||||
|
||||
c_CommonText = CreateClass("Common Text", KnownInstanceGuids.Classes.CommonText);
|
||||
|
||||
@ -32,17 +32,33 @@ public class MethodsModule : MiniOmsModule
|
||||
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_ReturnAttributeMethodBinding, c_ReturnInstanceSetMethodBinding, c_ReturnElementMethodBinding, c_BuildResponseMethodBinding;
|
||||
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_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, c_BuildUIResponseMethod, c_ControlTransactionMethod;
|
||||
private InstanceHandle c_ExecutableReturningAttribute, c_ExecutableReturningInstanceSet, c_ExecutableReturningElement, c_ExecutableReturningWorkData;
|
||||
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;
|
||||
private InstanceHandle c_Element, c_ElementContent;
|
||||
|
||||
protected override void BuildInternal(Oms oms)
|
||||
{
|
||||
c_Element = oms.CreateClass("Element", KnownInstanceGuids.Classes.Element);
|
||||
c_ElementContent = oms.CreateClass("Element Content", KnownInstanceGuids.Classes.ElementContent);
|
||||
oms.CreateRelationship(c_Element, "has", c_ElementContent, KnownRelationshipGuids.Element__has__Element_Content, false, "for", KnownRelationshipGuids.Element_Content__for__Element);
|
||||
oms.CreateRelationship(c_ElementContent, "has", c_Instance, KnownRelationshipGuids.Element_Content__has__Instance, true, "has", KnownRelationshipGuids.Instance__for__Element_Content);
|
||||
|
||||
c_ExecutableReturningAttribute = oms.CreateClass("Executable returning Attribute", KnownInstanceGuids.Classes.ExecutableReturningAttribute);
|
||||
c_ExecutableReturningInstanceSet = oms.CreateClass("Executable returning Instance Set", KnownInstanceGuids.Classes.ExecutableReturningInstanceSet);
|
||||
c_ExecutableReturningElement = oms.CreateClass("Executable returning Element", KnownInstanceGuids.Classes.ExecutableReturningElement);
|
||||
c_ExecutableReturningWorkData = oms.CreateClass("Executable returning Work Data", KnownInstanceGuids.Classes.ExecutableReturningWorkData);
|
||||
|
||||
oms.AddSuperClass(c_Attribute, c_ExecutableReturningAttribute);
|
||||
|
||||
c_WorkData = oms.GetInstance(KnownInstanceGuids.Classes.WorkData);
|
||||
oms.AddSuperClass(c_WorkData, c_ExecutableReturningWorkData);
|
||||
|
||||
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);
|
||||
@ -51,6 +67,9 @@ public class MethodsModule : MiniOmsModule
|
||||
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_ReturnElementMethodBinding = oms.CreateClass("Return Element Method Binding", KnownInstanceGuids.Classes.ReturnElementMethodBinding);
|
||||
c_BuildResponseMethodBinding = oms.CreateClass("Build Response Method Binding", KnownInstanceGuids.Classes.BuildResponseMethodBinding);
|
||||
// c_ReturnWorkDataMethodBinding = oms.CreateClass("Return Work Data Method Binding", KnownInstanceGuids.Classes.ReturnWorkDataMethodBinding);
|
||||
|
||||
c_AccumulationFunction = oms.CreateEnumeration(KnownInstanceGuids.Classes.AccumulationFunction, new Guid[]
|
||||
{
|
||||
@ -178,6 +197,15 @@ public class MethodsModule : MiniOmsModule
|
||||
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);
|
||||
|
||||
c_BuildUIResponseMethod = oms.CreateClass("BUIR - Build UI Response Method", KnownInstanceGuids.MethodClasses.BuildUIResponseMethod);
|
||||
oms.CreateRelationship(c_BuildUIResponseMethod, "uses", c_ExecutableReturningElement, KnownRelationshipGuids.Build_UI_Response_Method__uses__Executable_returning_Element, true, "used by", KnownRelationshipGuids.Executable_returning_Element__used_by__Build_UI_Response_Method);
|
||||
oms.AddSuperClass(c_BuildUIResponseMethod, c_Method);
|
||||
|
||||
c_ControlTransactionMethod = oms.CreateClass("CT - Control Transaction Method", KnownInstanceGuids.MethodClasses.ControlTransactionMethod);
|
||||
oms.CreateRelationship(c_ControlTransactionMethod, "processes", c_Element, KnownRelationshipGuids.Control_Transaction_Method__processes__Element, true, "processed by", KnownRelationshipGuids.Element__processed_by__Control_Transaction_Method);
|
||||
oms.CreateRelationship(c_ControlTransactionMethod, "uses", c_BuildResponseMethodBinding, KnownRelationshipGuids.Control_Transaction_Method__uses__Build_Response_Method_Binding, true, "used by", KnownRelationshipGuids.Build_Response_Method_Binding__used_by__Control_Transaction_Method);
|
||||
oms.AddSuperClass(c_ControlTransactionMethod, c_Method);
|
||||
|
||||
InstanceHandle c_BooleanOperator = oms.CreateClass("Boolean Operator", KnownInstanceGuids.Classes.BooleanOperator);
|
||||
InstanceHandle c_RelationalOperator = oms.CreateClass("Relational Operator", KnownInstanceGuids.Classes.RelationalOperator);
|
||||
|
||||
@ -261,8 +289,12 @@ public class MethodsModule : MiniOmsModule
|
||||
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));
|
||||
|
||||
BuildAttributeMethod Method__get__CT_Method_Suffix = mb.CreateBuildAttributeMethod(c_Method, "get", "CT Method Suffix", AccessModifier.Public, true, a_Value, "CT");
|
||||
EvaluateBooleanExpressionMethod Method__is__CT = mb.CreateEvaluateBooleanExpressionMethod(c_Method, "is", "CT", AccessModifier.Public, false, oms.GetInstance(KnownAttributeGuids.Boolean.MethodIsOfTypeSpecified), Instance__get__Parent_Class_rsmb.Handle, RelationalOperator.InSelectionList, oms.GetInstance(KnownInstanceGuids.MethodClasses.ControlTransactionMethod));
|
||||
|
||||
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__CT.CreateMethodBinding(oms) }, null, false, Method__get__CT_Method_Suffix.CreateMethodBinding(oms)),
|
||||
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))
|
||||
|
||||
@ -2,13 +2,13 @@ namespace Mocha.Core.OmsImplementations.Mini.Modules;
|
||||
|
||||
public class WebModule : MiniOmsModule
|
||||
{
|
||||
private InstanceHandle c_Route;
|
||||
private InstanceHandle c_Route, c_ControlTransactionMethod;
|
||||
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");
|
||||
oms.SetAttributeValue(rt, a_TargetURL, targetUrl);
|
||||
return rt;
|
||||
}
|
||||
|
||||
@ -19,7 +19,9 @@ public class WebModule : MiniOmsModule
|
||||
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);
|
||||
c_ControlTransactionMethod = oms.GetInstance(KnownInstanceGuids.MethodClasses.ControlTransactionMethod);
|
||||
|
||||
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
|
||||
|
||||
@ -25,7 +25,7 @@ namespace Mocha.Core;
|
||||
|
||||
public class OmsMethodBuilder
|
||||
{
|
||||
private InstanceHandle c_ReturnAttributeMethodBinding, c_ReturnInstanceSetMethodBinding;
|
||||
private InstanceHandle c_ReturnAttributeMethodBinding, c_ReturnInstanceSetMethodBinding, c_ReturnElementMethodBinding, c_BuildResponseMethodBinding;
|
||||
|
||||
public Oms Oms { get; }
|
||||
public OmsMethodBuilder(Oms oms)
|
||||
@ -34,21 +34,34 @@ public class OmsMethodBuilder
|
||||
|
||||
c_ReturnAttributeMethodBinding = Oms.GetInstance(KnownInstanceGuids.Classes.ReturnAttributeMethodBinding);
|
||||
c_ReturnInstanceSetMethodBinding = Oms.GetInstance(KnownInstanceGuids.Classes.ReturnInstanceSetMethodBinding);
|
||||
c_ReturnElementMethodBinding = Oms.GetInstance(KnownInstanceGuids.Classes.ReturnElementMethodBinding);
|
||||
c_BuildResponseMethodBinding = oms.GetInstance(KnownInstanceGuids.Classes.BuildResponseMethodBinding);
|
||||
}
|
||||
|
||||
public ReturnAttributeMethodBinding CreateReturnAttributeMethodBinding(Method method)
|
||||
public ReturnAttributeMethodBinding CreateReturnAttributeMethodBinding(MethodReturningAttribute method)
|
||||
{
|
||||
InstanceHandle methodBinding = Oms.CreateInstanceOf(c_ReturnAttributeMethodBinding);
|
||||
Oms.AssignRelationship(methodBinding, Oms.GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method), method.Handle);
|
||||
return new ReturnAttributeMethodBinding(methodBinding);
|
||||
}
|
||||
|
||||
public ReturnInstanceSetMethodBinding CreateReturnInstanceSetMethodBinding(Method method)
|
||||
public ReturnInstanceSetMethodBinding CreateReturnInstanceSetMethodBinding(MethodReturningInstanceSet method)
|
||||
{
|
||||
InstanceHandle methodBinding = Oms.CreateInstanceOf(c_ReturnInstanceSetMethodBinding);
|
||||
Oms.AssignRelationship(methodBinding, Oms.GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method), method.Handle);
|
||||
return new ReturnInstanceSetMethodBinding(methodBinding);
|
||||
}
|
||||
public ReturnElementMethodBinding CreateReturnElementMethodBinding(MethodReturningElement method)
|
||||
{
|
||||
InstanceHandle methodBinding = Oms.CreateInstanceOf(c_ReturnElementMethodBinding);
|
||||
Oms.AssignRelationship(methodBinding, Oms.GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method), method.Handle);
|
||||
return new ReturnElementMethodBinding(methodBinding);
|
||||
}
|
||||
public BuildResponseMethodBinding CreateBuildResponseMethodBinding(MethodBuildingResponse method)
|
||||
{
|
||||
InstanceHandle methodBinding = Oms.CreateInstanceOf(c_BuildResponseMethodBinding);
|
||||
Oms.AssignRelationship(methodBinding, Oms.GetInstance(KnownRelationshipGuids.Method_Binding__executes__Method), method.Handle);
|
||||
return new BuildResponseMethodBinding(methodBinding);
|
||||
}
|
||||
|
||||
public GetAttributeMethod CreateGetAttributeMethod(InstanceHandle forClassInstance, string verb, string name, InstanceHandle attributeInstance)
|
||||
{
|
||||
@ -291,4 +304,22 @@ public class OmsMethodBuilder
|
||||
|
||||
return new CalculateDateMethod(method);
|
||||
}
|
||||
|
||||
public BuildUIResponseMethod CreateBuildUIResponseMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle usesExecutableReturningElement)
|
||||
{
|
||||
InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.BuildUIResponseMethod), forClassInstance, verb, name, accessModifier, isStatic);
|
||||
InstanceHandle r_Build_UI_Response_Method__uses__Executable_returning_Element = Oms.GetInstance(KnownRelationshipGuids.Build_UI_Response_Method__uses__Executable_returning_Element);
|
||||
Oms.AssignRelationship(method, r_Build_UI_Response_Method__uses__Executable_returning_Element, usesExecutableReturningElement);
|
||||
return new BuildUIResponseMethod(method);
|
||||
}
|
||||
|
||||
public ControlTransactionMethod CreateControlTransactionMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle processesElement, BuildResponseMethodBinding usesBuildResponseMethodBinding)
|
||||
{
|
||||
InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.BuildUIResponseMethod), forClassInstance, verb, name, accessModifier, isStatic);
|
||||
InstanceHandle r_Control_Transaction_Method__processes__Element = Oms.GetInstance(KnownRelationshipGuids.Control_Transaction_Method__processes__Element);
|
||||
InstanceHandle r_Control_Transaction_Method__uses__Build_Response_Method_Binding = Oms.GetInstance(KnownRelationshipGuids.Control_Transaction_Method__uses__Build_Response_Method_Binding);
|
||||
Oms.AssignRelationship(method, r_Control_Transaction_Method__processes__Element, processesElement);
|
||||
Oms.AssignRelationship(method, r_Control_Transaction_Method__uses__Build_Response_Method_Binding, usesBuildResponseMethodBinding.Handle);
|
||||
return new ControlTransactionMethod(method);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2024 Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
namespace Mocha.Core.Oop;
|
||||
|
||||
public interface IExecutableReturningElement : IInstanceWrapper
|
||||
{
|
||||
|
||||
}
|
||||
@ -31,4 +31,14 @@ public class ReturnInstanceSetMethodBinding : MethodBinding, IExecutableReturnin
|
||||
{
|
||||
public override Guid ClassId => KnownInstanceGuids.Classes.ReturnInstanceSetMethodBinding;
|
||||
internal ReturnInstanceSetMethodBinding(InstanceHandle handle) : base(handle) { }
|
||||
}
|
||||
public class ReturnElementMethodBinding : MethodBinding, IExecutableReturningElement
|
||||
{
|
||||
public override Guid ClassId => KnownInstanceGuids.Classes.ReturnElementMethodBinding;
|
||||
internal ReturnElementMethodBinding(InstanceHandle handle) : base(handle) { }
|
||||
}
|
||||
public class BuildResponseMethodBinding : MethodBinding //, IExecutableBuildingResponse
|
||||
{
|
||||
public override Guid ClassId => KnownInstanceGuids.Classes.BuildResponseMethodBinding;
|
||||
internal BuildResponseMethodBinding(InstanceHandle handle) : base(handle) { }
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2024 Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
namespace Mocha.Core.Oop;
|
||||
|
||||
public abstract class MethodBuildingResponse : Method //, IExecutableReturningResponse
|
||||
{
|
||||
public MethodBuildingResponse(InstanceHandle handle) : base(handle) { }
|
||||
|
||||
public BuildResponseMethodBinding CreateMethodBinding(Oms oms, IEnumerable<KeyValuePair<InstanceHandle, object?>> parameterAssignments = null)
|
||||
{
|
||||
OmsMethodBuilder builder = new OmsMethodBuilder(oms);
|
||||
BuildResponseMethodBinding mb = builder.CreateBuildResponseMethodBinding(this);
|
||||
SetupMethodBinding(oms, mb, parameterAssignments);
|
||||
return mb;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2024 Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
namespace Mocha.Core.Oop;
|
||||
|
||||
public abstract class MethodReturningElement : Method, IExecutableReturningElement
|
||||
{
|
||||
public MethodReturningElement(InstanceHandle handle) : base(handle) { }
|
||||
|
||||
public ReturnElementMethodBinding CreateMethodBinding(Oms oms, IEnumerable<KeyValuePair<InstanceHandle, object?>> parameterAssignments = null)
|
||||
{
|
||||
OmsMethodBuilder builder = new OmsMethodBuilder(oms);
|
||||
ReturnElementMethodBinding mb = builder.CreateReturnElementMethodBinding(this);
|
||||
SetupMethodBinding(oms, mb, parameterAssignments);
|
||||
return mb;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
|
||||
namespace Mocha.Core.Oop.Methods;
|
||||
|
||||
public class BuildUIResponseMethod : MethodBuildingResponse
|
||||
{
|
||||
public BuildUIResponseMethod(InstanceHandle handle) : base(handle)
|
||||
{
|
||||
}
|
||||
|
||||
public override Guid ClassId => KnownInstanceGuids.MethodClasses.BuildUIResponseMethod;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2024 Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
namespace Mocha.Core.Oop.Methods;
|
||||
|
||||
public class ControlTransactionMethod : Method
|
||||
{
|
||||
public override Guid ClassId => KnownInstanceGuids.MethodClasses.ControlTransactionMethod;
|
||||
internal ControlTransactionMethod(InstanceHandle handle) : base(handle) { }
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user