|
@@ -1046,6 +1046,7 @@ String function cmd_help():
|
|
|
result = ""
|
|
|
result = result + ("Model operations\n")
|
|
|
result = result + (" model_add -- Add a new model\n")
|
|
|
+ result = result + (" model_move -- Move a model to a different location\n")
|
|
|
result = result + (" model_modify -- Modify an existing model\n")
|
|
|
result = result + (" model_list -- List all models\n")
|
|
|
result = result + (" model_list_full -- List all models with full info\n")
|
|
@@ -1093,6 +1094,35 @@ String function cmd_help():
|
|
|
|
|
|
return result!
|
|
|
|
|
|
+String function cmd_model_move(source : String, target : String):
|
|
|
+ String source_id
|
|
|
+ source_id = get_entry_id(source)
|
|
|
+ if (source_id != ""):
|
|
|
+ if (get_entry_id(target) == ""):
|
|
|
+ // Create folders on path to the target
|
|
|
+ create_folders(current_user_id, get_foldername(target))
|
|
|
+
|
|
|
+ // Change location, first the name
|
|
|
+ instantiate_attribute(core, source_id, "name", target)
|
|
|
+
|
|
|
+ // Now the folder links
|
|
|
+ Element links
|
|
|
+ links = allIncomingAssociationInstances(core, source_id, "contains")
|
|
|
+ while (set_len(links) > 0):
|
|
|
+ model_delete_element(core, set_pop(links))
|
|
|
+ instantiate_link(core, "contains", "", get_entry_id(get_foldername(target)), source_id)
|
|
|
+
|
|
|
+ // Flush caches
|
|
|
+ dict_add(caches["models"], target, caches["models"][source])
|
|
|
+ dict_delete(caches["models"], source)
|
|
|
+
|
|
|
+ // Done
|
|
|
+ return "Success"!
|
|
|
+ else:
|
|
|
+ return "Model exists: " + target!
|
|
|
+ else:
|
|
|
+ return "Model does not exist: " + source!
|
|
|
+
|
|
|
String function cmd_model_add(type : String, name : String, code : String):
|
|
|
// Model addition operation, which uses model upload commands of the compiler
|
|
|
String location
|
|
@@ -2367,6 +2397,8 @@ Void function user_function_skip_init(user_id : String):
|
|
|
output(cmd_help())
|
|
|
elif (cmd == "model_add"):
|
|
|
output(cmd_model_add(single_input("Model type?"), single_input("Model name?"), single_input("Model textual representation?")))
|
|
|
+ elif (cmd == "model_move"):
|
|
|
+ output(cmd_model_move(single_input("Model name?"), single_input("New location?")))
|
|
|
elif (cmd == "process_execute"):
|
|
|
output(cmd_process_execute(single_input("Process to execute?"), dict_input("Model bindings to use?")))
|
|
|
elif (cmd == "process_signature"):
|