3 Replies Latest reply on Aug 23, 2007 4:24 AM by vorsorge

    Node configuration with Maps - How to?

    vorsorge

      Hi,

      I can't get a node configuration for am Map to run.

      My jPDL looks like this:

      <action class="baseJbpmActionHandler.MyHandler" >
      <vars>
       <entry><key>Vertragsnummer</key><value>12346</value></entry>
       <entry><key>Vorgang</key><value>25847</value></entry>
       <entry><key>StichtagTest</key><value>01.03.2007</value></entry>
       </vars>
      </action>
      


      In the ActionHandler I wnat to have a Map (HashMap) with these entrys.

      There is no example in the documentation. So:

      How does the ActionHandler where I can inject these entries into look like?

      Thank You!

      Martin


        • 1. Re: Node configuration with Maps - How to?
          jeanguyer

          I have an actionHandler with a List ,not a map.
          Hope this will help you :


          <action name="initProcessHeader"
           class="fr.xxx.xxx.workflow.impl.jbpm.actionhandler.InitProcessHeaderHandler">
           <lstVariables>
           <el>label.process|Demande de produits et prestations</el>
           <el>url.process|eco.dempdtpst</el>
           <el>label.info|N°Demande</el>
           <el>txt.info| </el>
           <el>label.sortie_stock|Sortie produit</el>
           <el>url.sortie_stock|eco.stock</el>
           <el>label.validation_preco|validation précommande</el>
           <el>url.sortie_stock|eco.commande</el>
           </lstVariables>
           </action>


          public class InitProcessHeaderHandler implements ActionHandler {
           List<String> lstVariables;
          
           public void execute(ExecutionContext contextInstance) throws Exception {
           // TODO Auto-generated method stub
           for (String element : lstVariables) {
           createProcessVarFromElement(contextInstance, element);
           }
           }


          • 2. Re: Node configuration with Maps - How to?
            kukeltje

            Examples in the SOURCE!!!!!

            Map should work, the variable should be called 'vars'

            • 3. Re: Node configuration with Maps - How to?
              vorsorge

              Hi,

              I do not know what I did wrong yesterday. Today everything worked fine. The mysteries of software development! ;-)

              Here is my answer to my problem:


              
              public class SubProcessHandler extends SubProcessNode implements ActionHandler {
              
               private Map<String, Object> vars = new HashMap<String, Object>();
              
               public void execute(ExecutionContext contxt) throws Exception {
              
               Iterator varIt = this.vars.entrySet().iterator();
              
               while (varIt.hasNext()) {
               Entry entry = (Entry)varIt.next();
              
               System.out.println("################# " + entry.getKey() + " - " + entry.getValue());
               }
              
               }
              
              
              


              Thanks!
              Martin