major push
This commit is contained in:
parent
7cbade84e1
commit
026cf2defa
@ -30,6 +30,37 @@ class MochaLibraryManager:
|
|||||||
for op in self._operations:
|
for op in self._operations:
|
||||||
op.execute(self.db)
|
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`...")
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
self.db.commit()
|
self.db.commit()
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
|||||||
@ -15,162 +15,3 @@
|
|||||||
- language: '&IDI_Language_English;'
|
- language: '&IDI_Language_English;'
|
||||||
- value: 'Class'
|
- value: 'Class'
|
||||||
|
|
||||||
- relationship: '&IDR_Class__has__Attribute;'
|
|
||||||
index: 1
|
|
||||||
sourceClassId: '&IDC_Class;'
|
|
||||||
type: 'has'
|
|
||||||
destinationClassId: '&IDC_Attribute;'
|
|
||||||
siblingRelationshipId: '&IDR_Attribute__for__Class;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Attribute__for__Class;'
|
|
||||||
index: 2
|
|
||||||
sourceClassId: '&IDC_Attribute;'
|
|
||||||
type: 'for'
|
|
||||||
destinationClassId: '&IDC_Class;'
|
|
||||||
siblingRelationshipId: '&IDR_Class__has__Attribute;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Class__has__Relationship;'
|
|
||||||
index: 3
|
|
||||||
sourceClassId: '&IDC_Class;'
|
|
||||||
type: 'has'
|
|
||||||
destinationClassId: '&IDC_Relationship;'
|
|
||||||
siblingRelationshipId: '&IDR_Relationship__for__Class;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Relationship__for__Class;'
|
|
||||||
index: 4
|
|
||||||
sourceClassId: '&IDC_Relationship;'
|
|
||||||
type: 'for'
|
|
||||||
destinationClassId: '&IDC_Class;'
|
|
||||||
siblingRelationshipId: '&IDR_Class__has__Attribute;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Relationship__has_sibling__Relationship;'
|
|
||||||
index: 5
|
|
||||||
sourceClassId: '&IDC_Relationship;'
|
|
||||||
type: 'has sibling'
|
|
||||||
destinationClassId: '&IDC_Relationship;'
|
|
||||||
siblingRelationshipId: '&IDR_Relationship__is_sibling__Relationship;'
|
|
||||||
singular: yes
|
|
||||||
|
|
||||||
- relationship: '&IDR_Relationship__is_sibling__Relationship;'
|
|
||||||
index: 6
|
|
||||||
sourceClassId: '&IDC_Relationship;'
|
|
||||||
type: 'is sibling'
|
|
||||||
destinationClassId: '&IDC_Relationship;'
|
|
||||||
siblingRelationshipId: '&IDR_Relationship__has_sibling__Relationship;'
|
|
||||||
singular: yes
|
|
||||||
|
|
||||||
- relationship: '&IDR_Class__has_super__Class;'
|
|
||||||
index: 7
|
|
||||||
sourceClassId: '&IDC_Class;'
|
|
||||||
type: 'has super'
|
|
||||||
destinationClassId: '&IDC_Class;'
|
|
||||||
siblingRelationshipId: '&IDR_Class__has_sub__Class;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Class__has_sub__Class;'
|
|
||||||
index: 8
|
|
||||||
sourceClassId: '&IDC_Class;'
|
|
||||||
type: 'has sub'
|
|
||||||
destinationClassId: '&IDC_Class;'
|
|
||||||
siblingRelationshipId: '&IDR_Class__has_super__Class;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Work_Set__has_valid__Class;'
|
|
||||||
index: 9
|
|
||||||
sourceClassId: '&IDC_WorkSet;'
|
|
||||||
type: 'has valid'
|
|
||||||
destinationClassId: '&IDC_Class;'
|
|
||||||
siblingRelationshipId: '&IDR_Class__valid_for__Work_Set;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Class__valid_for__Work_Set;'
|
|
||||||
index: 10
|
|
||||||
sourceClassId: '&IDC_Class;'
|
|
||||||
type: 'valid for'
|
|
||||||
destinationClassId: '&IDC_WorkSet;'
|
|
||||||
siblingRelationshipId: '&IDR_Work_Set__has_valid__Class;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Control_Transaction_Method__processes__Element;'
|
|
||||||
index: 11
|
|
||||||
sourceClassId: '&IDC_ControlTransactionMethod;'
|
|
||||||
type: 'processes'
|
|
||||||
destinationClassId: '&IDC_Element;'
|
|
||||||
siblingRelationshipId: '&IDR_Element__processed_by__Control_Transaction_Method;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Element__processed_by__Control_Transaction_Method;'
|
|
||||||
index: 12
|
|
||||||
sourceClassId: '&IDC_Element;'
|
|
||||||
type: 'processed by'
|
|
||||||
destinationClassId: '&IDC_ControlTransactionMethod;'
|
|
||||||
siblingRelationshipId: '&IDR_Control_Transaction_Method__processes__Element;'
|
|
||||||
singular: yes
|
|
||||||
|
|
||||||
#- relationship: '&IDR_Element__has_text_node_value__Attribute;'
|
|
||||||
# index: 13,
|
|
||||||
# sourceClassId: '&IDC_Element;'
|
|
||||||
# type: 'has text node value'
|
|
||||||
# destinationClassId: '&IDC_Attribute;'
|
|
||||||
# siblingRelationshipId: '&IDR_Element__processed_by__Control_Transaction_Method;'
|
|
||||||
# singular: yes
|
|
||||||
|
|
||||||
# - relationship: '&IDR_Attribute__is_text_node_value_for__Element;'
|
|
||||||
# index: 14,
|
|
||||||
# sourceClassId: '&IDC_Attribute;'
|
|
||||||
# type: 'is text node value for'
|
|
||||||
# destinationClassId: '&IDC_Element;'
|
|
||||||
# siblingRelationshipId: '&IDR_Element__has_text_node_value__Attribute;'
|
|
||||||
# singular: yes
|
|
||||||
|
|
||||||
- relationship: '&IDR_Class__has__Method;'
|
|
||||||
index: 15
|
|
||||||
sourceClassId: '&IDC_Class;'
|
|
||||||
type: 'has'
|
|
||||||
destinationClassId: '&IDC_Method;'
|
|
||||||
siblingRelationshipId: '&IDR_Method__for__Class;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
- relationship: '&IDR_Method__for__Class;'
|
|
||||||
index: 16
|
|
||||||
sourceClassId: '&IDC_Method;'
|
|
||||||
type: 'for'
|
|
||||||
destinationClassId: '&IDC_Class;'
|
|
||||||
siblingRelationshipId: '&IDR_Class__has__Method;'
|
|
||||||
singular: no
|
|
||||||
|
|
||||||
# - relationship: '&IDR_Class__has_implementation__Method;'
|
|
||||||
# index: 17,
|
|
||||||
# sourceClassId: '&IDC_Class;'
|
|
||||||
# type: 'has implementation'
|
|
||||||
# destinationClassId: '&IDC_Method;'
|
|
||||||
# siblingRelationshipId: '&IDR_Method__implements_for__Class;'
|
|
||||||
# singular: no
|
|
||||||
|
|
||||||
# - relationship: '&IDR_Method__implements_for__Class;'
|
|
||||||
# index: 18,
|
|
||||||
# sourceClassId: '&IDC_Method;'
|
|
||||||
# type: 'implements for'
|
|
||||||
# destinationClassId: '&IDC_Class;'
|
|
||||||
# siblingRelationshipId: '&IDR_Class__has_implementation__Method;'
|
|
||||||
# singular: yes
|
|
||||||
|
|
||||||
# - relationship: '&IDR_Method__implements__Method;'
|
|
||||||
# index: 19
|
|
||||||
# sourceClassId: '&IDC_Method;'
|
|
||||||
# type: 'implements'
|
|
||||||
# destinationClassId: '&IDC_Method;'
|
|
||||||
# siblingRelationshipId: '&IDR_Method__implemented_by__Method;'
|
|
||||||
# singular: no
|
|
||||||
|
|
||||||
# - relationship: '&IDR_Method__implemented_by__Method;'
|
|
||||||
# index: 20,
|
|
||||||
# sourceClassId: '&IDC_Method;'
|
|
||||||
# type: 'implemented by'
|
|
||||||
# destinationClassId: '&IDC_Method;'
|
|
||||||
# siblingRelationshipId: '&IDR_Method__implements__Method;'
|
|
||||||
# singular: no
|
|
||||||
|
|||||||
@ -23,4 +23,181 @@
|
|||||||
- instance: '&IDR_Relationship__has_destination__Class;'
|
- instance: '&IDR_Relationship__has_destination__Class;'
|
||||||
customTagName: 'destinationClassId'
|
customTagName: 'destinationClassId'
|
||||||
- instance: '&IDR_Relationship__has_sibling__Relationship;'
|
- instance: '&IDR_Relationship__has_sibling__Relationship;'
|
||||||
customTagName: 'siblingRelationshipId'
|
customTagName: 'siblingRelationshipId'
|
||||||
|
|
||||||
|
|
||||||
|
- relationship: '&IDR_Class__has__Attribute;'
|
||||||
|
index: 1
|
||||||
|
sourceClassId: '&IDC_Class;'
|
||||||
|
type: 'has'
|
||||||
|
destinationClassId: '&IDC_Attribute;'
|
||||||
|
siblingRelationshipId: '&IDR_Attribute__for__Class;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Attribute__for__Class;'
|
||||||
|
index: 2
|
||||||
|
sourceClassId: '&IDC_Attribute;'
|
||||||
|
type: 'for'
|
||||||
|
destinationClassId: '&IDC_Class;'
|
||||||
|
siblingRelationshipId: '&IDR_Class__has__Attribute;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Class__has__Relationship;'
|
||||||
|
index: 3
|
||||||
|
sourceClassId: '&IDC_Class;'
|
||||||
|
type: 'has'
|
||||||
|
destinationClassId: '&IDC_Relationship;'
|
||||||
|
siblingRelationshipId: '&IDR_Relationship__for__Class;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Relationship__for__Class;'
|
||||||
|
index: 4
|
||||||
|
sourceClassId: '&IDC_Relationship;'
|
||||||
|
type: 'for'
|
||||||
|
destinationClassId: '&IDC_Class;'
|
||||||
|
siblingRelationshipId: '&IDR_Class__has__Attribute;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Relationship__has_sibling__Relationship;'
|
||||||
|
index: 5
|
||||||
|
sourceClassId: '&IDC_Relationship;'
|
||||||
|
type: 'has sibling'
|
||||||
|
destinationClassId: '&IDC_Relationship;'
|
||||||
|
siblingRelationshipId: '&IDR_Relationship__is_sibling__Relationship;'
|
||||||
|
singular: yes
|
||||||
|
|
||||||
|
- relationship: '&IDR_Relationship__is_sibling__Relationship;'
|
||||||
|
index: 6
|
||||||
|
sourceClassId: '&IDC_Relationship;'
|
||||||
|
type: 'is sibling'
|
||||||
|
destinationClassId: '&IDC_Relationship;'
|
||||||
|
siblingRelationshipId: '&IDR_Relationship__has_sibling__Relationship;'
|
||||||
|
singular: yes
|
||||||
|
|
||||||
|
- relationship: '&IDR_Class__has_super__Class;'
|
||||||
|
index: 7
|
||||||
|
sourceClassId: '&IDC_Class;'
|
||||||
|
type: 'has super'
|
||||||
|
destinationClassId: '&IDC_Class;'
|
||||||
|
siblingRelationshipId: '&IDR_Class__has_sub__Class;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Class__has_sub__Class;'
|
||||||
|
index: 8
|
||||||
|
sourceClassId: '&IDC_Class;'
|
||||||
|
type: 'has sub'
|
||||||
|
destinationClassId: '&IDC_Class;'
|
||||||
|
siblingRelationshipId: '&IDR_Class__has_super__Class;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Work_Set__has_valid__Class;'
|
||||||
|
index: 9
|
||||||
|
sourceClassId: '&IDC_WorkSet;'
|
||||||
|
type: 'has valid'
|
||||||
|
destinationClassId: '&IDC_Class;'
|
||||||
|
siblingRelationshipId: '&IDR_Class__valid_for__Work_Set;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Class__valid_for__Work_Set;'
|
||||||
|
index: 10
|
||||||
|
sourceClassId: '&IDC_Class;'
|
||||||
|
type: 'valid for'
|
||||||
|
destinationClassId: '&IDC_WorkSet;'
|
||||||
|
siblingRelationshipId: '&IDR_Work_Set__has_valid__Class;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Control_Transaction_Method__processes__Element;'
|
||||||
|
index: 11
|
||||||
|
sourceClassId: '&IDC_ControlTransactionMethod;'
|
||||||
|
type: 'processes'
|
||||||
|
destinationClassId: '&IDC_Element;'
|
||||||
|
siblingRelationshipId: '&IDR_Element__processed_by__Control_Transaction_Method;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Element__processed_by__Control_Transaction_Method;'
|
||||||
|
index: 12
|
||||||
|
sourceClassId: '&IDC_Element;'
|
||||||
|
type: 'processed by'
|
||||||
|
destinationClassId: '&IDC_ControlTransactionMethod;'
|
||||||
|
siblingRelationshipId: '&IDR_Control_Transaction_Method__processes__Element;'
|
||||||
|
singular: yes
|
||||||
|
|
||||||
|
#- relationship: '&IDR_Element__has_text_node_value__Attribute;'
|
||||||
|
# index: 13,
|
||||||
|
# sourceClassId: '&IDC_Element;'
|
||||||
|
# type: 'has text node value'
|
||||||
|
# destinationClassId: '&IDC_Attribute;'
|
||||||
|
# siblingRelationshipId: '&IDR_Element__processed_by__Control_Transaction_Method;'
|
||||||
|
# singular: yes
|
||||||
|
|
||||||
|
# - relationship: '&IDR_Attribute__is_text_node_value_for__Element;'
|
||||||
|
# index: 14,
|
||||||
|
# sourceClassId: '&IDC_Attribute;'
|
||||||
|
# type: 'is text node value for'
|
||||||
|
# destinationClassId: '&IDC_Element;'
|
||||||
|
# siblingRelationshipId: '&IDR_Element__has_text_node_value__Attribute;'
|
||||||
|
# singular: yes
|
||||||
|
|
||||||
|
- relationship: '&IDR_Class__has__Method;'
|
||||||
|
index: 15
|
||||||
|
sourceClassId: '&IDC_Class;'
|
||||||
|
type: 'has'
|
||||||
|
destinationClassId: '&IDC_Method;'
|
||||||
|
siblingRelationshipId: '&IDR_Method__for__Class;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Method__for__Class;'
|
||||||
|
index: 16
|
||||||
|
sourceClassId: '&IDC_Method;'
|
||||||
|
type: 'for'
|
||||||
|
destinationClassId: '&IDC_Class;'
|
||||||
|
siblingRelationshipId: '&IDR_Class__has__Method;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
# - relationship: '&IDR_Class__has_implementation__Method;'
|
||||||
|
# index: 17,
|
||||||
|
# sourceClassId: '&IDC_Class;'
|
||||||
|
# type: 'has implementation'
|
||||||
|
# destinationClassId: '&IDC_Method;'
|
||||||
|
# siblingRelationshipId: '&IDR_Method__implements_for__Class;'
|
||||||
|
# singular: no
|
||||||
|
|
||||||
|
# - relationship: '&IDR_Method__implements_for__Class;'
|
||||||
|
# index: 18,
|
||||||
|
# sourceClassId: '&IDC_Method;'
|
||||||
|
# type: 'implements for'
|
||||||
|
# destinationClassId: '&IDC_Class;'
|
||||||
|
# siblingRelationshipId: '&IDR_Class__has_implementation__Method;'
|
||||||
|
# singular: yes
|
||||||
|
|
||||||
|
# - relationship: '&IDR_Method__implements__Method;'
|
||||||
|
# index: 19
|
||||||
|
# sourceClassId: '&IDC_Method;'
|
||||||
|
# type: 'implements'
|
||||||
|
# destinationClassId: '&IDC_Method;'
|
||||||
|
# siblingRelationshipId: '&IDR_Method__implemented_by__Method;'
|
||||||
|
# singular: no
|
||||||
|
|
||||||
|
# - relationship: '&IDR_Method__implemented_by__Method;'
|
||||||
|
# index: 20,
|
||||||
|
# sourceClassId: '&IDC_Method;'
|
||||||
|
# type: 'implemented by'
|
||||||
|
# destinationClassId: '&IDC_Method;'
|
||||||
|
# siblingRelationshipId: '&IDR_Method__implements__Method;'
|
||||||
|
# singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Class__has__Instance;'
|
||||||
|
index: 249
|
||||||
|
sourceClassId: '&IDC_Class;'
|
||||||
|
type: 'has'
|
||||||
|
destinationClassId: '&IDC_Instance;'
|
||||||
|
siblingRelationshipId: '&IDR_Instance__for__Class;'
|
||||||
|
singular: no
|
||||||
|
|
||||||
|
- relationship: '&IDR_Instance__for__Class;'
|
||||||
|
index: 250
|
||||||
|
sourceClassId: '&IDC_Instance;'
|
||||||
|
type: 'for'
|
||||||
|
destinationClassId: '&IDC_Class;'
|
||||||
|
siblingRelationshipId: '&IDR_Class__has__Instance;'
|
||||||
|
singular: no
|
||||||
@ -1,3 +1,4 @@
|
|||||||
- class: '&IDC_CommonNumeric;'
|
- class: '&IDC_CommonNumeric;'
|
||||||
|
name: 'Common Numeric'
|
||||||
index: 58
|
index: 58
|
||||||
|
|
||||||
@ -1,4 +1,5 @@
|
|||||||
- class: '&IDC_Task;'
|
- class: '&IDC_Task;'
|
||||||
|
name: 'Task'
|
||||||
index: 2993
|
index: 2993
|
||||||
abstract: yes
|
abstract: yes
|
||||||
relationships:
|
relationships:
|
||||||
|
|||||||
@ -101,6 +101,31 @@ System::$BeforeGetTenantNameHandler = function()
|
|||||||
return $path[0];
|
return $path[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function requiresLogin($path)
|
||||||
|
{
|
||||||
|
if ($path != null)
|
||||||
|
{
|
||||||
|
if ($path == "ots/{tenant}/services/{serviceName}/{version}/{command}")
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (count($path) > 0)
|
||||||
|
{
|
||||||
|
if ($path[0] == "ots"
|
||||||
|
|| $path[0] == "suv"
|
||||||
|
|| $path[0] == "ccx")
|
||||||
|
{
|
||||||
|
echo("no");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
System::$BeforeLaunchEventHandler = function($path)
|
System::$BeforeLaunchEventHandler = function($path)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -145,11 +170,16 @@ System::$BeforeLaunchEventHandler = function($path)
|
|||||||
{
|
{
|
||||||
$currentTenantName = $path[2];
|
$currentTenantName = $path[2];
|
||||||
}
|
}
|
||||||
|
else if ($path[0] == "ots")
|
||||||
|
{
|
||||||
|
$currentTenantName = $path[1];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$currentTenantName = $path[0];
|
$currentTenantName = $path[0];
|
||||||
}
|
}
|
||||||
$currentTenant = $oms->getTenantByName($currentTenantName);
|
$currentTenant = $oms->getTenantByName($currentTenantName);
|
||||||
|
|
||||||
if ($currentTenant == null)
|
if ($currentTenant == null)
|
||||||
{
|
{
|
||||||
System::Redirect("~/invalid-url", true);
|
System::Redirect("~/invalid-url", true);
|
||||||
@ -191,6 +221,10 @@ System::$BeforeLaunchEventHandler = function($path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$page = null;
|
||||||
|
$pathVars = null;
|
||||||
|
System::ParsePathVariablesIntoPage($page, $pathVars);
|
||||||
|
|
||||||
if ($currentUser === null)
|
if ($currentUser === null)
|
||||||
{
|
{
|
||||||
@ -202,9 +236,16 @@ System::$BeforeLaunchEventHandler = function($path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION["login_return"] = $path;
|
if ($page != null)
|
||||||
System::RedirectToLoginPage(true);
|
{
|
||||||
return false;
|
if (requiresLogin($page->FileName))
|
||||||
|
{
|
||||||
|
echo($page->FileName);
|
||||||
|
$_SESSION["login_return"] = $path;
|
||||||
|
System::RedirectToLoginPage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -161,19 +161,32 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "CALL mocha_get_instance_by_global_identifier(:global_identifier)";
|
$query = "CALL mocha_get_instance_by_global_identifier(mocha_normalize_uuid(:global_identifier))";
|
||||||
$stmt = $this->PDO->prepare($query);
|
$stmt = $this->PDO->prepare($query);
|
||||||
$result = $stmt->execute(array
|
$parms = array
|
||||||
(
|
(
|
||||||
"global_identifier" => $globalIdentifier
|
"global_identifier" => $globalIdentifier
|
||||||
));
|
);
|
||||||
|
$result = $stmt->execute($parms);
|
||||||
|
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
|
{
|
||||||
|
trigger_error("unknown database error, query was:", \E_USER_ERROR);
|
||||||
|
trigger_error($query, \E_USER_NOTICE);
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$values = $stmt->fetchAll();
|
$values = $stmt->fetchAll();
|
||||||
if (count($values) == 0)
|
if (count($values) == 0)
|
||||||
|
{
|
||||||
|
trigger_error("no records found, query was:", \E_USER_NOTICE);
|
||||||
|
trigger_error($query, \E_USER_NOTICE);
|
||||||
|
foreach ($parms as $key => $value)
|
||||||
|
{
|
||||||
|
trigger_error($key . ": '" . $value . "'", \E_USER_NOTICE);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$dbid = $values[0]["id"];
|
$dbid = $values[0]["id"];
|
||||||
$class_id = $values[0]["class_id"];
|
$class_id = $values[0]["class_id"];
|
||||||
@ -189,6 +202,13 @@
|
|||||||
|
|
||||||
public function getRelatedInstances(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?array
|
public function getRelatedInstances(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?array
|
||||||
{
|
{
|
||||||
|
$tenant = $this->getTenant();
|
||||||
|
if ($tenant === null)
|
||||||
|
{
|
||||||
|
trigger_error("tenant cannot be null", \E_USER_ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$dt = null;
|
$dt = null;
|
||||||
if ($effectiveDate !== null)
|
if ($effectiveDate !== null)
|
||||||
{
|
{
|
||||||
@ -196,12 +216,19 @@
|
|||||||
}
|
}
|
||||||
$query = "CALL mocha_get_related_instances(:src_inst_id, :rel_inst_id, :eff_date)";
|
$query = "CALL mocha_get_related_instances(:src_inst_id, :rel_inst_id, :eff_date)";
|
||||||
$stmt = $this->PDO->prepare($query);
|
$stmt = $this->PDO->prepare($query);
|
||||||
$result = $stmt->execute(array
|
$parms = array
|
||||||
(
|
(
|
||||||
"src_inst_id" => $this->getDbId($sourceInstance),
|
"src_inst_id" => $this->getDbId($sourceInstance),
|
||||||
"rel_inst_id" => $this->getDbId($relationshipInstance),
|
"rel_inst_id" => $this->getDbId($relationshipInstance),
|
||||||
"eff_date" => $dt
|
"eff_date" => $dt
|
||||||
));
|
);
|
||||||
|
$result = $stmt->execute($parms);
|
||||||
|
|
||||||
|
trigger_error($query, \E_USER_NOTICE);
|
||||||
|
foreach ($parms as $key => $value)
|
||||||
|
{
|
||||||
|
trigger_error($key . ": '" . $value . "'", \E_USER_NOTICE);
|
||||||
|
}
|
||||||
|
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
{
|
{
|
||||||
|
|||||||
10
php/mocha/ui/pages/OTSPage.phpx
Normal file
10
php/mocha/ui/pages/OTSPage.phpx
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Website>
|
||||||
|
<Pages>
|
||||||
|
<Page FileName="ots" CodeBehindClassName="Mocha\UI\Pages\OTSPage" />
|
||||||
|
<Page FileName="ots/{tenant}" CodeBehindClassName="Mocha\UI\Pages\OTSPage" />
|
||||||
|
<Page FileName="ots/{tenant}/services" CodeBehindClassName="Mocha\UI\Pages\OTSPage" />
|
||||||
|
<Page FileName="ots/{tenant}/services/{serviceName}" CodeBehindClassName="Mocha\UI\Pages\OTSPage" />
|
||||||
|
<Page FileName="ots/{tenant}/services/{serviceName}/{version}" CodeBehindClassName="Mocha\UI\Pages\OTSPage" />
|
||||||
|
<Page FileName="ots/{tenant}/services/{serviceName}/{version}/{command}" CodeBehindClassName="Mocha\UI\Pages\OTSPage" />
|
||||||
|
</Pages>
|
||||||
|
</Website>
|
||||||
108
php/mocha/ui/pages/OTSPage.phpx.php
Normal file
108
php/mocha/ui/pages/OTSPage.phpx.php
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Mocha\UI\Pages;
|
||||||
|
|
||||||
|
use Mocha\Core\KnownClassGuids;
|
||||||
|
use Mocha\Core\KnownInstanceGuids;
|
||||||
|
use Mocha\Core\KnownRelationshipGuids;
|
||||||
|
use Phast\RenderingEventArgs;
|
||||||
|
use Phast\System;
|
||||||
|
use Phast\WebPage;
|
||||||
|
|
||||||
|
class OTSPage extends WebPage
|
||||||
|
{
|
||||||
|
protected function OnRendering(RenderingEventArgs $re)
|
||||||
|
{
|
||||||
|
parent::OnRendering($re);
|
||||||
|
|
||||||
|
$path = System::GetVirtualPath();
|
||||||
|
$tenantName = null;
|
||||||
|
if (count($path) >= 3)
|
||||||
|
{
|
||||||
|
$tenantName = $path[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tenantName === null)
|
||||||
|
{
|
||||||
|
header("HTTP/1.1 404 Not Found");
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
echo ("\" Not Available \"");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oms = mocha_get_oms();
|
||||||
|
if ($oms != null)
|
||||||
|
{
|
||||||
|
$ti = $oms->getTenantByName($tenantName);
|
||||||
|
if ($ti === null)
|
||||||
|
{
|
||||||
|
header("HTTP/1.1 404 Not Found");
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
echo("The requested resource could not be found.");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (count($path) >= 5)
|
||||||
|
{
|
||||||
|
header("HTTP/1.1 200 OK");
|
||||||
|
|
||||||
|
// e.g. https://i-0c0398f84acecb702.privatesuv.com/ots/super/services/zq/v1/module/list
|
||||||
|
|
||||||
|
// ots/{tenant}/services/{serviceName}/{version}/{command}
|
||||||
|
$tenantName = $this->Page->GetPathVariableValue("tenant");
|
||||||
|
$serviceName = $this->Page->GetPathVariableValue("serviceName");
|
||||||
|
$version = $this->Page->GetPathVariableValue("version");
|
||||||
|
$command = $this->Page->GetPathVariableValue("command");
|
||||||
|
|
||||||
|
$oms->setTenant($oms->getTenantByName($tenantName));
|
||||||
|
|
||||||
|
$instClass = $oms->getInstanceByGlobalIdentifier(KnownClassGuids::Clasz);
|
||||||
|
$instances = $oms->getRelatedInstances($instClass, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Class__has__Instance));
|
||||||
|
|
||||||
|
if ($command == "module/list")
|
||||||
|
{
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
print("{ \"items\": [ ");
|
||||||
|
print("{ \"name\": \"mocha\", \"title\": \"mocha\", \"type\": \"module\", \"items\": [ ");
|
||||||
|
|
||||||
|
$ct = count($instances);
|
||||||
|
for ($i = 0; $i < $ct; $i++)
|
||||||
|
{
|
||||||
|
print("{ \"name\": \"mocha:inst" . $i . "\", \"title\": \"" . $oms->getInstanceText($instances[$i]) . "\", \"type\": \"class\", \"instanceId\": \"" . $instances[$i]->InstanceKey . "\" }");
|
||||||
|
if ($i < $ct - 1)
|
||||||
|
{
|
||||||
|
print(", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print("] }");
|
||||||
|
print("] }");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
print("tenantName: " . $tenantName . "\n");
|
||||||
|
print("serviceName: " . $serviceName . "\n");
|
||||||
|
print("version: " . $version . "\n");
|
||||||
|
print("command: " . $command . "\n");
|
||||||
|
}
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("HTTP/1.1 404 Not Found");
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
echo("The requested resource could not be found.");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$re->Cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@ -22,6 +22,7 @@ BEGIN
|
|||||||
SELECT mocha_instances.*
|
SELECT mocha_instances.*
|
||||||
FROM mocha_instances, mocha_relationships
|
FROM mocha_instances, mocha_relationships
|
||||||
WHERE mocha_instances.tenant_id = p_tenant_id
|
WHERE mocha_instances.tenant_id = p_tenant_id
|
||||||
|
AND mocha_relationships.tenant_id = p_tenant_id
|
||||||
AND mocha_instances.id = mocha_relationships.destination_inst_id
|
AND mocha_instances.id = mocha_relationships.destination_inst_id
|
||||||
AND mocha_relationships.source_inst_id = p_src_inst_id
|
AND mocha_relationships.source_inst_id = p_src_inst_id
|
||||||
AND mocha_relationships.relationship_inst_id = p_rel_inst_id
|
AND mocha_relationships.relationship_inst_id = p_rel_inst_id
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user