add debug information, additional data to support ordering Build Attribute components, aesthetic improvements

This commit is contained in:
Michael Becker 2024-02-05 13:36:22 -05:00
parent b3abc7e451
commit d89210af74
35 changed files with 446 additions and 107 deletions

View File

@ -1,5 +1,5 @@
from .Normalization import Normalization
from .Guid import Guid
from .core.Guid import Guid
class InstanceCache:

View File

@ -10,7 +10,11 @@ from .operations.StoredProcedureOperation import StoredProcedureOperation
from .Normalization import Normalization
from .Guid import Guid
from .core.Guid import Guid
from .core.KnownClassGuids import IDC_EntityDefinition, IDC_SourceDefinition
from .core.KnownAttributeGuids import *
from .core.KnownRelationshipGuids import *
from .InstanceCache import InstanceCache
from .SQLExpression import SQLExpression
@ -20,6 +24,7 @@ class MochaLibraryManager:
def __init__(self):
self.entityReferences = dict()
self.entityReferenceFileNames = dict()
self.db = None
self._instances = []
self._attOps = []
@ -175,8 +180,47 @@ class MochaLibraryManager:
print (query)
self.db.query(query)
def before_commit(self):
"""
Called before the unstructured information is sorted and written to the database.
---
This is your last chance to add instances, set attributes, and assign
relationships before the compilation is finalized. After this stage, calls made
to modify the compilation are undefined and will almost certainly not do what you
want.
"""
self.write_debug_information()
def write_debug_information(self):
"""
Writes debugging information, such as entity definitions ('&IDC_...;') and source
code definitions (filename, line number, column number, etc.)
"""
print ("preparing debug information (use --no-debug or undefine DEBUG or etc. [NOT IMPLEMENTED] to turn off)")
for key in self.entityReferences:
val = self.entityReferences[key]
gidEntityDefinition = Guid.create()
self.add_instance(IDC_EntityDefinition, gidEntityDefinition, None, None)
self.set_attribute_value(gidEntityDefinition, IDA_Name, key)
self.set_attribute_value(gidEntityDefinition, IDA_Value, val)
gidSourceDefinition = Guid.create()
self.add_instance(IDC_SourceDefinition, gidSourceDefinition, None, None)
self.set_attribute_value(gidSourceDefinition, IDA_DebugDefinitionFileName, self.entityReferenceFileNames[key])
self.assign_relationship(gidEntityDefinition, IDR_Instance__has__Source_Definition, gidSourceDefinition)
# Source Definition.has X
# self.add_instance(KnownClassGuids.CLASS, Guid("{dc0a5dd2-22e0-471f-87cf-a5ef1b764efa}"), 1, index)
# self.assign_relationship(instGid, Guid("{dc0a5dd2-22e0-471f-87cf-a5ef1b764efa}"), targetInstanceId)
def commit(self):
self.before_commit()
# first record all the instances
if not self.process_instance_ops():
return False
@ -216,10 +260,12 @@ class MochaLibraryManager:
print("assigning sibling relationships...")
self.process_relationship_ops(siblingOps)
print("setting creation user...")
cur = self.db.cursor()
# cur.execute("UPDATE mocha_instances SET user_inst_id = mocha_get_instance_by_global_identifier(mocha_normalize_uuid('{B066A54B-B160-4510-A805-436D3F90C2E6}'))")
cur.execute("UPDATE mocha_attributes SET usr_inst_id = mocha_get_instance_by_global_identifier('" + Normalization.normalize_uuid("{B066A54B-B160-4510-A805-436D3F90C2E6}") + "')")
cur.execute("UPDATE mocha_relationships SET user_inst_id = mocha_get_instance_by_global_identifier('" + Normalization.normalize_uuid("{B066A54B-B160-4510-A805-436D3F90C2E6}") + "')")
cur.execute("UPDATE mocha_attributes SET usr_inst_id = " + str(self.instances.get_database_id_by_global_identifier(Guid("{B066A54B-B160-4510-A805-436D3F90C2E6}"))))
cur.execute("UPDATE mocha_relationships SET user_inst_id = " + str(self.instances.get_database_id_by_global_identifier(Guid("{B066A54B-B160-4510-A805-436D3F90C2E6}"))))
# rows = cur.fetchall()
# print(rows)
@ -357,8 +403,9 @@ class MochaLibraryManager:
def exists_entity_reference(self, name):
return name in self.entityReferences
def register_entity_reference(self, name, value):
def register_entity_reference(self, name, value, filename = None):
self.entityReferences[name] = value
self.entityReferenceFileNames[name] = filename
def define_entity_reference(self, name):
return self.entityReferences[name]

View File

@ -1,4 +1,4 @@
from .Guid import Guid
from .core.Guid import Guid
from .Normalization import Normalization
class SQLExpression:

View File

@ -0,0 +1,18 @@
from .Guid import Guid
"""
Represents the Text Attribute `Name`
"""
IDA_Name = Guid("{9153A637-992E-4712-ADF2-B03F0D9EDEA6}")
"""
Represents the Text Attribute `Value`
"""
IDA_Value = Guid("{041DD7FD-2D9C-412B-8B9D-D7125C166FE0}")
"""
Represents the Text Attribute `Debug Definition File Name`
"""
IDA_DebugDefinitionFileName = Guid("{03bf47c7-dc97-43c8-a8c9-c6147bee4e1f}")
IDA_DebugDefinitionLineNumber = Guid("{822be9b7-531d-4aa1-818a-6e4de1609057}")
IDA_DebugDefinitionColumnNumber = Guid("{0f75c750-e738-4410-9b4e-deb422efc7aa}")

View File

@ -0,0 +1,5 @@
from .Guid import Guid
IDC_SourceDefinition = Guid("{5d0b2f03-4886-4ba6-ac3c-8f9612963fa6}")
IDC_EntityDefinition = Guid("{15ffa529-6aab-4f1f-8720-f2534951b045}")

View File

@ -0,0 +1,3 @@
from .Guid import Guid
IDR_Instance__has__Source_Definition = Guid("{57cbc351-0428-47e6-a6db-445e4503abab}")

View File

@ -67,7 +67,7 @@ class YAMLLibraryParser (LibraryParser):
print("duplicate entity definition: '" + key + "'")
exit(1)
self.manager.register_entity_reference(key, entity[key])
self.manager.register_entity_reference(key, entity[key], filename)
def load_instance_with_template(self, elem, template):
(parentCreatorKey, parentInstanceId) = self.find_custom_tag_name(template)

View File

@ -33,6 +33,8 @@
- IDA_IPAddress: '{ADE5A3C3-A84E-4798-BC5B-E08F21380208}'
- IDA_Token: '{da7686b6-3803-4f15-97f6-7f8f3ae16668}'
- IDA_DebugDefinitionFileName: '{03bf47c7-dc97-43c8-a8c9-c6147bee4e1f}'
- IDA_DebugDefinitionLineNumber: '{822be9b7-531d-4aa1-818a-6e4de1609057}'
- IDA_DebugDefinitionColumnNumber: '{0f75c750-e738-4410-9b4e-deb422efc7aa}'
- IDA_DisplayVersionInBadge: '{BE5966A4-C4CA-49A6-B504-B6E8759F392D}'
- IDA_Editable: '{957fd8b3-fdc4-4f35-87d6-db1c0682f53c}'
- IDA_Static: '{9A3A0719-64C2-484F-A55E-22CD4597D9FD}'

View File

@ -314,12 +314,6 @@
- IDR_Control_Transaction_Method__uses__Build_Response_Method_Binding: '{d8f2f0cc-54a2-4004-a383-8c1321495531}'
- IDR_Build_Response_Method_Binding__used_by__Control_Transaction_Method: '{9b83d1f3-6569-4e98-9d88-765684abfd18}'
- IDR_Build_Attribute_Method__returns__Attribute: "{dadbf0f3-7af0-4387-a6b7-a1724a216d88}"
- IDR_Attribute__returned_by__Build_Attribute_Method: "{d5a6062b-2e84-46a1-8f54-da630ef6a48c}"
- IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute: '{bb64cd83-85c2-4c20-82eb-2a5a5ead31f1}'
- IDR_Executable_returning_Attribute__builds_for__Build_Attribute_Method: '{a43525da-c9fb-4d4d-96df-850f3911c31b}'
- 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}"

View File

@ -21,3 +21,4 @@
- IDI_WorkSet_TaskRelatedInstance: '{d3860252-491e-469e-939e-702d56d88063}'
- IDI_WorkSet_InstanceNonsingular: '{d0d58858-7716-489b-bd95-4f3ae1ac05a3}'
- IDI_WorkSet_SiblingRelationship: '{e5d14540-fad5-4ec4-bc08-a695234f3c73}'
- IDI_WorkSet_BuildAttributeMethodComponentNonsingular: '{3db83818-4585-4f53-bdb7-ce7e8f83892b}'

View File

@ -258,22 +258,6 @@
siblingRelationshipId: '&IDR_Relationship__has_destination__Class;'
singular: no
- relationship: '&IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute;'
index: 219
sourceClassId: '&IDC_BuildAttributeMethod;'
type: 'builds with'
destinationClassId: '&IDC_ExecutableReturningAttribute;'
siblingRelationshipId: '&IDR_Executable_returning_Attribute__builds_for__Build_Attribute_Method;'
singular: no
- relationship: '&IDR_Executable_returning_Attribute__builds_for__Build_Attribute_Method;'
index: 220
sourceClassId: '&IDC_ExecutableReturningAttribute;'
type: 'builds for'
destinationClassId: '&IDC_BuildAttributeMethod;'
siblingRelationshipId: '&IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute;'
singular: no
- relationship: '&IDR_Class__has__Instance;'
index: 249
sourceClassId: '&IDC_Class;'

View File

@ -96,3 +96,6 @@
- workSet: '&IDI_WorkSet_SiblingRelationship;'
name: 'Sibling Relationship'
singular: yes
- workSet: '&IDI_WorkSet_BuildAttributeMethodComponentNonsingular;'
name: 'Build Attribute Method Component [Nonsingular]'
singular: no

View File

@ -1,4 +1,19 @@
---
- entityDefinitions:
- IDR_Build_Attribute_Method__returns__Attribute: "{dadbf0f3-7af0-4387-a6b7-a1724a216d88}"
- IDR_Attribute__returned_by__Build_Attribute_Method: "{d5a6062b-2e84-46a1-8f54-da630ef6a48c}"
- IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute: '{bb64cd83-85c2-4c20-82eb-2a5a5ead31f1}'
- IDR_Executable_returning_Attribute__builds_for__Build_Attribute_Method: '{a43525da-c9fb-4d4d-96df-850f3911c31b}'
- IDC_BuildAttributeMethodComponent: '{96460c4a-f719-4933-91d4-480f89d088ec}'
- IDR_Build_Attribute_Method__builds_with__Build_Attribute_Method_Component: '{b4fad1b8-711c-4e84-82d0-e9a9e41e8aa7}'
- IDR_Build_Attribute_Method_Component__builds_for__Build_Attribute_Method: '{f168e31f-c516-443a-b82b-223c969bcf08}'
- IDR_Build_Attribute_Method_Component__uses__Executable_returning_Attribute: '{9d2acd01-5c6d-4a95-b77e-5261ba109540}'
- IDR_Executable_returning_Attribute__used_by__Build_Attribute_Method_Component: '{d043a52a-1571-486f-b8de-000e92b663c6}'
- library: '&IDL_MochaBaseSystem;'
instances:
- class: '&IDC_BuildAttributeMethod;'
@ -32,11 +47,22 @@
customTagName: 'accessModifierId'
- instance: '&IDR_Build_Attribute_Method__returns__Attribute;'
customTagName: 'returnsAttributeId'
- instance: '&IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute;'
- instance: '&IDR_Build_Attribute_Method__builds_with__Build_Attribute_Method_Component;'
customTagName: 'buildsWithAttributes'
customTagNameCreatesInstanceOf: '&IDC_BuildAttributeMethodComponent;'
- instance: '&IDR_Instance__for__Module;'
customTagName: 'moduleId'
- class: '&IDC_BuildAttributeMethodComponent;'
name: 'Build Attribute Method Component'
registerForTemplate: yes
attributes:
- instance: '&IDA_Order;'
customTagName: 'order'
relationships:
- instance: '&IDR_Build_Attribute_Method_Component__uses__Executable_returning_Attribute;'
customTagName: 'executes'
- relationship: '&IDR_Build_Attribute_Method__returns__Attribute;'
index: 60
sourceClassId: '&IDC_BuildAttributeMethod;'
@ -52,3 +78,35 @@
destinationClassId: '&IDC_BuildAttributeMethod;'
siblingRelationshipId: '&IDR_Build_Attribute_Method__returns__Attribute;'
singular: no
- relationship: '&IDR_Build_Attribute_Method__builds_with__Build_Attribute_Method_Component;'
index: 219
sourceClassId: '&IDC_BuildAttributeMethod;'
type: 'builds with'
destinationClassId: '&IDC_BuildAttributeMethodComponent;'
siblingRelationshipId: '&IDR_Build_Attribute_Method_Component__builds_for__Build_Attribute_Method;'
singular: no
- relationship: '&IDR_Build_Attribute_Method_Component__builds_for__Build_Attribute_Method;'
index: 220
sourceClassId: '&IDC_BuildAttributeMethodComponent;'
type: 'builds for'
destinationClassId: '&IDC_BuildAttributeMethod;'
siblingRelationshipId: '&IDR_Build_Attribute_Method__builds_with__Build_Attribute_Method_Component;'
singular: no
- relationship: '&IDR_Build_Attribute_Method_Component__uses__Executable_returning_Attribute;'
index: 227
sourceClassId: '&IDC_BuildAttributeMethodComponent;'
type: 'uses'
destinationClassId: '&IDC_ExecutableReturningAttribute;'
siblingRelationshipId: '&IDR_Executable_returning_Attribute__used_by__Build_Attribute_Method_Component;'
singular: yes
- relationship: '&IDR_Executable_returning_Attribute__used_by__Build_Attribute_Method_Component;'
index: 228
sourceClassId: '&IDC_ExecutableReturningAttribute;'
type: 'used by'
destinationClassId: '&IDC_BuildAttributeMethodComponent;'
siblingRelationshipId: '&IDR_Build_Attribute_Method_Component__uses__Executable_returning_Attribute;'
singular: no

View File

@ -58,6 +58,7 @@
customTagName: 'layout'
- instance: '&IDR_Element_Content__built_from__BEM_Process;'
customTagName: 'builtFromBEMProcess'
customTagNameCreatesInstanceOf: '&IDC_BEMProcess;'
- instance: '&IDR_Derived_Element_Content__update_with__Executable_returning_Work_Data;'
customTagName: 'value'
instances:

View File

@ -0,0 +1,39 @@
- entityDefinitions:
- IDC_SourceDefinition: '{5d0b2f03-4886-4ba6-ac3c-8f9612963fa6}'
- IDR_Instance__has__Source_Definition: '{57cbc351-0428-47e6-a6db-445e4503abab}'
- IDR_Source_Definition__for__Instance: '{4a2fc1bf-29d5-4c39-8489-38ec25e6ae2b}'
- library: '&IDL_MochaBaseSystem;'
instances:
- class: '&IDC_SourceDefinition;'
name: Source Definition
index: 473
attributes:
- instance: '&IDA_DebugDefinitionFileName;'
- instance: '&IDA_DebugDefinitionLineNumber;'
- instance: '&IDA_DebugDefinitionColumnNumber;'
- textAttribute: '&IDA_DebugDefinitionFileName;'
name: 'Source Definition File Name'
- textAttribute: '&IDA_DebugDefinitionLineNumber;'
name: 'Source Definition Line Number'
- textAttribute: '&IDA_DebugDefinitionColumnNumber;'
name: 'Source Definition Column Number'
- relationship: '&IDR_Instance__has__Source_Definition;'
index: 865
sourceClassId: '&IDC_Instance;'
type: 'has'
destinationClassId: '&IDC_SourceDefinition;'
siblingRelationshipId: '&IDR_Source_Definition__for__Instance;'
singular: yes
- relationship: '&IDR_Source_Definition__for__Instance;'
index: 866
sourceClassId: '&IDC_SourceDefinition;'
type: 'for'
destinationClassId: '&IDC_Instance;'
siblingRelationshipId: '&IDR_Instance__has__Source_Definition;'
singular: no

View File

@ -0,0 +1,11 @@
- entityDefinitions:
- IDC_EntityDefinition: '{15ffa529-6aab-4f1f-8720-f2534951b045}'
- library: '&IDL_MochaBaseSystem;'
instances:
- class: '&IDC_EntityDefinition;'
name: Entity Definition
index: 474
attributes:
- instance: '&IDA_Name;'
- instance: '&IDA_Value;'

View File

@ -12,11 +12,16 @@
initialValue: ''
returnsAttributeId: '&IDA_Value;'
buildsWithAttributes:
- instance: '&IDMB_Element_Content__get__Element_Name;'
- instance: '&IDMB_Common_Text__get__Forward_Slash;' #/
- instance: '&IDMB_Element_Content__get__Order;' #a, b, c, etc.
- instance: '&IDMB_Common_Text__get__Forward_Slash;' #/
- instance: '&IDMB_Element_Content__get__Data_Type_Name;'
- order: a
executes: '&IDMB_Element_Content__get__Element_Name;'
- order: b
executes: '&IDMB_Common_Text__get__Forward_Slash;' #/
- order: c
executes: '&IDMB_Element_Content__get__Order;' #a, b, c, etc.
- order: d
executes: '&IDMB_Common_Text__get__Forward_Slash;' #/
- order: e
executes: '&IDMB_Element_Content__get__Data_Type_Name;'
- returnAttributeMethodBinding: '&IDMB_Element_Content__get__Fully_Qualified_Name;'
executesMethod: '&IDM_Element_Content__get__Fully_Qualified_Name;'

View File

@ -12,17 +12,28 @@
initialValue: ''
returnsAttributeId: '&IDA_Value;'
buildsWithAttributes:
- instance: '&IDMB_Method__get__Class_Name;'
- instance: '&IDMB_Common_Text__get__At_Sign;' #@
- instance: '&IDMB_Method__get__Verb;'
- instance: '&IDMB_Common_Text__get__Single_Space;'
- instance: '&IDMB_Method__get__Name;'
- instance: '&IDMB_Common_Text__get__Open_Parenthesis;' #(
- instance: '&IDMB_Method__get__Method_Type;' # GRA, GSI, etc.
- instance: '&IDMB_Common_Text__get__Close_Parenthesis;' #)
- instance: '&IDMB_Method__get__Parms_Qualifier_or_Empty_String;' # *P
- instance: '&IDMB_Method__get__Static_Qualifier_or_Empty_String;' # *S
- instance: '&IDMB_Method__get__Public_Qualifier_or_Empty_String;' #(public)
- order: a
executes: '&IDMB_Method__get__Class_Name;'
- order: b
executes: '&IDMB_Common_Text__get__At_Sign;' #@
- order: c
executes: '&IDMB_Method__get__Verb;'
- order: d
executes: '&IDMB_Common_Text__get__Single_Space;'
- order: e
executes: '&IDMB_Method__get__Name;'
- order: f
executes: '&IDMB_Common_Text__get__Open_Parenthesis;' #(
- order: g
executes: '&IDMB_Method__get__Method_Type;' # GRA, GSI, etc.
- order: h
executes: '&IDMB_Common_Text__get__Close_Parenthesis;' #)
- order: i
executes: '&IDMB_Method__get__Parms_Qualifier_or_Empty_String;' # *P
- order: j
executes: '&IDMB_Method__get__Static_Qualifier_or_Empty_String;' # *S
- order: k
executes: '&IDMB_Method__get__Public_Qualifier_or_Empty_String;' #(public)
- returnAttributeMethodBinding: '&IDMB_Method__get__Fully_Qualified_Name;'
executesMethod: '&IDM_Method__get__Fully_Qualified_Name;'

View File

@ -81,10 +81,14 @@
initialValue: ''
returnsAttributeId: '&IDA_Value;'
buildsWithAttributes:
- instance: '&IDMB_Method_Binding__get__Executes_Method_Name;'
- instance: '&IDMB_Common_Text__get__Open_Bracket;'
- instance: '&IDA_MethodBindingType;'
- instance: '&IDMB_Common_Text__get__Close_Bracket;'
- order: a
executes: '&IDMB_Method_Binding__get__Executes_Method_Name;'
- order: b
executes: '&IDMB_Common_Text__get__Open_Bracket;'
- order: c
executes: '&IDA_MethodBindingType;'
- order: d
executes: '&IDMB_Common_Text__get__Close_Bracket;'
- returnAttributeMethodBinding: '&IDMB_Method_Binding__get__Executes_Method_and_Method_Type_RAMB;'
executesMethod: '&IDM_Method_Binding__get__Executes_Method_and_Method_Type;'

View File

@ -12,11 +12,16 @@
initialValue: ''
returnsAttributeId: '&IDA_Value;'
buildsWithAttributes:
- instance: '&IDMB_Relationship__get__Source_Class_Name;'
- instance: '&IDMB_Common_Text__get__Period;' #.
- instance: '&IDMB_Relationship__get__Relationship_Type;' #has, for, etc.
- instance: '&IDMB_Common_Text__get__Single_Space;'
- instance: '&IDMB_Relationship__get__Destination_Class_Name;'
- order: a
executes: '&IDMB_Relationship__get__Source_Class_Name;'
- order: b
executes: '&IDMB_Common_Text__get__Period;' #.
- order: c
executes: '&IDMB_Relationship__get__Relationship_Type;' #has, for, etc.
- order: d
executes: '&IDMB_Common_Text__get__Single_Space;'
- order: e
executes: '&IDMB_Relationship__get__Destination_Class_Name;'
- returnAttributeMethodBinding: '&IDMB_Relationship__get__Fully_Qualified_Name;'
executesMethod: '&IDM_Relationship__get__Fully_Qualified_Name;'

View File

@ -42,7 +42,7 @@
singular: yes
- getReferencedAttributeMethod: '&IDM_User__get__Preferred_Display_Name_-_Given_Name;'
forClassId: '&IDC_PersonName;'
forClassId: '&IDC_User;'
returnsAttributeId: '&IDA_Value;'
verb: 'get'
name: 'Preferred Display Name - Given Name'
@ -54,7 +54,7 @@
executesMethod: '&IDM_User__get__Preferred_Display_Name_-_Given_Name;'
- getReferencedAttributeMethod: '&IDM_User__get__Preferred_Display_Name_-_Family_Name;'
forClassId: '&IDC_PersonName;'
forClassId: '&IDC_User;'
returnsAttributeId: '&IDA_Value;'
verb: 'get'
name: 'Preferred Display Name - Family Name'
@ -73,6 +73,9 @@
returnsAttributeId: '&IDA_Value;'
initialValue: ''
buildsWithAttributes:
- instance: '&IDMB_User__get__Preferred_Display_Name_-_Given_Name;'
- instance: '&IDM_Common_Text__get__Single_Space;'
- instance: '&IDMB_User__get__Preferred_Display_Name_-_Family_Name;'
- order: a
executes: '&IDMB_User__get__Preferred_Display_Name_-_Given_Name;'
- order: b
executes: '&IDM_Common_Text__get__Single_Space;'
- order: c
executes: '&IDMB_User__get__Preferred_Display_Name_-_Family_Name;'

View File

@ -14,8 +14,13 @@
returnsAttributeId: '&IDA_Value;'
initialValue: ''
buildsWithAttributes:
- instance: '&IDMB_User__get__User_Name;'
- instance: '&IDM_Common_Text__get__Single_Space;'
- instance: '&IDM_Common_Text__get__Forward_Slash;'
- instance: '&IDM_Common_Text__get__Single_Space;'
- instance: '&IDMB_User__get__Preferred_Display_Name_Formatted;'
- order: a
executes: '&IDMB_User__get__User_Name;'
- order: b
executes: '&IDM_Common_Text__get__Single_Space;'
- order: c
executes: '&IDM_Common_Text__get__Forward_Slash;'
- order: d
executes: '&IDM_Common_Text__get__Single_Space;'
- order: e
executes: '&IDMB_User__get__Preferred_Display_Name_Formatted;'

View File

@ -5,6 +5,10 @@
- IDE_BuildAttributeMethod_Edit: '{9e6e7b88-412e-4b31-b943-72003bd48533}'
- IDE_BuildAttributeMethod_Implementation: '{4bbbad38-54b9-4c37-ba51-c9595e0f1542}'
- IDE_BuildAttributeMethod: '{263dacea-c414-4a88-9820-8931aa448494}'
- IDE_BuildAttributeMethod_Components: '{4526f7aa-66b6-4c67-a98b-01b9d5dc3167}'
- IDM_Build_Attribute_Method__get__Build_Attribute_Method_Components: '{37fba2f0-a7e3-4d2c-918b-745e29871274}'
- IDMB_Build_Attribute_Method__get__Build_Attribute_Method_Components: '{cc13b993-f177-4323-9941-229de827108d}'
- library: '&IDL_MochaBaseSystem;'
instances:
@ -56,6 +60,20 @@
- instance: '&IDI_DisplayOption_Singular;'
- instance: '&IDI_DisplayOption_ShowSubelementsVertically;'
- getReferencedInstanceSetMethod: '&IDM_Build_Attribute_Method__get__Build_Attribute_Method_Components;'
# initialValue: 'Method Example@get Dummy Method Name (BA)*S*P(public)'
forClassId: '&IDC_BuildAttributeMethod;'
returnsWorkSetId: '&IDI_WorkSet_BuildAttributeMethodComponentNonsingular;'
verb: 'get'
name: 'Build Attribute Method Components'
accessModifierId: '&IDI_AccessModifier_RootA2;'
referenceInstanceSet: '&IDC_BuildAttributeMethod;'
answerInstanceSet: '&IDR_Build_Attribute_Method__builds_with__Build_Attribute_Method_Component;'
singular: no
- returnInstanceSetMethodBinding: '&IDMB_Build_Attribute_Method__get__Build_Attribute_Method_Components;'
executesMethod: '&IDM_Build_Attribute_Method__get__Build_Attribute_Method_Components;'
- element: '&IDE_BuildAttributeMethod_Implementation;'
name: 'ba subedit'
label: 'Method Implementation'
@ -69,6 +87,25 @@
label: 'Returns Attribute'
order: b
- globalIdentifier: '{03ac7e75-b1be-4700-baa6-23caeb3ddbff}'
defaultDataType: '&IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute;'
defaultDataType: '&IDE_BuildAttributeMethod_Components;'
label: 'Builds with Attributes from RAMBs'
order: c
builtFromBEMProcess:
- globalIdentifier: '{251d2c93-7538-4461-8f64-2e0efb14af96}'
loopExecutableReturningInstanceSet: '&IDMB_Build_Attribute_Method__get__Build_Attribute_Method_Components;'
- element: '&IDE_BuildAttributeMethod_Components;'
name: 'ba components'
label: 'Components'
elementContents:
- globalIdentifier: '{f126ae0f-6a40-45dc-8c7c-13fcf0b6c315}'
defaultDataType: '&IDC_BuildAttributeMethodComponent;'
label: 'Build Attribute Method Component'
displayOptions:
- instance: '&IDI_DisplayOption_DoNotShow;'
- globalIdentifier: '{7d64ed5d-b254-46cb-987b-bc2e674f34cb}'
defaultDataType: '&IDR_Build_Attribute_Method_Component__uses__Executable_returning_Attribute;'
label: 'Executes RAMB'
- globalIdentifier: '{483ece00-7e5e-42da-81f2-53993d99f9e2}'
defaultDataType: '&IDA_Order;'
label: 'Order'

View File

@ -2,10 +2,10 @@
- IDI_Task_ViewReturnAttributeMethodBinding: '{9d4b8259-1141-4b83-8a02-8b3b269fb1d3}'
- IDE_ReturnAttributeMethodBinding_View_Start: '{c91702c7-2199-4106-9be9-aa829e8b1044}'
- IDM_ReturnAttributeMethodBinding_View_Start: '{92d66fcb-e73b-4f09-913b-1d774193153c}'
- IDM_ReturnAttributeMethodBinding_View_Start: '{034b1dde-0ed2-491f-ad92-6d69b9316025}'
- IDE_ReturnAttributeMethodBinding_View: '{9321f1a4-b4a1-4111-a506-a086d255466d}'
- IDM_ReturnAttributeMethodBinding_View: '{92d66fcb-e73b-4f09-913b-1d774193153c}'
- IDM_ReturnAttributeMethodBinding_View: '{2e26929c-0f1f-4ace-8650-d73c57ed872f}'
- IDMB_ReturnAttributeMethodBinding_View: '{4700ff7c-bff2-43b8-b9c9-82007b657523}'
- library: '&IDL_MochaBaseSystem;'

View File

@ -12,19 +12,32 @@
initialValue: ''
returnsAttributeId: '&IDA_Value;'
buildsWithAttributes:
- instance: '&IDMB_Product__get__Product_Code;' # 123456
- instance: '&IDMB_Common_Text__get__Single_Space;' # ' '
- instance: '&IDMB_Product__get__Manufacturer_Name;' # Paper Mate
- instance: '&IDMB_Common_Text__get__Single_Space;' # ' '
- instance: '&IDMB_Product__get__Brand_Name;' # FlexGrip Ultra
- instance: '&IDMB_Common_Text__get__Single_Space;' # ' '
- instance: '&IDMB_Product__get__Product_Style_Name;' # Retractable
- instance: '&IDMB_Common_Text__get__Single_Space;' # ' '
- instance: '&IDMB_Product__get__Product_Color_Name;' # Blue
- instance: '&IDMB_Common_Text__get__Single_Space;' # ' '
- instance: '&IDMB_Product__get__Product_Type_Name;' # Ballpoint Pen
- instance: '&IDMB_Common_Text__get__Single_Space;' # ' '
- instance: '&IDMB_Product__get__Additional_Details;'
- order: a
executes: '&IDMB_Product__get__Product_Code;' # 123456
- order: b
executes: '&IDMB_Common_Text__get__Single_Space;' # ' '
- order: c
executes: '&IDMB_Product__get__Manufacturer_Name;' # Paper Mate
- order: d
executes: '&IDMB_Common_Text__get__Single_Space;' # ' '
- order: e
executes: '&IDMB_Product__get__Brand_Name;' # FlexGrip Ultra
- order: f
executes: '&IDMB_Common_Text__get__Single_Space;' # ' '
- order: g
executes: '&IDMB_Product__get__Product_Style_Name;' # Retractable
- order: h
executes: '&IDMB_Common_Text__get__Single_Space;' # ' '
- order: i
executes: '&IDMB_Product__get__Product_Color_Name;' # Blue
- order: j
executes: '&IDMB_Common_Text__get__Single_Space;' # ' '
- order: k
executes: '&IDMB_Product__get__Product_Type_Name;' # Ballpoint Pen
- order: l
executes: '&IDMB_Common_Text__get__Single_Space;' # ' '
- order: m
executes: '&IDMB_Product__get__Additional_Details;'
- returnAttributeMethodBinding: '&IDMB_Product__get__Calculated_Description;'
executesMethod: '&IDM_Product__get__Calculated_Description;'

View File

@ -104,7 +104,9 @@ class KnownRelationshipGuids
const Translation__failure_message_for__Validation = "46a7dfcb884847d59ad3d27fbd8b423f";
const Build_Attribute_Method__returns__Attribute = "{dadbf0f3-7af0-4387-a6b7-a1724a216d88}";
const Build_Attribute_Method__builds_with__Executable_returning_Attribute = "{bb64cd83-85c2-4c20-82eb-2a5a5ead31f1}";
# const Build_Attribute_Method__builds_with__Executable_returning_Attribute = "{bb64cd83-85c2-4c20-82eb-2a5a5ead31f1}";
const Build_Attribute_Method__builds_with__Build_Attribute_Method_Component = "{b4fad1b8-711c-4e84-82d0-e9a9e41e8aa7}";
const Build_Attribute_Method_Component__uses__Executable_returning_Attribute = "{9d2acd01-5c6d-4a95-b77e-5261ba109540}";
const Get_Attribute_Method__has__Attribute = "5eca9b3fbe754f6e8495781480774833";
const Get_Referenced_Instance_Set_Method__returns__Work_Set = "{72057f5b-9b49-497d-852f-cd7e5e258d6c}";

View File

@ -410,7 +410,7 @@
* !Remove when we can figure out a solution to the duplicate instance problem
* !(DUPLICATEINSTANCES)
*/
public $HACK__IncludeDuplicateInstances = false;
// public $HACK__IncludeDuplicateInstances = false;
protected function getRelatedInstancesInternal(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?array
{
@ -497,6 +497,7 @@
// ! We cannot do duplicate instances AND single line removal of instances
// ! because we would not have a way to determine which *index* of instance
// ! was removed!
/*
if ($this->HACK__IncludeDuplicateInstances)
{
$ret[] = $ir;
@ -514,14 +515,26 @@
$ret[$ir->GlobalIdentifier->__toString()] = $ir;
}
}
*/
if ($value["remove_flag"] == 1)
{
unset($ret[$ir->GlobalIdentifier->__toString()]);
}
else
{
//echo($retval->GlobalIdentifier->__toString() . "\n");
// $ret[$retval->GlobalIdentifier->__toString()] = $retval;
$ret[$ir->GlobalIdentifier->__toString()] = $ir;
}
}
}
/*
if ($this->HACK__IncludeDuplicateInstances)
{
$this->MetadataExceptions["MX_DUPLICATEINSTANCES_HACK"] = new OmsMetadataException("An element on this page uses the (DUPLICATEINSTANCES) hack", [ "Source" => "getRelatedInstancesInternal" ], null, OmsMetadataExceptionSeverity::Warning);
return $ret;
}
*/
//$this->_relatedInstancesCache[$sourceInstance->DatabaseId][$relationshipInstance->DatabaseId] = $ret;
return array_values($ret);
}

View File

@ -7,6 +7,7 @@
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oop\MethodImplementation;
use Phast\QuickSort;
class BuildAttributeMethodImplementation extends MethodImplementation
{
@ -14,15 +15,29 @@
{
$returnsAttribute = $oms->getRelatedInstance($method, KnownRelationshipGuids::Build_Attribute_Method__returns__Attribute);
$initialValue = $oms->getAttributeValue($method, KnownAttributeGuids::Value);
$oms->HACK__IncludeDuplicateInstances = true;
$buildsWithAttributes = $oms->getRelatedInstances($method, KnownRelationshipGuids::Build_Attribute_Method__builds_with__Executable_returning_Attribute);
$oms->HACK__IncludeDuplicateInstances = false;
$buildsWithAttributes = $oms->getRelatedInstances($method, KnownRelationshipGuids::Build_Attribute_Method__builds_with__Build_Attribute_Method_Component);
$value = $initialValue;
foreach ($buildsWithAttributes as $buildsWithAttribute)
$qs = new QuickSort();
$sortedAttributes = $qs->Sort_By($buildsWithAttributes, function($item)
{
$oms = mocha_get_oms();
$order = $oms->getAttributeValue($item, KnownAttributeGuids::Order);
return $order;
});
foreach ($sortedAttributes as $buildsWithAttribute)
{
$baExecutesMethod = $oms->getRelatedInstance($buildsWithAttribute, KnownRelationshipGuids::Build_Attribute_Method_Component__uses__Executable_returning_Attribute);
$attr = null;
if ($baExecutesMethod !== null)
{
$attr = $oms->execute($context, $baExecutesMethod);
}
else
{
$attr = $oms->execute($context, $buildsWithAttribute);
}
// echo ("value of `" . $attr->InstanceKey . "` is '" . $context->getWorkData($attr) . "'");
if ($attr !== null)
{

View File

@ -1662,7 +1662,7 @@
private function renderOmsMetadataExceptions(array $array, string $title, string $singularName, string $pluralName, string $colorClass)
{
echo("<div class=\"uwt-alert uwt-alert-sticky " . $colorClass . " uwt-collapsible uwt-collapsed\">");
echo("<div class=\"uwt-alert uwt-alert-sticky " . $colorClass . " uwt-collapsible uwt-collapsed uwt-disabled\">");
echo("<div class=\"uwt-icon\" title=\"" . count($array) . " " . ($array == 1 ? $singularName : $pluralName) . "\">&nbsp;</div>");
echo("<div class=\"uwt-title\">" . $title . "</div>");
echo("<div class=\"uwt-badge\">" . count($array) . "</div>");
@ -2285,6 +2285,7 @@
$this->renderBeginTag("tr", [ ], [ "uwt-listview-item" ]);
//$this->renderBeginTag("div", [ ], [ "uwt-listview-item" ]);
echo("<!-- " . $rowInst . " -->");
$this->renderBeginTag("td", [ ], [ "uwt-listview-row-buttons" ]);
$this->renderBeginTag("a", [ "href" => "#" ], [ "uwt-listview-row-add" ]);

View File

@ -0,0 +1,37 @@
@media (max-width: 800px)
{
body
{
&> div.uwt-header, &> form > div.uwt-header
{
&> div.uwt-header-item
{
&.uwt-searchbar
{
&:not(:focus-within)
{
&::before
{
color: #4e5155;
font-size: 16pt;
top: 6px;
}
&:hover
{
cursor: pointer;
&::before
{
color: #fff;
}
}
}
input:not(:focus)
{
width: 32px;
background: transparent;
}
}
}
}
}
}

View File

@ -1,2 +1,3 @@
@import "uwt-htmlheading.less";
@import "uwt-formview.less";
@import "uwt-searchbar.less";

View File

@ -60,6 +60,7 @@ div.uwt-alert
content: "\f0a8";
}
}
&.uwt-color-danger
{
//.AlertColor2(#4d1b1a, #ffcecd, #ffcecd);
@ -92,6 +93,8 @@ div.uwt-alert
}
}
}
&:not(.uwt-disabled)
{
&.uwt-color-success
{
.AlertColor2(#ffffff, #00acac, #008181);
@ -108,4 +111,12 @@ div.uwt-alert
{
.AlertColor(@ThemeColorInfo);
}
}
&.uwt-disabled
{
color: #999;
background: #ccc;
border-color: #999;
}
}

View File

@ -37,6 +37,8 @@ body
margin-left: -16px;
left: 28px;
top: 10px;
pointer-events: none;
}
input
{

View File

@ -74,4 +74,12 @@ div.uwt-alert
overflow: clip;
overflow-y: scroll;
}
&.uwt-disabled
{
&> div.uwt-badge
{
display: none;
}
}
}