|
@@ -383,12 +383,17 @@ Void function model_create(model : Element, name : String, user_id : String, typ
|
|
|
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")
|
|
|
+ log("Owner")
|
|
|
instantiate_link(core, "owner", "", model_id, user_id)
|
|
|
+ log("Group")
|
|
|
instantiate_link(core, "group", "", model_id, get_group_id("nobody"))
|
|
|
+ log("type_id")
|
|
|
instance_of = instantiate_link(core, "instanceOf", "", model_id, type_id)
|
|
|
+ log("Semantics")
|
|
|
instantiate_link(core, "semantics", "", instance_of, get_entry_id("models/conformance_mv"))
|
|
|
|
|
|
// Create type mapping model
|
|
|
+ log("Typing")
|
|
|
instantiate_link(core, "typing", "", instance_of, export_typing(model, name, user_id))
|
|
|
|
|
|
return!
|
|
@@ -1177,45 +1182,50 @@ String function cmd_model_delete(user_id : String, model_name : String):
|
|
|
|
|
|
String function cmd_model_list(location : String):
|
|
|
// List all models
|
|
|
- Element models
|
|
|
- String result
|
|
|
- String m
|
|
|
-
|
|
|
- result = "Success: "
|
|
|
- models = allAssociationDestinations(core, get_entry_id(location), "contains")
|
|
|
- while (set_len(models) > 0):
|
|
|
- m = set_pop(models)
|
|
|
- if (is_nominal_instance(core, m, "Folder")):
|
|
|
- result = result + string_join(read_attribute(core, m, "name"), "/\n")
|
|
|
- else:
|
|
|
- result = result + string_join(read_attribute(core, m, "name"), "\n")
|
|
|
- return result!
|
|
|
+ if (get_entry_id(location) != ""):
|
|
|
+ Element models
|
|
|
+ String result
|
|
|
+ String m
|
|
|
+
|
|
|
+ result = "Success: "
|
|
|
+ models = allAssociationDestinations(core, get_entry_id(location), "contains")
|
|
|
+ while (set_len(models) > 0):
|
|
|
+ m = set_pop(models)
|
|
|
+ if (is_nominal_instance(core, m, "Folder")):
|
|
|
+ result = result + string_join(read_attribute(core, m, "name"), "/\n")
|
|
|
+ else:
|
|
|
+ result = result + string_join(read_attribute(core, m, "name"), "\n")
|
|
|
+ return result!
|
|
|
+ else:
|
|
|
+ return "Location not found: " + location!
|
|
|
|
|
|
String function cmd_model_list_full(location : String):
|
|
|
// List all models with full info
|
|
|
- Element models
|
|
|
- String m
|
|
|
- String permissions
|
|
|
- String owner
|
|
|
- String group
|
|
|
- String name
|
|
|
- String type
|
|
|
- String result
|
|
|
-
|
|
|
- result = "Success: "
|
|
|
- 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")
|
|
|
- if (is_nominal_instance(core, m, "Folder")):
|
|
|
- name = string_join(read_attribute(core, m, "name"), "/")
|
|
|
- else:
|
|
|
- name = read_attribute(core, m, "name")
|
|
|
- result = result + (((((((permissions + " ") + owner) + " ") + group) + " ") + name) + "\n")
|
|
|
-
|
|
|
- return result!
|
|
|
+ if (get_entry_id(location) != ""):
|
|
|
+ Element models
|
|
|
+ String m
|
|
|
+ String permissions
|
|
|
+ String owner
|
|
|
+ String group
|
|
|
+ String name
|
|
|
+ String type
|
|
|
+ String result
|
|
|
+
|
|
|
+ result = "Success: "
|
|
|
+ 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")
|
|
|
+ if (is_nominal_instance(core, m, "Folder")):
|
|
|
+ name = string_join(read_attribute(core, m, "name"), "/")
|
|
|
+ else:
|
|
|
+ name = read_attribute(core, m, "name")
|
|
|
+ result = result + (((((((permissions + " ") + owner) + " ") + group) + " ") + name) + "\n")
|
|
|
+ return result!
|
|
|
+ else:
|
|
|
+ return "Location not found: " + location!
|
|
|
|
|
|
String function cmd_transformation_add_MANUAL(user_id : String, source_models : Element, target_models : Element, operation_name : String):
|
|
|
return transformation_add(user_id, source_models, target_models, operation_name, "manual")!
|