You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Johannes Neuber (JIRA)" <ji...@apache.org> on 2014/10/27 18:04:34 UTC

[jira] [Created] (SCXML-219) API to influence Element during runtime

Johannes Neuber created SCXML-219:
-------------------------------------

             Summary: API to influence <history> Element during runtime
                 Key: SCXML-219
                 URL: https://issues.apache.org/jira/browse/SCXML-219
             Project: Commons SCXML
          Issue Type: Improvement
    Affects Versions: 2.0
            Reporter: Johannes Neuber


Is there a possibility to influence a certain <history> from the SCXML specification during runtime by using a special (JEXL) API? It would be really helpful to be able to (at least) reset a certain history using its ID.

Something like: History.reset(id)

I took a look into the source code recently and found that there doesn't seem to be a possibility like this. That's why I made the following changes manually to be able to access a certain history using a custom action:

{code:java}
public class SCXMLExecutor implements SCXMLIOProcessor {
    // changed to public from protected ...
    public SCInstance getSCInstance() {
        return exctx.getScInstance();
    }
}
public class SCInstance implements Serializable {
    // added this method to access a certain history using it's id ...
    public void resetConfiguration(final String id) {
      if (id == null || id.length() == 0) {
        return;
      }
      History history = null;
      for (History h : histories.keySet()) {
        if ( h.getId().equals(id) ) 
          history = h;
          break;
        }
      }
      if (history != null) {
        resetConfiguration(history);
      }
    }
}
{code}

It seems to work. Maybe you could include this code in the following releases ...?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)