AnsweredAssumed Answered

unable to get Task after a condition

Question asked by parul_vipparthi on Nov 15, 2010
Latest reply on Nov 15, 2010 by jbarrez
Hello

I know i made a mistake somewhere. Please guide me.

I have a bpmn file.

        <process id="usecase_indexer_createwidget" name="Indexer Usecase">
        <startEvent id="StartNoneEvent_2" activiti:form="org/activiti/examples/task/search_document.form"/>
        <task name="Search Document on First Name, Last Name, SSN" id="searchdoc_on_fn_ln"/>
        <task name="Push to Allocate" id="push_to_allocate"/>
        <task name="Append Document to Existing Widget" id="append_doc_to_existing_widget"/>
        <task name="Create Widget with FN, LN, SSN, and Networth as IndexFields"
        activiti:form="org/activiti/examples/task/create_widget.form"
        id="create_widget"/>
        <exclusiveGateway gatewayDirection="Diverging" name="Document Exists?" id="is_document_existing"/>
        <sequenceFlow targetRef="searchdoc_on_fn_ln" sourceRef="StartNoneEvent_2" id="SequenceFlow_3"/>
        <sequenceFlow targetRef="is_document_existing" sourceRef="searchdoc_on_fn_ln" id="SequenceFlow_1"/>
        <sequenceFlow targetRef="append_doc_to_existing_widget" sourceRef="is_document_existing" id="SequenceFlow_2">
            <conditionExpression xsi:type="tFormalExpression" >${doc_found}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow targetRef="create_widget" sourceRef="is_document_existing" id="SequenceFlow_4">
            <conditionExpression xsi:type="tFormalExpression" >${!doc_found}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow targetRef="push_to_allocate" sourceRef="append_doc_to_existing_widget" id="SequenceFlow_5"/>
        <sequenceFlow targetRef="push_to_allocate" sourceRef="create_widget" id="SequenceFlow"/>
    </process>
</definitions>

and java code for the above process
    // Get start form
    Object startForm = taskService.getRenderedStartFormByKey("usecase_indexer_createwidget");
    assertNotNull(startForm);
   
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
    assertEquals("org/activiti/examples/task/search_document.form", processDefinition.getStartFormResourceKey());
    System.out.println("Start search form … "+ startForm);
    // Define variables that would be filled in through the form
    Map<String, Object> variables = new HashMap<String, Object>();
    String fname = "app_fn";
    String lname="app_ln";

    variables.put("firstName", fname);
    variables.put("lastName", lname);
    variables.put("doc_found", Boolean.FALSE);
   
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("usecase_indexer_createwidget", variables);

//List<Task> tasks = query.list();
    System.out.println("List of Tasks  "+taskService.createTaskQuery()
           .processInstanceId(pi.getId()).list());

I was expecting "create_widget" task. but it shows none.

Please guide me where is my mistake

Thank you

Outcomes