From 306bd49cd44272b19399644facb78b6397e3a6a1 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sun, 10 Dec 2023 23:37:11 -0500 Subject: [PATCH] we can log in now, yay --- .../internal/librarymanager/LibraryManager.py | 54 +-- .../libraryparser/YAMLLibraryParser.py | 143 +++++-- .../operations/AssignRelationshipOperation.py | 21 ++ .../operations/PrepareInstanceOperation.py | 41 +- common/admin/mocha-libexec/mocha-oms | 127 ++++++- common/admin/mocha-libexec/mocha-up | 3 +- .../000-EntityDefinitions/001-Classes.yaml | 4 +- .../000-EntityDefinitions/002-Attributes.yaml | 4 + .../003-Relationships.yaml | 14 +- .../000-EntityDefinitions/004-Instances.yaml | 14 +- .../005-MethodClasses.yaml | 0 .../000-EntityDefinitions/006-Methods.yaml | 0 .../007-TaskClasses.yaml | 0 .../000-EntityDefinitions/008-Elements.yaml | 1 + .../009-MethodBindings.yaml | 4 + .../010-SystemInstanceSetRoutines.yaml | 2 + .../003-Classes/00001-Class.yaml | 0 .../003-Classes/00002-Attribute.yaml | 0 .../003-Classes/00003-Relationship.yaml | 0 .../003-Classes/00004-TextAttribute.yaml | 74 ++++ .../003-Classes/00005-BooleanAttribute.yaml | 0 .../003-Classes/00006-Element.yaml | 47 +++ .../003-Classes/00007-InstanceSet.yaml | 0 .../00008-ControlTransactionMethod.yaml | 0 .../003-Classes/00009-OMS.yaml | 0 .../003-Classes/00010-Method.yaml | 0 .../003-Classes/00012-GetAttributeMethod.yaml | 0 .../00023-AssignRelationshipMethod.yaml | 0 ...00024-EvaluateBooleanExpressionMethod.yaml | 0 .../003-Classes/00027-MethodBinding.yaml | 29 ++ .../00030-BuildAttributeMethod.yaml | 32 ++ .../003-Classes/00039-SystemUser.yaml | 2 +- .../003-Classes/00056-ElementContent.yaml | 32 ++ .../003-Classes/00057-Module.yaml | 15 + .../003-Classes/00058-CommonNumeric.yaml | 0 ...5-GetInstanceSetBySystemRoutineMethod.yaml | 27 ++ .../00069-SystemInstanceSetRoutine.yaml | 6 + .../00087-ReturnInstanceSetMethodBinding.yaml | 14 + .../00116-ECDynamicDisplayOption.yaml | 46 +++ .../003-Classes/00234-Language.yaml | 29 ++ .../003-Classes/00361-Tenant.yaml | 10 + .../003-Classes/02993-Task.yaml | 0 .../003-Classes/02997-SequenceTask.yaml | 0 ...13038-ConditionalSelectAttibuteMethod.yaml | 32 ++ ...an or equal to Nth of this same month.yaml | 0 ... Date And Time parm to 'Nth of month'.yaml | 0 .../Translation@get Translation Value.yaml | 0 ...em_User__get__User_for_User_Name_parm.yaml | 7 + .../Elements/113859-HomePage.yaml | 17 + .../005-UserInterface/Elements/LoginPage.yaml | 16 + .../Elements/LoginPageSubedit.yaml | 38 ++ .../005-UserInterface/Tasks/ViewElement.yaml | 0 .../009-Users/zq-developer.yaml | 0 .../003-Classes/00004-TextAttribute.yaml | 26 -- .../003-Classes/00006-Element.yaml | 14 - .../003-Classes/00056-ElementContent.yaml | 18 - .../005-UserInterface/Elements/LoginPage.yaml | 7 - .../Elements/LoginPageSubedit.yaml | 15 - .../yaml/net.alcetech.Mocha.System@current | 1 - .../000-EntityDefinitions/001-Classes.yaml | 3 + .../000-EntityDefinitions/002-Attributes.yaml | 2 + .../003-Relationships.yaml | 7 + .../003-Classes/00434-Route.yaml | 66 ++++ .../MochaXML/MochaXMLDataFormat.cs | 7 - php/mocha-ccx/ui/masterPages/Blank.phpx.php | 2 +- php/mocha/index.php | 1 + .../lib/mocha/core/InstanceReference.inc.php | 33 +- .../mocha/core/KnownAttributeGuids.inc.php | 1 + .../lib/mocha/core/KnownInstanceGuids.inc.php | 5 + .../core/KnownMethodBindingGuids.inc.php | 13 + .../mocha/core/KnownRelationshipGuids.inc.php | 10 +- php/mocha/lib/mocha/core/OmsContext.inc.php | 53 +++ .../lib/mocha/oms/MySQLDatabaseOms.inc.php | 21 +- php/mocha/lib/mocha/oms/Oms.inc.php | 41 ++ php/mocha/lib/mocha/oop/Method.inc.php | 46 +++ php/mocha/lib/mocha/oop/MethodBinding.inc.php | 36 ++ ...etInstanceSetBySystemRoutineMethod.inc.php | 47 +++ php/mocha/lib/mocha/system.inc.php | 17 +- .../mocha/ui/renderers/HTMLRenderer.inc.php | 357 ++++++++++++++++++ php/mocha/themes/clearview/uwt-formview.less | 5 +- .../themes/clearview/{main.less => uwt.less} | 0 .../themes/common/styles/mochahacks.less | 24 ++ php/mocha/ui/pages/HomePage.phpx | 3 +- php/mocha/ui/pages/HomePage.phpx.php | 40 +- php/mocha/ui/pages/LoginPage.phpx.php | 37 +- ...ocha_get_instance_by_global_identifier.sql | 2 +- .../000-functions/mocha_get_instance_key.sql | 14 + ...ocha_get_instance_by_global_identifier.sql | 1 + .../mocha_get_related_instances.sql | 2 +- .../001-procedures/mocha_prepare_instance.sql | 78 ++++ 90 files changed, 1731 insertions(+), 229 deletions(-) create mode 100644 common/admin/mocha-libexec/internal/librarymanager/operations/AssignRelationshipOperation.py rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/000-EntityDefinitions/001-Classes.yaml (97%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/000-EntityDefinitions/002-Attributes.yaml (91%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/000-EntityDefinitions/003-Relationships.yaml (95%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/000-EntityDefinitions/004-Instances.yaml (60%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/000-EntityDefinitions/005-MethodClasses.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/000-EntityDefinitions/006-Methods.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/000-EntityDefinitions/007-TaskClasses.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/000-EntityDefinitions/008-Elements.yaml (71%) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/009-MethodBindings.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/010-SystemInstanceSetRoutines.yaml rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00001-Class.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00002-Attribute.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00003-Relationship.yaml (100%) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00004-TextAttribute.yaml rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00005-BooleanAttribute.yaml (100%) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00006-Element.yaml rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00007-InstanceSet.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00008-ControlTransactionMethod.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00009-OMS.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00010-Method.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00012-GetAttributeMethod.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00023-AssignRelationshipMethod.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00024-EvaluateBooleanExpressionMethod.yaml (100%) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00027-MethodBinding.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00030-BuildAttributeMethod.yaml rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00039-SystemUser.yaml (97%) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00056-ElementContent.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00057-Module.yaml rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/00058-CommonNumeric.yaml (100%) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00065-GetInstanceSetBySystemRoutineMethod.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00069-SystemInstanceSetRoutine.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00087-ReturnInstanceSetMethodBinding.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00116-ECDynamicDisplayOption.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00234-Language.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00361-Tenant.yaml rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/02993-Task.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/003-Classes/02997-SequenceTask.yaml (100%) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/13038-ConditionalSelectAttibuteMethod.yaml rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/004-Methods/Common Boolean@is Date And Time parm less than or equal to Nth of this same month.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/004-Methods/Date And Time Adjustment@adjust Date And Time parm to 'Nth of month'.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/004-Methods/Translation@get Translation Value.yaml (100%) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_for_User_Name_parm.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/113859-HomePage.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/LoginPage.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/LoginPageSubedit.yaml rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/005-UserInterface/Tasks/ViewElement.yaml (100%) rename common/libraries/yaml/{net.alcetech.Mocha.System@20231121T2131-0500 => net.alcetech.Mocha.System}/009-Users/zq-developer.yaml (100%) delete mode 100644 common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00004-TextAttribute.yaml delete mode 100644 common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00006-Element.yaml delete mode 100644 common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00056-ElementContent.yaml delete mode 100644 common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Elements/LoginPage.yaml delete mode 100644 common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Elements/LoginPageSubedit.yaml delete mode 120000 common/libraries/yaml/net.alcetech.Mocha.System@current create mode 100644 common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/001-Classes.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/002-Attributes.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/003-Relationships.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.Web/003-Classes/00434-Route.yaml create mode 100644 php/mocha/lib/mocha/core/KnownMethodBindingGuids.inc.php create mode 100644 php/mocha/lib/mocha/core/OmsContext.inc.php create mode 100644 php/mocha/lib/mocha/oop/Method.inc.php create mode 100644 php/mocha/lib/mocha/oop/MethodBinding.inc.php create mode 100644 php/mocha/lib/mocha/oop/methods/GetInstanceSetBySystemRoutineMethod.inc.php create mode 100644 php/mocha/lib/mocha/ui/renderers/HTMLRenderer.inc.php rename php/mocha/themes/clearview/{main.less => uwt.less} (100%) create mode 100644 sql/mysql/000-functions/mocha_get_instance_key.sql create mode 100644 sql/mysql/001-procedures/mocha_prepare_instance.sql diff --git a/common/admin/mocha-libexec/internal/librarymanager/LibraryManager.py b/common/admin/mocha-libexec/internal/librarymanager/LibraryManager.py index cdf39cc..0a2c8a9 100644 --- a/common/admin/mocha-libexec/internal/librarymanager/LibraryManager.py +++ b/common/admin/mocha-libexec/internal/librarymanager/LibraryManager.py @@ -4,6 +4,7 @@ from .libraryparser import XMLLibraryParser, JSONLibraryParser, YAMLLibraryParse from .LibraryOperation import LibraryOperation from .operations.AssignAttributeOperation import AssignAttributeOperation +from .operations.AssignRelationshipOperation import AssignRelationshipOperation from .operations.CreateClassOperation import CreateClassOperation from .operations.CreateInstanceOperation import CreateInstanceOperation from .operations.PrepareInstanceOperation import PrepareInstanceOperation @@ -18,6 +19,7 @@ class MochaLibraryManager: self.db = None self._instances = [] self._operations = [] + self._relOps = [] def connect(self, hostname, database, username, password): self.db = MySQLdb.connect(host=hostname, user=username, passwd=password, db=database) @@ -29,37 +31,39 @@ class MochaLibraryManager: for op in self._operations: op.execute(self.db) + for op in self._relOps: + op.execute(self.db) cur = self.db.cursor() cur.execute("SELECT * FROM mocha_instances") rows = cur.fetchall() # print(rows) - print ("ok , applying `Class.has Instance`...") + # print ("ok , applying `Class.has Instance`...") - for row in rows: - print(row) - id = row[0] - tenant_id = row[1] - class_id = row[2] - inst_id = row[3] - global_identifier = row[4] + # for row in rows: + # print(row) + # id = row[0] + # tenant_id = row[1] + # class_id = row[2] + # inst_id = row[3] + # global_identifier = row[4] - if class_id is not None and id is not None: + # if class_id is not None and id is not None: - # Class.has Instance - query2 = ("CALL mocha_assign_relationship (" + - "mocha_get_instance_by_key(1, " + str(class_id) + "), " + - "mocha_get_instance_by_global_identifier(mocha_normalize_uuid('7EB41D3C-2AE9-4884-83A4-E59441BCAEFB'))" + ", " + - str(id) + ", NULL, NULL)") - cur.execute(query2) + # # Class.has Instance + # query2 = ("CALL mocha_assign_relationship (" + + # "mocha_get_instance_by_key(1, " + str(class_id) + "), " + + # "mocha_get_instance_by_global_identifier(mocha_normalize_uuid('7EB41D3C-2AE9-4884-83A4-E59441BCAEFB'))" + ", " + + # str(id) + ", NULL, NULL)") + # cur.execute(query2) - # Instance.for Class - query3 = ("CALL mocha_assign_relationship (" + - str(id) + ", " + - "mocha_get_instance_by_global_identifier(mocha_normalize_uuid('494D5A6D-04BE-477B-8763-E3F57D0DD8C8'))" + ", " + - "mocha_get_instance_by_key(1, " + str(class_id) + "), NULL, NULL)") - cur.execute(query3) + # # Instance.for Class + # query3 = ("CALL mocha_assign_relationship (" + + # str(id) + ", " + + # "mocha_get_instance_by_global_identifier(mocha_normalize_uuid('494D5A6D-04BE-477B-8763-E3F57D0DD8C8'))" + ", " + + # "mocha_get_instance_by_key(1, " + str(class_id) + "), NULL, NULL)") + # cur.execute(query3) self.db.commit() @@ -102,7 +106,8 @@ class MochaLibraryManager: pass def create_instance_of(self, classGlobalId : Guid, instanceGlobalId : Guid, classIndex : int, instanceIndex : int): - self._operations.append(CreateInstanceOperation(instanceGlobalId, classIndex, instanceIndex)) + pass + #self._operations.append(CreateInstanceOperation(instanceGlobalId, classIndex, instanceIndex)) # cur = self.db.cursor() # strInstanceGlobalId = "NULL" @@ -116,6 +121,7 @@ class MochaLibraryManager: def assign_relationship(self, instanceId : Guid, relationshipInstanceId : Guid, targetInstanceId : Guid): print("-- assigning relationship " + relationshipInstanceId.get_value() + " = '" + targetInstanceId.get_value() + "'") + self._relOps.append(AssignRelationshipOperation(instanceId, relationshipInstanceId, targetInstanceId)) # self._operations.append(AssignRelationshipOperation(instanceId, relationshipInstanceId, targetInstanceId)) # query = "CALL mocha_assign_relationship(mocha_get_instance_by_global_identifier(mocha_normalize_uuid('" + instanceId.get_value() + "')), mocha_get_instance_by_global_identifier(mocha_normalize_uuid('" + relationshipInstanceId.get_value() + "')), mocha_get_instance_by_global_identifier(mocha_normalize_uuid('" + targetInstanceId.get_value() + "')), NULL, NULL);" # print(query) @@ -148,11 +154,15 @@ class MochaLibraryManager: print ("no files found ; does the path exist?") return 3 + # first, load the entity defs for yaml_file in yaml_files: yl.load_entity_definitions_from_file(yaml_file) + + # then, load instance definitions (also loads sugar elements into memory for later use) for yaml_file in yaml_files: yl.load_instances_from_file(yaml_file) + # finally, apply syntactic sugar yl.apply_sugar() def register_entity_reference(self, name, value): diff --git a/common/admin/mocha-libexec/internal/librarymanager/libraryparser/YAMLLibraryParser.py b/common/admin/mocha-libexec/internal/librarymanager/libraryparser/YAMLLibraryParser.py index bbbc6c4..3542924 100644 --- a/common/admin/mocha-libexec/internal/librarymanager/libraryparser/YAMLLibraryParser.py +++ b/common/admin/mocha-libexec/internal/librarymanager/libraryparser/YAMLLibraryParser.py @@ -18,7 +18,9 @@ class YAMLLibraryParser (LibraryParser): def apply_sugar(self): print("applying syntactic sugar to remaining instances...") for inst in self._instances_awaiting_sugar: + print("applying sugar from '" + inst["from_file_name"] + "'") self.load_instance(inst) + print("\n") def load_sugar_from_file(self, filename): print("loading sugar from " + filename) @@ -35,6 +37,20 @@ class YAMLLibraryParser (LibraryParser): pass + def find_custom_tag_name(self, elem) -> (str, Guid): + # return tuple (tagname, value) + if "instance" in elem: + return ("instance", Guid(self.manager.expand_entity_references(elem["instance"]))) + + for key in self.yamlIds: + if key in elem: + k = str(key) + v = Guid(self.manager.expand_entity_references(elem[key])) + return (k, v) + + return (None, None) + + def load_entity_definitions_from_file(self, filename): print("loading entity defs from " + filename) @@ -50,24 +66,8 @@ class YAMLLibraryParser (LibraryParser): self.manager.register_entity_reference(key, entity[key]) def load_instance_with_template(self, elem, template): - parentInstanceId = None - if "instance" in template: - parentInstanceId = self.manager.expand_entity_references(template["instance"]) - else: - for key in self.yamlIds: - if key in template: - parentInstanceId = self.manager.expand_entity_references(template[key]) - break - - if "instance" in elem: - instanceId = Guid(self.manager.expand_entity_references(elem["instance"])) - creatorKey = 'instance' - else: - for key in self.yamlIds: - if key in elem: - instanceId = Guid(self.manager.expand_entity_references(elem[key])) - creatorKey = key - break + (parentCreatorKey, parentInstanceId) = self.find_custom_tag_name(template) + (creatorKey, instanceId) = self.find_custom_tag_name(elem) if "attributes" in template: attrs = template["attributes"] @@ -86,9 +86,61 @@ class YAMLLibraryParser (LibraryParser): if "customTagName" in rel: customTagName = rel["customTagName"] if customTagName in elem: - relinst = Guid(self.manager.expand_entity_references(rel["instance"])) - relval = Guid(self.manager.expand_entity_references(elem[customTagName])) - self.manager.assign_relationship(instanceId, relinst, relval) + relationshipValue = elem[customTagName] + + if isinstance(relationshipValue, list): + # multiple instances + for v in relationshipValue: + #FIXME: this 'instance' isn't always the tag name, this can be subject to customTagName as well!and should be processed accordingly + (relinst_key, relinst_iid) = self.find_custom_tag_name(v) + if relinst_key is not None: + # for example, 'relinst_key' is 'elementContent' and 'relinst_iid' is '{8ECA14A4...}' + + if "instance" in rel: + rel_iid = rel["instance"] # the globalId of the relationship instance + + print("found customTagName '" + str(relinst_key) + "' with value '" + str(relinst_iid.get_value()) + "'") + + # relval = Guid(self.manager.expand_entity_references(elem[customTagName])) + # we need to create the new instance and assign relationship + self.manager.assign_relationship(instanceId, Guid(self.manager.expand_entity_references(rel_iid)), relinst_iid) + else: + print("no relationship instance specified for relationship sugar") + + else: + # single instance, this should be a GUID or entityref + # we should only need to refer to existing instance in this case + relationshipValueInst = Guid(self.manager.expand_entity_references(relationshipValue)) + if "instance" in rel: + self.manager.assign_relationship(instanceId, Guid(self.manager.expand_entity_references(rel["instance"])), relationshipValueInst) + else: + print("no relationship instance specified for relationship sugar") + + + + + + + + + + + + + + def get_instance_sugar_for_elem(self, elem): + if "instance" in elem: + return (elem["instance"], "instance", None) + else: + for key in self.yamlIds: + # no 'instance', see if we + if key in elem: + template = self.yamlIds[key] + templateKey = key + return (elem[templateKey], templateKey, template) + + return (None, None, None) # should never get here + def load_instance(self, elem, elemParent = None): # 'class' and 'relationship' are both at the 'same level' @@ -99,24 +151,25 @@ class YAMLLibraryParser (LibraryParser): # for now, let's just forward define important classes (e.g. IDC_Relationship) + + # all of these problems could be avoided by simply + # LOADING EVERYTHING INTO MEMORY (like the .NET version does) + # and only committing to the DB at the very end + # this will resolve problems where we can't find instances, or use syntactic sugar + + (globalIdentifier, templateKey, template) = self.get_instance_sugar_for_elem(elem) + print ("globalIdentifier = " + str(globalIdentifier) + ", templateKey = " + str(templateKey)) + + if template is None: + # no sugar + pass + customTagName = None if "customTagName" in elem: customTagName = elem["customTagName"] self.yamlIds[customTagName] = elem print("registering customTagName '" + customTagName + "'") - template = None - templateKey = None - - if not "instance" in elem: - for key in self.yamlIds: - #print(elem) - if key != "instance" and key in elem: - template = self.yamlIds[key] - templateKey = key - #print("got template " + key) - break - classId = None classIndex = None @@ -162,19 +215,32 @@ class YAMLLibraryParser (LibraryParser): if creatorKey == 'class': print("creating class " + instanceId.get_value()) + + # assign relationship `Instance.for Class` + self.manager.assign_relationship(instanceId, Guid('494D5A6D04BE477B8763E3F57D0DD8C8'), Guid('B9C9B9B7AD8A4CBDAA6BE05784630B6B')) + + # assign relationship `Class.has Instance` + self.manager.assign_relationship(Guid('B9C9B9B7AD8A4CBDAA6BE05784630B6B'), Guid('7EB41D3C2AE9488483A4E59441BCAEFB'), instanceId) + if "instances" in elem: classInsts = elem["instances"] for inst in classInsts: self.load_instance(inst, elem) - self.manager.create_class(instanceId, index) else: print("creating instance " + instanceId.get_value() + " (of class " + classId.get_value() + ")") - self.manager.create_instance_of(classId, instanceId, classIndex, index) + + # assign relationship `Instance.for Class` + self.manager.assign_relationship(instanceId, Guid('494D5A6D04BE477B8763E3F57D0DD8C8'), classId) + + # assign relationship `Class.has Instance` + self.manager.assign_relationship(classId, Guid('7EB41D3C2AE9488483A4E59441BCAEFB'), instanceId) + + # self.manager.create_instance_of(classId, instanceId, classIndex, index) if templateKey is not None: if template is not None: - #print("using template (" + templateKey + ")") + print("using template (" + templateKey + ")") #print(template) self.load_instance_with_template(elem, template) @@ -190,7 +256,12 @@ class YAMLLibraryParser (LibraryParser): content = yaml.safe_load_all(file) for doc in content: for elem in doc: + if "entityDefinitions" in elem: + continue if "instance" in elem: + # this is an instance definition (no sugar), so just load it self.load_instance(elem) else: + # this is a syntactic sugar definition, so store it for later use + elem["from_file_name"] = filename self._instances_awaiting_sugar.append(elem) \ No newline at end of file diff --git a/common/admin/mocha-libexec/internal/librarymanager/operations/AssignRelationshipOperation.py b/common/admin/mocha-libexec/internal/librarymanager/operations/AssignRelationshipOperation.py new file mode 100644 index 0000000..ee88ca3 --- /dev/null +++ b/common/admin/mocha-libexec/internal/librarymanager/operations/AssignRelationshipOperation.py @@ -0,0 +1,21 @@ +from .StoredProcedureOperation import StoredProcedureOperation +from ..Guid import Guid +from ..SQLParameter import SQLParameter +from ..SQLFunctionCall import SQLFunctionCall + +class AssignRelationshipOperation(StoredProcedureOperation): + + def __init__(self, instanceId : Guid, relationshipInstanceId : Guid, targetInstanceId : Guid): + self.instanceId = instanceId + self.relationshipInstanceId = relationshipInstanceId + self.targetInstanceId = targetInstanceId + + def get_sp_name(self): + return "mocha_assign_relationship" + + def get_sp_parameters(self): + return [ SQLFunctionCall('mocha_get_instance_by_global_identifier', [ self.instanceId ]), SQLFunctionCall('mocha_get_instance_by_global_identifier', [ self.relationshipInstanceId ]), SQLFunctionCall('mocha_get_instance_by_global_identifier', [ self.targetInstanceId ]), None, None ] + #query = "CALL mocha_set_attribute_value(mocha_get_instance_by_global_identifier(mocha_normalize_uuid('" + instanceId.get_value() + "')), mocha_get_instance_by_global_identifier(mocha_normalize_uuid('" + attributeInstanceId.get_value() + "')), '" + str(value) + "', NULL, NULL);" + #print(query) + #cur.execute(query) + #self.print_error(cur) \ No newline at end of file diff --git a/common/admin/mocha-libexec/internal/librarymanager/operations/PrepareInstanceOperation.py b/common/admin/mocha-libexec/internal/librarymanager/operations/PrepareInstanceOperation.py index b9163cf..c6d0c36 100644 --- a/common/admin/mocha-libexec/internal/librarymanager/operations/PrepareInstanceOperation.py +++ b/common/admin/mocha-libexec/internal/librarymanager/operations/PrepareInstanceOperation.py @@ -1,34 +1,33 @@ -from ..LibraryOperation import LibraryOperation +from .StoredProcedureOperation import StoredProcedureOperation from ..Guid import Guid from ..SQLParameter import SQLParameter from ..SQLFunctionCall import SQLFunctionCall -class PrepareInstanceOperation(LibraryOperation): +class PrepareInstanceOperation(StoredProcedureOperation): def __init__(self, globalIdentifier : Guid, classIndex : int, instanceIndex : int): self.globalIdentifier = globalIdentifier self.classIndex = classIndex self.instanceIndex = instanceIndex - def build_query(self): - globalId = "NULL" - if self.globalIdentifier is not None: - globalId = "mocha_normalize_uuid('" + self.globalIdentifier.get_value() + "')" - - strCid = "NULL" - if self.classIndex is not None: - strCid = str(self.classIndex) - else: - strCid = "1" - - strIid = "NULL" - if self.instanceIndex is not None: - strIid = str(self.instanceIndex) - - return "INSERT INTO mocha_instances (tenant_id, class_id, inst_id, global_identifier) VALUES (1, " + strCid + ", " + strIid + ", " + globalId + ")" - def get_sp_name(self): - return 'mocha_create_instance' + return "mocha_prepare_instance" def get_sp_parameters(self): - return [ self.globalIdentifier, self.classIndex, self.instanceIndex, None, None, SQLParameter('assigned_inst_id') ] + parms = [] + + globalId = None + if self.globalIdentifier is not None: + globalId = self.globalIdentifier + + strCid = None + if self.classIndex is not None: + strCid = self.classIndex + else: + strCid = 1 + + strIid = None + if self.instanceIndex is not None: + strIid = self.instanceIndex + + return [strCid, strIid, globalId, None, None, SQLParameter("p_assigned_inst_id")] diff --git a/common/admin/mocha-libexec/mocha-oms b/common/admin/mocha-libexec/mocha-oms index 6b2de65..c9ad947 100755 --- a/common/admin/mocha-libexec/mocha-oms +++ b/common/admin/mocha-libexec/mocha-oms @@ -192,7 +192,7 @@ elif [ "$1" == "instance" ]; then # usage: mocha oms instance list attributes INSTID if [ "$3" == "" ]; then - $MOCHA_MYSQL -e "SELECT * FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT')" + $MOCHA_MYSQL -e "SELECT id, tenant_id, CONCAT(class_id, '$', inst_id) AS inst_key, global_identifier FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT')" elif [ "$3" == "attributes" ]; then @@ -208,7 +208,128 @@ elif [ "$1" == "instance" ]; then ATT_INST_ID_CID=${ATT_INST_ID%\$*} ATT_INST_ID_IID=${ATT_INST_ID#*\$} - $MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "SELECT * FROM mocha_attributes WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND src_inst_id = mocha_get_instance_by_key($ATT_INST_ID_CID, $ATT_INST_ID_IID);" + $MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "SELECT * FROM mocha_attributes WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND src_inst_id = mocha_get_instance_by_key($ATT_INST_ID_CID, $ATT_INST_ID_IID);" -e "CALL mocha_release_tenant();" + + fi + + elif [ "$2" == "get" ]; then + + if [ "$3" == "by-gid" ]; then + + # thanks https://stackoverflow.com/a/911213 + if [ -t 1 ]; then + + $MOCHA_MYSQL -e "SELECT * FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND global_identifier = mocha_normalize_uuid('$4');" + + else + + $MOCHA_MYSQL -N -e "SELECT id FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND global_identifier = mocha_normalize_uuid('$4');" + + fi + + elif [ "$3" == "by-iid" ]; then + + # thanks https://stackoverflow.com/a/10520718 + INST_ID=$4 + INST_ID_CID=${INST_ID%\$*} + INST_ID_IID=${INST_ID#*\$} + + # thanks https://stackoverflow.com/a/911213 + if [ -t 1 ]; then + + $MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "SELECT * FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND class_id = $INST_ID_CID AND inst_id = $INST_ID_IID;" -e "CALL mocha_release_tenant();" + + else + + $MOCHA_MYSQL -N -e "SELECT id FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND class_id = $INST_ID_CID AND inst_id = $INST_ID_IID;" + + fi + fi + + fi + + +elif [ "$1" == "attribute" ]; then + + if [ "$2" == "list" ]; then + + REL_COLUMNS="id, tenant_id, mocha_get_instance_key(src_inst_id) AS source_inst, mocha_get_instance_key(att_inst_id) AS attribute_inst, att_value, mocha_get_instance_key(usr_inst_id) AS user_inst, att_effective_date" + + # usage: mocha oms instance list attributes INSTID + if [ "$3" == "" ]; then + + $MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "SELECT $REL_COLUMNS FROM mocha_attributes WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT');" -e "CALL mocha_release_tenant();" + + elif [ "$3" == "for" ]; then + + if [ "$4" == "" ]; then + + echo "usage: mocha oms relationship list for INSTID" + exit + + fi + + $MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "SELECT $REL_COLUMNS FROM mocha_attributes WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND src_inst_id = $4;" -e "CALL mocha_release_tenant();" + + fi + + elif [ "$2" == "get" ]; then + + if [ "$3" == "by-gid" ]; then + + # thanks https://stackoverflow.com/a/911213 + if [ -t 1 ]; then + + $MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "SELECT * FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND global_identifier = mocha_normalize_uuid('$4');" -e "CALL mocha_release_tenant();" + + else + + $MOCHA_MYSQL -N -e "SELECT id FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND global_identifier = mocha_normalize_uuid('$4');" + + fi + fi + + fi + + +elif [ "$1" == "relationship" ]; then + + if [ "$2" == "list" ]; then + + REL_COLUMNS="id, tenant_id, mocha_get_instance_key(source_inst_id) AS source_inst, mocha_get_instance_key(relationship_inst_id) AS relationship_inst, mocha_get_instance_key(destination_inst_id) AS destination_inst, mocha_get_instance_key(user_inst_id) AS user_inst, effective_date" + + # usage: mocha oms instance list attributes INSTID + if [ "$3" == "" ]; then + + $MOCHA_MYSQL -e "SELECT $REL_COLUMNS FROM mocha_relationships WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT')" + + elif [ "$3" == "for" ]; then + + if [ "$4" == "" ]; then + + echo "usage: mocha oms relationship list for INSTID" + exit + + fi + + $MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "SELECT $REL_COLUMNS FROM mocha_relationships WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND source_inst_id = $4;" -e "CALL mocha_release_tenant();" + + fi + + elif [ "$2" == "get" ]; then + + if [ "$3" == "by-gid" ]; then + + # thanks https://stackoverflow.com/a/911213 + if [ -t 1 ]; then + + $MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "SELECT * FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND global_identifier = mocha_normalize_uuid('$4');" -e "CALL mocha_release_tenant();" + + else + + $MOCHA_MYSQL -N -e "SELECT id FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND global_identifier = mocha_normalize_uuid('$4');" + + fi fi @@ -216,7 +337,7 @@ elif [ "$1" == "instance" ]; then else - echo "usage: mocha oms tenant|user" + echo "usage: mocha oms tenant|user|instance|attribute|relationship" fi diff --git a/common/admin/mocha-libexec/mocha-up b/common/admin/mocha-libexec/mocha-up index a56c48a..7ec8195 100755 --- a/common/admin/mocha-libexec/mocha-up +++ b/common/admin/mocha-libexec/mocha-up @@ -37,7 +37,8 @@ else mysql -e "CREATE DATABASE $MOCHA_DB_DATABASENAME; CREATE USER $MOCHA_DB_USERNAME IDENTIFIED BY '$MOCHA_DB_PASSWORD'; GRANT ALL ON $MOCHA_DB_DATABASENAME.* TO '$MOCHA_DB_USERNAME'@'%';" # install mocha using the `mocha oms` command - mocha oms install library /usr/share/mocha/libraries/net.alcetech.Mocha.System@current + mocha oms install + mocha oms install library /usr/share/mocha/libraries mocha oms tenant select super diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/001-Classes.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/001-Classes.yaml similarity index 97% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/001-Classes.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/001-Classes.yaml index 5b7524e..6da8988 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/001-Classes.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/001-Classes.yaml @@ -18,6 +18,7 @@ - IDC_Element: '{91929595-3dbd-4eae-8add-6120a49797c7}' - IDC_ElementContent: '{f85d4f5e-c69f-4498-9913-7a8554e233a4}' + - IDC_Language: '{61102B47-9B2F-4CF3-9840-D168B84CF1E5}' - IDC_Translation: '{04A53CC8-3206-4A97-99C5-464DB8CAA6E6}' - IDC_TranslationValue: '{6D38E757-EC18-43AD-9C35-D15BB446C0E1}' @@ -127,4 +128,5 @@ - IDC_CommonInstanceSet: '{3382da21-4fc5-45dc-bbd1-f7ba3ece1a1b}' - IDC_OMS: '{1ddf9a56-ebb8-4992-ab68-1820acf6bfc8}' - \ No newline at end of file + + - IDC_SystemInstanceSetRoutine: '{d17a6d27-da03-4b5d-9256-f67f978f403d}' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/002-Attributes.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/002-Attributes.yaml similarity index 91% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/002-Attributes.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/002-Attributes.yaml index 6c5473a..4c94d22 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/002-Attributes.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/002-Attributes.yaml @@ -4,10 +4,12 @@ - IDA_Verb: '{61345a5d-3397-4a96-8797-8863f03a476c}' - IDA_Singular: '{F1A06573-C447-4D85-B4E7-54A438C4A960}' - IDA_Value: '{041DD7FD-2D9C-412B-8B9D-D7125C166FE0}' + - IDA_Order: '{49423f66-8837-430d-8cac-7892ebdcb1fe}' - IDA_CSSValue: '{C0DD4A42-F503-4EB3-8034-7C428B1B8803}' - IDA_RelationshipType: '{71106B12-1934-4834-B0F6-D894637BAEED}' - IDA_TargetURL: '{970F79A0-9EFE-4E7D-9286-9908C6F06A67}' - IDA_UserName: '{960FAF02-5C59-40F7-91A7-20012A99D9ED}' + - IDA_Password: '{f3ef81b9-70c1-4830-a5f1-f567bc2e4f66}' - IDA_PasswordHash: '{F377FC29-4DF1-4AFB-9643-4191F37A00A9}' - IDA_PasswordSalt: '{8C5A99BC-40ED-4FA2-B23F-F373C1F3F4BE}' - IDA_ContentType: '{34142FCB-172C-490A-AF03-FF8451D00CAF}' @@ -47,3 +49,5 @@ - IDA_IncludeMIs: '{c97c2410-30d8-41eb-9b71-2aecc63abf46}' - IDA_IncludeSuperclassMethods: '{3828a3f7-57ff-409b-b814-338d5ff51e19}' - IDA_AllowAny: '{af02b1d7-b261-4eaf-9f99-37356c74e237}' + - IDA_UserNameOrPasswordIncorrectMessage: '{7a63f087-f47c-4b49-9043-94d6d59ac6c4}' + - IDA_LoginPageInstructions: '{dc11f905-335d-4e9b-8f03-55551a184dc3}' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/003-Relationships.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/003-Relationships.yaml similarity index 95% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/003-Relationships.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/003-Relationships.yaml index 2c3a14a..3a3685e 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/003-Relationships.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/003-Relationships.yaml @@ -62,8 +62,8 @@ - IDR_Instance_Prompt_Value__has__Instance: "{512B518E-A892-44AB-AC35-4E9DBCABFF0B}" - - IDR_Method__has__Method_Binding: "{D52500F1-1421-4B73-9987-223163BC9C04}" - - IDR_Method_Binding__for__Method: "{B782A592-8AF5-4228-8296-E3D0B24C70A8}" + - IDR_Method__executed_by__Method_Binding: "{D52500F1-1421-4B73-9987-223163BC9C04}" + - IDR_Method_Binding__executes__Method: "{B782A592-8AF5-4228-8296-E3D0B24C70A8}" - IDR_Method__has_return_type__Class: "{1241c599-e55d-4dcf-9200-d0e48c217ef8}" @@ -134,7 +134,7 @@ - IDR_Tenant__has__Application: "{22936f51-2629-4503-a30b-a02d61a6c0e0}" - - IDR_Tenant__has_sidebar__Menu_Item: "{D62DFB9F-48D5-4697-AAAD-1CAD0EA7ECFA}" + - IDR_Tenant__has_sidebar__Menu: "{D62DFB9F-48D5-4697-AAAD-1CAD0EA7ECFA}" - IDR_Tenant__has__Tenant_Type: "{E94B6C9D-3307-4858-9726-F24B7DB21E2D}" - IDR_Tenant__has_company_logo_image__File: "{3540c81c-b229-4eac-b9b5-9d4b4c6ad1eb}" @@ -231,6 +231,7 @@ - IDR_Instance__for__Element_Content: "{c3959f84-248d-4ede-a3f2-f262917c7b56}" - IDR_Element_Content__has__Element_Content_Display_Option: "{f070dfa7-6260-4488-a779-fae291903f2d}" + - IDR_Element_Content_Display_Option__for__Element_Content: "{12fe7923-b3d2-4152-96c7-a901410b3466}" - IDR_Element_Content__has__Parameter_Assignment: "{51214ef0-458a-44fa-8b9d-f3d9d2309388}" - IDR_Parameter__assigned_from__Element_Content: "{dcef180b-a2ca-4d87-bb05-b946c319b562}" @@ -265,4 +266,9 @@ - IDR_Evaluate_Boolean_Expression_Method__returns__Boolean_Attribute: "{53cf2cb6-f5f2-499f-9f18-26b86bf671c4}" - IDR_Boolean_Attribute__returned_by__Evaluate_Boolean_Expression_Method: "{24397b98-65da-4f5a-93a3-e933bab1f59b}" - \ No newline at end of file + + - IDR_Build_Attribute_Method__returns__Attribute: "{dadbf0f3-7af0-4387-a6b7-a1724a216d88}" + - IDR_Attribute__returned_by__Build_Attribute_Method: "{d5a6062b-2e84-46a1-8f54-da630ef6a48c}" + + - IDR_Get_Instance_Set_By_System_Routine_Method__uses__System_Instance_Set_Routine: "{085bd706-eece-4604-ac04-b7af114d1d21}" + - IDR_System_Instance_Set_Routine__used_by__Get_Instance_Set_By_System_Routine_Method: "{6fb6534c-2a46-4d6d-b9df-fd581f19efed}" diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/004-Instances.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/004-Instances.yaml similarity index 60% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/004-Instances.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/004-Instances.yaml index 60a7de9..3c075c8 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/004-Instances.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/004-Instances.yaml @@ -1,5 +1,5 @@ - entityDefinitions: - - IDI_Element_AddMetadataInstance: '{3b2223ab-000d-4910-ac24-e13f46cf5d99}' + - IDI_Element_AddMetadataInstance: '{a-000d-4910-ac24-e13f46cf5d99}' - IDI_Page_LoginPage: '{9E272BC3-0358-4EB7-8B3B-581964A59634}' - IDE_LoginPage: '{9E272BC3-0358-4EB7-8B3B-581964A59634}' @@ -17,3 +17,15 @@ - IDI_DisplayOption_DoNotShowIfEmpty: '{055b9a42-caf5-42ad-bd2e-9a4c3527947d}' # displays text in a text box element as obscured (system-dependent, e.g. asterisk (*) or dot) - IDI_DisplayOption_ObscuredText: '{e42fb627-6559-42e7-a8fe-59c9d674eec4}' + + - IDI_Module_MochaBaseSystem: '{3ffd3a31-208c-49c9-905d-2a69362902ca}' + - IDI_Module_MochaBaseSystem_OOP_OOPMethodExamples: '{5017c102-c154-4ef0-b117-e42bd1c756c1}' + + - IDI_Language_English: '{68BB6038-A4B5-4EE1-AAE9-326494942062}' + - IDI_Language_Spanish: '{6dc357cb-37c3-43ed-ae13-6259fb109213}' + - IDI_Language_French: '{6bf0cf09-87c9-4e21-b360-7eb5a1c279de}' + - IDI_Language_German: '{c7c1d740-0d3c-493f-ab0b-fe1b42546d0a}' + - IDI_Language_Italian: '{cf165170-0680-4a41-8f88-88f34b2b1986}' + - IDI_Language_Chinese: '{6f908a9b-7464-4a16-aed9-7eccb8d39032}' + - IDI_Language_Japanese: '{1e16de9d-0e49-4a79-b690-4905c46a94cc}' + - IDI_Language_Korean: '{d03a795e-906b-49ee-87ea-c1bef4b8ee9a}' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/005-MethodClasses.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/005-MethodClasses.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/005-MethodClasses.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/005-MethodClasses.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/006-Methods.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/006-Methods.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/006-Methods.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/006-Methods.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/007-TaskClasses.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/007-TaskClasses.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/007-TaskClasses.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/007-TaskClasses.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/008-Elements.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/008-Elements.yaml similarity index 71% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/008-Elements.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/008-Elements.yaml index b4b5ef5..26239a7 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/000-EntityDefinitions/008-Elements.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/008-Elements.yaml @@ -1,3 +1,4 @@ - entityDefinitions: - IDE_LoginPage: '{9E272BC3-0358-4EB7-8B3B-581964A59634}' - IDE_LoginPageSubedit: '{2b7d4481-b7c2-4e26-a917-e3ff7c367a8a}' + - IDE_HomePage: '{3c1f92a5-09a0-4b52-9269-46c386b0c905}' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/009-MethodBindings.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/009-MethodBindings.yaml new file mode 100644 index 0000000..d0d62fa --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/009-MethodBindings.yaml @@ -0,0 +1,4 @@ +- entityDefinitions: + - IDM_User__get__User_for_User_Name_parm: '{43d43f04-0c6d-41e9-9073-36719c4b93f5}' + - IDMB_User__get__User_for_User_Name_parm: '{08265aea-1c51-4fa6-9987-242952386cfe}' + # '{f3052795-4db7-48fe-a229-e19cac05b463}' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/010-SystemInstanceSetRoutines.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/010-SystemInstanceSetRoutines.yaml new file mode 100644 index 0000000..f70184e --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/010-SystemInstanceSetRoutines.yaml @@ -0,0 +1,2 @@ +- entityDefinitions: + - IDI_SystemInstanceSetRoutine_GetUserForUserNameParm: '{430f572d-d116-4b04-97b2-65a9e9230ce5}' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00001-Class.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00001-Class.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00001-Class.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00001-Class.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00002-Attribute.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00002-Attribute.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00002-Attribute.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00002-Attribute.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00003-Relationship.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00003-Relationship.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00003-Relationship.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00003-Relationship.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00004-TextAttribute.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00004-TextAttribute.yaml new file mode 100644 index 0000000..be99893 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00004-TextAttribute.yaml @@ -0,0 +1,74 @@ +--- +# YAML definition for Boolean Attribute +- class: '&IDC_TextAttribute;' + inherits: '&IDC_Attribute;' + name: Text Attribute + index: 4 + customTagName: 'textAttribute' + attributes: + - instance: '&IDA_Name;' + customTagName: 'name' + - instance: '&IDA_Value;' + customTagName: 'value' + +# YAML definition for Instances of Boolean Attribute, 1$5 + +- textAttribute: '&IDA_Name;' + name: Name + index: 1 +- textAttribute: '&IDA_Value;' + name: Value + index: 2 +# - textAttribute: '&IDA_DisplayID;' +# name: Display ID +# index: 3 +# - textAttribute: '&IDA_ClassName;' +# name: Class Name +# index: 4 +# - textAttribute: '&IDA_Expression;' +# name: Expression +# index: 5 +# - textAttribute: '&IDA_Comment;' +# name: Comment +# index: 6 +- textAttribute: '&IDA_RelationshipType;' + name: 'Relationship Type' + index: 8 +- textAttribute: '&IDA_UserName;' + name: 'UserName' + index: 11 +- textAttribute: '&IDA_Token;' + name: 'Token' + index: 33 +- textAttribute: '&IDA_UserNameOrPasswordIncorrectMessage;' + name: 'User Name or Password Incorrect Message' + index: 34 + value: 'The user name or password you entered is not correct.' + translations: + - relationship: '&IDR_Translatable__has__Translation;' + values: + - language: '&IDI_Language_English;' + - value: 'User Name or Password Incorrect Message' + +- textAttribute: '&IDA_LoginPageInstructions;' + name: 'Login Page Instructions' + index: 1034 + value: 'Please enter your user name and password to log in to this system.' + translations: + - relationship: '&IDR_Translatable__has__Translation;' + values: + - language: '&IDI_Language_English;' + - value: 'Login Page Instructions' + +- textAttribute: '&IDA_Verb;' + name: Verb + index: 35 +- textAttribute: '&IDA_Password;' + name: 'Password' + index: 36 +- textAttribute: '&IDA_PasswordHash;' + name: 'Password Hash' + index: 37 +- textAttribute: '&IDA_PasswordSalt;' + name: 'Password Salt' + index: 38 \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00005-BooleanAttribute.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00005-BooleanAttribute.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00005-BooleanAttribute.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00005-BooleanAttribute.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00006-Element.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00006-Element.yaml new file mode 100644 index 0000000..3612091 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00006-Element.yaml @@ -0,0 +1,47 @@ +--- +- class: '&IDC_Element;' + name: Element + index: 6 + customTagName: 'element' + attributes: + - instance: '&IDA_Name;' + customTagName: 'name' + relationships: + - instance: '&IDR_Element__has__Element_Content;' + customTagName: 'elementContents' + instances: + - instance: '&IDI_Element_AddMetadataInstance;' + name: add metadata instance + index: 1 + +- relationship: '&IDR_Element__has__Element_Content;' + index: 101 + sourceClassId: '&IDC_Element;' + type: 'has' + destinationClassId: '&IDC_ElementContent;' + siblingRelationshipId: '&IDR_Element_Content__for__Element;' + singular: no + +- relationship: '&IDR_Element_Content__for__Element;' + index: 102 + sourceClassId: '&IDC_ElementContent;' + type: 'for' + destinationClassId: '&IDC_Element;' + siblingRelationshipId: '&IDR_Element__has__Element_Content;' + singular: no + +- relationship: '&IDR_Element_Content__has__Instance;' + index: 103 + sourceClassId: '&IDC_ElementContent;' + type: 'has' + destinationClassId: '&IDC_Instance;' + siblingRelationshipId: '&IDR_Instance__for__Element_Content;' + singular: no + +- relationship: '&IDR_Instance__for__Element_Content;' + index: 104 + sourceClassId: '&IDC_Instance;' + type: 'for' + destinationClassId: '&IDC_ElementContent;' + siblingRelationshipId: '&IDR_Element_Content__has__Instance;' + singular: no \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00007-InstanceSet.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00007-InstanceSet.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00007-InstanceSet.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00007-InstanceSet.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00008-ControlTransactionMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00008-ControlTransactionMethod.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00008-ControlTransactionMethod.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00008-ControlTransactionMethod.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00009-OMS.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00009-OMS.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00009-OMS.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00009-OMS.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00010-Method.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00010-Method.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00010-Method.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00010-Method.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00012-GetAttributeMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00012-GetAttributeMethod.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00012-GetAttributeMethod.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00012-GetAttributeMethod.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00023-AssignRelationshipMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00023-AssignRelationshipMethod.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00023-AssignRelationshipMethod.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00023-AssignRelationshipMethod.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00024-EvaluateBooleanExpressionMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00024-EvaluateBooleanExpressionMethod.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00024-EvaluateBooleanExpressionMethod.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00024-EvaluateBooleanExpressionMethod.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00027-MethodBinding.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00027-MethodBinding.yaml new file mode 100644 index 0000000..03073c1 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00027-MethodBinding.yaml @@ -0,0 +1,29 @@ +--- +- class: '&IDC_MethodBinding;' + name: Method Binding + index: 27 + abstract: yes + translations: + - relationship: '&IDR_Class__has_title__Translation;' + values: + - languageInstanceId: '&IDI_Language_English;' + value: 'Method Binding' + relationships: + - instance: '&IDR_Method_Binding__executes__Method;' + customTagName: 'executesMethod' + +- relationship: '&IDR_Method_Binding__executes__Method;' + index: 32 + sourceClassId: '&IDC_MethodBinding;' + type: 'executes' + destinationClassId: '&IDC_Method;' + siblingRelationshipId: '&IDR_Method__executed_by__Method_Binding;' + singular: yes + +- relationship: '&IDR_Method__executed_by__Method_Binding;' + index: 33 + sourceClassId: '&IDC_Method;' + type: 'executed by' + destinationClassId: '&IDC_MethodBinding;' + siblingRelationshipId: '&IDR_Method_Binding__executes__Method;' + singular: no \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00030-BuildAttributeMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00030-BuildAttributeMethod.yaml new file mode 100644 index 0000000..90fec37 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00030-BuildAttributeMethod.yaml @@ -0,0 +1,32 @@ +--- +- class: '&IDC_BuildAttributeMethod;' + inherits: '&IDC_Method;' + name: BA - Build Attribute Method + index: 30 + customTagName: buildAttributeMethod + attributes: + - instance: '&IDA_Verb;' + customTagName: 'verb' + - instance: '&IDA_Name;' + customTagName: 'name' + - instance: '&IDA_Value;' + customTagName: 'initialValue' + relationships: + - instance: '&IDR_Build_Attribute_Method__returns__Attribute;' + customTagName: 'returnsAttributeId' + +- relationship: '&IDR_Build_Attribute_Method__returns__Attribute;' + index: 60 + sourceClassId: '&IDC_BuildAttributeMethod;' + type: 'returns' + destinationClassId: '&IDC_Attribute;' + siblingRelationshipId: '&IDR_Attribute__returned_by__Build_Attribute_Method;' + singular: no + +- relationship: '&IDR_Attribute__returned_by__Build_Attribute_Method;' + index: 61 + sourceClassId: '&IDC_Attribute;' + type: 'returned by' + destinationClassId: '&IDC_BuildAttributeMethod;' + siblingRelationshipId: '&IDR_Build_Attribute_Method__returns__Attribute;' + singular: no diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00039-SystemUser.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00039-SystemUser.yaml similarity index 97% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00039-SystemUser.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00039-SystemUser.yaml index 255ca70..690b540 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00039-SystemUser.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00039-SystemUser.yaml @@ -28,4 +28,4 @@ # type: 'for' # destinationClassId: '&IDC_UserLogin;' # siblingRelationshipId: '&IDR_User_Login__has__User;' -# singular: no \ No newline at end of file +# singular: no diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00056-ElementContent.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00056-ElementContent.yaml new file mode 100644 index 0000000..c69946c --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00056-ElementContent.yaml @@ -0,0 +1,32 @@ +--- +- class: '&IDC_ElementContent;' + name: Element Content + index: 56 + customTagName: 'elementContent' + attributes: + - instance: '&IDA_Order;' + customTagName: 'order' + relationships: + - instance: '&IDR_Element_Content__has__Instance;' + customTagName: 'defaultDataType' + - instance: '&IDR_Element_Content__has__Element_Content_Display_Option;' + customTagName: 'displayOptions' + instances: + - instance: '&IDI_Element_AddMetadataInstance;' + name: add metadata instance + index: 1 + +- relationship: '&IDR_Element_Content__has__Element_Content_Display_Option;' + index: 259 + sourceClassId: '&IDC_ElementContent;' + type: 'has' + destinationClassId: '&IDC_ElementContentDisplayOption;' + siblingRelationshipId: '&IDR_Element_Content_Display_Option__for__Element_Content;' + singular: no +- relationship: '&IDR_Element_Content_Display_Option__for__Element_Content;' + index: 260 + sourceClassId: '&IDC_ElementContentDisplayOption;' + type: 'for' + destinationClassId: '&IDC_ElementContent;' + siblingRelationshipId: '&IDR_Element_Content__has__Element_Content_Display_Option;' + singular: no \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00057-Module.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00057-Module.yaml new file mode 100644 index 0000000..a88d452 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00057-Module.yaml @@ -0,0 +1,15 @@ +--- +- class: '&IDC_Module;' + name: Module + index: 57 + customTagName: 'module' + attributes: + - instance: '&IDA_Name;' + customTagName: 'name' + relationships: + - instance: '&IDR_Module__has__Instance;' + - instance: '&IDR_Instance__for__Module' + #- instance: '&IDR_Module__owned_by__Owner;' + instances: + - instance: '&IDI_Module_MochaBaseSystem;' + name: 'Mocha Base System' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00058-CommonNumeric.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00058-CommonNumeric.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00058-CommonNumeric.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00058-CommonNumeric.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00065-GetInstanceSetBySystemRoutineMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00065-GetInstanceSetBySystemRoutineMethod.yaml new file mode 100644 index 0000000..f3056e6 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00065-GetInstanceSetBySystemRoutineMethod.yaml @@ -0,0 +1,27 @@ +--- +- class: '&IDC_GetInstanceSetBySystemRoutineMethod;' + inherits: '&IDC_Method;' + name: GSS - Get Instance Set By System Routine Method + index: 65 + customTagName: getInstanceSetBySystemRoutineMethod + relationships: + # - instance: '&IDR_Get_Instance_Set_By_System_Routine_Method__returns__Instance_Set;' + # customTagName: 'returnsInstanceSetId' + - instance: '&IDR_Get_Instance_Set_By_System_Routine_Method__uses__System_Instance_Set_Routine;' + customTagName: 'systemInstanceSetRoutine' + +- relationship: '&IDR_Get_Instance_Set_By_System_Routine_Method__uses__System_Instance_Set_Routine;' + index: 131 + sourceClassId: '&IDC_GetInstanceSetBySystemRoutineMethod;' + type: 'uses' + destinationClassId: '&IDC_SystemInstanceSetRoutine;' + siblingRelationshipId: '&IDR_System_Instance_Set_Routine__used_by__Get_Instance_Set_By_System_Routine_Method;' + singular: yes + +- relationship: '&IDR_System_Instance_Set_Routine__used_by__Get_Instance_Set_By_System_Routine_Method;' + index: 132 + sourceClassId: '&IDC_SystemInstanceSetRoutine;' + type: 'used by' + destinationClassId: '&IDC_GetInstanceSetBySystemRoutineMethod;' + siblingRelationshipId: '&IDR_Get_Instance_Set_By_System_Routine_Method__uses__System_Instance_Set_Routine;' + singular: no diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00069-SystemInstanceSetRoutine.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00069-SystemInstanceSetRoutine.yaml new file mode 100644 index 0000000..49f5666 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00069-SystemInstanceSetRoutine.yaml @@ -0,0 +1,6 @@ +--- +- class: '&IDC_SystemInstanceSetRoutine;' + name: System Instance Set Routine + instances: + - instance: '&IDI_SystemInstanceSetRoutine_GetUserForUserNameParm;' + name: 'Get User For User Name Parm' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00087-ReturnInstanceSetMethodBinding.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00087-ReturnInstanceSetMethodBinding.yaml new file mode 100644 index 0000000..eb1b123 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00087-ReturnInstanceSetMethodBinding.yaml @@ -0,0 +1,14 @@ +--- +- class: '&IDC_ReturnInstanceSetMethodBinding;' + name: Return Instance Set Method Binding + index: 87 + customTagName: returnInstanceSetMethodBinding + inherits: '&IDC_MethodBinding;' + translations: + - relationship: '&IDR_Class__has_title__Translation;' + values: + - languageInstanceId: '&IDI_Language_English;' + value: 'Return Instance Set Method Binding' + relationships: # FIXME: remove this when we can properly inherit definitions in zq-python + - instance: '&IDR_Method_Binding__executes__Method;' + customTagName: 'executesMethod' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00116-ECDynamicDisplayOption.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00116-ECDynamicDisplayOption.yaml new file mode 100644 index 0000000..acdf74b --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00116-ECDynamicDisplayOption.yaml @@ -0,0 +1,46 @@ +--- +- class: '&IDC_ElementContentDisplayOption;' + name: Element Content Display Option + index: 116 + translations: + - relationship: '&IDR_Class__has_title__Translation;' + values: + - languageInstanceId: '&IDI_Language_English;' + value: 'Element Content Display Option' + instances: + - instance: '&IDI_DisplayOption_DisplayAsPageTitle;' + name: Display as Page Title + index: 1 + - instance: '&IDI_DisplayOption_NotEnterable;' + name: Not Enterable + index: 2 + - instance: '&IDI_DisplayOption_SubmitNotEnterable;' + name: Submit Not Enterable + index: 3 + - instance: '&IDI_DisplayOption_ShowSubelementsVertically;' + name: Show Subelements Vertically + index: 4 + - instance: '&IDI_DisplayOption_Singular;' + name: Singular + index: 5 + - instance: '&IDI_DisplayOption_DoNotShow;' + name: Do Not Show + index: 6 + - instance: '&IDI_DisplayOption_InitializeForEntry;' + name: Initialize For Entry + index: 7 + - instance: '&IDI_DisplayOption_DoNotShowLabel;' + name: Do Not Show Label + index: 9 + - instance: '&IDI_DisplayOption_WideText;' + name: Wide Text + index: 10 + - instance: '&IDI_DisplayOption_Required;' + name: Required + index: 11 + - instance: '&IDI_DisplayOption_DoNotShowIfEmpty;' + name: Do Not Show If Empty + index: 12 + - instance: '&IDI_DisplayOption_ObscuredText;' + name: Obscured Text + index: 13 \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00234-Language.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00234-Language.yaml new file mode 100644 index 0000000..79e427c --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00234-Language.yaml @@ -0,0 +1,29 @@ +- class: '&IDC_Language;' + name: 'Language' + index: 234 + abstract: no + customTagName: 'language' + +- language: '&IDI_Language_English;' + index: 1 + +- language: '&IDI_Language_Spanish;' + index: 2 + +- language: '&IDI_Language_French;' + index: 3 + +- language: '&IDI_Language_German;' + index: 4 + +- language: '&IDI_Language_Italian;' + index: 5 + +- language: '&IDI_Language_Chinese;' + index: 6 + +- language: '&IDI_Language_Japanese;' + index: 7 + +- language: '&IDI_Language_Korean;' + index: 8 \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00361-Tenant.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00361-Tenant.yaml new file mode 100644 index 0000000..7a0222f --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00361-Tenant.yaml @@ -0,0 +1,10 @@ +- class: '&IDC_Tenant;' + name: 'Tenant' + index: 361 + abstract: no + sealed: yes + customTagName: 'tenant' + +- tenant: '&IDI_Language_English;' + index: 1 + \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/02993-Task.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/02993-Task.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/02993-Task.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/02993-Task.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/02997-SequenceTask.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/02997-SequenceTask.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/02997-SequenceTask.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/02997-SequenceTask.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/13038-ConditionalSelectAttibuteMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/13038-ConditionalSelectAttibuteMethod.yaml new file mode 100644 index 0000000..975a1ea --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/13038-ConditionalSelectAttibuteMethod.yaml @@ -0,0 +1,32 @@ +- class: '&IDC_ConditionalSelectAttributeMethod;' + index: 13038 + name: SAC - Conditional Select Attribute Method + customTagName: conditionalSelectAttributeMethod + superclasses: + - '&IDC_Method;' + relationships: + - instance: '&IDR_Conditional_Method__has__Conditional_Method_Case;' + customTagName: cases + # let's try this, define a custom tag name local to this particular context + # otherwise, we would have to have e.g. 'conditionalSelectAttributeCase' and 'conditionalSelectInstanceSetCase' because they're different.. + instanceCustomTagName: case + +- conditionalSelectAttributeMethod: '{c047715b-2547-47be-9437-9af40f1d6fdf}' + forClassId: '&IDC_ConditionalSelectAttributeMethod' + verb: 'get' + name: 'example item from choices depending on arbitrary magic' + cases: + - case: '{ec04570c-c5ac-4146-ba4a-a9a496465067}' + #conditionGroup: '{23705abe-d562-4335-b78b-1ba06d886866}' + trueConditions: '&IDMB_Common_Boolean__get__Arbitrary_Magic_Toggle;' + falseConditions: + useAnyCondition: no + # default implementation: `Common Numeric@get 42 (BA)*P*S[ramb]` + executableReturningAttribute: '&IDMB_Common_Numeric__get__42;' + + - case: '{3e149124-cc01-4427-ae19-167a23e8b647}' # default case + #conditionGroup: '{b5585cf6-0483-437f-9dc9-fb804f5b7db2}' + trueConditions: + falseConditions: + useAnyCondition: no + executableReturningAttribute: '&IDA_DateAndTime;' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/004-Methods/Common Boolean@is Date And Time parm less than or equal to Nth of this same month.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/Common Boolean@is Date And Time parm less than or equal to Nth of this same month.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/004-Methods/Common Boolean@is Date And Time parm less than or equal to Nth of this same month.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/Common Boolean@is Date And Time parm less than or equal to Nth of this same month.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/004-Methods/Date And Time Adjustment@adjust Date And Time parm to 'Nth of month'.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/Date And Time Adjustment@adjust Date And Time parm to 'Nth of month'.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/004-Methods/Date And Time Adjustment@adjust Date And Time parm to 'Nth of month'.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/Date And Time Adjustment@adjust Date And Time parm to 'Nth of month'.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/004-Methods/Translation@get Translation Value.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/Translation@get Translation Value.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/004-Methods/Translation@get Translation Value.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/Translation@get Translation Value.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_for_User_Name_parm.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_for_User_Name_parm.yaml new file mode 100644 index 0000000..4ecd499 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_for_User_Name_parm.yaml @@ -0,0 +1,7 @@ +- getInstanceSetBySystemRoutineMethod: '&IDM_User__get__User_for_User_Name_parm;' + index: 100 + systemInstanceSetRoutine: '&IDI_SystemInstanceSetRoutine_GetUserForUserNameParm;' + +- returnInstanceSetMethodBinding: '&IDMB_User__get__User_for_User_Name_parm;' + index: 100 + executesMethod: '&IDM_User__get__User_for_User_Name_parm;' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/113859-HomePage.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/113859-HomePage.yaml new file mode 100644 index 0000000..7309898 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/113859-HomePage.yaml @@ -0,0 +1,17 @@ +--- +- element: '&IDE_HomePage;' + name: Home Page + index: 113859 + # elementContents: + # - elementContent: '&IDE_LoginPageSubedit;' + # displayOptions: + # - instance: '&IDI_DisplayOption_ShowSubelementsVertically;' + # - instance: '&IDI_DisplayOption_Singular;' + #elementContents: + #- instance: '{f2f77680-37ca-48fa-b4b3-5f8a382e5d8c}' + +# - elementContent: '{f2f77680-37ca-48fa-b4b3-5f8a382e5d8c}' +# defaultDataType: '&IDE_LoginPageSubedit;' +# displayOptions: +# - instance: '&IDI_DisplayOption_ShowSubelementsVertically;' +# - instance: '&IDI_DisplayOption_Singular;' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/LoginPage.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/LoginPage.yaml new file mode 100644 index 0000000..bbfc6b5 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/LoginPage.yaml @@ -0,0 +1,16 @@ +--- +- element: '&IDE_LoginPage;' + name: login page + # elementContents: + # - elementContent: '&IDE_LoginPageSubedit;' + # displayOptions: + # - instance: '&IDI_DisplayOption_ShowSubelementsVertically;' + # - instance: '&IDI_DisplayOption_Singular;' + elementContents: + - instance: '{079fbdf6-26cc-45bc-9c66-1bcb97638659}' + +- elementContent: '{079fbdf6-26cc-45bc-9c66-1bcb97638659}' + defaultDataType: '&IDE_LoginPageSubedit;' + displayOptions: + - instance: '&IDI_DisplayOption_ShowSubelementsVertically;' + - instance: '&IDI_DisplayOption_Singular;' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/LoginPageSubedit.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/LoginPageSubedit.yaml new file mode 100644 index 0000000..69e32f3 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Elements/LoginPageSubedit.yaml @@ -0,0 +1,38 @@ +- element: '&IDE_LoginPageSubedit;' + name: login page subedit + module: '&IDI_Module_MochaBaseSystem;' + elementContents: + - instance: '{4a827e38-e07a-4b8b-a19f-9217299f5c45}' + - instance: '{c67f305e-bd4d-4628-816b-55fb85ea1b67}' + - instance: '{51b51be3-44fd-48f1-971f-682aee0a6132}' + - instance: '{684f1e03-9ecd-43d5-8aca-dcf5b84c71f8}' + +- elementContent: '{4a827e38-e07a-4b8b-a19f-9217299f5c45}' + defaultDataType: '&IDA_LoginPageInstructions;' + order: a + displayOptions: + - instance: '&IDI_DisplayOption_DoNotShowLabel;' + - instance: '&IDI_DisplayOption_NotEnterable;' + - instance: '&IDI_DisplayOption_WideText;' + +- elementContent: '{c67f305e-bd4d-4628-816b-55fb85ea1b67}' + defaultDataType: '&IDA_UserName;' + order: b + displayOptions: + - instance: '&IDI_DisplayOption_Required;' + +- elementContent: '{51b51be3-44fd-48f1-971f-682aee0a6132}' + defaultDataType: '&IDA_Password;' + order: c + displayOptions: + - instance: '&IDI_DisplayOption_Required;' + - instance: '&IDI_DisplayOption_ObscuredText;' + +- elementContent: '{684f1e03-9ecd-43d5-8aca-dcf5b84c71f8}' + defaultDataType: '&IDA_UserNameOrPasswordIncorrectMessage;' + order: d + displayOptions: + - instance: '&IDI_DisplayOption_DoNotShowLabel;' + - instance: '&IDI_DisplayOption_DoNotShow;' + - instance: '&IDI_DisplayOption_NotEnterable;' + - instance: '&IDI_DisplayOption_WideText;' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Tasks/ViewElement.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Tasks/ViewElement.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Tasks/ViewElement.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/005-UserInterface/Tasks/ViewElement.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/009-Users/zq-developer.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/009-Users/zq-developer.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/009-Users/zq-developer.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/009-Users/zq-developer.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00004-TextAttribute.yaml b/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00004-TextAttribute.yaml deleted file mode 100644 index 23516e5..0000000 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00004-TextAttribute.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -# YAML definition for Boolean Attribute -- class: '&IDC_TextAttribute;' - inherits: '&IDC_Attribute;' - name: Text Attribute - index: 4 - # YAML definition for Instances of Boolean Attribute, 1$5 - instances: - - instance: '&IDA_Name;' - name: Name - index: 1 - - instance: '&IDA_RelationshipType;' - name: 'Relationship Type' - index: 2 - - instance: '&IDA_UserName;' - name: 'User Name' - index: 11 - - instance: '&IDA_Token;' - name: 'Token' - index: 33 - - instance: '&IDA_PasswordHash;' - name: 'Password Hash' - index: 37 - - instance: '&IDA_PasswordSalt;' - name: 'Password Salt' - index: 38 \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00006-Element.yaml b/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00006-Element.yaml deleted file mode 100644 index 4a04440..0000000 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00006-Element.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- class: '&IDC_Element;' - name: Element - index: 6 - customTagName: 'element' - attributes: - relationships: - - instance: '&IDR_Element__has__Element_Content;' - customTagName: 'elementContents' - instances: - - instance: '&IDI_Element_AddMetadataInstance;' - name: add metadata instance - index: 1 - \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00056-ElementContent.yaml b/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00056-ElementContent.yaml deleted file mode 100644 index 88599ca..0000000 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/003-Classes/00056-ElementContent.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- class: '&IDC_ElementContent;' - name: Element Content - index: 56 - customTagName: 'elementContent' - attributes: - - instance: '&IDA_Order;' - customTagName: 'order' - relationships: - - instance: '&IDR_Element_Content__has__Instance;' - customTagName: 'defaultDataType' - - instance: '&IDR_Element_Content__has__Element_Content_Display_Option;' - customTagName: 'displayOptions' - instances: - - instance: '&IDI_Element_AddMetadataInstance;' - name: add metadata instance - index: 1 - \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Elements/LoginPage.yaml b/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Elements/LoginPage.yaml deleted file mode 100644 index e401222..0000000 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Elements/LoginPage.yaml +++ /dev/null @@ -1,7 +0,0 @@ -- element: '&IDE_LoginPage;' - name: login page - elementContents: - - elementContent: '&IDE_LoginPageSubedit;' - displayOptions: - - instance: '&IDI_DisplayOption_ShowSubelementsVertically;' - - instance: '&IDI_DisplayOption_Singular;' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Elements/LoginPageSubedit.yaml b/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Elements/LoginPageSubedit.yaml deleted file mode 100644 index 3ce5511..0000000 --- a/common/libraries/yaml/net.alcetech.Mocha.System@20231121T2131-0500/005-UserInterface/Elements/LoginPageSubedit.yaml +++ /dev/null @@ -1,15 +0,0 @@ -- element: '&IDE_LoginPageSubedit;' - name: login page subedit - module: '&IDI_Module_MochaBaseSystem;' - elementContents: - - elementContent: '{c67f305e-bd4d-4628-816b-55fb85ea1b67}' - defaultDataType: '&IDA_UserName;' - order: a - displayOptions: - - instance: '&IDI_DisplayOption_Required;' - - elementContent: '{51b51be3-44fd-48f1-971f-682aee0a6132}' - defaultDataType: '&IDA_Password;' - order: b - displayOptions: - - instance: '&IDI_DisplayOption_Required;' - - instance: '&IDI_DisplayOption_ObscuredText;' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System@current b/common/libraries/yaml/net.alcetech.Mocha.System@current deleted file mode 120000 index d7bfeb5..0000000 --- a/common/libraries/yaml/net.alcetech.Mocha.System@current +++ /dev/null @@ -1 +0,0 @@ -net.alcetech.Mocha.System@20231121T2131-0500 \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/001-Classes.yaml b/common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/001-Classes.yaml new file mode 100644 index 0000000..c560b24 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/001-Classes.yaml @@ -0,0 +1,3 @@ +- entityDefinitions: + - IDC_Route: '{6c589422-3f1e-4402-afc7-27b6956aa588}' + - IDC_RouteTable: '{76e5ce90-5f64-4355-a0ee-f659cf615a63}' diff --git a/common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/002-Attributes.yaml b/common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/002-Attributes.yaml new file mode 100644 index 0000000..06b2f10 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/002-Attributes.yaml @@ -0,0 +1,2 @@ +- entityDefinitions: + - IDA_RouteURL: '{304d9fb0-a5fc-4503-b6e5-96842b856bb1}' diff --git a/common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/003-Relationships.yaml b/common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/003-Relationships.yaml new file mode 100644 index 0000000..a599f88 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.Web/000-EntityDefinitions/003-Relationships.yaml @@ -0,0 +1,7 @@ +- entityDefinitions: + - IDR_Route_Table__has__Route: '{551efe23-f97c-4e11-b5cc-e3c99117a9cc}' + - IDR_Route__for__Route_Table: '{1d38259e-b4f4-4bf9-a7ab-1cb09561bf3b}' + + - IDR_Tenant__has__Route_Table: '{1af6c245-2faa-4f31-9368-4148b3051c04}' + - IDR_Route_Table__for__Tenant: '{e55755c3-3574-41f5-b8e7-ed634050fe67}' + \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.Web/003-Classes/00434-Route.yaml b/common/libraries/yaml/net.alcetech.Mocha.Web/003-Classes/00434-Route.yaml new file mode 100644 index 0000000..4f9b660 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.Web/003-Classes/00434-Route.yaml @@ -0,0 +1,66 @@ +--- #definitions for YAML +- textAttribute: '&IDA_RouteURL;' + name: 'Route URL' + index: 438 + +- instance: '&IDC_Route;' + name: Route + index: 434 + customTagName: 'route' + attributes: + - instance: '&IDA_Name;' + customTagName: 'name' + - instance: '&IDA_RouteURL;' + customTagName: 'url' + +- instance: '&IDC_RouteTable;' + name: Route Table + index: 439 + customTagName: 'routeTable' + attributes: + - instance: '&IDA_Name;' + customTagName: 'name' + relationships: + - instance: '&IDR_Route_Table__has__Route;' + customTagName: 'routes' + +- relationship: '&IDR_Route_Table__has__Route;' + sourceClassId: '&IDC_RouteTable;' + type: 'has' + destinationClassId: '&IDC_Route;' + siblingRelationshipId: '&IDR_Route__for__Route_Table;' + singular: no + +- relationship: '&IDR_Route__for__Route_Table;' + sourceClassId: '&IDC_Route;' + type: 'for' + destinationClassId: '&IDC_RouteTable;' + siblingRelationshipId: '&IDR_Route_Table__has__Route;' + singular: no + +- relationship: '&IDR_Tenant__has__Route_Table;' + sourceClassId: '&IDC_Tenant;' + type: 'has' + destinationClassId: '&IDC_RouteTable;' + siblingRelationshipId: '&IDR_Route_Table__for__Tenant;' + singular: yes + +- relationship: '&IDR_Route_Table__for__Tenant;' + sourceClassId: '&IDC_RouteTable;' + type: 'for' + destinationClassId: '&IDC_Tenant;' + siblingRelationshipId: '&IDR_Tenant__has__Route_Table;' + singular: no + +- routeTable: '{641ea97b-a1c2-4005-9bda-c0111a254365}' + routes: + - instance: '{1184d102-0710-4632-bf64-6362b9485a0f}' + - instance: '{88de14b6-53ca-4394-8500-bd4120499875}' + +- route: '{1184d102-0710-4632-bf64-6362b9485a0f}' + name: MADI Authentication Gateway Login + url: 'madi/authgwy/{tenant}/login.htmld' + +- route: '{88de14b6-53ca-4394-8500-bd4120499875}' + name: MADI Authentication Gateway Login + url: 'madi/authgwy/{tenant}/login.htmld' diff --git a/dotnet/Libraries/UniversalEditor.Plugins.Mocha/DataFormats/MochaXML/MochaXMLDataFormat.cs b/dotnet/Libraries/UniversalEditor.Plugins.Mocha/DataFormats/MochaXML/MochaXMLDataFormat.cs index ba8bf90..a50e2a4 100755 --- a/dotnet/Libraries/UniversalEditor.Plugins.Mocha/DataFormats/MochaXML/MochaXMLDataFormat.cs +++ b/dotnet/Libraries/UniversalEditor.Plugins.Mocha/DataFormats/MochaXML/MochaXMLDataFormat.cs @@ -153,13 +153,6 @@ namespace UniversalEditor.Plugins.Mocha.DataFormats.MochaXML // InitGuids(typeof(KnownRelationshipGuids), "IDR", false); - /* - - // {085bd706-eece-4604-ac04-b7af114d1d21} - - // 6fb6534c-2a46-4d6d-b9df-fd581f19efed - */ - this.Settings.Entities.Add("IDI_Module_MochaBaseSystem", "{3ffd3a31-208c-49c9-905d-2a69362902ca}"); this.Settings.Entities.Add("IDI_Language_English", "{68BB6038-A4B5-4EE1-AAE9-326494942062}"); diff --git a/php/mocha-ccx/ui/masterPages/Blank.phpx.php b/php/mocha-ccx/ui/masterPages/Blank.phpx.php index 6403daa..8faeb48 100644 --- a/php/mocha-ccx/ui/masterPages/Blank.phpx.php +++ b/php/mocha-ccx/ui/masterPages/Blank.phpx.php @@ -14,7 +14,7 @@ if ($re->RenderMode === RenderMode::Complete) { echo(""); - echo(""); + echo(""); } } diff --git a/php/mocha/index.php b/php/mocha/index.php index b1795a1..04a1915 100644 --- a/php/mocha/index.php +++ b/php/mocha/index.php @@ -20,6 +20,7 @@ // Load the Phast content (which also include_once's the system modules and // other Phast-specific stuff) require_once("lib/phast/System.inc.php"); + require_once("lib/mocha/system.inc.php"); // Bring in the Phast\System and Phast\IncludeFile classes so we can simply refer // to them (in this file only) as "System" and "IncludeFile", respectively, from diff --git a/php/mocha/lib/mocha/core/InstanceReference.inc.php b/php/mocha/lib/mocha/core/InstanceReference.inc.php index c8fede4..0254217 100644 --- a/php/mocha/lib/mocha/core/InstanceReference.inc.php +++ b/php/mocha/lib/mocha/core/InstanceReference.inc.php @@ -1,10 +1,39 @@ OMS = $oms; + $this->DatabaseId = $databaseId; + $this->InstanceKey = $instanceKey; + $this->GlobalIdentifier = $globalIdentifier; + } + + public function getRelatedInstances(InstanceReference $relationship) + { + $instances = []; + return $instances; + } + + public function asMethod() + { + return new Method($this); + } + public function asMethodBinding() + { + return new MethodBinding($this); + } } ?> \ No newline at end of file diff --git a/php/mocha/lib/mocha/core/KnownAttributeGuids.inc.php b/php/mocha/lib/mocha/core/KnownAttributeGuids.inc.php index cc0904c..be2d324 100644 --- a/php/mocha/lib/mocha/core/KnownAttributeGuids.inc.php +++ b/php/mocha/lib/mocha/core/KnownAttributeGuids.inc.php @@ -6,6 +6,7 @@ class KnownAttributeGuids // Text const Name = "9153A637992E4712ADF2B03F0D9EDEA6"; const Verb = "61345a5d33974a9687978863f03a476c"; + const Singular = "F1A06573C4474D85B4E754A438C4A960"; const Value = "041DD7FD2D9C412B8B9DD7125C166FE0"; const CSSValue = "C0DD4A42F5034EB380347C428B1B8803"; const RelationshipType = "71106B1219344834B0F6D894637BAEED"; diff --git a/php/mocha/lib/mocha/core/KnownInstanceGuids.inc.php b/php/mocha/lib/mocha/core/KnownInstanceGuids.inc.php index a97e964..0c99111 100644 --- a/php/mocha/lib/mocha/core/KnownInstanceGuids.inc.php +++ b/php/mocha/lib/mocha/core/KnownInstanceGuids.inc.php @@ -27,5 +27,10 @@ class KnownInstanceGuids const DisplayOption__ObscuredText = "e42fb627655942e7a8fe59c9d674eec4"; const Element__LoginPage = "9E272BC303584EB78B3B581964A59634"; + const Element__LoginPageSubedit = "2b7d4481b7c24e26a917e3ff7c367a8a"; + const Element__HomePage = "3c1f92a509a04b52926946c386b0c905"; + + const ElementContent__UserNameForLoginPage = "c67f305ebd4d4628816b55fb85ea1b67"; + const ElementContent__PasswordForLoginPage = "51b51be344fd48f1971f682aee0a6132"; } ?> \ No newline at end of file diff --git a/php/mocha/lib/mocha/core/KnownMethodBindingGuids.inc.php b/php/mocha/lib/mocha/core/KnownMethodBindingGuids.inc.php new file mode 100644 index 0000000..f5fe43c --- /dev/null +++ b/php/mocha/lib/mocha/core/KnownMethodBindingGuids.inc.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/php/mocha/lib/mocha/core/KnownRelationshipGuids.inc.php b/php/mocha/lib/mocha/core/KnownRelationshipGuids.inc.php index 7d6f037..03400dc 100644 --- a/php/mocha/lib/mocha/core/KnownRelationshipGuids.inc.php +++ b/php/mocha/lib/mocha/core/KnownRelationshipGuids.inc.php @@ -63,8 +63,8 @@ class KnownRelationshipGuids const Instance_Prompt_Value__has__Instance = "512B518EA89244ABAC354E9DBCABFF0B"; - const Method__has__Method_Binding = "D52500F114214B739987223163BC9C04"; - const Method_Binding__for__Method = "B782A5928AF542288296E3D0B24C70A8"; + const Method__executed_by__Method_Binding = "D52500F114214B739987223163BC9C04"; + const Method_Binding__executes__Method = "B782A5928AF542288296E3D0B24C70A8"; const Method__has_return_type__Class = "1241c599e55d4dcf9200d0e48c217ef8"; @@ -82,9 +82,6 @@ class KnownRelationshipGuids const Method_Binding__assigned_to__Parameter_Assignment = "cbcb23b710c449eba1cab9da73fe8b83"; const Parameter_Assignment__assigns_from__Method_Binding = "1e055d30a96849d893fe541994fc0c51"; - const Method_Call__has__Method = "3D3B601B4EF049F3AF0586CEA0F00619"; - const Method_Call__has__Prompt_Value = "765BD0C9117D4D0E88C92CEBD4898135"; - const Validation__has__Validation_Classification = "BCDB6FFDD2F24B63BD7E9C2CCD9547E0"; const Validation__has_true_condition__Executable = "AA2D3B5141534599A9836B4A13ADCBCB"; const Validation__has_false_condition__Executable = "419047F8852B4A4DB161A8BD022FD8EB"; @@ -259,5 +256,8 @@ class KnownRelationshipGuids const Style__implements__Style = "99b1c16af2cb4cc5a3bb82a96335aa39"; const Style__implemented_for__Style = "271ef8161e944f02a8054f9536c28dca"; + + const Get_Instance_Set_by_System_Routine_Method__uses__System_Instance_Set_Routine = "{085bd706-eece-4604-ac04-b7af114d1d21}"; + const System_Instance_Set_Routine__used_by__Get_Instance_Set_By_System_Routine_Method = "{6fb6534c-2a46-4d6d-b9df-fd581f19efed}"; } ?> \ No newline at end of file diff --git a/php/mocha/lib/mocha/core/OmsContext.inc.php b/php/mocha/lib/mocha/core/OmsContext.inc.php new file mode 100644 index 0000000..018ca5a --- /dev/null +++ b/php/mocha/lib/mocha/core/OmsContext.inc.php @@ -0,0 +1,53 @@ +elementParms = array(); + $this->workData = array(); + } + + public function setElementParm(InstanceReference $elementContent, string $parmId, $value) + { + if (!array_key_exists($elementContent->DatabaseId, $this->elementParms)) + { + $this->elementParms[$elementContent->DatabaseId] = array(); + } + $this->elementParms[$elementContent->DatabaseId][$parmId] = $value; + } + + public function getElementParm(InstanceReference $elementContent, string $parmId, $defaultValue = null) + { + if (array_key_exists($elementContent->DatabaseId, $this->elementParms)) + { + if (array_key_exists($parmId, $this->elementParms[$elementContent->DatabaseId])) + { + return $this->elementParms[$elementContent->DatabaseId][$parmId]; + } + } + return $defaultValue; + } + public function setWorkData(string $parmId, $value) + { + $this->workData[$parmId] = $value; + } + public function getWorkData(InstanceReference $elementContent, string $parmId, $defaultValue = null) + { + if (array_key_exists($parmId, $this->workData)) + { + return $this->workData[$parmId]; + } + return $defaultValue; + } + + } + +?> \ No newline at end of file diff --git a/php/mocha/lib/mocha/oms/MySQLDatabaseOms.inc.php b/php/mocha/lib/mocha/oms/MySQLDatabaseOms.inc.php index 2b42c5c..2386114 100644 --- a/php/mocha/lib/mocha/oms/MySQLDatabaseOms.inc.php +++ b/php/mocha/lib/mocha/oms/MySQLDatabaseOms.inc.php @@ -103,10 +103,8 @@ if ($values[0] == null) return null; - $ir = new InstanceReference(); - $ir->DatabaseId = $values[0]; - $ir->GlobalIdentifier = $this->getGlobalIdentifier($ir->DatabaseId); - $ir->InstanceKey = $this->getInstanceKey($ir->DatabaseId); + $dbid = $values[0]; + $ir = new InstanceReference($this, $dbid, $this->getInstanceKey($dbid), $this->getGlobalIdentifier($dbid)); return $ir; } @@ -145,10 +143,7 @@ )); $values = $stmt->fetch(); - $ir = new InstanceReference(); - $ir->DatabaseId = $values["id"]; - $ir->GlobalIdentifier = $values["global_identifier"]; - $ir->InstanceKey = new InstanceKey($values["class_id"], $values["inst_id"]); + $ir = new InstanceReference($this, $values["id"], new InstanceKey($values["class_id"], $values["inst_id"]), $values["global_identifier"]); return $ir; } @@ -193,10 +188,7 @@ $inst_id = $values[0]["inst_id"]; $global_id = $values[0]["global_identifier"]; - $ir = new InstanceReference(); - $ir->DatabaseId = $dbid; - $ir->GlobalIdentifier = $global_id; - $ir->InstanceKey = new InstanceKey($class_id, $inst_id); + $ir = new InstanceReference($this, $dbid, new InstanceKey($class_id, $inst_id), $global_id); return $ir; } @@ -372,10 +364,7 @@ public function getInstanceFromDatabase($value) { - $retval = new InstanceReference(); - $retval->DatabaseId = $value["id"]; - $retval->InstanceKey = new InstanceKey($value["class_id"], $value["inst_id"]); - $retval->GlobalIdentifier = $value["global_identifier"]; + $retval = new InstanceReference($this, $value["id"], new InstanceKey($value["class_id"], $value["inst_id"]), $value["global_identifier"]); return $retval; } } diff --git a/php/mocha/lib/mocha/oms/Oms.inc.php b/php/mocha/lib/mocha/oms/Oms.inc.php index 952ffae..6018dd6 100644 --- a/php/mocha/lib/mocha/oms/Oms.inc.php +++ b/php/mocha/lib/mocha/oms/Oms.inc.php @@ -7,6 +7,7 @@ use Mocha\Core\KnownClassGuids; use Mocha\Core\KnownInstanceGuids; use Mocha\Core\KnownAttributeGuids; + use Mocha\Core\KnownRelationshipGuids; use Mocha\Core\TenantReference; abstract class Oms @@ -28,6 +29,24 @@ { return null; } + public function getRelatedInstance(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?InstanceReference + { + $insts = $this->getRelatedInstances($sourceInstance, $relationshipInstance, $effectiveDate); + if ($insts === null) + return null; + if (count($insts) === 0) + return null; + return $insts[0]; + } + + /** + * Gets the parent class Instance of the specified Instance. + */ + public function getParentClass(InstanceReference $inst) : ?InstanceReference + { + $forClass = $this->getRelatedInstance($inst, $this->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Instance__for__Class)); + return $forClass; + } /** * Gets the instance representing the default tenant. @@ -85,5 +104,27 @@ { return null; } + + public function instanceSetContains(array /**/ $haystack, InstanceReference $needle) + { + foreach ($haystack as $v) + { + if ($v->DatabaseId == $needle->DatabaseId) + { + return true; + } + } + return false; + } + + public function executeMethodReturningInstanceSet(InstanceReference $method, array $parms) + { + $parentClass = $this->getParentClass($method); + echo("parent class of method"); + print_r($parentClass); + die(); + + return null; + } } ?> diff --git a/php/mocha/lib/mocha/oop/Method.inc.php b/php/mocha/lib/mocha/oop/Method.inc.php new file mode 100644 index 0000000..02e8d92 --- /dev/null +++ b/php/mocha/lib/mocha/oop/Method.inc.php @@ -0,0 +1,46 @@ +MethodInstance = $methodInstance; + } + + public function execute(array $parms) : null|array|InstanceReference + { + $oms = $this->MethodInstance->OMS; + + $methods = array + ( + 65 => new GetInstanceSetBySystemRoutineMethod($this) + ); + + + echo ($oms->getAttributeValue($this->MethodInstance, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Name))); + + $parentClass = $oms->getParentClass($this->MethodInstance); + if (array_key_exists($parentClass->InstanceKey->InstanceIndex, $methods)) + { + $method = $methods[$parentClass->InstanceKey->InstanceIndex]; + return $method->execute($parms); + } + else + { + echo ("method implementation not found for method 1\$" . $parentClass->InstanceKey->InstanceIndex . " !"); + } + return null; + } + } +?> \ No newline at end of file diff --git a/php/mocha/lib/mocha/oop/MethodBinding.inc.php b/php/mocha/lib/mocha/oop/MethodBinding.inc.php new file mode 100644 index 0000000..e1067ad --- /dev/null +++ b/php/mocha/lib/mocha/oop/MethodBinding.inc.php @@ -0,0 +1,36 @@ +MethodBindingInstance = $methodBindingInst; + } + + public function executeReturningInstanceSet(?array $parms = null) : null|array|InstanceReference + { + $context = new OmsContext(); + $method = $this->MethodBindingInstance->OMS->getRelatedInstance($this->MethodBindingInstance, $this->MethodBindingInstance->OMS->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Method_Binding__executes__Method))->asMethod(); + if (is_array($parms)) + { + foreach ($parms as $gid => $value) + { + $context->setWorkData($gid, $value); + } + } + $val = $method->execute($parms); + return $val; + } + + } + +?> \ No newline at end of file diff --git a/php/mocha/lib/mocha/oop/methods/GetInstanceSetBySystemRoutineMethod.inc.php b/php/mocha/lib/mocha/oop/methods/GetInstanceSetBySystemRoutineMethod.inc.php new file mode 100644 index 0000000..1ac2db0 --- /dev/null +++ b/php/mocha/lib/mocha/oop/methods/GetInstanceSetBySystemRoutineMethod.inc.php @@ -0,0 +1,47 @@ +Method = $method; + } + + public function execute(array $parms) + { + + $instMethod = $this->Method->MethodInstance; + $oms = $instMethod->OMS; + + $instSystemRoutine = $oms->getRelatedInstance($instMethod, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Get_Instance_Set_by_System_Routine_Method__uses__System_Instance_Set_Routine)); + $singular = false; // $oms->getAttributeValue($instSystemRoutine, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Singular)); + + if ($instSystemRoutine->GlobalIdentifier == "430f572dd1164b0497b265a9e9230ce5") + { + // get User for User Name parm + $userName = $parms["960FAF025C5940F791A720012A99D9ED"]; + $singular = true; + + if ($singular) + { + return $oms->getUserByUserName($userName); + } + return [ $oms->getUserByUserName($userName) ]; + } + + if ($singular) + { + return null; + } + return [ ]; + } + } + +?> \ No newline at end of file diff --git a/php/mocha/lib/mocha/system.inc.php b/php/mocha/lib/mocha/system.inc.php index 199e8ec..2666243 100644 --- a/php/mocha/lib/mocha/system.inc.php +++ b/php/mocha/lib/mocha/system.inc.php @@ -8,21 +8,20 @@ require("core/KnownInstanceGuids.inc.php"); require("core/KnownAttributeGuids.inc.php"); require("core/KnownRelationshipGuids.inc.php"); + require("core/KnownMethodBindingGuids.inc.php"); + + require("core/OmsContext.inc.php"); require("oms/Oms.inc.php"); require("oms/DatabaseOms.inc.php"); require("oms/MySQLDatabaseOms.inc.php"); + require("oop/Method.inc.php"); + require("oop/MethodBinding.inc.php"); + require("oop/methods/GetInstanceSetBySystemRoutineMethod.inc.php"); + require("ui/DisplayOption.inc.php"); require("ui/ElementContent.inc.php"); + require("ui/renderers/HTMLRenderer.inc.php"); - function getOMS() - { - global $oms; - if ($oms == null) - { - $oms = new \Mocha\Oms\MySQLDatabaseOms("localhost", 3306, "mocha_0001", "mocha_0001", "4hpVLM4QDEfzwZwS"); - } - return $oms; - } ?> \ No newline at end of file diff --git a/php/mocha/lib/mocha/ui/renderers/HTMLRenderer.inc.php b/php/mocha/lib/mocha/ui/renderers/HTMLRenderer.inc.php new file mode 100644 index 0000000..bab5079 --- /dev/null +++ b/php/mocha/lib/mocha/ui/renderers/HTMLRenderer.inc.php @@ -0,0 +1,357 @@ +Context = $context; + } + /** + * Thanks https://stackoverflow.com/a/31107425 + * + * Generate a random string, using a cryptographically secure + * pseudorandom number generator (random_int) + * + * This function uses type hints now (PHP 7+ only), but it was originally + * written for PHP 5 as well. + * + * For PHP 7, random_int is a PHP core function + * For PHP 5.x, depends on https://github.com/paragonie/random_compat + * + * @param int $length How many characters do we want? + * @param string $keyspace A string of all possible characters + * to select from + * @return string + */ + private function random_str(int $length = 64, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ) : string + { + if ($length < 1) + { + throw new \RangeException("Length must be a positive integer"); + } + $pieces = []; + $max = \mb_strlen($keyspace, '8bit') - 1; + for ($i = 0; $i < $length; ++$i) + { + $pieces[] = $keyspace[\random_int(0, $max)]; + } + return \implode('', $pieces); + } + + public function getElementContentValue(InstanceReference $elementContent, $defaultValue = null) + { + if (isset($_POST["ec_" . $elementContent->InstanceKey])) + { + return $_POST["ec_" . $elementContent->InstanceKey]; + } + return $defaultValue; + } + + public function processPostback(InstanceReference $element) + { + /** + * @var MySQLDatabaseOms + */ + $oms = mocha_get_oms(); + + $ec_UserName = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::ElementContent__UserNameForLoginPage); + $ec_Password = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::ElementContent__PasswordForLoginPage); + + // $ct = $oms->getRelatedInstance($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__processed_by__Control_Transaction_Method)); + // Login Page@ Login Page Edit(CT)*S + // uses Build Response Method Binding... + // + + $userName = $this->getElementContentValue($ec_UserName); // $_POST["ec_56$4"]; + $password = $this->getElementContentValue($ec_Password); // $_POST["ec_56$5"]; + + $mbUser__get__User_for_User_Name_parm = $oms->getInstanceByGlobalIdentifier(KnownMethodBindingGuids::User__get__User_for_User_Name_parm); + if ($mbUser__get__User_for_User_Name_parm === null) + { + echo("`User@get User for User Name parm`: method not found ('" . KnownMethodBindingGuids::User__get__User_for_User_Name_parm . "')");die(); + } + $mbUser__get__User_for_User_Name_parm = $mbUser__get__User_for_User_Name_parm->asMethodBinding(); + + $instUser = $mbUser__get__User_for_User_Name_parm->executeReturningInstanceSet(array( KnownAttributeGuids::UserName => $userName )); + if ($instUser !== null) + { + $passwordSalt = $oms->getAttributeValue($instUser, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::PasswordSalt)); + $passwordHashExpected = $oms->getAttributeValue($instUser, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::PasswordHash)); + $passwordHashActual = hash('sha512', $password . $passwordSalt); + + if ($passwordHashExpected == $passwordHashActual) + { + $token = $this->random_str(); + + // create the instance of `User Login` + $instLogin = $oms->createInstanceOf($oms->getInstanceByGlobalIdentifier(KnownClassGuids::UserLogin)); + if ($instLogin !== null) + { + $oms->setAttributeValue($instLogin, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Token), $token); + $oms->assignRelationship($instLogin, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::User_Login__has__User), $instUser); + } + $_SESSION["user_token_" . $oms->getTenant()->ID] = $token; + + System::Redirect("~/d/home.htmld"); + exit(); + } + else + { + //$this->Page->GetControlByID("literal1")->EnableRender = true; + + //System::RedirectToLoginPage(true); + } + } + $ecPasswordMsg = $oms->getInstanceByGlobalIdentifier("684f1e039ecd43d58acadcf5b84c71f8"); + $this->Context->setElementParm($ecPasswordMsg, "visible", true); + } + + public function shouldRenderElementContent(InstanceReference $elementContent) + { + /** + * @var MySQLDatabaseOms + */ + $oms = mocha_get_oms(); + if ($this->Context->getElementParm($elementContent, "visible", false)) + { + return true; + } + + $displayOptions = $oms->getRelatedInstances($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option)); + if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__DoNotShow))) + return false; + + if (!$this->Context->getElementParm($elementContent, "visible", true)) + { + return false; + } + + return true; + } + + public function renderElementContent(InstanceReference $elementContent) + { + /** + * @var MySQLDatabaseOms + */ + $oms = mocha_get_oms(); + + $ecInst = $oms->getRelatedInstance($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Instance)); + if ($ecInst === null) + { + } + else + { + if ($this->shouldRenderElementContent($elementContent)) + { + $this->renderBeginTag("tr", [ "data-instance-id" => $elementContent->InstanceKey ], [ "mcx-elementcontent" ]); + + $ecPClass = $oms->getParentClass($ecInst); + $title = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Name)); + + //!HACK + if ($ecInst->InstanceKey->ClassIndex == 6) + { + // ELements should not have a title + $title = ""; + } + + echo(""); + $displayOptions = $oms->getRelatedInstances($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option)); + if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__WideText))) + { + $this->renderBeginTag("td"); + if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__DoNotShowLabel))) + { + echo (""); + } + $this->renderEndTag("td"); + $this->renderBeginTag("td"); + } + else + { + $this->renderBeginTag("td", [ "colspan" => "2" ]); + } + + if (strtolower($ecPClass->GlobalIdentifier) == strtolower(KnownClassGuids::Element)) + { + $this->renderElement($ecInst, $displayOptions); + } + else if (strtolower($ecPClass->GlobalIdentifier) == strtolower(KnownClassGuids::TextAttribute)) + { + if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__NotEnterable))) + { + $this->renderTextAttribute($elementContent, $ecInst, $oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ObscuredText))); + } + else + { + // get the default value of the Text Attribute ( the Text Attribute `Value` on the EC text attribute ) + $value = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value)); + echo($value); + } + } + else + { + echo ("unknown pclass ident " . $ecPClass->GlobalIdentifier . ""); + } + echo (""); + $this->renderEndTag("tr"); + } + } + } + + public function renderTextAttribute(InstanceReference $ec, InstanceReference $inst, $password = false) + { + $ecid = $ec->InstanceKey; + echo(""); + } + + public function renderArray(?array $array, string $separator, string $prefix = "", string $suffix = "") + { + if ($array === null) + return ""; + if (\count($array) > 0) + { + return $prefix . \implode($separator, $array) . $suffix; + } + return ""; + } + + public function renderKeyedArray(?array $array, string $separator, string $prefix = "", string $suffix = "", string $partSeparator = "", string $keyPrefix = "", string $keySuffix = "", string $valuePrefix = "", string $valueSuffix = "") + { + if ($array === null) + return ""; + + if (\count($array) > 0) + { + $str = $prefix; + foreach ($array as $key => $value) + { + $str .= $keyPrefix . $key . $keySuffix; + $str .= $partSeparator; + $str .= $valuePrefix . $value . $valueSuffix; + $str .= $separator; + } + $str .= $suffix; + return $str; + } + return ""; + } + + public function renderInitialElement(InstanceReference $element) + { + /** + * @var MySQLDatabaseOms + */ + $oms = mocha_get_oms(); + + $metaCharset = "UTF-8"; + $metaAttributes = []; + $metaAttributes["viewport"] = "width=device-width, initial-scale=1.0"; + + echo (""); + echo (""); + echo (""); + foreach ($metaAttributes as $key => $value) + { + echo (""); + } + echo (""); + echo(""); + echo(""); + echo("
"); + + $DO_Singular = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Singular); + $this->renderElement($element, [ $DO_Singular ]); + + echo("
"); + echo (""); + echo("
"); + echo ("
"); + echo(""); + } + + public function renderBeginTag($tagName, ?array $attributeList = null, ?array $classList = null) + { + echo ("<" . $tagName . $this->renderArray($classList, " ", " class=\"", "\"") . $this->renderKeyedArray($attributeList, " ", " ", "", "=", "", "", "\"", "\"") . ">"); + } + public function renderEndTag($tagName) + { + echo (""); + } + + public function renderElement(InstanceReference $element, array $displayOptions) + { + /** + * @var MySQLDatabaseOms + */ + $oms = mocha_get_oms(); + + if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ShowSubelementsVertically))) + { + $this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-formview", "mcx-element" ]); + + $contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content)); + foreach ($contents as $content) + { + $this->renderElementContent($content); + } + $this->renderEndTag ("table"); + } + else + { + if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Singular))) + { + $contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content)); + foreach ($contents as $content) + { + $this->renderElementContent($content); + } + } + else + { + $this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element" ]); + + $this->renderBeginTag(""); + $contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content)); + foreach ($contents as $content) + { + $this->renderBeginTag(""); + $this->renderElementContent($content); + $this->renderEndTag(""); + } + $this->renderEndTag(""); + + $this->renderEndTag("table"); + } + } + } + + } +?> \ No newline at end of file diff --git a/php/mocha/themes/clearview/uwt-formview.less b/php/mocha/themes/clearview/uwt-formview.less index a291b79..c5b9fa2 100644 --- a/php/mocha/themes/clearview/uwt-formview.less +++ b/php/mocha/themes/clearview/uwt-formview.less @@ -3,11 +3,8 @@ table.uwt-formview > tbody > tr > td margin-bottom: 10px; padding: 6px; } -table.uwt-formview > tbody > tr > td:first-child -{ - font-weight: bold; -} table.uwt-formview > tbody > tr > td:first-child > label { + font-weight: bold; white-space: nowrap; } \ No newline at end of file diff --git a/php/mocha/themes/clearview/main.less b/php/mocha/themes/clearview/uwt.less similarity index 100% rename from php/mocha/themes/clearview/main.less rename to php/mocha/themes/clearview/uwt.less diff --git a/php/mocha/themes/common/styles/mochahacks.less b/php/mocha/themes/common/styles/mochahacks.less index e9d9bab..2986fe0 100644 --- a/php/mocha/themes/common/styles/mochahacks.less +++ b/php/mocha/themes/common/styles/mochahacks.less @@ -119,4 +119,28 @@ a.uwt-user-menu-button div.login-container input[type="submit"] { margin-top: 32px; +} + + +div.mcx-elementcontent +{ + display: table-row; + &> * + { + display: table-cell; + margin: 8px; + vertical-align: middle; + } + &> label + { + font-weight: bold; + } +} +div.mcx-element +{ + &.mcx-display-subelements-vertically + { + display: flex; + flex-direction: column; + } } \ No newline at end of file diff --git a/php/mocha/ui/pages/HomePage.phpx b/php/mocha/ui/pages/HomePage.phpx index 487fc7a..23157a6 100644 --- a/php/mocha/ui/pages/HomePage.phpx +++ b/php/mocha/ui/pages/HomePage.phpx @@ -1,6 +1,7 @@ - + + diff --git a/php/mocha/ui/pages/HomePage.phpx.php b/php/mocha/ui/pages/HomePage.phpx.php index ce40888..8028d2d 100644 --- a/php/mocha/ui/pages/HomePage.phpx.php +++ b/php/mocha/ui/pages/HomePage.phpx.php @@ -1,10 +1,22 @@ getInstanceByGlobalIdentifier(KnownInstanceGuids::Element__HomePage); + if ($pageElement === null) + { + print ("could not find element 'HomePage'"); + die(); + } + + if ($this->Page->IsPostback) + { + $renderer->processPostback($pageElement); + } + + $renderer->renderInitialElement($pageElement); + exit(); + + /* mocha_init_spot_timer($this); $this->Page->GetControlByID("litUserNameForUserMenu")->Content = "zq-developer / Developer Generic User"; @@ -20,6 +57,7 @@ $litDashboard->Content = "
" . "
" . "
"; + */ } } diff --git a/php/mocha/ui/pages/LoginPage.phpx.php b/php/mocha/ui/pages/LoginPage.phpx.php index 8e68aaf..f5fea6b 100644 --- a/php/mocha/ui/pages/LoginPage.phpx.php +++ b/php/mocha/ui/pages/LoginPage.phpx.php @@ -2,14 +2,18 @@ namespace Mocha\UI\Pages; use Mocha\Core\KnownAttributeGuids; - use Mocha\Core\KnownClassGuids; use Mocha\Core\KnownInstanceGuids; use Mocha\Core\KnownRelationshipGuids; + + use Mocha\Core\OmsContext; + + use Mocha\UI\Renderers\HTMLRenderer; use Phast\RenderingEventArgs; use Phast\System; use Phast\WebPage; + use Mocha\Oms\MySQLDatabaseOms; class LoginPage extends WebPage { /** @@ -55,15 +59,6 @@ mocha_init_spot_timer($this); - - - $pageElement = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::Element__LoginPage); - if ($pageElement === null) - { - print ("null"); - } - print_r($pageElement); die(); - $path = System::GetVirtualPath(); $tenantName = ""; if ($path[0] == "madi") @@ -74,6 +69,28 @@ { $tenantName = $path[0]; } + $oms->setTenant($oms->getTenantByName($tenantName)); + + $pageElement = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::Element__LoginPage); + if ($pageElement === null) + { + print ("could not find element 'LoginPage'"); + die(); + } + + $context = new OmsContext(); + + $renderer = new HTMLRenderer($context); + + if ($this->Page->IsPostback) + { + $renderer->processPostback($pageElement); + } + + # $contents = $pageElement->getRelatedInstances($oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content)); + $renderer->renderInitialElement($pageElement); + exit(); + $tenant = $oms->getTenantByName($tenantName); if ($tenant === null) { diff --git a/sql/mysql/000-functions/mocha_get_instance_by_global_identifier.sql b/sql/mysql/000-functions/mocha_get_instance_by_global_identifier.sql index c01c4a6..5fcb71d 100644 --- a/sql/mysql/000-functions/mocha_get_instance_by_global_identifier.sql +++ b/sql/mysql/000-functions/mocha_get_instance_by_global_identifier.sql @@ -5,4 +5,4 @@ CREATE FUNCTION mocha_get_instance_by_global_identifier p_global_identifier CHAR(40) ) RETURNS INT -RETURN (SELECT id FROM mocha_instances WHERE tenant_id = mocha_get_current_tenant() AND UPPER(global_identifier) = UPPER(mocha_normalize_uuid(p_global_identifier)) LIMIT 1); \ No newline at end of file +RETURN (SELECT id FROM mocha_instances WHERE tenant_id = mocha_get_current_tenant() AND UPPER(global_identifier) = UPPER(mocha_normalize_uuid(p_global_identifier)) ORDER BY id DESC LIMIT 1); \ No newline at end of file diff --git a/sql/mysql/000-functions/mocha_get_instance_key.sql b/sql/mysql/000-functions/mocha_get_instance_key.sql new file mode 100644 index 0000000..19ef196 --- /dev/null +++ b/sql/mysql/000-functions/mocha_get_instance_key.sql @@ -0,0 +1,14 @@ +DROP FUNCTION IF EXISTS mocha_get_instance_key; + +CREATE FUNCTION mocha_get_instance_key +( + p_inst_id INT +) +RETURNS VARCHAR(50) +BEGIN + RETURN (SELECT CONCAT(class_id, '$', inst_id) FROM mocha_instances WHERE tenant_id = mocha_get_current_tenant() AND id = p_inst_id); +END; + + + + diff --git a/sql/mysql/001-procedures/mocha_get_instance_by_global_identifier.sql b/sql/mysql/001-procedures/mocha_get_instance_by_global_identifier.sql index 302d13a..2691365 100644 --- a/sql/mysql/001-procedures/mocha_get_instance_by_global_identifier.sql +++ b/sql/mysql/001-procedures/mocha_get_instance_by_global_identifier.sql @@ -9,6 +9,7 @@ BEGIN SELECT * FROM mocha_instances WHERE tenant_id = mocha_get_current_tenant() AND UPPER(global_identifier) = UPPER(REPLACE(REPLACE(REPLACE(p_global_identifier, '{', ''), '}', ''), '-', '')) + ORDER BY id DESC LIMIT 1; END; diff --git a/sql/mysql/001-procedures/mocha_get_related_instances.sql b/sql/mysql/001-procedures/mocha_get_related_instances.sql index 09fe927..312a62d 100644 --- a/sql/mysql/001-procedures/mocha_get_related_instances.sql +++ b/sql/mysql/001-procedures/mocha_get_related_instances.sql @@ -27,6 +27,6 @@ BEGIN AND mocha_relationships.source_inst_id = p_src_inst_id AND mocha_relationships.relationship_inst_id = p_rel_inst_id AND mocha_relationships.effective_date <= z_effective_date - ORDER BY mocha_relationships.effective_date ASC; + ORDER BY mocha_relationships.effective_date, mocha_instances.class_id, mocha_instances.inst_id ASC; END; \ No newline at end of file diff --git a/sql/mysql/001-procedures/mocha_prepare_instance.sql b/sql/mysql/001-procedures/mocha_prepare_instance.sql new file mode 100644 index 0000000..9f28bbf --- /dev/null +++ b/sql/mysql/001-procedures/mocha_prepare_instance.sql @@ -0,0 +1,78 @@ +DROP PROCEDURE IF EXISTS mocha_prepare_instance; + +CREATE PROCEDURE mocha_prepare_instance +( + IN p_class_inst_id INT, + IN p_inst_id INT, + IN p_global_identifier CHAR(32), -- the desired global identifier for the newly created instance + IN p_user_inst_id INT, + IN p_effective_date DATETIME, + OUT p_assigned_inst_id INT +) +sp: BEGIN + + DECLARE p_tenant_id INT; + DECLARE next_inst_id INT; + DECLARE p_class_index INT; + + DECLARE z_global_identifier CHAR(32); + DECLARE z_effective_date DATETIME; + + SET p_tenant_id = mocha_get_current_tenant(); + + -- SET p_class_index = (SELECT inst_id FROM mocha_instances WHERE tenant_id = p_tenant_id AND class_id = 1 AND id = p_class_inst_id); + + SET p_class_index = p_class_inst_id; + + -- IF p_class_index IS NULL THEN + + -- SELECT "cannot create an instance of something that is not a Class" AS error_description; + -- LEAVE sp; + + -- END IF; + + SET next_inst_id=mocha_get_next_inst_id(p_class_index); + IF NOT p_inst_id IS NULL THEN + SET next_inst_id = p_inst_id; + END IF; + + IF p_effective_date IS NULL THEN + SET z_effective_date = NOW(); + ELSE + SET z_effective_date = p_effective_date; + END IF; + + IF p_global_identifier IS NULL THEN + SET z_global_identifier=mocha_uuid_v4(); + ELSE + SET z_global_identifier=p_global_identifier; + END IF; + + -- insert record first + INSERT INTO mocha_instances + (tenant_id, class_id, inst_id, global_identifier) + VALUES + (p_tenant_id, p_class_index, next_inst_id, z_global_identifier); + + SET p_assigned_inst_id = LAST_INSERT_ID(); + + -- -- then update relationship: Class.has Instance + -- CALL mocha_assign_relationship + -- ( + -- mocha_get_instance_by_key(1, p_class_index), + -- mocha_get_instance_by_global_identifier('7EB41D3C2AE9488483A4E59441BCAEFB'), + -- mocha_get_instance_by_key(p_class_index, next_inst_id), + -- p_user_inst_id, + -- z_effective_date + -- ); + -- -- then update relationship: Instance.for Class + -- CALL mocha_assign_relationship + -- ( + -- mocha_get_instance_by_key(p_class_index, next_inst_id), + -- mocha_get_instance_by_global_identifier('494D5A6D04BE477B8763E3F57D0DD8C8'), + -- mocha_get_instance_by_key(1, p_class_index), + -- p_user_inst_id, + -- z_effective_date + -- ); + +END;