|
@@ -112,6 +112,7 @@ Void function main():
|
|
|
instantiate_link(core, "owner", "", al_model, admin_user)
|
|
|
|
|
|
// Add the Manual Operation formalism
|
|
|
+ log("Adding manual model")
|
|
|
Element manual
|
|
|
String manual_model
|
|
|
manual = instantiate_model(scd)
|
|
@@ -122,6 +123,7 @@ Void function main():
|
|
|
instantiate_attribute(core, manual_model, "permissions", "221")
|
|
|
instance_of = instantiate_link(core, "instanceOf", "", manual_model, scd_model)
|
|
|
instantiate_attribute(core, instance_of, "type_mapping", create_node())
|
|
|
+ log("Added manual model")
|
|
|
|
|
|
// Make necessary links for the formalism to the owners
|
|
|
instantiate_link(core, "group", "", manual_model, admin_group)
|
|
@@ -714,10 +716,14 @@ Void function user_function_skip_init(user_id : String):
|
|
|
|
|
|
trace_links = allOutgoingAssociationInstances(core, transformation_id, "tracability")
|
|
|
merged_metamodel_id = ""
|
|
|
+ log("Tracability links: " + cast_v2s(read_nr_out(trace_links)))
|
|
|
while (read_nr_out(trace_links) > 0):
|
|
|
trace_link_id = set_pop(trace_links)
|
|
|
if (value_eq(read_attribute(core, trace_link_id, "type"), "operatesOn")):
|
|
|
merged_metamodel_id = readAssociationDestination(core, trace_link_id)
|
|
|
+ else:
|
|
|
+ output("Unknown tracability link: " + cast_v2s(read_attribute(core, trace_link_id, "type")))
|
|
|
+
|
|
|
if (merged_metamodel_id != ""):
|
|
|
merged_model = instantiate_model(get_full_model(merged_metamodel_id))
|
|
|
|
|
@@ -735,7 +741,9 @@ Void function user_function_skip_init(user_id : String):
|
|
|
|
|
|
// 3) Transform
|
|
|
|
|
|
+ log("Start modify")
|
|
|
modify(merged_model, True)
|
|
|
+ log("Modify finished")
|
|
|
|
|
|
// 4) Split in different files depending on type
|
|
|
|
|
@@ -755,7 +763,8 @@ Void function user_function_skip_init(user_id : String):
|
|
|
else:
|
|
|
// Model exists, so we overwrite
|
|
|
model_overwrite(split_off_model, get_model_id(outputs[key]))
|
|
|
-
|
|
|
+ else:
|
|
|
+ output("Could not find merged metamodel")
|
|
|
else:
|
|
|
output("Did not know how to interpret model of type " + exact_type)
|
|
|
else:
|
|
@@ -992,23 +1001,35 @@ Void function user_function_skip_init(user_id : String):
|
|
|
Element merged_formalism
|
|
|
String merged_formalism_id
|
|
|
String source_formalism_id
|
|
|
- String type_id
|
|
|
String tracability_link
|
|
|
+ String type_id
|
|
|
+ String old_type_id
|
|
|
|
|
|
name = input()
|
|
|
source = create_node()
|
|
|
target = create_node()
|
|
|
all_formalisms = create_node()
|
|
|
|
|
|
+ type_id = ""
|
|
|
+ old_type_id = ""
|
|
|
while (name != ""):
|
|
|
model_id = get_model_id(name)
|
|
|
if (model_id != ""):
|
|
|
- if (bool_not(set_in(source, model_id))):
|
|
|
- set_add(source, model_id)
|
|
|
- set_add(all_formalisms, create_tuple(name, get_full_model(model_id)))
|
|
|
- output("Model added as source")
|
|
|
+ if (allow_read(user_id, model_id)):
|
|
|
+ if (bool_not(set_in(source, model_id))):
|
|
|
+ type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
|
|
|
+ if (bool_or(old_type_id == "", type_id == old_type_id)):
|
|
|
+ old_type_id = type_id
|
|
|
+ set_add(source, model_id)
|
|
|
+ set_add(all_formalisms, create_tuple(name, get_full_model(model_id)))
|
|
|
+ output("Model added as source")
|
|
|
+ elif (old_type_id != type_id):
|
|
|
+ // Already have a previous type_id and now another: CLASH
|
|
|
+ output("Cannot add model as types not compatible with previous models; try again")
|
|
|
+ else:
|
|
|
+ output("Model already selected as source")
|
|
|
else:
|
|
|
- output("Model already selected as source")
|
|
|
+ output("Permission denied")
|
|
|
else:
|
|
|
output("No such model; try again")
|
|
|
|
|
@@ -1019,12 +1040,21 @@ Void function user_function_skip_init(user_id : String):
|
|
|
while (name != ""):
|
|
|
model_id = get_model_id(name)
|
|
|
if (model_id != ""):
|
|
|
- if (bool_not(set_in(target, model_id))):
|
|
|
- set_add(target, model_id)
|
|
|
- set_add(all_formalisms, create_tuple(name, get_full_model(model_id)))
|
|
|
- output("Model added as target")
|
|
|
+ if (allow_read(user_id, model_id)):
|
|
|
+ if (bool_not(set_in(target, model_id))):
|
|
|
+ type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
|
|
|
+ if (bool_or(old_type_id == "", type_id == old_type_id)):
|
|
|
+ old_type_id = type_id
|
|
|
+ set_add(target, model_id)
|
|
|
+ set_add(all_formalisms, create_tuple(name, get_full_model(model_id)))
|
|
|
+ output("Model added as target")
|
|
|
+ elif (old_type_id != type_id):
|
|
|
+ // Already have a previous type_id and now another: CLASH
|
|
|
+ output("Cannot add model as types not compatible with previous models; try again")
|
|
|
+ else:
|
|
|
+ output("Model already selected as target")
|
|
|
else:
|
|
|
- output("Model already selected as target")
|
|
|
+ output("Permission denied")
|
|
|
else:
|
|
|
output("No such model; try again")
|
|
|
|
|
@@ -1050,7 +1080,10 @@ Void function user_function_skip_init(user_id : String):
|
|
|
while (read_nr_out(all_formalisms) > 0):
|
|
|
source_formalism_id = get_model_id(list_read(set_pop(all_formalisms), 0))
|
|
|
tracability_link = instantiate_link(core, "tracability", "", merged_formalism_id, source_formalism_id)
|
|
|
- instantiate_attribute(core, tracability_link, "type", "operatesOn")
|
|
|
+ instantiate_attribute(core, tracability_link, "type", "merged")
|
|
|
+
|
|
|
+ tracability_link = instantiate_link(core, "tracability", "", model_id, merged_formalism_id)
|
|
|
+ instantiate_attribute(core, tracability_link, "type", "operatesOn")
|
|
|
|
|
|
// Extend metadata with info on source and target
|
|
|
String link
|