AnsweredAssumed Answered

Workflow Model Problem

Question asked by mangar on Dec 7, 2013
Latest reply on Dec 7, 2013 by mangar
I am new to the workflows and i am trying to do a simple private message workflow.  The start task takes a name and a message.  The problem is setting the data.  When I iterate through the task variables I get this very weird problem:

here it the model:


      <type name="jiswf:privateMessage">
         <parent>bpm:startTask</parent>
         <properties>
            <property name="jiswf:toName">
               <type>d:text</type>
               <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>
            <property name="jiswf:privateMessage">
               <type>d:text</type>
               <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>            
         </properties>
      </type>


it is launched by a java web script:


      WorkflowDefinition wfDefinition = workflowService.getDefinitionByName("activiti$privateMessageProcess");
           Map<QName, Serializable> vars = new HashMap<QName, Serializable>();
           vars.put(QName.createQName(AlfrescoModel.WORKFLOW_NAMESPACE,"toName"),toName);
           vars.put(QName.createQName(AlfrescoModel.WORKFLOW_NAMESPACE,"privateMessage"),message);
      workflowService.startWorkflow(wfDefinition.getId(), vars);


and a simple iterator through the variables in the task listener (Java):


      Map<String,Object> vars = task.getVariables();
      Iterator<String> keys = vars.keySet().iterator();
      while(keys.hasNext()) {
         String key = keys.next();
         System.out.println("Key:"+key+" Value:"+vars.get(key));
      }


The output is the issue:


  Key:jiswf_toName Value:joe
  Key:jiswf:privateMessage Value:asdfasdf


Why oh why is one key "jiswf_toName" and the other "jiswf:privateMessage"

that difference between "_" and ":" makes it hard to get the variables out of the model as you can imagine. Using v4.2.d comm.

Any help is appreciated.

Outcomes