cancel
Showing results for 
Search instead for 
Did you mean: 

activiti-cdi : cannot start process param not set

nawnaw
Champ in-the-making
Champ in-the-making
Hi,
I have tested an example of activiti-cdi with JSF (example of Daniel Meyer) and it works fine
in the next step,  I have embeded activiti-cdi example in my project (thechnologies used : JSF(primefaces), spring security)
but it did not work , I have a jsf page listing the deployed processes

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   template="/WEB-INF/templates/template.xhtml">
   
   <ui:define name="content">

      <h1>List of deployed processes</h1>
         <h:form>
      <h:dataTable value="#{processDefinitionList}" var="v_process">
         <h:column>
            <f:facet name="header">Key</f:facet>
            #{v_process.key}
         </h:column>
         <h:column>
            <f:facet name="header">Name</f:facet>
            #{v_process.name}
         </h:column>
         <h:column>
            <f:facet name="header">Version</f:facet>
            #{v_process.version}
         </h:column>
         <h:column>
            <f:facet name="header">Action</f:facet>
             <h:outputLink value="#{formService.getStartFormData(v_process.id).formKey}">
               Start
               <f:param name="processDefinitionKey" value="#{v_process.key}"></f:param>
            </h:outputLink>
         </h:column>
      </h:dataTable>
</h:form>

   </ui:define>
</ui:composition>

when i click start the fSmiley Tonguearam set the process_id in the url but not in the backing bean "processList"
the set method is not invoked

The code source of the bean
package beans;

import java.util.List;

import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;

import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.ProcessDefinition;

/**
* backing bean for retrieving a list of processes
*
* @author meyerd
*/
@Named
@RequestScoped
public class ProcessList {
 
  private String processDefinitionKey;

  @Inject
  private RepositoryService repositoryService;
 
  @Produces
  @Named("processDefinitionList")
  public List<ProcessDefinition> getProcessDefinitionList() {
    return repositoryService.createProcessDefinitionQuery()
            .list();
  }
 
  public void setProcessDefinitionKey(String processDefinitionKey) {
   System.out.println("settttt_________" +processDefinitionKey);
    this.processDefinitionKey = processDefinitionKey;
  }
 
  public String getProcessDefinitionKey() {
     System.out.println("gettttt_________" +processDefinitionKey);
    return processDefinitionKey;
  }

}


The start link redirect me to the page to fill data

<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   template="/WEB-INF/templates/template.xhtml">
   
   <ui:define name="metadata">
       <f:metadata>
         <!– bind the key of the process to be started –>
         <f:viewParam name="processDefinitionKey" value="#{processList.processDefinitionKey}" />
      </f:metadata>
    </ui:define>
   
   <ui:define name="content">      
      <h1>New Tweet</h1>
      <h:form>
         <table>
            <tr>
               <td>Your twitter account:</td>
               <td><h:inputText value="#{processVariables['account']}" />
               </td>
            </tr>
            <tr>
               <td>Tweet content:</td>
               <td><h:inputText value="#{processVariables['content']}" />
               </td>
            </tr>
            <tr>
               <td></td>
               <td><h:commandButton value="Submit"
                     action="#{businessProcess.startProcessByKey(processList.processDefinitionKey)}" />
               </td>
            </tr>
         </table>
      </h:form>
   </ui:define>

</ui:composition>


when i click submitt the process don't start because processDefinitionKey=null

Please help
There is no error message and i don't know what's wrong
2 REPLIES 2

p4w3l
Champ in-the-making
Champ in-the-making
It's rather JSF question than Activiti. You've set request param then use bean instead ? Use param on second page or change bean to some other scope.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
   <ui:define name="metadata">
       <f:metadata>
         <!– bind the key of the process to be started –>
         <f:viewParam name="processDefinitionKey" value="#{processList.processDefinitionKey}" />
      </f:metadata>
    </ui:define>

Is 'metadata' referenced in the template? Otherwise it will never be called.

And yes

It's rather JSF question than Activiti.