|
@@ -15,6 +15,7 @@
|
|
|
<method name="split_response">
|
|
|
<parameter name="response"/>
|
|
|
<body>
|
|
|
+ print("Splitting " + str(response))
|
|
|
splitted = response.strip().split(": ", 1)
|
|
|
if len(splitted) > 1:
|
|
|
return splitted[1].split("\n")
|
|
@@ -53,7 +54,10 @@
|
|
|
<parameter name="context"/>
|
|
|
<parameter name="expected"/>
|
|
|
<body>
|
|
|
- return self.actions[context] and self.actions[context][0]["name"] == expected
|
|
|
+ if isinstance(expected, list):
|
|
|
+ return self.actions[context] and expected in self.actions[context][0]["name"]
|
|
|
+ else:
|
|
|
+ return self.actions[context] and self.actions[context][0]["name"] == expected
|
|
|
</body>
|
|
|
</method>
|
|
|
|
|
@@ -260,7 +264,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -314,7 +318,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -410,7 +414,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="self.split_response(self.responses.pop(0))[0]"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -424,7 +428,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -450,7 +454,7 @@
|
|
|
</state>
|
|
|
|
|
|
<state id="edit_metamodel">
|
|
|
- <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../wait_for_action/modelling/scripted"/>
|
|
|
+ <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../wait_for_action/modelling/recognized_operation/scripted"/>
|
|
|
<transition cond="self.expect_response('Waiting for model constructors...')" target="../send_model"/>
|
|
|
</state>
|
|
|
|
|
@@ -490,7 +494,7 @@
|
|
|
</state>
|
|
|
|
|
|
<state id="edit_metamodel">
|
|
|
- <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../wait_for_action/modelling/scripted"/>
|
|
|
+ <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../wait_for_action/modelling/recognized_operation/scripted"/>
|
|
|
<transition cond="self.expect_response('Waiting for code constructors...')" target="../send_model"/>
|
|
|
</state>
|
|
|
|
|
@@ -530,7 +534,7 @@
|
|
|
</state>
|
|
|
|
|
|
<state id="edit_metamodel">
|
|
|
- <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../wait_for_action/modelling/scripted"/>
|
|
|
+ <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../wait_for_action/modelling/recognized_operation/scripted"/>
|
|
|
<transition cond="self.expect_response('Success')" target="../../../wait_for_action/megamodelling">
|
|
|
<raise event="result">
|
|
|
<parameter expr="None"/>
|
|
@@ -640,7 +644,7 @@
|
|
|
</state>
|
|
|
|
|
|
<state id="edit_model">
|
|
|
- <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../wait_for_action/modelling/scripted"/>
|
|
|
+ <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../wait_for_action/modelling/recognized_operation/scripted"/>
|
|
|
<transition cond="self.expect_response('Success')" target="../../../wait_for_action/megamodelling">
|
|
|
<raise event="result">
|
|
|
<parameter expr="None"/>
|
|
@@ -793,7 +797,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.responses.pop(0)"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -877,7 +881,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ')" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -891,7 +895,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -919,7 +923,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -933,7 +937,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -972,11 +976,11 @@
|
|
|
<script>
|
|
|
response = self.responses.pop(0).strip()
|
|
|
_, response = response.split(": ", 1)
|
|
|
- values = {line.split(: ", 1)[0]: line.split(": ", 1)[1] for line in response.split("\n")}
|
|
|
- values = {key: values[key].split(" = ", 1)[0], values[key].split(" = ", 1)[1] for key in values}
|
|
|
+ values = {line.split(": ", 1)[0]: line.split(": ", 1)[1] for line in response.split("\n")}
|
|
|
+ values = {key: values[key].split(" = ", 1)[1] for key in values}
|
|
|
</script>
|
|
|
<raise event="result">
|
|
|
- <parameter expr="result"/>
|
|
|
+ <parameter expr="values"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -1070,7 +1074,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))" target="../../wait_for_action/history"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -1084,7 +1088,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))" target="../../wait_for_action/history"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -1098,7 +1102,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))" target="../../wait_for_action/history"/>
|
|
|
+ <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -1112,7 +1116,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))" target="../../wait_for_action/history"/>
|
|
|
+ <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -1126,7 +1130,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -1154,7 +1158,7 @@
|
|
|
|
|
|
<transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
|
|
|
<raise event="result">
|
|
|
- <parameter expr="self.split_response(self.responses.pop(0))"/>
|
|
|
+ <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
|
|
|
</raise>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -1199,6 +1203,7 @@
|
|
|
<transition cond="self.expect_action(None, 'model_list_full')" target="../../operations/model_list_full">
|
|
|
<script>
|
|
|
self.load_action(None)
|
|
|
+ print("MLF")
|
|
|
</script>
|
|
|
</transition>
|
|
|
|
|
@@ -1391,126 +1396,161 @@
|
|
|
self.load_action(None)
|
|
|
</script>
|
|
|
</transition>
|
|
|
- </state>
|
|
|
|
|
|
- <state id="modelling" initial="manual">
|
|
|
- <state id="manual">
|
|
|
- <onentry>
|
|
|
- self.context = None
|
|
|
- </onentry>
|
|
|
-
|
|
|
- <transition cond="self.expect_action(self.context, 'exit')" target="../../megamodelling"/>
|
|
|
- </state>
|
|
|
-
|
|
|
- <state id="scripted">
|
|
|
- <transition cond="self.expect_action(self.context, 'exit')" target="../../../operations/history"/>
|
|
|
- </state>
|
|
|
+ <transition cond="self.expect_action(None, ['element_list', 'element_list_nice', 'types', 'types_full', 'read_info', 'read_attrs', 'instantiate', 'delete_element', 'attr_assign', 'attr_assign_code', 'attr_delete', 'read_outgoing', 'read_incoming', 'read_association_source', 'read_association_destination', 'connections_between', 'define_attribute', 'all_instances'], pop=False)" target="../modelling/recognized_operation/manual"/>
|
|
|
+ </state>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'element_list')" target="../../operations/element_list">
|
|
|
+ <state id="modelling" initial="recognized_operation">
|
|
|
+ <onentry>
|
|
|
<script>
|
|
|
- self.load_action(self.context)
|
|
|
+ # TODO enter a specific model
|
|
|
+ pass
|
|
|
</script>
|
|
|
- </transition>
|
|
|
+ </onentry>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'element_list_nice')" target="../../operations/element_list_nice">
|
|
|
+ <onexit>
|
|
|
<script>
|
|
|
- self.load_action(self.context)
|
|
|
+ # TODO exit the specific model
|
|
|
+ pass
|
|
|
</script>
|
|
|
- </transition>
|
|
|
+ </onexit>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'types')" target="../../operations/types">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <state id="recognized_operation" initial="manual">
|
|
|
+ <state id="manual">
|
|
|
+ <onentry>
|
|
|
+ self.context = None
|
|
|
+ </onentry>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'types_full')" target="../../operations/types_full">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'exit')" target="../../../megamodelling"/>
|
|
|
+ </state>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'read_info')" target="../../operations/read_info">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <state id="scripted">
|
|
|
+ <transition cond="self.expect_action(self.context, 'exit')" target="../../../../operations/history"/>
|
|
|
+ </state>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'read_attrs')" target="../../operations/read_attrs">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'element_list')" target="../../../operations/element_list">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'instantiate')" target="../../operations/instantiate">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'element_list_nice')" target="../../../operations/element_list_nice">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'delete_element')" target="../../operations/delete_element">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'types')" target="../../../operations/types">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'attr_assign')" target="../../operations/attr_assign">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'types_full')" target="../../../operations/types_full">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'attr_assign_code')" target="../../operations/attr_assign_code">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'read_info')" target="../../../operations/read_info">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'attr_delete')" target="../../operations/attr_delete">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'read_attrs')" target="../../../operations/read_attrs">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'read_outgoing')" target="../../operations/read_outgoing">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'instantiate')" target="../../../operations/instantiate">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'read_incoming')" target="../../operations/read_incoming">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'delete_element')" target="../../../operations/delete_element">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'read_association_source')" target="../../operations/read_association_source">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'attr_assign')" target="../../../operations/attr_assign">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'read_association_destination')" target="../../operations/read_association_destination">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'attr_assign_code')" target="../../../operations/attr_assign_code">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'connections_between')" target="../../operations/connections_between">
|
|
|
- <script>
|
|
|
- self.load_action(self.context)
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
+ <transition cond="self.expect_action(self.context, 'attr_delete')" target="../../../operations/attr_delete">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'define_attribute')" target="../../operations/define_attribute">
|
|
|
+ <transition cond="self.expect_action(self.context, 'read_outgoing')" target="../../../operations/read_outgoing">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
+
|
|
|
+ <transition cond="self.expect_action(self.context, 'read_incoming')" target="../../../operations/read_incoming">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
+
|
|
|
+ <transition cond="self.expect_action(self.context, 'read_association_source')" target="../../../operations/read_association_source">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
+
|
|
|
+ <transition cond="self.expect_action(self.context, 'read_association_destination')" target="../../../operations/read_association_destination">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
+
|
|
|
+ <transition cond="self.expect_action(self.context, 'connections_between')" target="../../../operations/connections_between">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
+
|
|
|
+ <transition cond="self.expect_action(self.context, 'define_attribute')" target="../../../operations/define_attribute">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
+
|
|
|
+ <transition cond="self.expect_action(self.context, 'all_instances')" target="../../../operations/all_instances">
|
|
|
+ <script>
|
|
|
+ self.load_action(self.context)
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
+ </state>
|
|
|
+
|
|
|
+ <transition cond="self.context is not None and self.unexpected_action(self.context)" target=".">
|
|
|
<script>
|
|
|
- self.load_action(self.context)
|
|
|
+ print("Got unexpected operation: " + str(self.actions[self.context][0]))
|
|
|
</script>
|
|
|
+
|
|
|
+ <raise event="error">
|
|
|
+ <parameter expr="'IllegalContextOperation'"/>
|
|
|
+ <parameter expr="'Operation not allowed in a context!'"/>
|
|
|
+ </raise>
|
|
|
</transition>
|
|
|
|
|
|
- <transition cond="self.expect_action(self.context, 'all_instances')" target="../../operations/all_instances">
|
|
|
+ <transition cond="self.context is None and self.unexpected_action(self.context)" target="../megamodelling">
|
|
|
<script>
|
|
|
- self.load_action(self.context)
|
|
|
+ print("Got megamodelling operation in model: transferring")
|
|
|
</script>
|
|
|
</transition>
|
|
|
</state>
|
|
@@ -1518,6 +1558,17 @@
|
|
|
<state id="finished"/>
|
|
|
|
|
|
<history id="history" type="deep"/>
|
|
|
+
|
|
|
+ <transition cond="self.unexpected_action(None)" target=".">
|
|
|
+ <script>
|
|
|
+ print("Got unknown operation: " + str(self.actions[self.context][0]))
|
|
|
+ </script>
|
|
|
+
|
|
|
+ <raise event="error">
|
|
|
+ <parameter expr="'UnknownOperation'"/>
|
|
|
+ <parameter expr="'Operation is unknown'"/>
|
|
|
+ </raise>
|
|
|
+ </transition>
|
|
|
</state>
|
|
|
</state>
|
|
|
|