1 Reply Latest reply on Jan 4, 2007 11:28 AM by kukeltje

    newbie: Configurable Decision nodes in JBPM3.1

    urkens_jp

      I am trying to create a configurable decision node in JBPM3.1 using a DecisionHandler class that in its decide() method calls a method on a specific class.
      I have an example from JBPM2.1 where the 'Configurable' interface is used to make the decision node configurable by passing a String parameter in the decision node. This String parameter then represents the method to be called.
      However this 'Configurable' interface does no longer exist in JBPM3.1.
      So how does this work in JBPM 3.1 ?

      Example from JBPM2.1 project:
      ====================
      1) DecisionHandler class
      public class VodItemMethodDecision implements DecisionHandler, Configurable {
      public String decide(ExecutionContext context) {
      Long contentId = (Long) context.getVariable(VariableNames.CONTENT_ITEM_ID);
      String result = null;
      try {
      VodItem vodItem = new VodItem();
      vodItem = (VodItem) vodItem.lookup(contentId);
      Class vodItemClass = vodItem.getClass();
      Method method = vodItemClass.getMethod(methodName,null);
      result = method.invoke(vodItem,null).toString();
      } catch (Exception e) { }
      if (result == null)
      return (result != null ? result : "unknown");
      }

      public void configure(String configuration) throws ConfigurationException {
      if (configuration == null) {
      throw new ConfigurationException("The method name is missing");
      }
      methodName = configuration;
      }
      private String methodName = null;
      private static Log log = ogFactory.getLog(VodItemMethodDecision.class);
      }

      2) Decision Node declaration:

      getEncryptionNeeded