AnsweredAssumed Answered

Problems using ProcessDiagramGenerator

Question asked by gant on Nov 30, 2011
Latest reply on Dec 2, 2011 by trademak
Hi,

I try to create a process diagram with highlighted active activities using the code posted in this forum:
String processDefinitionId = activitiTaskService.createTaskQuery().taskId(activitiTaskId).singleResult()
            .getProcessDefinitionId();
      String processInstanceId = activitiTaskService.createTaskQuery().taskId(activitiTaskId).singleResult()
            .getProcessInstanceId();
      ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) activitiRepositoryService)
            .getDeployedProcessDefinition(processDefinitionId);
      List<String> activeActivityIds = activitiRuntimeService.getActiveActivityIds(processInstanceId);
      InputStream imageStream = ProcessDiagramGenerator.generateDiagram(processDefinitionEntity, "jpg",
            activeActivityIds);
      try{
      BufferedImage is = ImageIO.read(imageStream);
      ImageIO.write(is, "jpg", new File("C:\\Users\\user\\tescht.jpg"));
      }catch(Exception e){
         e.printStackTrace();
      }

My bpmn.xml:
<?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.test.org/processes">
  <process id="CreatePersonProcess" name="Person erstellen">
    <startEvent id="start" name=""></startEvent>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow1" name="" sourceRef="start" targetRef="exclusivegateway1"></sequenceFlow>
    <userTask id="createPerson" name="Person erfassen" activiti:candidateGroups="AD-MA,AD-Kader"></userTask>
    <sequenceFlow id="flow2" name="" sourceRef="exclusivegateway1" targetRef="createPerson"></sequenceFlow>
    <userTask id="verifyPerson" name="Person prüfen und ergänzen" activiti:candidateGroups="BO-MA"></userTask>
    <sequenceFlow id="flow3" name="" sourceRef="createPerson" targetRef="verifyPerson"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow4" name="" sourceRef="verifyPerson" targetRef="exclusivegateway2"></sequenceFlow>
    <sequenceFlow id="flow5" name="" sourceRef="exclusivegateway2" targetRef="exclusivegateway1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${processControl == 'reject'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow6" name="" sourceRef="exclusivegateway2" targetRef="servicetask1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${processControl == 'release'}]]></conditionExpression>
    </sequenceFlow>
    <serviceTask id="servicetask1" name="Person speichern" activiti:expression="#{defaultPersonService.createPerson(payload)}"></serviceTask>
    <sequenceFlow id="flow7" name="" sourceRef="servicetask1" targetRef="parallelgateway1"></sequenceFlow>
    <parallelGateway id="parallelgateway1" name="Parallel Gateway"></parallelGateway>
    <serviceTask id="informResponsible" name="Verantwortlichen informieren" activiti:expression="#{defaultInformationService.createInformationMessageForUser(payload.id, payload.responsibleEmployeeId.employeeId, 'Adress-Freigabe')}"></serviceTask>
    <sequenceFlow id="flow8" name="" sourceRef="parallelgateway1" targetRef="informResponsible"></sequenceFlow>
    <serviceTask id="informAdCadre" name="AD-Kader informieren" activiti:expression="#{defaultInformationService.createInformationMessageForUser(payload.id, 'AD-Kader', 'Adress-Freigabe')}"></serviceTask>
    <sequenceFlow id="flow9" name="" sourceRef="parallelgateway1" targetRef="informAdCadre"></sequenceFlow>
    <sequenceFlow id="flow10" name="" sourceRef="informAdCadre" targetRef="parallelgateway2"></sequenceFlow>
    <parallelGateway id="parallelgateway2" name="Parallel Gateway"></parallelGateway>
    <sequenceFlow id="flow11" name="" sourceRef="informResponsible" targetRef="parallelgateway2"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow12" name="" sourceRef="parallelgateway2" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_CreatePersonProcess">
    <bpmndi:BPMNPlane bpmnElement="CreatePersonProcess" id="BPMNPlane_CreatePersonProcess">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="35" width="35" x="40" y="100"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40" width="40" x="120" y="97"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="createPerson" id="BPMNShape_createPerson">
        <omgdc:Bounds height="55" width="105" x="205" y="90"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="verifyPerson" id="BPMNShape_verifyPerson">
        <omgdc:Bounds height="55" width="105" x="365" y="90"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
        <omgdc:Bounds height="40" width="40" x="525" y="97"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="55" width="105" x="610" y="90"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="parallelgateway1" id="BPMNShape_parallelgateway1">
        <omgdc:Bounds height="40" width="40" x="770" y="97"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="informResponsible" id="BPMNShape_informResponsible">
        <omgdc:Bounds height="55" width="105" x="850" y="36"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="informAdCadre" id="BPMNShape_informAdCadre">
        <omgdc:Bounds height="55" width="105" x="850" y="144"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="parallelgateway2" id="BPMNShape_parallelgateway2">
        <omgdc:Bounds height="40" width="40" x="1000" y="97"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35" width="35" x="1085" y="100"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="75" y="117"></omgdi:waypoint>
        <omgdi:waypoint x="120" y="117"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="160" y="117"></omgdi:waypoint>
        <omgdi:waypoint x="205" y="117"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="310" y="117"></omgdi:waypoint>
        <omgdi:waypoint x="365" y="117"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="470" y="117"></omgdi:waypoint>
        <omgdi:waypoint x="525" y="117"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="545" y="137"></omgdi:waypoint>
        <omgdi:waypoint x="545" y="190"></omgdi:waypoint>
        <omgdi:waypoint x="344" y="190"></omgdi:waypoint>
        <omgdi:waypoint x="140" y="190"></omgdi:waypoint>
        <omgdi:waypoint x="140" y="137"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="565" y="117"></omgdi:waypoint>
        <omgdi:waypoint x="610" y="117"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="715" y="117"></omgdi:waypoint>
        <omgdi:waypoint x="770" y="117"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="790" y="97"></omgdi:waypoint>
        <omgdi:waypoint x="790" y="63"></omgdi:waypoint>
        <omgdi:waypoint x="850" y="63"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="790" y="137"></omgdi:waypoint>
        <omgdi:waypoint x="790" y="171"></omgdi:waypoint>
        <omgdi:waypoint x="850" y="171"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="955" y="171"></omgdi:waypoint>
        <omgdi:waypoint x="1020" y="171"></omgdi:waypoint>
        <omgdi:waypoint x="1020" y="137"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
        <omgdi:waypoint x="955" y="63"></omgdi:waypoint>
        <omgdi:waypoint x="1020" y="63"></omgdi:waypoint>
        <omgdi:waypoint x="1020" y="97"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow12" id="BPMNEdge_flow12">
        <omgdi:waypoint x="1040" y="117"></omgdi:waypoint>
        <omgdi:waypoint x="1085" y="117"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

see the image I get attached.

Any hints, why this is happening? There is nothing to see in the logs. It doesn't matter, which file tiype I use.

Diagram modelled with latest Activiti Designer, runtime Activiti 6.5

Regards,
michael

Attachments

Outcomes