AnsweredAssumed Answered

Problem with parameters and subprocesses

Question asked by fwachs on Dec 4, 2012
Latest reply on Dec 6, 2012 by fwachs
Hi all, I'm having a bit of a problem while trying to set parameters to a subprocess. Basically they never get there and I'm not sure what else I can do to set them.

Here's the process, sorry, it's in spanish. But I can explain a little bit what each of the service tasks ( which are java classes ) do, or try to do.

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="EnvioTrial" name="Envio semanal de trial">
    <serviceTask id="OfreceTrial" name="Mail a locadores con ofrecimiento" activiti:type="mail">
      <extensionElements>
        <activiti:field name="to" expression="someothergmail.com"></activiti:field>
        <activiti:field name="from" expression="someother@gmail.com"></activiti:field>
        <activiti:field name="subject" expression="${props.title}"></activiti:field>
        <activiti:field name="text">
          <activiti:expression><![CDATA[te ofrezco algo]]></activiti:expression>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <startEvent id="InicioTrial" name="Inicio de proceso de trials - Martes 10 AM">
      <timerEventDefinition>
        <timeCycle>R1000/2012-12-04T10:00:00/PT168H</timeCycle>
      </timerEventDefinition>
    </startEvent>
    <endEvent id="FinalizaProcesoTrial" name="Finalizacion del Proceso de Trial"></endEvent>
    <exclusiveGateway id="NuevoRowTrial" name="Definir existencia de nuevo Locador"></exclusiveGateway>
    <parallelGateway id="NuevaIteracionTrial" name="Iterar Nuevamente buscando Locador"></parallelGateway>
    <serviceTask id="ObtenerListadoTrial" name="Execute Mensajes Ultimo Mes" activiti:class="com.zukbox.bpmn.process.TrialEmailProcessTask"></serviceTask>
    <subProcess id="SubprocesoTrial" name="Sub Proceso Trial">
      <serviceTask id="VerificarTrialsActivos" name="Verificar existencia suscripcion" activiti:class="com.zukbox.bpmn.process.VerifySubscriptionTask"></serviceTask>
      <exclusiveGateway id="AceptoTrial" name="Define si el usuario acepto el Trial o no"></exclusiveGateway>
      <serviceTask id="NotificacionVencimientoTrial" name="Notificación de finalización de Trial" activiti:type="mail">
        <extensionElements>
          <activiti:field name="to" expression="${email}"></activiti:field>
          <activiti:field name="from" expression="some@gmail.com"></activiti:field>
          <activiti:field name="subject" expression="Notificacion de finalizacion de trial"></activiti:field>
          <activiti:field name="text">
            <activiti:expression><![CDATA[se acabo loco.]]></activiti:expression>
          </activiti:field>
        </extensionElements>
      </serviceTask>
      <endEvent id="endevent1" name="End"></endEvent>
      <startEvent id="IniciaSubprocesoTrial" name="Inicia Suproceso Trial">
        <extensionElements>
          <activiti:formProperty id="title1" name="titulo" type="string" required="true" readable="true" writable="true"></activiti:formProperty>
        </extensionElements>
      </startEvent>
      <intermediateCatchEvent id="VerificarExistenciaSuscripcionTrial" name="Verifica Existencia Suscripcion Trial">
        <timerEventDefinition>
          <timeDuration>PT1M</timeDuration>
        </timerEventDefinition>
      </intermediateCatchEvent>
      <sequenceFlow id="flow27" name="" sourceRef="VerificarTrialsActivos" targetRef="AceptoTrial"></sequenceFlow>
      <sequenceFlow id="flow21" name="No hay suscripcion" sourceRef="AceptoTrial" targetRef="endevent1"></sequenceFlow>
      <sequenceFlow id="flow22" name="Hay suscripcion" sourceRef="AceptoTrial" targetRef="NotificacionVencimientoTrial"></sequenceFlow>
      <sequenceFlow id="flow32" name="" sourceRef="NotificacionVencimientoTrial" targetRef="endevent1"></sequenceFlow>
      <sequenceFlow id="flow39" name="" sourceRef="IniciaSubprocesoTrial" targetRef="VerificarExistenciaSuscripcionTrial"></sequenceFlow>
      <sequenceFlow id="flow40" name="" sourceRef="VerificarExistenciaSuscripcionTrial" targetRef="VerificarTrialsActivos"></sequenceFlow>
    </subProcess>
    <sequenceFlow id="flow13" name="No hay mas emails" sourceRef="NuevoRowTrial" targetRef="FinalizaProcesoTrial">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${emailCount <= 0}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow15" name="" sourceRef="OfreceTrial" targetRef="NuevaIteracionTrial"></sequenceFlow>
    <sequenceFlow id="flow23" name="" sourceRef="InicioTrial" targetRef="ObtenerListadoTrial"></sequenceFlow>
    <sequenceFlow id="flow24" name="" sourceRef="ObtenerListadoTrial" targetRef="NuevoRowTrial"></sequenceFlow>
    <sequenceFlow id="flow25" name="" sourceRef="NuevaIteracionTrial" targetRef="ObtenerListadoTrial"></sequenceFlow>
    <sequenceFlow id="flow31" name="Hay mail" sourceRef="NuevoRowTrial" targetRef="OfreceTrial">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${emailCount > 0}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow37" name="" sourceRef="SubprocesoTrial" targetRef="FinalizaProcesoTrial"></sequenceFlow>
    <sequenceFlow id="flow38" name="" sourceRef="NuevaIteracionTrial" targetRef="SubprocesoTrial"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_EnvioTrial">
    <bpmndi:BPMNPlane bpmnElement="EnvioTrial" id="BPMNPlane_EnvioTrial">
      <bpmndi:BPMNShape bpmnElement="OfreceTrial" id="BPMNShape_OfreceTrial">
        <omgdc:Bounds height="55" width="105" x="303" y="100"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="InicioTrial" id="BPMNShape_InicioTrial">
        <omgdc:Bounds height="35" width="35" x="10" y="30"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="FinalizaProcesoTrial" id="BPMNShape_FinalizaProcesoTrial">
        <omgdc:Bounds height="35" width="35" x="545" y="30"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="NuevoRowTrial" id="BPMNShape_NuevoRowTrial">
        <omgdc:Bounds height="40" width="40" x="335" y="27"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="NuevaIteracionTrial" id="BPMNShape_NuevaIteracionTrial">
        <omgdc:Bounds height="40" width="40" x="122" y="107"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="ObtenerListadoTrial" id="BPMNShape_ObtenerListadoTrial">
        <omgdc:Bounds height="55" width="105" x="90" y="20"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="SubprocesoTrial" id="BPMNShape_SubprocesoTrial" isExpanded="true">
        <omgdc:Bounds height="181" width="754" x="60" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="VerificarTrialsActivos" id="BPMNShape_VerificarTrialsActivos">
        <omgdc:Bounds height="55" width="105" x="125" y="277"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="AceptoTrial" id="BPMNShape_AceptoTrial">
        <omgdc:Bounds height="40" width="40" x="303" y="284"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="NotificacionVencimientoTrial" id="BPMNShape_NotificacionVencimientoTrial">
        <omgdc:Bounds height="69" width="131" x="500" y="270"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35" width="35" x="750" y="287"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="IniciaSubprocesoTrial" id="BPMNShape_IniciaSubprocesoTrial">
        <omgdc:Bounds height="35" width="35" x="80" y="220"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="VerificarExistenciaSuscripcionTrial" id="BPMNShape_VerificarExistenciaSuscripcionTrial">
        <omgdc:Bounds height="35" width="35" x="160" y="220"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow27" id="BPMNEdge_flow27">
        <omgdi:waypoint x="230" y="304"></omgdi:waypoint>
        <omgdi:waypoint x="303" y="304"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow21" id="BPMNEdge_flow21">
        <omgdi:waypoint x="323" y="284"></omgdi:waypoint>
        <omgdi:waypoint x="435" y="251"></omgdi:waypoint>
        <omgdi:waypoint x="602" y="251"></omgdi:waypoint>
        <omgdi:waypoint x="767" y="287"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12" width="100" x="-56" y="-15"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow22" id="BPMNEdge_flow22">
        <omgdi:waypoint x="343" y="304"></omgdi:waypoint>
        <omgdi:waypoint x="500" y="304"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12" width="100" x="-41" y="-20"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow32" id="BPMNEdge_flow32">
        <omgdi:waypoint x="631" y="304"></omgdi:waypoint>
        <omgdi:waypoint x="750" y="304"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow39" id="BPMNEdge_flow39">
        <omgdi:waypoint x="115" y="237"></omgdi:waypoint>
        <omgdi:waypoint x="160" y="237"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow40" id="BPMNEdge_flow40">
        <omgdi:waypoint x="177" y="255"></omgdi:waypoint>
        <omgdi:waypoint x="177" y="277"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow13" id="BPMNEdge_flow13">
        <omgdi:waypoint x="375" y="47"></omgdi:waypoint>
        <omgdi:waypoint x="545" y="47"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12" width="100" x="-53" y="0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow15" id="BPMNEdge_flow15">
        <omgdi:waypoint x="303" y="127"></omgdi:waypoint>
        <omgdi:waypoint x="162" y="127"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow23" id="BPMNEdge_flow23">
        <omgdi:waypoint x="45" y="47"></omgdi:waypoint>
        <omgdi:waypoint x="90" y="47"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow24" id="BPMNEdge_flow24">
        <omgdi:waypoint x="195" y="47"></omgdi:waypoint>
        <omgdi:waypoint x="335" y="47"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow25" id="BPMNEdge_flow25">
        <omgdi:waypoint x="142" y="107"></omgdi:waypoint>
        <omgdi:waypoint x="142" y="75"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow31" id="BPMNEdge_flow31">
        <omgdi:waypoint x="355" y="67"></omgdi:waypoint>
        <omgdi:waypoint x="355" y="100"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12" width="100" x="5" y="-16"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow37" id="BPMNEdge_flow37">
        <omgdi:waypoint x="437" y="200"></omgdi:waypoint>
        <omgdi:waypoint x="562" y="65"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow38" id="BPMNEdge_flow38">
        <omgdi:waypoint x="142" y="147"></omgdi:waypoint>
        <omgdi:waypoint x="437" y="200"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12" width="100" x="10" y="0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

The forum does not allow me to upload an image of the process, i'm still trying to figure that out..

The first service task goes to the db, fetches some results and for each result I try to initiate a new sub process , sending parameters to that subprocess.

The second service task should take those parameters and make some modifications if needed, but they are never getting there…

What am I doing wrong?

Thanks in advanced! Plz be patient with me, i'm new to Activiti and BPMN in general :)

Regards,
Federico

Outcomes