|
@@ -19,6 +19,25 @@ String core_model_location = "models/core"
|
|
|
Element core = ?
|
|
|
Element caches
|
|
|
|
|
|
+String function full_name(model_id : String):
|
|
|
+ if (dict_in(caches["full_name"], model_id)):
|
|
|
+ if (get_entry_id(caches["full_name"]) == model_id):
|
|
|
+ return caches["full_name"]!
|
|
|
+
|
|
|
+ // No cache, or out of date
|
|
|
+ Element incoming
|
|
|
+ String parent
|
|
|
+ String parent_name
|
|
|
+
|
|
|
+ incoming = allAssociationOrigins(core, model_id, "contains")
|
|
|
+ if (set_len(incoming) > 0):
|
|
|
+ parent = set_pop(incoming)
|
|
|
+ parent_name = full_name(parent)
|
|
|
+ dict_add(caches["full_name"], parent, parent_name)
|
|
|
+ return string_join(parent_name + "/", read_attribute(core, model_id, "name"))!
|
|
|
+ else:
|
|
|
+ return ""!
|
|
|
+
|
|
|
Void function initialize_core():
|
|
|
// TODO make this more flexible by putting it in the bootstrap in a similar way as other models
|
|
|
add_code_model(import_node("models/ActionLanguage"), "models/Conformance_MV", wrap_conformance)
|
|
@@ -70,14 +89,14 @@ Element function get_full_model(model_id : String, metamodel_id : String):
|
|
|
|
|
|
// TODO for now this is restricted to the fixed semantics
|
|
|
// dict_add(m, "semantics", set_pop(allAssociationDestinations(core, choice, "semantics")))
|
|
|
- dict_add(m, "semantics", get_model_id("conformance_mv"))
|
|
|
+ dict_add(m, "semantics", get_entry_id("conformance_mv"))
|
|
|
|
|
|
if (metamodel_id == model_id):
|
|
|
// Found the meta-circular level, so we can stop!
|
|
|
dict_add(m, "metamodel", m)
|
|
|
else:
|
|
|
Element mm
|
|
|
- mm = get_full_model(metamodel_id, get_model_id("SimpleClassDiagrams"))
|
|
|
+ mm = get_full_model(metamodel_id, get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
return read_root()!
|
|
|
else:
|
|
@@ -223,22 +242,43 @@ Void function new_task():
|
|
|
// User destroyed already, so just stop execution
|
|
|
return!
|
|
|
|
|
|
-String function get_model_id(name : String):
|
|
|
- Element models
|
|
|
- String model
|
|
|
+String function get_entry_id(name : String):
|
|
|
+ Element hierarchy_split
|
|
|
+ String current
|
|
|
+ Integer i
|
|
|
+ Element elems
|
|
|
+ String current_part
|
|
|
+ String elem
|
|
|
|
|
|
- if (dict_in(caches["models"], name)):
|
|
|
- if (value_eq(read_attribute(core, caches["models"][name], "name"), name)):
|
|
|
- return caches["models"][name]!
|
|
|
+ i = 0
|
|
|
+ name = "/" + name
|
|
|
+ hierarchy_split = string_split(name, "/")
|
|
|
+ current = caches["models"][""]
|
|
|
+ log("Reading " + name)
|
|
|
+ log("Split up in: " + list_to_string(hierarchy_split))
|
|
|
+
|
|
|
+ while (i < list_len(hierarchy_split)):
|
|
|
+ current_part = list_read(hierarchy_split, i)
|
|
|
+
|
|
|
+ // the initial current ("") will always be in the cache as root element
|
|
|
+ if (bool_not(dict_in(caches["models"], current))):
|
|
|
+ // This element is not cached, so cache completely!
|
|
|
+ log("Miss for " + current_part)
|
|
|
+ elems = allAssociationDestinations(core, current, "contains")
|
|
|
+ while (set_len(elems) > 0):
|
|
|
+ elem = set_pop(elems)
|
|
|
+ dict_overwrite(caches["models"][current], read_attribute(core, elem, "name"), elem)
|
|
|
+ dict_overwrite(caches["models"][current], "", current)
|
|
|
+ log("Ready for access: " + current_part)
|
|
|
+
|
|
|
+ if (dict_in(caches["models"][current], current_part)):
|
|
|
+ current = caches["models"][current][current_part]
|
|
|
+ log("SUCCESS: " + current)
|
|
|
+ else:
|
|
|
+ log("FAILED")
|
|
|
+ return ""!
|
|
|
|
|
|
- models = allInstances(core, "Model")
|
|
|
- while (set_len(models) > 0):
|
|
|
- model = set_pop(models)
|
|
|
- if (value_eq(name, read_attribute(core, model, "name"))):
|
|
|
- dict_overwrite(caches["models"], name, model)
|
|
|
- return model!
|
|
|
-
|
|
|
- return ""!
|
|
|
+ return current!
|
|
|
|
|
|
String function get_service_id(name : String):
|
|
|
Element services
|
|
@@ -278,9 +318,37 @@ String function get_group_id(name : String):
|
|
|
|
|
|
return ""!
|
|
|
|
|
|
+String function store_entry(model_id : String, full_name : String, user_id : String):
|
|
|
+ Element hierarchy
|
|
|
+ Integer i
|
|
|
+ String prev
|
|
|
+ String elem
|
|
|
+ String new_entry
|
|
|
+
|
|
|
+ i = 0
|
|
|
+ hierarchy = string_split(full_name, "/")
|
|
|
+ prev = get_entry_id("")
|
|
|
+
|
|
|
+ // Go through folders first
|
|
|
+ while (i < list_len(hierarchy) - 1):
|
|
|
+ elem = list_read(hierarchy, i)
|
|
|
+ if (get_entry_id(elem) == ""):
|
|
|
+ // Element does not exist yet!
|
|
|
+ new_entry = instantiate_node(core, "Folder", "")
|
|
|
+ instantiate_attribute(core, new_entry, "name", elem)
|
|
|
+ instantiate_attribute(core, new_entry, "permissions", "200")
|
|
|
+ instantiate_link(core, "contains", "", prev, new_entry)
|
|
|
+ instantiate_link(core, "group", "", new_entry, get_group_id("nobody"))
|
|
|
+ instantiate_link(core, "owner", "", new_entry, user_id)
|
|
|
+
|
|
|
+ instantiate_link(core, "contains", "", prev, model_id)
|
|
|
+
|
|
|
+ return list_pop_final(hierarchy)!
|
|
|
+
|
|
|
String function export_typing(model : Element, name : String, user_id : String):
|
|
|
String result
|
|
|
result = instantiate_node(core, "TypeMapping", "")
|
|
|
+ name = "type mappings/" + name
|
|
|
|
|
|
// Create type mapping model
|
|
|
String location
|
|
@@ -288,13 +356,14 @@ String function export_typing(model : Element, name : String, user_id : String):
|
|
|
export_node(location, model["type_mapping"])
|
|
|
|
|
|
String instance_of
|
|
|
- instantiate_attribute(core, result, "name", "TM_" + name)
|
|
|
+ name = store_entry(result, name, get_user_id("admin"))
|
|
|
+ instantiate_attribute(core, result, "name", name)
|
|
|
instantiate_attribute(core, result, "location", location)
|
|
|
instantiate_attribute(core, result, "permissions", "200")
|
|
|
instantiate_link(core, "owner", "", result, user_id)
|
|
|
instantiate_link(core, "group", "", result, get_group_id("nobody"))
|
|
|
- instance_of = instantiate_link(core, "instanceOf", "", result, get_model_id("TypeMapping"))
|
|
|
- instantiate_link(core, "semantics", "", instance_of, get_model_id("conformance_mv"))
|
|
|
+ instance_of = instantiate_link(core, "instanceOf", "", result, get_entry_id("TypeMapping"))
|
|
|
+ instantiate_link(core, "semantics", "", instance_of, get_entry_id("conformance_mv"))
|
|
|
|
|
|
return result!
|
|
|
|
|
@@ -308,13 +377,13 @@ Void function model_create(model : Element, name : String, user_id : String, typ
|
|
|
export_node(location, model["model"])
|
|
|
|
|
|
model_id = instantiate_node(core, kind, "")
|
|
|
- instantiate_attribute(core, model_id, "name", name)
|
|
|
+ instantiate_attribute(core, model_id, "name", store_entry(model_id, name, user_id))
|
|
|
instantiate_attribute(core, model_id, "location", location)
|
|
|
instantiate_attribute(core, model_id, "permissions", "200")
|
|
|
instantiate_link(core, "owner", "", model_id, user_id)
|
|
|
instantiate_link(core, "group", "", model_id, get_group_id("nobody"))
|
|
|
instance_of = instantiate_link(core, "instanceOf", "", model_id, type_id)
|
|
|
- instantiate_link(core, "semantics", "", instance_of, get_model_id("conformance_mv"))
|
|
|
+ instantiate_link(core, "semantics", "", instance_of, get_entry_id("conformance_mv"))
|
|
|
|
|
|
// Create type mapping model
|
|
|
instantiate_link(core, "typing", "", instance_of, export_typing(model, name, user_id))
|
|
@@ -344,8 +413,8 @@ Void function model_overwrite(model : Element, model_id : String, metamodel_id :
|
|
|
// Create a new instanceOf relation now
|
|
|
String instance_of
|
|
|
instance_of = instantiate_link(core, "instanceOf", "", model_id, metamodel_id)
|
|
|
- instantiate_link(core, "semantics", "", instance_of, get_model_id("conformance_mv"))
|
|
|
- instantiate_link(core, "typing", "", instance_of, export_typing(model, read_attribute(core, model_id, "name"), get_user_id("admin")))
|
|
|
+ instantiate_link(core, "semantics", "", instance_of, get_entry_id("conformance_mv"))
|
|
|
+ instantiate_link(core, "typing", "", instance_of, export_typing(model, full_name(model_id), get_user_id("admin")))
|
|
|
|
|
|
return!
|
|
|
|
|
@@ -405,13 +474,13 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
iter = allOutgoingAssociationInstances(core, operation_id, "transformInput")
|
|
|
while (set_len(iter) > 0):
|
|
|
edge = set_pop(iter)
|
|
|
- dict_add(input_metamodels, read_attribute(core, edge, "name"), read_attribute(core, readAssociationDestination(core, edge), "name"))
|
|
|
+ dict_add(input_metamodels, read_attribute(core, edge, "name"), full_name(readAssociationDestination(core, edge)))
|
|
|
|
|
|
output_metamodels = dict_create()
|
|
|
iter = allOutgoingAssociationInstances(core, operation_id, "transformOutput")
|
|
|
while (set_len(iter) > 0):
|
|
|
edge = set_pop(iter)
|
|
|
- dict_add(output_metamodels, read_attribute(core, edge, "name"), read_attribute(core, readAssociationDestination(core, edge), "name"))
|
|
|
+ dict_add(output_metamodels, read_attribute(core, edge, "name"), full_name(readAssociationDestination(core, edge)))
|
|
|
|
|
|
// 1) Find merged metamodel
|
|
|
|
|
@@ -431,7 +500,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
Element mm
|
|
|
- mm = get_full_model(get_model_id(input_models[key]), get_model_id(input_metamodels[key]))
|
|
|
+ mm = get_full_model(get_entry_id(input_models[key]), get_entry_id(input_metamodels[key]))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
log("Signature mismatch in operation for tag " + key)
|
|
|
output("Signature mismatch in operation for tag " + key)
|
|
@@ -439,7 +508,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
set_add_node(model_tuples, create_tuple(key, mm))
|
|
|
|
|
|
Element merged_metamodel
|
|
|
- merged_metamodel = get_full_model(merged_metamodel_id, get_model_id("SimpleClassDiagrams"))
|
|
|
+ merged_metamodel = get_full_model(merged_metamodel_id, get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(merged_metamodel, read_root())):
|
|
|
log("Merged metamodel in operation is not of type SimpleClassDiagrams")
|
|
|
output("Merged metamodel in operation is not of type SimpleClassDiagrams")
|
|
@@ -450,7 +519,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
if (bool_and(dict_len(input_models) == 1, dict_len(output_metamodels) == 0)):
|
|
|
// Just skip the merge...
|
|
|
Element m
|
|
|
- m = get_full_model(get_model_id(input_models[set_pop(dict_keys(input_models))]), get_model_id(input_metamodels[set_pop(dict_keys(input_metamodels))]))
|
|
|
+ m = get_full_model(get_entry_id(input_models[set_pop(dict_keys(input_models))]), get_entry_id(input_metamodels[set_pop(dict_keys(input_metamodels))]))
|
|
|
if (element_eq(m, read_root())):
|
|
|
log("Signature mismatch in operation for tag " + cast_v2s(set_pop(dict_keys(input_models))))
|
|
|
output("Signature mismatch in operation for tag " + cast_v2s(set_pop(dict_keys(input_models))))
|
|
@@ -481,13 +550,13 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
return read_root()!
|
|
|
result = transform(merged_model, operation)
|
|
|
elif (exact_type == "ManualOperation"):
|
|
|
- output("Please perform manual operation " + cast_v2s(read_attribute(core, operation_id, "name")))
|
|
|
+ output("Please perform manual operation " + cast_v2s(full_name(operation_id)))
|
|
|
modify(merged_model, True)
|
|
|
result = True
|
|
|
elif (exact_type == "ActionLanguage"):
|
|
|
Element func
|
|
|
Element al
|
|
|
- al = get_full_model(operation_id, get_model_id("ActionLanguage"))
|
|
|
+ al = get_full_model(operation_id, get_entry_id("ActionLanguage"))
|
|
|
if (element_eq(al, read_root())):
|
|
|
log("Action Language operation not typed by ActionLanguage metamodel!")
|
|
|
output("Action Language operation not typed by ActionLanguage metamodel!")
|
|
@@ -512,7 +581,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
Element mm
|
|
|
- mm = get_full_model(get_model_id(output_metamodels[key]), get_model_id("SimpleClassDiagrams"))
|
|
|
+ mm = get_full_model(get_entry_id(output_metamodels[key]), get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
log("Output metamodel cannot be interpreted using SimpleClassDiagrams: " + key)
|
|
|
output("Output metamodel cannot be interpreted using SimpleClassDiagrams: " + key)
|
|
@@ -560,7 +629,7 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
output_map = dict_create()
|
|
|
|
|
|
// Read out the referenced element from the MvC
|
|
|
- transformation_id = get_model_id(read_attribute(pm, element, "name"))
|
|
|
+ transformation_id = get_entry_id(read_attribute(pm, element, "name"))
|
|
|
|
|
|
// Find all input model names
|
|
|
lst = allOutgoingAssociationInstances(pm, element, "Consumes")
|
|
@@ -598,11 +667,11 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
keys = dict_keys(result)
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
- if (get_model_id(output_map[key]) == ""):
|
|
|
+ if (get_entry_id(output_map[key]) == ""):
|
|
|
// New model
|
|
|
- model_create(result[key], output_map[key], user_id, get_model_id(key), "Model")
|
|
|
+ model_create(result[key], output_map[key], user_id, get_entry_id(key), "Model")
|
|
|
else:
|
|
|
- model_overwrite(result[key], get_model_id(output_map[key]), get_model_id(outputs[key]))
|
|
|
+ model_overwrite(result[key], get_entry_id(output_map[key]), get_entry_id(outputs[key]))
|
|
|
return True!
|
|
|
|
|
|
Void function enact_PM(pm : Element, prefix : String, user_id : String):
|
|
@@ -755,15 +824,15 @@ String function cmd_model_add(user_id : String, type : String, name : String):
|
|
|
Element new_model
|
|
|
String new_model_id
|
|
|
|
|
|
- type_id = get_model_id(type)
|
|
|
+ type_id = get_entry_id(type)
|
|
|
if (type_id != ""):
|
|
|
// Type exists
|
|
|
if (allow_read(user_id, type_id)):
|
|
|
// And is readable
|
|
|
- if (get_model_id(name) == ""):
|
|
|
+ if (get_entry_id(name) == ""):
|
|
|
// Model doesn't exist yet
|
|
|
Element mm
|
|
|
- mm = get_full_model(type_id, get_model_id("SimpleClassDiagrams"))
|
|
|
+ mm = get_full_model(type_id, get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
return "Type is not typed by SimpleClassDiagrams: " + type!
|
|
|
|
|
@@ -782,11 +851,11 @@ String function cmd_process_execute(user_id : String, process : String, prefix :
|
|
|
// Execute a process model until it reaches termination
|
|
|
String process_id
|
|
|
|
|
|
- process_id = get_model_id(process)
|
|
|
+ process_id = get_entry_id(process)
|
|
|
if (process_id != ""):
|
|
|
if (allow_read(user_id, process_id)):
|
|
|
Element pm
|
|
|
- pm = get_full_model(process_id, get_model_id("ProcessModel"))
|
|
|
+ pm = get_full_model(process_id, get_entry_id("ProcessModel"))
|
|
|
if (element_eq(pm, read_root())):
|
|
|
return "Specified model cannot be interpreted as a ProcessModel: " + process!
|
|
|
|
|
@@ -805,9 +874,9 @@ String function cmd_transformation_between(user_id : String, source_name : Strin
|
|
|
Element result
|
|
|
String transformation
|
|
|
|
|
|
- source_id = get_model_id(source_name)
|
|
|
+ source_id = get_entry_id(source_name)
|
|
|
if (source_id != ""):
|
|
|
- target_id = get_model_id(target_name)
|
|
|
+ target_id = get_entry_id(target_name)
|
|
|
|
|
|
if (target_id != ""):
|
|
|
onSource = allAssociationOrigins(core, source_id, "transformInput")
|
|
@@ -820,7 +889,7 @@ String function cmd_transformation_between(user_id : String, source_name : Strin
|
|
|
while (set_len(result) > 0):
|
|
|
transformation = set_pop(result)
|
|
|
if (allow_read(user_id, transformation)):
|
|
|
- r = r + string_join(read_attribute(core, transformation, "name"), "\n")
|
|
|
+ r = r + string_join(full_name(transformation), "\n")
|
|
|
return r!
|
|
|
else:
|
|
|
return "Model not found: " + target_name!
|
|
@@ -840,10 +909,10 @@ String function cmd_model_render(user_id : String, model_name : String, mapper_n
|
|
|
Element out_links
|
|
|
String link
|
|
|
|
|
|
- model_ID = get_model_id(model_name)
|
|
|
+ model_ID = get_entry_id(model_name)
|
|
|
|
|
|
if (model_ID != ""):
|
|
|
- mapper_ID = get_model_id(mapper_name)
|
|
|
+ mapper_ID = get_entry_id(mapper_name)
|
|
|
|
|
|
if (allow_read(user_id, model_ID)):
|
|
|
if (mapper_ID != ""):
|
|
@@ -863,25 +932,25 @@ String function cmd_model_render(user_id : String, model_name : String, mapper_n
|
|
|
out_links = allOutgoingAssociationInstances(core, mapper_ID, "transformOutput")
|
|
|
while(set_len(out_links) > 0):
|
|
|
link = set_pop(out_links)
|
|
|
- dict_add(output_map, read_attribute(core, link, "name"), read_attribute(core, readAssociationDestination(core, link), "name"))
|
|
|
+ dict_add(output_map, read_attribute(core, link, "name"), full_name(readAssociationDestination(core, link)))
|
|
|
|
|
|
- if (get_model_id(rendered_name) == ""):
|
|
|
+ if (get_entry_id(rendered_name) == ""):
|
|
|
// Instantiate
|
|
|
Element rendered
|
|
|
- rendered = get_full_model(get_model_id(output_map["rendered"]), get_model_id("SimpleClassDiagrams"))
|
|
|
+ rendered = get_full_model(get_entry_id(output_map["rendered"]), get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(rendered, read_root())):
|
|
|
return "Rendered metamodel cannot conform to SimpleClassDiagrams"!
|
|
|
|
|
|
rendered_model = instantiate_model(rendered)
|
|
|
- model_create(rendered_model, rendered_name, user_id, get_model_id(output_map["rendered"]), "Model")
|
|
|
+ model_create(rendered_model, rendered_name, user_id, get_entry_id(output_map["rendered"]), "Model")
|
|
|
|
|
|
// Tracability model won't exist either
|
|
|
- tracability_model = instantiate_model(get_full_model(get_model_id("Tracability"), get_model_id("SimpleClassDiagrams")))
|
|
|
- model_create(tracability_model, tracability_name, user_id, get_model_id("Tracability"), "Model")
|
|
|
+ tracability_model = instantiate_model(get_full_model(get_entry_id("Tracability"), get_entry_id("SimpleClassDiagrams")))
|
|
|
+ model_create(tracability_model, tracability_name, user_id, get_entry_id("Tracability"), "Model")
|
|
|
|
|
|
else:
|
|
|
// Read out tracability model
|
|
|
- tracability_model = get_full_model(get_model_id(tracability_name), get_model_id("Tracability"))
|
|
|
+ tracability_model = get_full_model(get_entry_id(tracability_name), get_entry_id("Tracability"))
|
|
|
if (element_eq(tracability_model, read_root())):
|
|
|
return "Tracability model not typed by Tracability metamodel: " + tracability_name!
|
|
|
|
|
@@ -889,17 +958,17 @@ String function cmd_model_render(user_id : String, model_name : String, mapper_n
|
|
|
result = execute_operation(mapper_ID, inputs, tracability_model)
|
|
|
|
|
|
// Overwrite the previous rendered model
|
|
|
- model_overwrite(result["rendered"], get_model_id(rendered_name), get_model_id(output_map["rendered"]))
|
|
|
- model_overwrite(result["abstract"], get_model_id(model_name), get_model_id(output_map["abstract"]))
|
|
|
+ model_overwrite(result["rendered"], get_entry_id(rendered_name), get_entry_id(output_map["rendered"]))
|
|
|
+ model_overwrite(result["abstract"], get_entry_id(model_name), get_entry_id(output_map["abstract"]))
|
|
|
|
|
|
// Tracability updated in-place
|
|
|
- model_overwrite(tracability_model, get_model_id(tracability_name), get_model_id("Tracability"))
|
|
|
- tracability_model = get_full_model(get_model_id(tracability_name), get_model_id("Tracability"))
|
|
|
+ model_overwrite(tracability_model, get_entry_id(tracability_name), get_entry_id("Tracability"))
|
|
|
+ tracability_model = get_full_model(get_entry_id(tracability_name), get_entry_id("Tracability"))
|
|
|
if (element_eq(tracability_model, read_root())):
|
|
|
return "Tracability model not typed by Tracability metamodel: " + tracability_name!
|
|
|
|
|
|
// Also output the resulting model
|
|
|
- return "Success: " + JSON_print(get_full_model(get_model_id(rendered_name), get_model_id(output_map["rendered"])))!
|
|
|
+ return "Success: " + JSON_print(get_full_model(get_entry_id(rendered_name), get_entry_id(output_map["rendered"])))!
|
|
|
else:
|
|
|
return "Permission denied to model: " + mapper_name!
|
|
|
else:
|
|
@@ -930,7 +999,7 @@ String function cmd_transformation_execute(user_id : String, transformation_name
|
|
|
String key
|
|
|
String assoc_name
|
|
|
|
|
|
- transformation_id = get_model_id(transformation_name)
|
|
|
+ transformation_id = get_entry_id(transformation_name)
|
|
|
if (transformation_id != ""):
|
|
|
if (allow_read(user_id, transformation_id)):
|
|
|
if (is_nominal_instance(core, transformation_id, "Transformation")):
|
|
@@ -946,7 +1015,7 @@ String function cmd_transformation_execute(user_id : String, transformation_name
|
|
|
else:
|
|
|
return "Source model not bound: " + assoc_name!
|
|
|
|
|
|
- source_model_ID = get_model_id(source_model_name)
|
|
|
+ source_model_ID = get_entry_id(source_model_name)
|
|
|
if (source_model_ID != ""):
|
|
|
if (allow_read(user_id, source_model_ID)):
|
|
|
// Check for conformance to the requested metamodel
|
|
@@ -968,14 +1037,14 @@ String function cmd_transformation_execute(user_id : String, transformation_name
|
|
|
else:
|
|
|
return "Target model not bound: " + assoc_name!
|
|
|
|
|
|
- if (get_model_id(target_model_name) == ""):
|
|
|
+ if (get_entry_id(target_model_name) == ""):
|
|
|
// Doesn't exist yet, so we can easily create
|
|
|
- dict_add(output_map, assoc_name, read_attribute(core, readAssociationDestination(core, target), "name"))
|
|
|
+ dict_add(output_map, assoc_name, full_name(target))
|
|
|
dict_add(outputs, assoc_name, target_model_name)
|
|
|
else:
|
|
|
// Already exists, so we need to check for write access
|
|
|
- if (allow_write(user_id, get_model_id(target_model_name))):
|
|
|
- dict_add(output_map, assoc_name, read_attribute(core, readAssociationDestination(core, target), "name"))
|
|
|
+ if (allow_write(user_id, get_entry_id(target_model_name))):
|
|
|
+ dict_add(output_map, assoc_name, full_name(target))
|
|
|
dict_add(outputs, assoc_name, target_model_name)
|
|
|
else:
|
|
|
return "Permission denied to model: " + target_model_name!
|
|
@@ -998,11 +1067,11 @@ String function cmd_transformation_execute(user_id : String, transformation_name
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
|
|
|
- if (get_model_id(outputs[key]) == ""):
|
|
|
+ if (get_entry_id(outputs[key]) == ""):
|
|
|
// New model
|
|
|
- model_create(result[key], outputs[key], user_id, get_model_id(key), "Model")
|
|
|
+ model_create(result[key], outputs[key], user_id, get_entry_id(key), "Model")
|
|
|
else:
|
|
|
- model_overwrite(result[key], get_model_id(outputs[key]), get_model_id(output_map[key]))
|
|
|
+ model_overwrite(result[key], get_entry_id(outputs[key]), get_entry_id(output_map[key]))
|
|
|
|
|
|
return "Success"!
|
|
|
else:
|
|
@@ -1018,11 +1087,11 @@ String function cmd_verify(user_id : String, model_name : String, metamodel_name
|
|
|
String result
|
|
|
Element inputs
|
|
|
|
|
|
- model_id = get_model_id(model_name)
|
|
|
+ model_id = get_entry_id(model_name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, model_id)):
|
|
|
Element m
|
|
|
- m = get_full_model(get_model_id(model_name), get_model_id(metamodel_name))
|
|
|
+ m = get_full_model(get_entry_id(model_name), get_entry_id(metamodel_name))
|
|
|
if (element_eq(m, read_root())):
|
|
|
return "No conformance relation can be found between these models"!
|
|
|
|
|
@@ -1038,13 +1107,13 @@ String function cmd_model_overwrite(user_id : String, model_name : String, metam
|
|
|
String type_id
|
|
|
Element new_model
|
|
|
|
|
|
- model_id = get_model_id(model_name)
|
|
|
+ model_id = get_entry_id(model_name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_write(user_id, model_id)):
|
|
|
type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
|
|
|
if (allow_read(user_id, type_id)):
|
|
|
Element mm
|
|
|
- mm = get_full_model(get_model_id(metamodel_name), get_model_id("SimpleClassDiagrams"))
|
|
|
+ mm = get_full_model(get_entry_id(metamodel_name), get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
return "Metamodel does not conform to SimpleClassDiagrams: " + metamodel_name!
|
|
|
|
|
@@ -1053,7 +1122,7 @@ String function cmd_model_overwrite(user_id : String, model_name : String, metam
|
|
|
model_overwrite(new_model, model_id, metamodel_name)
|
|
|
return "Success"!
|
|
|
else:
|
|
|
- return string_join("Permission denied to model: ", read_attribute(core, type_id, "name"))!
|
|
|
+ return string_join("Permission denied to model: ", full_name(type_id))!
|
|
|
else:
|
|
|
return "Permission denied to model: " + model_name!
|
|
|
else:
|
|
@@ -1064,14 +1133,14 @@ String function cmd_model_modify(user_id : String, model_name : String, metamode
|
|
|
String model_id
|
|
|
String type_id
|
|
|
|
|
|
- model_id = get_model_id(model_name)
|
|
|
+ model_id = get_entry_id(model_name)
|
|
|
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, model_id)):
|
|
|
type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
|
|
|
if (allow_read(user_id, type_id)):
|
|
|
Element new_model
|
|
|
- new_model = get_full_model(model_id, get_model_id(metamodel_name))
|
|
|
+ new_model = get_full_model(model_id, get_entry_id(metamodel_name))
|
|
|
if (element_eq(new_model, read_root())):
|
|
|
return "No conformance relation can be found between these models"!
|
|
|
output("Success")
|
|
@@ -1081,7 +1150,7 @@ String function cmd_model_modify(user_id : String, model_name : String, metamode
|
|
|
model_overwrite(new_model, model_id, metamodel_name)
|
|
|
return "Success"!
|
|
|
else:
|
|
|
- return string_join("Permission denied to model: ", read_attribute(core, type_id, "name"))!
|
|
|
+ return string_join("Permission denied to model: ", full_name(type_id))!
|
|
|
else:
|
|
|
return "Permission denied to model: " + model_name!
|
|
|
else:
|
|
@@ -1089,7 +1158,7 @@ String function cmd_model_modify(user_id : String, model_name : String, metamode
|
|
|
|
|
|
String function cmd_model_delete(user_id : String, model_name : String):
|
|
|
String model_id
|
|
|
- model_id = get_model_id(model_name)
|
|
|
+ model_id = get_entry_id(model_name)
|
|
|
|
|
|
if (model_id != ""):
|
|
|
if (allow_write(user_id, model_id)):
|
|
@@ -1100,23 +1169,20 @@ String function cmd_model_delete(user_id : String, model_name : String):
|
|
|
else:
|
|
|
return "Model not found: " + model_name!
|
|
|
|
|
|
-String function cmd_model_list():
|
|
|
+String function cmd_model_list(location : String):
|
|
|
// List all models
|
|
|
Element models
|
|
|
String result
|
|
|
String m
|
|
|
|
|
|
result = "Success: "
|
|
|
- models = allInstances(core, "Model")
|
|
|
+ models = allAssociationDestinations(core, get_entry_id(location), "contains")
|
|
|
while (set_len(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
- if (set_len(allAssociationDestinations(core, m, "instanceOf")) > 0):
|
|
|
- result = (result + string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name"))) + "\n"
|
|
|
- else:
|
|
|
- result = result + string_join(string_join(" ", read_attribute(core, m, "name")), " : None\n")
|
|
|
+ result = result + string_join(string_join(" ", read_attribute(core, m, "name")), "\n")
|
|
|
return result!
|
|
|
|
|
|
-String function cmd_model_list_full():
|
|
|
+String function cmd_model_list_full(location : String):
|
|
|
// List all models with full info
|
|
|
Element models
|
|
|
String m
|
|
@@ -1128,20 +1194,14 @@ String function cmd_model_list_full():
|
|
|
String result
|
|
|
|
|
|
result = "Success: "
|
|
|
- models = allInstances(core, "Model")
|
|
|
+ models = allAssociationDestinations(core, get_entry_id(location), "contains")
|
|
|
while (set_len(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
permissions = read_attribute(core, m, "permissions")
|
|
|
owner = read_attribute(core, set_pop(allAssociationDestinations(core, m, "owner")), "name")
|
|
|
group = read_attribute(core, set_pop(allAssociationDestinations(core, m, "group")), "name")
|
|
|
name = read_attribute(core, m, "name")
|
|
|
-
|
|
|
- if (set_len(allAssociationDestinations(core, m, "instanceOf")) > 0):
|
|
|
- type = read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name")
|
|
|
- else:
|
|
|
- type = "None"
|
|
|
-
|
|
|
- result = (result + (((((((((" " + permissions) + " ") + owner) + " ") + group) + " ") + name) + " : ") + type)) + "\n"
|
|
|
+ result = result + ((((((((" " + permissions) + " ") + owner) + " ") + group) + " ") + name) + "\n")
|
|
|
|
|
|
return result!
|
|
|
|
|
@@ -1179,12 +1239,12 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
name = source_models[key]
|
|
|
- model_id = get_model_id(name)
|
|
|
+ model_id = get_entry_id(name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, model_id)):
|
|
|
if (bool_not(dict_in(source, key))):
|
|
|
dict_add(source, key, model_id)
|
|
|
- mm = get_full_model(model_id, get_model_id("SimpleClassDiagrams"))
|
|
|
+ mm = get_full_model(model_id, get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
return "Transformation source type not in SimpleClassDiagrams hierarchy: " + key!
|
|
|
|
|
@@ -1205,12 +1265,12 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
name = target_models[key]
|
|
|
- model_id = get_model_id(name)
|
|
|
+ model_id = get_entry_id(name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, model_id)):
|
|
|
if (bool_not(dict_in(target, key))):
|
|
|
dict_add(target, key, model_id)
|
|
|
- mm = get_full_model(model_id, get_model_id("SimpleClassDiagrams"))
|
|
|
+ mm = get_full_model(model_id, get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
return "Transformation target type not in SimpleClassDiagrams hierarchy: " + key!
|
|
|
|
|
@@ -1227,7 +1287,7 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
else:
|
|
|
return "Model not found: " + name!
|
|
|
|
|
|
- if (get_model_id(operation_name) == ""):
|
|
|
+ if (get_entry_id(operation_name) == ""):
|
|
|
// Write out a merged metamodel containing all these models: this is the MM for the manual operation
|
|
|
// New location is available, so write
|
|
|
if (bool_not(bool_and(dict_len(source_models) == 0, dict_len(target_models) == 0))):
|
|
@@ -1237,23 +1297,23 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
if (operation_type == "manual"):
|
|
|
// Finished with all information, now create the model itself!
|
|
|
Element m
|
|
|
- m = get_full_model(get_model_id("ManualOperation"), get_model_id("SimpleClassDiagrams"))
|
|
|
+ m = get_full_model(get_entry_id("ManualOperation"), get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(m, read_root())):
|
|
|
log("Error when opening ManualOperation: no conformance relation found")
|
|
|
return "Error when opening ManualOperation: no conformance relation found"!
|
|
|
- model_create(instantiate_model(m), operation_name, user_id, get_model_id("ManualOperation"), "ManualOperation")
|
|
|
- model_id = get_model_id(operation_name)
|
|
|
+ model_create(instantiate_model(m), operation_name, user_id, get_entry_id("ManualOperation"), "ManualOperation")
|
|
|
+ model_id = get_entry_id(operation_name)
|
|
|
|
|
|
elif (operation_type == "actionlanguage"):
|
|
|
// Finished with all information, now create the model itself!
|
|
|
output("Waiting for code constructors...")
|
|
|
- add_code_model(get_full_model(get_model_id("ActionLanguage"), get_model_id("SimpleClassDiagrams")), "AL/" + operation_name, construct_function())
|
|
|
- model_create(import_node("AL/" + operation_name), operation_name, user_id, get_model_id("ActionLanguage"), "ActionLanguage")
|
|
|
- model_id = get_model_id(operation_name)
|
|
|
+ add_code_model(get_full_model(get_entry_id("ActionLanguage"), get_entry_id("SimpleClassDiagrams")), "AL/" + operation_name, construct_function())
|
|
|
+ model_create(import_node("AL/" + operation_name), operation_name, user_id, get_entry_id("ActionLanguage"), "ActionLanguage")
|
|
|
+ model_id = get_entry_id(operation_name)
|
|
|
|
|
|
if (bool_not(bool_and(dict_len(source_models) == 0, dict_len(target_models) == 0))):
|
|
|
- model_create(merged_formalism, "__merged_" + operation_name, user_id, get_model_id("SimpleClassDiagrams"), "Model")
|
|
|
- merged_formalism_id = get_model_id("__merged_" + operation_name)
|
|
|
+ model_create(merged_formalism, "__merged_" + operation_name, user_id, get_entry_id("SimpleClassDiagrams"), "Model")
|
|
|
+ merged_formalism_id = get_entry_id("__merged_" + operation_name)
|
|
|
|
|
|
// Add tracability links at this level
|
|
|
while (set_len(all_formalisms) > 0):
|
|
@@ -1317,14 +1377,14 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
name = source_models[key]
|
|
|
- model_id = get_model_id(name)
|
|
|
+ model_id = get_entry_id(name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, name)):
|
|
|
// Check whether or not it is SimpleClassDiagrams
|
|
|
- if (is_typed_by(model_id, get_model_id("SimpleClassDiagrams"))):
|
|
|
+ if (is_typed_by(model_id, get_entry_id("SimpleClassDiagrams"))):
|
|
|
if (bool_not(dict_in(source, key))):
|
|
|
dict_add(source, key, model_id)
|
|
|
- mm = get_full_model(model_id, get_model_id("SimpleClassDiagrams"))
|
|
|
+ mm = get_full_model(model_id, get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
return "ModelTransformation source type not in SimpleClassDiagrams hierarchy: " + name!
|
|
|
set_add_node(to_ramify, create_tuple(key, mm))
|
|
@@ -1341,10 +1401,10 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
name = target_models[key]
|
|
|
- model_id = get_model_id(name)
|
|
|
+ model_id = get_entry_id(name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, name)):
|
|
|
- if (is_typed_by(model_id, get_model_id("SimpleClassDiagrams"))):
|
|
|
+ if (is_typed_by(model_id, get_entry_id("SimpleClassDiagrams"))):
|
|
|
if (bool_not(dict_in(target, key))):
|
|
|
if (dict_in(source, key)):
|
|
|
if (value_eq(model_id, source[key])):
|
|
@@ -1354,7 +1414,7 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
return "Name in output cannot have different type than input: " + key!
|
|
|
else:
|
|
|
dict_add(target, key, model_id)
|
|
|
- mm = get_full_model(model_id, get_model_id("SimpleClassDiagrams"))
|
|
|
+ mm = get_full_model(model_id, get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
return "ModelTransformation target type not in SimpleClassDiagrams hierarchy: " + name!
|
|
|
set_add_node(to_ramify, create_tuple(key, mm))
|
|
@@ -1371,22 +1431,22 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
modify(merged_formalism, True)
|
|
|
|
|
|
ramified_metamodel = ramify(merged_formalism)
|
|
|
- model_create(ramified_metamodel, "__RAM_" + operation_name, user_id, get_model_id("SimpleClassDiagrams"), "Model")
|
|
|
- ramified_metamodel_id = get_model_id("__RAM_" + operation_name)
|
|
|
+ model_create(ramified_metamodel, "__RAM_" + operation_name, user_id, get_entry_id("SimpleClassDiagrams"), "Model")
|
|
|
+ ramified_metamodel_id = get_entry_id("__RAM_" + operation_name)
|
|
|
|
|
|
// Now use the RAMified model to create the instance
|
|
|
- if (get_model_id(operation_name) == ""):
|
|
|
+ if (get_entry_id(operation_name) == ""):
|
|
|
String new_model
|
|
|
// Finished with all information, now create the model itself!
|
|
|
output("Waiting for model constructors...")
|
|
|
- new_model = construct_model_raw(get_full_model(ramified_metamodel_id, get_model_id("SimpleClassDiagrams")))
|
|
|
+ new_model = construct_model_raw(get_full_model(ramified_metamodel_id, get_entry_id("SimpleClassDiagrams")))
|
|
|
model_create(new_model, operation_name, user_id, ramified_metamodel_id, "ModelTransformation")
|
|
|
- model_id = get_model_id(operation_name)
|
|
|
+ model_id = get_entry_id(operation_name)
|
|
|
|
|
|
// Write out a merged metamodel containing all these models: this is the MM for the manual operation
|
|
|
// New location is available, so write
|
|
|
- model_create(merged_formalism, "__merged_" + operation_name, user_id, get_model_id("SimpleClassDiagrams"), "Model")
|
|
|
- merged_formalism_id = get_model_id("__merged_" + operation_name)
|
|
|
+ model_create(merged_formalism, "__merged_" + operation_name, user_id, get_entry_id("SimpleClassDiagrams"), "Model")
|
|
|
+ merged_formalism_id = get_entry_id("__merged_" + operation_name)
|
|
|
|
|
|
// Add tracability links at this level
|
|
|
tracability_link = instantiate_link(core, "tracability", "", model_id, merged_formalism_id)
|
|
@@ -1418,50 +1478,11 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
else:
|
|
|
return "Model exists: " + operation_name!
|
|
|
|
|
|
-String function cmd_transformation_list():
|
|
|
- // List all models
|
|
|
- Element models
|
|
|
- String m
|
|
|
- String type
|
|
|
- String result
|
|
|
-
|
|
|
- result = "Success: "
|
|
|
- models = allInstances(core, "Transformation")
|
|
|
- while (set_len(models) > 0):
|
|
|
- m = set_pop(models)
|
|
|
- result = result + ((string_join(("[" + read_type(core, m)) + "]", string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name")))) + "\n")
|
|
|
-
|
|
|
- return result!
|
|
|
-
|
|
|
-String function cmd_transformation_list_full():
|
|
|
- // List all models with full info
|
|
|
- Element models
|
|
|
- String m
|
|
|
- String permissions
|
|
|
- String owner
|
|
|
- String group
|
|
|
- String name
|
|
|
- String type
|
|
|
- String result
|
|
|
-
|
|
|
- result = ""
|
|
|
- models = allInstances(core, "Transformation")
|
|
|
- while (set_len(models) > 0):
|
|
|
- m = set_pop(models)
|
|
|
- permissions = read_attribute(core, m, "permissions")
|
|
|
- owner = read_attribute(core, set_pop(allAssociationDestinations(core, m, "owner")), "name")
|
|
|
- group = read_attribute(core, set_pop(allAssociationDestinations(core, m, "group")), "name")
|
|
|
- name = read_attribute(core, m, "name")
|
|
|
- type = read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name")
|
|
|
- result = result + ((((((((((" " + permissions) + " ") + owner) + " ") + group) + " ") + ((("[" + read_type(core, m)) + "] ") + name)) + " : ") + type) + "\n")
|
|
|
-
|
|
|
- return result!
|
|
|
-
|
|
|
String function cmd_permission_modify(user_id : String, model_name : String, permissions : String):
|
|
|
Integer permission
|
|
|
String model_id
|
|
|
|
|
|
- model_id = get_model_id(model_name)
|
|
|
+ model_id = get_entry_id(model_name)
|
|
|
if (model_id != ""):
|
|
|
if (get_relation_to_model(user_id, model_id) == 0):
|
|
|
Boolean fail
|
|
@@ -1492,7 +1513,7 @@ String function cmd_permission_owner(user_id : String, model_name : String, new_
|
|
|
String model_id
|
|
|
String new_user_id
|
|
|
|
|
|
- model_id = get_model_id(model_name)
|
|
|
+ model_id = get_entry_id(model_name)
|
|
|
if (model_id != ""):
|
|
|
if (bool_or(get_relation_to_model(user_id, model_id) == 0, is_admin(user_id))):
|
|
|
new_user_id = get_user_id(new_user_name)
|
|
@@ -1511,7 +1532,7 @@ String function cmd_permission_group(user_id : String, model_name : String, new_
|
|
|
String model_id
|
|
|
String group_id
|
|
|
|
|
|
- model_id = get_model_id(model_name)
|
|
|
+ model_id = get_entry_id(model_name)
|
|
|
if (model_id != ""):
|
|
|
if (bool_or(get_relation_to_model(user_id, model_id) == 0, is_admin(user_id))):
|
|
|
group_id = get_group_id(new_group_name)
|
|
@@ -1744,7 +1765,7 @@ String function cmd_user_password(user_id : String, user_name : String, new_pass
|
|
|
|
|
|
String function cmd_transformation_signature(user_id : String, transformation_name : String):
|
|
|
String model_id
|
|
|
- model_id = get_model_id(transformation_name)
|
|
|
+ model_id = get_entry_id(transformation_name)
|
|
|
|
|
|
if (model_id != ""):
|
|
|
if (is_nominal_instance(core, model_id, "Transformation")):
|
|
@@ -1758,26 +1779,26 @@ String function cmd_transformation_signature(user_id : String, transformation_na
|
|
|
inputs = allOutgoingAssociationInstances(core, model_id, "transformInput")
|
|
|
while (set_len(inputs) > 0):
|
|
|
elem = set_pop(inputs)
|
|
|
- result = string_join(string_join(string_join(string_join("I ", read_attribute(core, elem, "name")), " "), read_attribute(core, readAssociationDestination(core, elem), "name")), "\n")
|
|
|
+ result = string_join(string_join(string_join(string_join("I ", read_attribute(core, elem, "name")), " "), full_name(readAssociationDestination(core, elem))), "\n")
|
|
|
|
|
|
outputs = allOutgoingAssociationInstances(core, model_id, "transformOutput")
|
|
|
while (set_len(outputs) > 0):
|
|
|
elem = set_pop(outputs)
|
|
|
- result = string_join(string_join(string_join(string_join("O ", read_attribute(core, elem, "name")), " "), read_attribute(core, readAssociationDestination(core, elem), "name")), "\n")
|
|
|
+ result = string_join(string_join(string_join(string_join("O ", read_attribute(core, elem, "name")), " "), full_name(readAssociationDestination(core, elem))), "\n")
|
|
|
|
|
|
return result!
|
|
|
else:
|
|
|
- return "Permission denied to transformation: " + transformation_name!
|
|
|
+ return "Permission denied to operation: " + transformation_name!
|
|
|
else:
|
|
|
- return "Model is not a transformation: " + transformation_name!
|
|
|
+ return "Model is not an operation: " + transformation_name!
|
|
|
else:
|
|
|
- return "No such transformation: " + transformation_name!
|
|
|
+ return "No such operation: " + transformation_name!
|
|
|
|
|
|
String function cmd_element_list_nice(user_id : String, model_name : String, metamodel_name : String):
|
|
|
- if (get_model_id(model_name) != ""):
|
|
|
- if (allow_read(user_id, get_model_id(model_name))):
|
|
|
+ if (get_entry_id(model_name) != ""):
|
|
|
+ if (allow_read(user_id, get_entry_id(model_name))):
|
|
|
Element mm
|
|
|
- mm = get_full_model(get_model_id(model_name), get_model_id(metamodel_name))
|
|
|
+ mm = get_full_model(get_entry_id(model_name), get_entry_id(metamodel_name))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
return "No conformance relation between these models"!
|
|
|
return "Success: " + JSON_print(mm)!
|
|
@@ -1793,6 +1814,19 @@ Void function user_function_skip_init(user_id : String):
|
|
|
caches = dict_create()
|
|
|
dict_add_fast(caches, "models", dict_create())
|
|
|
dict_add_fast(caches, "users", dict_create())
|
|
|
+ dict_add_fast(caches, "full_name", dict_create())
|
|
|
+
|
|
|
+ // Find root element
|
|
|
+ Element elems
|
|
|
+ String elem
|
|
|
+ elems = allInstances(core, "Folder")
|
|
|
+ while (set_len(elems) > 0):
|
|
|
+ elem = set_pop(elems)
|
|
|
+ if (value_eq(read_attribute(core, elem, "name"), "")):
|
|
|
+ if (set_len(allIncomingAssociationInstances(core, elem, "contains")) == 0):
|
|
|
+ dict_add_fast(caches["models"], "", dict_create())
|
|
|
+ dict_add_fast(caches["models"][""], "", elem)
|
|
|
+ break!
|
|
|
|
|
|
output("Welcome to the Model Management Interface v2.0!")
|
|
|
output("Use the 'help' command for a list of possible commands")
|
|
@@ -1822,19 +1856,15 @@ Void function user_function_skip_init(user_id : String):
|
|
|
elif (cmd == "model_delete"):
|
|
|
output(cmd_model_delete(user_id, single_input("Model name?")))
|
|
|
elif (cmd == "model_list"):
|
|
|
- output(cmd_model_list())
|
|
|
+ output(cmd_model_list(single_input("Location?")))
|
|
|
elif (cmd == "model_list_full"):
|
|
|
- output(cmd_model_list_full())
|
|
|
+ output(cmd_model_list_full(single_input("Location?")))
|
|
|
elif (cmd == "transformation_add_MANUAL"):
|
|
|
output(cmd_transformation_add_MANUAL(user_id, dict_input("Source model names?"), dict_input("Target model names?"), single_input("Operation name?")))
|
|
|
elif (cmd == "transformation_add_AL"):
|
|
|
output(cmd_transformation_add_AL(user_id, dict_input("Source model names?"), dict_input("Target model names?"), single_input("Operation name?")))
|
|
|
elif (cmd == "transformation_add_MT"):
|
|
|
output(cmd_transformation_add_MT(user_id, dict_input("Source model names?"), dict_input("Target models?"), single_input("Operation name?")))
|
|
|
- elif (cmd == "transformation_list"):
|
|
|
- output(cmd_transformation_list())
|
|
|
- elif (cmd == "transformation_list_full"):
|
|
|
- output(cmd_transformation_list_full())
|
|
|
elif (cmd == "permission_modify"):
|
|
|
output(cmd_permission_modify(user_id, single_input("Model name?"), single_input("Permissions?")))
|
|
|
elif (cmd == "permission_owner"):
|