a whole bunch of ZQ methods work now, yay!

This commit is contained in:
Michael Becker 2024-01-07 01:55:36 -05:00
parent 852a2e7f2b
commit eb3bc62854
23 changed files with 263 additions and 36 deletions

View File

@ -19,11 +19,17 @@ class YAMLLibraryParser (LibraryParser):
def apply_sugar(self):
print("applying syntactic sugar to remaining instances...")
# _instances_also_awaiting_sugar = []
for inst in self._instances_awaiting_sugar:
print("applying sugar from '" + inst["from_file_name"] + "'")
self.load_instance(inst)
print("\n")
# do recursively until we're all out of instances awaiting sugar
# if len(self._instances_awaiting_sugar) > 0:
# self.apply_sugar()
def load_library(self, elem):
print("loading library from elem")

View File

@ -28,6 +28,9 @@
- IDR_Class__has__Object_Source: "{B62F9B81-799B-4ABE-A4AF-29B45347DE54}"
- IDR_Object_Source__for__Class: "{FBB9391D-C4A2-4326-9F85-7801F377253C}"
- IDR_Class__instances_labeled_by__Executable_returning_Attribute: '{c22fc17f-0c92-47dc-9a8b-28db0db68985}'
- IDR_Executable_returning_Attribute__labels_instances_of__Class: '{f4bc604b-cd2a-42bb-9aed-b0282fb77a0a}'
- IDR_Relationship__has_source__Class: "{7FB5D234-042E-45CB-B11D-AD72F8D45BD3}"
- IDR_Class__source_for__Relationship: "{3de784b9-4561-42f0-946f-b1e90d80029e}"
- IDR_Relationship__has_destination__Class: "{F220F1C2-0499-4E87-A32E-BDBF80C1F8A4}"
@ -300,6 +303,9 @@
- 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

@ -2,3 +2,15 @@
- 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}'
- IDM_User__get__User_Name: '{e68ea4d8-da30-4ef7-bddf-5b6d77f9ce60}'
- IDMB_User__get__User_Name: '{0ecb9349-4dfe-49a8-964c-67c0fadc251c}'
- IDM_User__get__User_Name_with_Full_Name: '{43e9c7f6-affb-4fa7-a572-03c6ace04896}'
- IDMB_User__get__User_Name_with_Full_Name: '{bcf591c9-25a3-4080-8ac3-ac5b58143f7b}'
- IDM_User__get__Preferred_Display_Name: '{2febf91e-df60-4615-a15b-fbbe80b148c5}'
- IDMB_User__get__Preferred_Display_Name: '{12cd3f67-095f-488c-9886-c3a0df97d42c}'
- IDM_Common_Text__get__Forward_Slash: '{b727d9f4-42e5-4be2-9411-0f794bfe773e}'
- IDM_Common_Text__get__Single_Space: '{94297e64-f210-4777-bd94-a4a19e5fed2c}'

View File

@ -14,6 +14,8 @@
customTagName: 'defaultTask'
- instance: '&IDR_Class__has_related__Task;'
customTagName: 'relatedTasks'
- instance: '&IDR_Class__instances_labeled_by__Executable_returning_Attribute;'
customTagName: 'instancesLabeledByRAMB'
translations:
- relationship: '&IDR_Class__has_title__Translation;'
values:

View File

@ -204,6 +204,21 @@
siblingRelationshipId: '&IDR_Class__has_default__Task;'
singular: no
- relationship: '&IDR_Class__instances_labeled_by__Executable_returning_Attribute;'
index: 109
sourceClassId: '&IDC_Class;'
type: 'instances labeled by'
destinationClassId: '&IDC_ExecutableReturningAttribute;'
siblingRelationshipId: '&IDR_Executable_returning_Attribute__labels_instances_of__Class;'
singular: yes
- relationship: '&IDR_Executable_returning_Attribute__labels_instances_of__Class;'
index: 110
sourceClassId: '&IDC_ExecutableReturningAttribute;'
type: 'labels instances of'
destinationClassId: '&IDC_Class;'
siblingRelationshipId: '&IDR_Class__instances_labeled_by__Executable_returning_Attribute;'
singular: no
- relationship: '&IDR_Relationship__has_source__Class;'
index: 157
@ -237,6 +252,22 @@
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

@ -10,3 +10,6 @@
values:
- languageInstanceId: '&IDI_Language_English;'
value: 'Method'
relationships:
- instance: '&IDR_Method__for__Class;'
customTagName: 'forClassId'

View File

@ -6,7 +6,14 @@
name: GA - Get Attribute Method
index: 12
customTagName: getAttributeMethod
attributes:
- instance: '&IDA_Verb;'
customTagName: 'verb'
- instance: '&IDA_Name;'
customTagName: 'name'
relationships:
- instance: '&IDR_Method__for__Class;'
customTagName: 'forClassId'
- instance: '&IDR_Get_Attribute_Method__returns__Attribute;'
customTagName: 'returnsAttributeId'

View File

@ -16,6 +16,8 @@
relationships:
- instance: '&IDR_Build_Attribute_Method__returns__Attribute;'
customTagName: 'returnsAttributeId'
- instance: '&IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute;'
customTagName: 'buildsWithAttributes'
- relationship: '&IDR_Build_Attribute_Method__returns__Attribute;'
index: 60

View File

@ -4,6 +4,7 @@
name: System User
index: 39
customTagName: 'user'
instancesLabeledByRAMB: '&IDMB_User__get__User_Name_with_Full_Name;'
attributes:
- instance: '&IDA_UserName;'
customTagName: 'username'

View File

@ -17,6 +17,10 @@
- instance: '&IDR_Assign_Attribute_Method__assigns__Attribute;'
customTagName: 'assignsAttribute'
# hmm... what's this?
# 3$9824 Assignment Method.assigns attribute or relationship from Executable returning Instance Set
# 3$9825 Executable returning Instance Set.returns assign attribute or relationship for Assignment Method
- relationship: '&IDR_Assign_Attribute_Method__uses__Executable_returning_Attribute;'
index: 139
sourceClassId: '&IDC_AssignAttributeMethod;'

View File

@ -0,0 +1,16 @@
---
- library: '&IDL_MochaBaseSystem;'
instances:
- class: '&IDC_ReturnAttributeMethodBinding;'
name: Return Attribute Method Binding
index: 86
customTagName: returnAttributeMethodBinding
inherits: '&IDC_MethodBinding;'
translations:
- relationship: '&IDR_Class__has_title__Translation;'
values:
- languageInstanceId: '&IDI_Language_English;'
value: 'Return Attribute Method Binding'
relationships: # FIXME: remove this when we can properly inherit definitions in zq-python
- instance: '&IDR_Method_Binding__executes__Method;'
customTagName: 'executesMethod'

View File

@ -0,0 +1,8 @@
- library: '&IDL_MochaBaseSystem;'
instances:
- buildAttributeMethod: '&IDM_Common_Text__get__Forward_Slash;'
forClassId: '&IDC_CommonText;'
verb: 'get'
name: 'Forward Slash'
initialValue: '/'
static: yes

View File

@ -0,0 +1,7 @@
- library: '&IDL_MochaBaseSystem;'
instances:
- buildAttributeMethod: '&IDM_Common_Text__get__Single_Space;'
forClassId: '&IDC_CommonText;'
verb: 'get'
name: 'Single Space'
initialValue: ' '

View File

@ -0,0 +1,12 @@
- library: '&IDL_MochaBaseSystem;'
instances:
- returnAttributeMethodBinding: '&IDMB_User__get__Preferred_Display_Name;'
executesMethod: '&IDM_User__get__Preferred_Display_Name;'
- buildAttributeMethod: '&IDM_User__get__Preferred_Display_Name;'
forClassId: '&IDC_User;'
verb: 'get'
name: 'Preferred Display Name'
initialValue: 'Testing Preferred Display Name'

View File

@ -0,0 +1,10 @@
- library: '&IDL_MochaBaseSystem;'
instances:
- returnAttributeMethodBinding: '&IDMB_User__get__User_Name;'
executesMethod: '&IDM_User__get__User_Name;'
- getAttributeMethod: '&IDM_User__get__User_Name;'
forClassId: '&IDC_User;'
verb: 'get'
name: 'User Name'
returnsAttributeId: '&IDA_UserName;'

View File

@ -0,0 +1,19 @@
- library: '&IDL_MochaBaseSystem;'
instances:
- returnAttributeMethodBinding: '&IDMB_User__get__User_Name_with_Full_Name;'
executesMethod: '&IDM_User__get__User_Name_with_Full_Name;'
# User@get User Name with Full Name(BA)*S*P
# Gets a formatted string including both system user name and preferred display full name
# (e.g. `btrevino / Brooke Trevino` )
- buildAttributeMethod: '&IDM_User__get__User_Name_with_Full_Name;'
forClassId: '&IDC_User;'
verb: 'get'
name: 'User Name with Full Name'
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;'

View File

@ -130,6 +130,8 @@ class KnownClassGuids
const ButtonLayout = "6f6338db68e04cc7b257d1b97cf3cb92";
const ImageLayout = "4b1bb7c6168e4ce0b4f876dd5069a80b";
const BuildAttributeMethod = "{e5879955-0093-48c8-8042-813168578af2}";
const GetAttributeMethod = "{c3ecf8c9-597f-417b-ad65-fae0401719c6}";
const GetInstancesMethod = "{0a379314-9d0f-432d-ae59-63194ab32dd3}";
const GetSpecifiedInstancesMethod = "{7794c7d0-b15d-4b23-aa40-63bb3d1f53ac}";

View File

@ -45,7 +45,9 @@ class KnownRelationshipGuids
const Instance_Attribute_String_Component__has__Attribute = "E15D427769FB4F1992DB8D087F361484";
const String_Component__has_source__Method = "1ef1c965e12048beb682aa040573b5fb";
const Class__instance_labeled_by__String = "F52FC851D65548A9B526C5FE0D7A29D2";
// const Class__instance_labeled_by__String = "F52FC851D65548A9B526C5FE0D7A29D2";
const Class__instances_labeled_by__Executable_returning_Attribute = "{c22fc17f-0c92-47dc-9a8b-28db0db68985}";
const Class__has_summary__Report_Field = "D11050AD73764AB784DEE8D0336B74D2";
const Class__has_related__Task = "4D8670E12AF14E7C9C87C910BD7B319B";
@ -92,6 +94,8 @@ class KnownRelationshipGuids
const Validation__has_failure_message__Translation = "E15A97DD2A1D4DC0BD6BA957B63D9802";
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 Get_Attribute_Method__has__Attribute = "5eca9b3fbe754f6e8495781480774833";
const Get_Referenced_Instance_Set_Method__loop_on__Instance_Set = "2978238f7cb04ba38c6f473df782cfef";

View File

@ -106,11 +106,25 @@
{
$query = "SELECT mocha_get_user_by_username(:username);";
$stmt = $this->PDO->prepare($query);
try
{
$result = $stmt->execute(array
(
"username" => $username
));
$values = $stmt->fetch();
}
catch (\PDOException $ex)
{
// this may result in a "String data, right truncated" if we pass in
// text longer than whatever the stored procedure expects; in this case
// we should just treat it as the user doesn't exist and return null
//
// * Note that if any methods actually allow us to create users with names
// * this long, this will prevent them from logging in!
return null;
}
if ($values[0] == null)
return null;

View File

@ -126,6 +126,15 @@
public function getInstanceText($inst)
{
$parentClass = $this->getParentClass($inst);
$instancesLabeledByRAMB = $this->getRelatedInstance($parentClass, KnownRelationshipGuids::Class__instances_labeled_by__Executable_returning_Attribute);
if ($instancesLabeledByRAMB !== null)
{
$context = new OmsContext();
$context->setWorkData($parentClass->GlobalIdentifier->__toString(), $inst);
$text = $this->executeMethod($context, $instancesLabeledByRAMB);
return $text;
}
return $this->getAttributeValue($inst, $this->getInstanceByGlobalIdentifier(KnownAttributeGuids::Name));
}
@ -342,7 +351,38 @@
$methodInstanceClass = $this->getParentClass($methodInstance);
//$context->setWorkData("{d53d7283-92a2-4a62-b8f2-cf0a0b975634}", "blah blah");
if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::Parse(KnownClassGuids::ProcessRelatedUpdatesMethod)))
if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ReturnAttributeMethodBinding)))
{
$methodBindingExecutesMethod = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Method_Binding__executes__Method);
//echo ("RAMB stack: " . $methodInstance->InstanceKey . ":" . $methodBindingExecutesMethod->InstanceKey);
return $this->executeMethod($context, $methodBindingExecutesMethod);
}
else if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::GetAttributeMethod)))
{
$forClass = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Method__for__Class);
$returnsAttribute = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Get_Attribute_Method__has__Attribute);
$targetInstance = $context->workData[$forClass->GlobalIdentifier->__toString()];
return $this->getAttributeValue($targetInstance, $returnsAttribute);
}
else if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::BuildAttributeMethod)))
{
$returnsAttribute = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Build_Attribute_Method__returns__Attribute);
$initialValue = $this->getAttributeValue($methodInstance, KnownAttributeGuids::Value);
$buildsWithAttributes = $this->getRelatedInstances($methodInstance, KnownRelationshipGuids::Build_Attribute_Method__builds_with__Executable_returning_Attribute);
$value = $initialValue;
foreach ($buildsWithAttributes as $buildsWithAttribute)
{
if ($buildsWithAttribute !== null)
{
$value .= $this->executeMethod($context, $buildsWithAttribute);
}
}
return $value;
}
else if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ProcessRelatedUpdatesMethod)))
{
$classForPRU = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Process_Related_Updates_Method__processes_for__Class);
if ($classForPRU !== null)
@ -383,6 +423,10 @@
}
}
}
else
{
trigger_error("unknown method class '" . $methodInstanceClass->GlobalIdentifier . "' [" . $methodInstanceClass->InstanceKey . "]");
}
}
public function is_a(InstanceReference $inst, InstanceReference|string|InstanceKey $what)

View File

@ -1054,11 +1054,13 @@ MSG_EOF);
$rowCount = count($instances);
echo("<!-- nonsingular -->");
// $this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element" ]);
$this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element" ]);
$this->renderBeginTag("div", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element", "uwt-listview-view-details", "uwt-gridlines", "uwt-hottracking" ]);
// $this->renderBeginTag("div", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element", "uwt-listview-view-details", "uwt-gridlines", "uwt-hottracking" ]);
// $this->renderBeginTag("div", [ ], [ "uwt-listview-caption" ]);
$this->renderBeginTag("caption", [ ], [ ]);
$this->renderBeginTag("div", [ ], [ "uwt-listview-caption" ]);
$this->renderTag("span", [ ], [ "uwt-listview-title" ], $title);
$this->renderTag("span", [ ], [ "uwt-listview-item-count" ], $rowCount);
$this->renderTag("span", [ ], [ "uwt-listview-item-count-label" ], "&nbsp;items");
@ -1090,53 +1092,61 @@ MSG_EOF);
$this->renderEndTag("a");
$this->renderEndTag("div");
$this->renderEndTag("div");
// $this->renderEndTag("div");
$this->renderEndTag("caption");
$this->renderBeginTag("div", [], ["uwt-content"]);
//$this->renderBeginTag("div", [], ["uwt-content"]);
$this->renderBeginTag("div", [ ], [ "uwt-listview-column-headers" ]);
//$this->renderBeginTag("div", [ ], [ "uwt-listview-column-headers" ]);
$this->renderBeginTag("thead");
$this->renderBeginTag("tr");
foreach ($contents as $content)
{
$inst = $oms->getRelatedInstance($content, KnownRelationshipGuids::Element_Content__has__Instance);
// $this->renderBeginTag("td");
$this->renderBeginTag("div", [], [ "uwt-listview-column-header"]);
$this->renderBeginTag("th");
//$this->renderBeginTag("div", [], [ "uwt-listview-column-header"]);
echo ($this->get__EC_Override_Label_or_default_Instance_Title(array
(
KnownClassGuids::Instance => $inst,
KnownClassGuids::ElementContent => $content
)));
$this->renderEndTag("div");
// $this->renderEndTag("td");
// $this->renderEndTag("div");
$this->renderEndTag("th");
}
$this->renderEndTag("div");
$this->renderBeginTag("div", [], [ "uwt-listview-items" ]);
// $this->renderBeginTag("tr");
$this->renderEndTag("tr");
$this->renderEndTag("thead");
//$this->renderEndTag("div");
//$this->renderBeginTag("div", [], [ "uwt-listview-items" ]);
$this->renderBeginTag("tbody");
for ($i = 0; $i < $rowCount; $i++)
{
$rowInst = $instances[$i];
$this->renderBeginTag("div", [ ], [ "uwt-listview-item" ]);
$this->renderBeginTag("tr", [ ], [ "uwt-listview-item" ]);
//$this->renderBeginTag("div", [ ], [ "uwt-listview-item" ]);
foreach ($contents as $content)
{
// $this->renderBeginTag("td");
$this->renderBeginTag("div", [], [ "mcx-elementcontent", "uwt-listview-item-column" ]);
$this->renderBeginTag("td");
//$this->renderBeginTag("div", [], [ "mcx-elementcontent", "uwt-listview-item-column" ]);
$this->renderElementContent($content, $rowInst);
$this->renderEndTag("div");
// $this->renderEndTag("td");
//$this->renderEndTag("div");
$this->renderEndTag("td");
}
// $this->renderEndTag("tr");
$this->renderEndTag("div");
$this->renderEndTag("tr");
//$this->renderEndTag("div");
}
$this->renderEndTag("div");
//$this->renderEndTag("div");
$this->renderEndTag("tbody");
$this->renderEndTag("div");
//$this->renderEndTag("div");
// $this->renderEndTag("table");
$this->renderEndTag("div");
$this->renderEndTag("table");
//$this->renderEndTag("div");
}
}

View File

@ -1,9 +1,15 @@
.uwt-listview-caption, .uwt-listview > caption
div.uwt-listview-caption
{
display: flex;
flex-direction: row;
align-items: center;
}
table.uwt-listview
{
border-collapse: collapse;
}
.uwt-listview-caption, .uwt-listview > caption
{
text-align: left;
padding: 8px;
@ -18,6 +24,7 @@
}
&> .uwt-listview-controlbox
{
float: right;
margin-left: auto;
padding-right: 8px;
}