Selaa lähdekoodia

Correctly invoke enact_PM

Yentl Van Tendeloo 8 vuotta sitten
vanhempi
commit
9fad558f16
3 muutettua tiedostoa jossa 51 lisäystä ja 7 poistoa
  1. 1 1
      bootstrap/object_operations.alc
  2. 23 6
      core/core_algorithm.alc
  3. 27 0
      integration/test_mvc.py

+ 1 - 1
bootstrap/object_operations.alc

@@ -23,7 +23,7 @@ Element function allInstances(model : Element, type_name : String):
 
 		return result!
 	else:
-		log("No such type in the metamodel!")
+		log("No such type in the metamodel: " + type_name)
 		return create_node()!
 
 Element function selectPossibleIncoming(model : Element, target : String, limit_set : Element):

+ 23 - 6
core/core_algorithm.alc

@@ -486,7 +486,7 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
 	transformation_id = read_attribute(pm, element, "name")
 
 	// Find all inputs and their types (i.e., key)
-	lst = allAssociationOrigins(pm, element, "consumes")
+	lst = allAssociationOrigins(pm, element, "Consumes")
 	while (read_nr_out(lst) > 0):
 		elem = set_pop(lst)
 		// As there are no inheritance relations between full models, we can just read out the typename
@@ -494,7 +494,7 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
 		dict_add(inputs, type_name, read_attribute(core, elem, "name"))
 
 	// Find all outputs and their types (i.e., key)
-	lst = allAssociationDestinations(pm, element, "produces")
+	lst = allAssociationDestinations(pm, element, "Produces")
 	while (read_nr_out(lst) > 0):
 		elem = set_pop(lst)
 		// As there are no inheritance relations between full models, we can just read out the typename
@@ -781,7 +781,6 @@ Void function user_function_skip_init(user_id : String):
 			output("Model operations")
 			output("    model_add                       -- Add a new model")
 			output("    model_modify                    -- Modify an existing model")
-			output("    model_delete                    -- [TODO] Delete a model and all related transformations")
 			output("    model_list                      -- List all models")
 			output("    model_list_full                 -- List all models with full info")
 			output("    model_overwrite                 -- Overwrites a model with an uploaded model, leaving all metadata")
@@ -790,15 +789,17 @@ Void function user_function_skip_init(user_id : String):
 			output("Transformation-specific operations")
 			output("    transformation_add_MT_language  -- Create a RAMified metamodel of a set of models")
 			output("    transformation_add_MT           -- Initialize a new model transformation")
-			output("    transformation_add_AL           -- [TODO] Initialize a new action language transformation")
-			output("    transformation_add_EXT          -- [TODO] Initialize a new external tool transformation")
-			output("    transformation_add_MANUAL       -- [TODO] Initialize a new manual transformation")
+			output("    transformation_add_AL           -- Initialize a new action language transformation")
+			output("    transformation_add_MANUAL       -- Initialize a new manual transformation")
 			output("    transformation_execute          -- Execute a transformation on a set of input models")
 			output("    transformation_list             -- List all model transformations")
 			output("    transformation_list_full        -- List all model transformations with permissions")
 			output("    transformation_detail           -- List transformation details")
 			output("    transformation_RAMify           -- RAMify a metamodel (again)")
 			output("")
+			output("Process operations")
+			output("    process_execute                 -- Execute a process model")
+			output("")
 			output("Model permission operations")
 			output("    permission_modify               -- Change model permissions")
 			output("    permission_owner                -- Change model owner")
@@ -854,6 +855,22 @@ Void function user_function_skip_init(user_id : String):
 			else:
 				output("Could not find type model!")
 
+		elif (cmd == "process_execute"):
+			// Execute a process model until it reaches termination
+			String process_id
+
+			output("Which process model do you want to execute?")
+			log("Execute process!")
+			process_id = get_model_id(input())
+			if (process_id != ""):
+				if (allow_read(user_id, process_id)):
+					output("Model prefix to use?")
+					enact_PM(get_full_model(process_id), input(), user_id)
+				else:
+					output("Permission denied")
+			else:
+				output("No such model")
+			
 		elif (cmd == "transformation_execute"):
 			// Execute a transformation, whatever type it is
 			// First we detect the type, so we know how to prepare for invocation

+ 27 - 0
integration/test_mvc.py

@@ -1932,6 +1932,10 @@ class TestModelverseCore(unittest.TestCase):
                     "pn_reachability",
                     ] + get_model_constructor(open("integration/code/pm_pn_reachability.mvc", "r").read()) + [
                 "model_list",
+                "process_execute",
+                "pn_reachability",
+                "my_"
+                "model_list",
             ],
             [   # bootup phase
                 "Desired username for admin user?",
@@ -2029,4 +2033,27 @@ class TestModelverseCore(unittest.TestCase):
                      "  __merged_ReachabilityGraph_RAM : SimpleClassDiagrams",
                      "  __merged_refine_PN : SimpleClassDiagrams",
                      ]),
+                "Ready for command...",
+                # process_execute
+                "Which process model do you want to execute?",
+                "Model prefix to use?",
+                "Ready for command...",
+                # model_list
+                model_list |
+                set([
+                     "  PetriNet : SimpleClassDiagrams",
+                     "  ReachabilityGraph : SimpleClassDiagrams",
+                     "  initialize_PN : PetriNet_RAM",
+                     "  refine_PN : ManualOperation",
+                     "  reachability : ActionLanguage",
+                     "  reachability_print : ReachabilityGraph_RAM",
+                     "  pn_reachability : ProcessModel",
+                     "  PetriNet_RAM : SimpleClassDiagrams",
+                     "  ReachabilityGraph_RAM : SimpleClassDiagrams",
+                     "  my_PN : PetriNet",
+                     "  __merged_PetriNet_RAM : SimpleClassDiagrams",
+                     "  __merged_ReachabilityGraph_RAM : SimpleClassDiagrams",
+                     "  __merged_refine_PN : SimpleClassDiagrams",
+                     ]),
+                "Ready for command...",
             ]))