You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by at...@apache.org on 2014/03/19 01:19:31 UTC

svn commit: r1579096 - /commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/ModelUpdater.java

Author: ate
Date: Wed Mar 19 00:19:30 2014
New Revision: 1579096

URL: http://svn.apache.org/r1579096
Log:
SCXML-196: - <invoke> is allowed for composite states as well
- TODO: multiple <invoke> should be allowed too, as well as for <parallel>

Modified:
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/ModelUpdater.java

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/ModelUpdater.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/ModelUpdater.java?rev=1579096&r1=1579095&r2=1579096&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/ModelUpdater.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/ModelUpdater.java Wed Mar 19 00:19:30 2014
@@ -64,13 +64,6 @@ final class ModelUpdater {
             + "null or not a descendant of {0}";
 
     /**
-     * Error message when a state element contains anything other than
-     * an &lt;invoke&gt; or any number of &lt;state&gt; children.
-     */
-    private static final String ERR_STATE_BAD_CONTENTS = "{0} should "
-            + "contain either one <invoke> or any number of <state> children.";
-
-    /**
      * Error message when a referenced history state cannot be found.
      */
     private static final String ERR_STATE_NO_HIST = "Referenced history state"
@@ -225,6 +218,7 @@ final class ModelUpdater {
         else if (s.getInitial() != null) {
             logAndThrowModelError(ERR_UNSUPPORTED_INIT, new Object[] {getName(s)});
         }
+
         List<History> histories = s.getHistory();
         if (histories.size() > 0 && s.isSimple()) {
             logAndThrowModelError(ERR_HISTORY_SIMPLE_STATE,
@@ -236,10 +230,9 @@ final class ModelUpdater {
         for (Transition trn : s.getTransitionsList()) {
             updateTransition(trn, targets);
         }
+
+        // TODO: state must may have multiple invokes
         Invoke inv = s.getInvoke();
-        if (inv != null && !c.isEmpty()) {
-            logAndThrowModelError(ERR_STATE_BAD_CONTENTS, new Object[] {getName(s)});
-        }
         if (inv != null) {
             String type = inv.getType();
             if (type == null || type.trim().length() == 0) {
@@ -259,13 +252,13 @@ final class ModelUpdater {
                 logAndThrowModelError(ERR_INVOKE_AMBIGUOUS_SRC,
                         new Object[] {getName(s)});
             }
-        } else {
-            for (TransitionTarget tt : c.values()) {
-                if (tt instanceof State) {
-                    updateState((State) tt, targets);
-                } else if (tt instanceof Parallel) {
-                    updateParallel((Parallel) tt, targets);
-                }
+        }
+
+        for (TransitionTarget tt : c.values()) {
+            if (tt instanceof State) {
+                updateState((State) tt, targets);
+            } else if (tt instanceof Parallel) {
+                updateParallel((Parallel) tt, targets);
             }
         }
     }
@@ -289,6 +282,7 @@ final class ModelUpdater {
         for (History h : histories) {
             updateHistory(h, targets, p);
         }
+        // TODO: parallel must may have invokes too
     }
 
     /**