|
@@ -219,6 +219,9 @@ Boolean function check_login(user_id : String):
|
|
|
|
|
|
return password == stored_password!
|
|
|
|
|
|
+String function expand_path(name : String):
|
|
|
+ return string_replace(name, "~", "users/" + cast_string(read_attribute(core, current_user_id, "name")))!
|
|
|
+
|
|
|
String function get_entry_id(name : String):
|
|
|
Element hierarchy_split
|
|
|
String current
|
|
@@ -234,8 +237,7 @@ String function get_entry_id(name : String):
|
|
|
if (string_get(name, string_len(name) - 1) == "/"):
|
|
|
name = string_substr(name, 0, string_len(name) - 1)
|
|
|
|
|
|
- name = string_replace(name, "~", "users/" + cast_string(read_attribute(core, current_user_id, "name")))
|
|
|
- log("Expanded name to " + name)
|
|
|
+ name = expand_path(name)
|
|
|
|
|
|
if (dict_in(caches["models"], name)):
|
|
|
if (dict_in(core, caches["models"])):
|
|
@@ -309,7 +311,7 @@ String function create_folders(user_id : String, folder_name : String, permissio
|
|
|
return get_entry_id(folder_name)!
|
|
|
|
|
|
i = 0
|
|
|
- folder_name = string_replace(folder_name, "~", "users/" + cast_string(read_attribute(core, current_user_id, "name")))
|
|
|
+ folder_name = expand_path(folder_name)
|
|
|
|
|
|
hierarchy = string_split(folder_name, "/")
|
|
|
prev = get_entry_id("")
|
|
@@ -344,7 +346,7 @@ String function create_folders(user_id : String, folder_name : String, permissio
|
|
|
String function store_entry(model_id : String, full_name : String, user_id : String):
|
|
|
String prev
|
|
|
|
|
|
- full_name = string_replace(full_name, "~", "users/" + cast_string(read_attribute(core, current_user_id, "name")))
|
|
|
+ full_name = expand_path(full_name)
|
|
|
|
|
|
if (get_entry_id(full_name) != ""):
|
|
|
// Delete any old models
|
|
@@ -378,10 +380,8 @@ String function export_typing(model : Element, name : String):
|
|
|
|
|
|
Void function model_create(model : Element, name : String, type_id : String, kind : String):
|
|
|
if (get_entry_id(name) != ""):
|
|
|
- log("Exists, so overwrite...")
|
|
|
model_overwrite(model, get_entry_id(name), type_id)
|
|
|
else:
|
|
|
- log("New, so create")
|
|
|
String location
|
|
|
String model_id
|
|
|
String instance_of
|
|
@@ -402,8 +402,6 @@ Void function model_create(model : Element, name : String, type_id : String, kin
|
|
|
// Create type mapping model
|
|
|
instantiate_link(core, "typing", "", instance_of, export_typing(model, name))
|
|
|
|
|
|
- log("Stored with name: " + cast_string(read_attribute(core, model_id, "name")))
|
|
|
-
|
|
|
return!
|
|
|
|
|
|
Void function model_overwrite(model : Element, model_id : String, metamodel_id : String):
|
|
@@ -483,7 +481,6 @@ Element function merge_models(models_dict : Element, operation_name : String):
|
|
|
key = set_pop(keys)
|
|
|
mm = get_full_model(get_entry_id(models_dict[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)
|
|
|
return read_root()!
|
|
|
set_add_node(model_tuples, create_tuple(key, mm))
|
|
@@ -491,7 +488,6 @@ Element function merge_models(models_dict : Element, operation_name : String):
|
|
|
Element merged_metamodel
|
|
|
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("Type cannot be typed as formalisms/SimpleClassDiagrams: 'merged'")
|
|
|
return read_root()!
|
|
|
|
|
@@ -512,7 +508,6 @@ Element function split_model(model : Element, metamodels_dict : Element):
|
|
|
key = set_pop(keys)
|
|
|
mm = get_full_model(get_entry_id(metamodels_dict[key]), get_entry_id("SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
- log("Output metamodel cannot be interpreted using SimpleClassDiagrams: " + key)
|
|
|
output("Type cannot be typed as formalisms/SimpleClassDiagrams: " + key)
|
|
|
return read_root()!
|
|
|
set_add_node(model_tuples, create_tuple(key, mm))
|
|
@@ -668,7 +663,6 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
result = transform(merged_model, operation)
|
|
|
elif (exact_type == "ManualOperation"):
|
|
|
output("Please perform manual operation " + cast_value(full_name(operation_id)))
|
|
|
- log("Performing manual")
|
|
|
if (element_neq(merged_model, read_root())):
|
|
|
String model_name
|
|
|
model_name = ""
|
|
@@ -726,7 +720,8 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
else:
|
|
|
return "Failure"!
|
|
|
|
|
|
-Boolean function enact_action(pm : Element, element : String, mapping : Element):
|
|
|
+Boolean function enact_action(pm : Element, element : String, mapping : Element, user_id : String):
|
|
|
+ current_user_id = user_id
|
|
|
Boolean result
|
|
|
String transformation_id
|
|
|
Element lst
|
|
@@ -813,7 +808,6 @@ Boolean function enact_action(pm : Element, element : String, mapping : Element)
|
|
|
keys = dict_keys(outputs)
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
- log("Create model " + cast_string(output_map[key]))
|
|
|
model_create(result[key], output_map[key], get_entry_id(outputs[key]), "Model")
|
|
|
output("Success")
|
|
|
return True!
|
|
@@ -822,20 +816,22 @@ Element function PM_signature(pm : Element):
|
|
|
Element all_data
|
|
|
Element result
|
|
|
String entry
|
|
|
+ String name
|
|
|
|
|
|
result = dict_create()
|
|
|
all_data = allInstances(pm, "Data")
|
|
|
while (set_len(all_data) > 0):
|
|
|
entry = set_pop(all_data)
|
|
|
- dict_add(result, cast_string(read_attribute(pm, entry, "name")), cast_string(read_attribute(pm, entry, "type")))
|
|
|
+ name = read_attribute(pm, entry, "name")
|
|
|
+ dict_add(result, name, expand_path(read_attribute(pm, entry, "type")))
|
|
|
|
|
|
return result!
|
|
|
|
|
|
-Void function enact_PM_activity(activity_to_task : Element, task_to_result : Element, pm : Element, element : String, mapping : Element):
|
|
|
+Void function enact_PM_activity(activity_to_task : Element, task_to_result : Element, pm : Element, element : String, mapping : Element, user_id : String):
|
|
|
Boolean result
|
|
|
pm_tasks = activity_to_task
|
|
|
set_add(activity_to_task[element], get_taskname())
|
|
|
- result = enact_action(pm, element, mapping)
|
|
|
+ result = enact_action(pm, element, mapping, user_id)
|
|
|
dict_add_fast(task_to_result, get_taskname(), result)
|
|
|
|
|
|
while (other_has_output(get_taskname())):
|
|
@@ -874,6 +870,8 @@ Void function enact_PM(pm : Element, mapping : Element):
|
|
|
dict_add(mapping, key, mock_location)
|
|
|
cmd_model_add(signature[key], mapping[key], "")
|
|
|
set_add(mock_locations, mock_location)
|
|
|
+ else:
|
|
|
+ dict_overwrite(mapping, key, expand_path(mapping[key]))
|
|
|
|
|
|
// Initialize Join counters
|
|
|
counters = dict_create()
|
|
@@ -945,6 +943,7 @@ Void function enact_PM(pm : Element, mapping : Element):
|
|
|
list_append(args, pm)
|
|
|
list_append(args, element)
|
|
|
list_append(args, mapping)
|
|
|
+ list_append(args, current_user_id)
|
|
|
taskname = spawn(enact_PM_activity, args)
|
|
|
output(taskname + " : " + cast_string(read_attribute(pm, element, "name")))
|
|
|
dict_add(task_to_activity, taskname, element)
|