Explorar o código

More robust changing between modelling and megamodelling

Yentl Van Tendeloo %!s(int64=7) %!d(string=hai) anos
pai
achega
63e9037a1b
Modificáronse 2 ficheiros con 25 adicións e 36 borrados
  1. 12 21
      wrappers/classes/modelverse.xml
  2. 13 15
      wrappers/modelverse_SCCD.py

+ 12 - 21
wrappers/classes/modelverse.xml

@@ -258,24 +258,10 @@
                                 <raise event="request">
                                     <parameter expr="self.parameters[0]"/>
                                 </raise>
-
-                                <script>
-                                    print("Got logon query")
-                                </script>
                             </transition>
                         </state>
 
                         <state id="wait_prompt_2">
-                            <onentry>
-                                <script>
-                                    print("Wait for password query")
-                                </script>
-                            </onentry>
-                            <onexit>
-                                <script>
-                                    print("Exit password query")
-                                </script>
-                            </onexit>
                             <transition cond="self.expect_response('Password for existing user?', pop=True)" target="../wait_prompt_existing">
                                 <raise event="request">
                                     <parameter expr="self.parameters[1]"/>
@@ -1497,15 +1483,9 @@
                     </state>
 
                     <state id="connected">
-                        <onentry>
-                            <script>
-                                print("CONNECTED ready for login")
-                            </script>
-                        </onentry>
                         <transition cond="self.expect_action('login')" target="../../operations/login">
                             <script>
                                 self.load_action()
-                                print("Processing login for " + str(self.parameters))
                             </script>
                         </transition>
 
@@ -1835,7 +1815,7 @@
                             <state id="manual">
                                 <transition cond="self.expect_action('exit')" target="../../../../leaving_manual"/>
 
-                                <transition cond="self.actions and self.actions[0] in self.modelling_operations and self.actions[0]['parameters'][0] != self.current_model" target="../../../../leaving_manual"/>
+                                <transition cond="self.actions and self.actions[0]['name'] in self.modelling_operations and self.actions[0]['parameters'][0] != self.current_model" target="../../../../leaving_manual"/>
                             </state>
 
                             <state id="scripted">
@@ -1844,8 +1824,19 @@
                                         <parameter expr="'exit'"/>
                                     </raise>
                                 </transition>
+
+                                <transition cond="self.actions and self.actions[0] in self.modelling_operations and self.actions[0]['parameters'][0] != self.current_model" target=".">
+                                    <script>
+                                        self.load_action()
+                                    </script>
+                                    <raise event="exception">
+                                        <parameter expr="'InterfaceMismatch'"/>
+                                        <parameter expr="'Operation cannot be executed in this context'"/>
+                                    </raise>
+                                </transition>
                             </state>
 
+
                             <transition cond="self.expect_action('element_list')" target="../../../operations/element_list">
                                 <script>
                                     self.load_action()

+ 13 - 15
wrappers/modelverse_SCCD.py

@@ -174,8 +174,6 @@ class Modelverse(RuntimeClassBase):
         
         # state /initialized/behaviour/operations/login/wait_prompt_2
         self.states["/initialized/behaviour/operations/login/wait_prompt_2"] = State(15, "/initialized/behaviour/operations/login/wait_prompt_2", self)
-        self.states["/initialized/behaviour/operations/login/wait_prompt_2"].setEnter(self._initialized_behaviour_operations_login_wait_prompt_2_enter)
-        self.states["/initialized/behaviour/operations/login/wait_prompt_2"].setExit(self._initialized_behaviour_operations_login_wait_prompt_2_exit)
         
         # state /initialized/behaviour/operations/login/wait_prompt_existing
         self.states["/initialized/behaviour/operations/login/wait_prompt_existing"] = State(16, "/initialized/behaviour/operations/login/wait_prompt_existing", self)
@@ -489,7 +487,6 @@ class Modelverse(RuntimeClassBase):
         
         # state /initialized/behaviour/wait_for_action/connected
         self.states["/initialized/behaviour/wait_for_action/connected"] = State(99, "/initialized/behaviour/wait_for_action/connected", self)
-        self.states["/initialized/behaviour/wait_for_action/connected"].setEnter(self._initialized_behaviour_wait_for_action_connected_enter)
         
         # state /initialized/behaviour/wait_for_action/activity
         self.states["/initialized/behaviour/wait_for_action/activity"] = State(100, "/initialized/behaviour/wait_for_action/activity", self)
@@ -1622,6 +1619,11 @@ class Modelverse(RuntimeClassBase):
         _initialized_behaviour_wait_for_action_modelling_recognized_scripted_0.setTrigger(None)
         _initialized_behaviour_wait_for_action_modelling_recognized_scripted_0.setGuard(self._initialized_behaviour_wait_for_action_modelling_recognized_scripted_0_guard)
         self.states["/initialized/behaviour/wait_for_action/modelling/recognized/scripted"].addTransition(_initialized_behaviour_wait_for_action_modelling_recognized_scripted_0)
+        _initialized_behaviour_wait_for_action_modelling_recognized_scripted_1 = Transition(self, self.states["/initialized/behaviour/wait_for_action/modelling/recognized/scripted"], [self.states["/initialized/behaviour/wait_for_action/modelling/recognized/scripted"]])
+        _initialized_behaviour_wait_for_action_modelling_recognized_scripted_1.setAction(self._initialized_behaviour_wait_for_action_modelling_recognized_scripted_1_exec)
+        _initialized_behaviour_wait_for_action_modelling_recognized_scripted_1.setTrigger(None)
+        _initialized_behaviour_wait_for_action_modelling_recognized_scripted_1.setGuard(self._initialized_behaviour_wait_for_action_modelling_recognized_scripted_1_guard)
+        self.states["/initialized/behaviour/wait_for_action/modelling/recognized/scripted"].addTransition(_initialized_behaviour_wait_for_action_modelling_recognized_scripted_1)
         
         # transition /initialized/behaviour/going_manual/init
         _initialized_behaviour_going_manual_init_0 = Transition(self, self.states["/initialized/behaviour/going_manual/init"], [self.states["/initialized/behaviour/going_manual/OK"]])
@@ -1956,12 +1958,6 @@ class Modelverse(RuntimeClassBase):
         self.big_step.outputEventOM(Event("create_instance", None, [self, 'http_client', 'HTTPClient']))
         self.big_step.outputEventOM(Event("create_instance", None, [self, 'http_client', 'HTTPClient']))
     
-    def _initialized_behaviour_operations_login_wait_prompt_2_enter(self):
-        print("Wait for password query")
-    
-    def _initialized_behaviour_operations_login_wait_prompt_2_exit(self):
-        print("Exit password query")
-    
     def _initialized_behaviour_operations_model_list_enter(self):
         self.raiseInternalEvent(Event("request", None, [['model_list', self.parameters[0]]]))
     
@@ -2142,9 +2138,6 @@ class Modelverse(RuntimeClassBase):
     def _initialized_behaviour_operations_service_stop_enter(self):
         self.raiseInternalEvent(Event("request", None, [['service_stop']]))
     
-    def _initialized_behaviour_wait_for_action_connected_enter(self):
-        print("CONNECTED ready for login")
-    
     def _initialized_behaviour_going_manual_init_enter(self):
         self.current_model = self.actions[0]["parameters"][0]
     
@@ -2506,7 +2499,6 @@ class Modelverse(RuntimeClassBase):
     
     def _initialized_behaviour_operations_login_wait_prompt_1_0_exec(self, parameters):
         self.raiseInternalEvent(Event("request", None, [self.parameters[0]]))
-        print("Got logon query")
     
     def _initialized_behaviour_operations_login_wait_prompt_1_0_guard(self, parameters):
         return self.expect_response('Log on as which user?', pop=True)
@@ -3041,7 +3033,6 @@ class Modelverse(RuntimeClassBase):
     
     def _initialized_behaviour_wait_for_action_connected_0_exec(self, parameters):
         self.load_action()
-        print("Processing login for " + str(self.parameters))
     
     def _initialized_behaviour_wait_for_action_connected_0_guard(self, parameters):
         return self.expect_action('login')
@@ -3346,7 +3337,7 @@ class Modelverse(RuntimeClassBase):
         return self.expect_action('exit')
     
     def _initialized_behaviour_wait_for_action_modelling_recognized_manual_1_guard(self, parameters):
-        return self.actions and self.actions[0] in self.modelling_operations and self.actions[0]['parameters'][0] != self.current_model
+        return self.actions and self.actions[0]['name'] in self.modelling_operations and self.actions[0]['parameters'][0] != self.current_model
     
     def _initialized_behaviour_wait_for_action_modelling_recognized_scripted_0_exec(self, parameters):
         self.raiseInternalEvent(Event("request", None, ['exit']))
@@ -3354,6 +3345,13 @@ class Modelverse(RuntimeClassBase):
     def _initialized_behaviour_wait_for_action_modelling_recognized_scripted_0_guard(self, parameters):
         return self.expect_action('exit')
     
+    def _initialized_behaviour_wait_for_action_modelling_recognized_scripted_1_exec(self, parameters):
+        self.load_action()
+        self.raiseInternalEvent(Event("exception", None, ['InterfaceMismatch', 'Operation cannot be executed in this context']))
+    
+    def _initialized_behaviour_wait_for_action_modelling_recognized_scripted_1_guard(self, parameters):
+        return self.actions and self.actions[0] in self.modelling_operations and self.actions[0]['parameters'][0] != self.current_model
+    
     def _initialized_behaviour_going_manual_init_0_guard(self, parameters):
         return self.current_model in self.registered_metamodel