3 Replies Latest reply on May 27, 2009 6:08 PM by Ronald van Kuijk

    Delegate config map of lists

    Kevin Henderson Newbie

      Hi,

      I'm trying to use a map of lists inside of an ActionHandler, but I am not able to correctly configure the list; I get an error saying that it cannot convert a String to a List. Here is the config:


      ...
      <action name="my-action" class="com.sample.action.MyActionHandler">
       <fields>
       <entry>
       <key>one</key>
       <value>
       <list>
       <element>one-1</element>
       <element>one-2</element>
       </list>
       </value>
       </entry>
       <entry>
       <key>two</key>
       <value>
       <list>
       <element>two-1</element>
       <element>two-2</element>
       </list>
       </value>
       </entry>
       </fields>
      </action>
      ...
      



      
      public class MyActionHandler implements ActionHandler {
      
       private Map<String, List<String>> fields;
      
       @Override
       public void execute(ExecutionContext context) throws Exception {
       ...
       }
      
       public Map<String, List<String>> getFields() {
       return fields;
       }
      
       public void setFields(Map<String, List<String>> fields) {
       this.fields = fields;
       }
      
      }
      
      


      Here is the stack trace:


      16:52:38,732 [main] ERROR GraphElement : action threw exception: java.lang.String cannot be cast to java.util.List
      java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
       at com.sample.action.MysActionHandler.execute(CheckRequiredFieldsActionHandler.java:17)
       at org.jbpm.graph.def.Action.execute(Action.java:122)
       at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:259)
       at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:215)
       at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:185)
       at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:169)
       at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:452)
       at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:393)
       at com.sample.SimpleProcessTest.executeTask(SimpleProcessTest.java:103)
      
      


      Does anyone know why this won't work? Thanks...