Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.Process


    /**
     * 全局配置.
     */
    public void processGlobal(BpmnModel bpmnModel, int priority,
            BpmConfBase bpmConfBase) {
        Process process = bpmnModel.getMainProcess();
        BpmConfNodeManager bpmConfNodeManager = getBpmConfNodeManager();
        BpmConfNode bpmConfNode = bpmConfNodeManager.findUnique(
                "from BpmConfNode where code=? and bpmConfBase=?",
                process.getId(), bpmConfBase);

        if (bpmConfNode == null) {
            bpmConfNode = new BpmConfNode();
            bpmConfNode.setCode(process.getId());
            bpmConfNode.setName("全局");
            bpmConfNode.setType("process");
            bpmConfNode.setConfUser(2);
            bpmConfNode.setConfListener(0);
            bpmConfNode.setConfRule(2);
            bpmConfNode.setConfForm(0);
            bpmConfNode.setConfOperation(2);
            bpmConfNode.setConfNotice(2);
            bpmConfNode.setPriority(priority);
            bpmConfNode.setBpmConfBase(bpmConfBase);
            bpmConfNodeManager.save(bpmConfNode);
        }

        // 配置监听器
        processListener(process.getExecutionListeners(), bpmConfNode);
    }
View Full Code Here


    Pool pool = model.getPool(idPool);
    assertEquals(idPool, pool.getId());
    assertEquals(idProcess, pool.getProcessRef());
    assertTrue(pool.isExecutable());
   
    Process process = model.getProcess(idPool);
    assertEquals(idProcess, process.getId());
    assertTrue(process.isExecutable());
    assertEquals(3, process.getLanes().size());

    Lane lane = process.getLanes().get(0);
    assertEquals("idLane1", lane.getId());
    assertEquals("Lane 1", lane.getName());
    assertEquals(4, lane.getFlowReferences().size());
    assertTrue(lane.getFlowReferences().contains("startevent"));
    assertTrue(lane.getFlowReferences().contains("usertask1"));
    assertTrue(lane.getFlowReferences().contains("usertask6"));
    assertTrue(lane.getFlowReferences().contains("endevent"));
   
    lane = process.getLanes().get(1);
    assertEquals("idLane2", lane.getId());
    assertEquals("Lane 2", lane.getName());
    assertEquals(2, lane.getFlowReferences().size());
    assertTrue(lane.getFlowReferences().contains("usertask2"));
    assertTrue(lane.getFlowReferences().contains("usertask5"));
   
    lane = process.getLanes().get(2);
    assertEquals("idLane3", lane.getId());
    assertEquals("Lane 3", lane.getName());
    assertEquals(2, lane.getFlowReferences().size());
    assertTrue(lane.getFlowReferences().contains("usertask3"));
    assertTrue(lane.getFlowReferences().contains("usertask4"));
   
    assertNotNull(process.getFlowElement("startevent"));
    assertNotNull(process.getFlowElement("usertask1"));
    assertNotNull(process.getFlowElement("usertask2"));
    assertNotNull(process.getFlowElement("usertask3"));
    assertNotNull(process.getFlowElement("usertask4"));
    assertNotNull(process.getFlowElement("usertask5"));
    assertNotNull(process.getFlowElement("usertask6"));
    assertNotNull(process.getFlowElement("endevent"));
   
    assertNotNull(process.getFlowElement("flow1"));
    assertNotNull(process.getFlowElement("flow2"));
    assertNotNull(process.getFlowElement("flow3"));
    assertNotNull(process.getFlowElement("flow4"));
    assertNotNull(process.getFlowElement("flow5"));
    assertNotNull(process.getFlowElement("flow6"));
    assertNotNull(process.getFlowElement("flow7"));
  }
View Full Code Here

    Pool pool = model.getPool(idPool);
    assertEquals(idPool, pool.getId());
    assertEquals(idProcess, pool.getProcessRef());
    assertFalse(pool.isExecutable());
   
    Process process = model.getProcess(idPool);
    assertEquals(idProcess, process.getId());
    assertFalse(process.isExecutable());
    assertEquals(3, process.getLanes().size());
   
  }
View Full Code Here

  protected void initializeProcess(WorkflowDefinitionConversion conversion) {
    WorkflowDefinition workflowDefinition = conversion.getWorkflowDefinition();

    // Create new process
    Process process = conversion.getProcess();
    process.setId(generateProcessId(workflowDefinition));
    process.setName(workflowDefinition.getName());
    process.setDocumentation(workflowDefinition.getDescription());
   
    if (workflowDefinition.getCategory() != null) {
      conversion.getBpmnModel().setTargetNamespace(workflowDefinition.getCategory());
    }

    conversion.setProcess(process);

    // Add start-event
    StartEvent startEvent = new StartEvent();
    startEvent.setId(START_EVENT_ID);
   
    if(workflowDefinition.getStartFormDefinition() != null && workflowDefinition.getStartFormDefinition().getFormKey() != null) {
      startEvent.setFormKey(workflowDefinition.getStartFormDefinition().getFormKey());
    }
   
    process.addFlowElement(startEvent);
    conversion.setLastActivityId(startEvent.getId());
  }
View Full Code Here

    return processId;
  }

  public void afterStepsConversion(WorkflowDefinitionConversion conversion) {
    // Add end-event to process
    Process process = conversion.getProcess();

    EndEvent endEvent = new EndEvent();
    endEvent.setId(END_EVENT_ID);
    process.addFlowElement(endEvent);

    // Sequence flow from last created activity to end
    SequenceFlow sequenceFlow = new SequenceFlow();
    sequenceFlow.setId(conversion.getUniqueNumberedId(ConversionConstants.DEFAULT_SEQUENCEFLOW_PREFIX));
    sequenceFlow.setSourceRef(conversion.getLastActivityId());
    sequenceFlow.setTargetRef(END_EVENT_ID);
    process.addFlowElement(sequenceFlow);

    // To make the generated workflow compatible with some tools (eg the
    // Modeler, but also others),
    // We must add the ingoing and outgoing sequence flow to each of the flow
    // nodes
    SequenceFlowMapping sequenceFlowMapping = generateSequenceflowMappings(process);

    for (FlowNode flowNode : process.findFlowElementsOfType(FlowNode.class)) {
      List<SequenceFlow> incomingSequenceFlow = sequenceFlowMapping.getIncomingSequenceFlowMapping().get(flowNode.getId());
      if (incomingSequenceFlow != null) {
        flowNode.setIncomingFlows(incomingSequenceFlow);
      }
View Full Code Here

    this.incrementalIdMapping = new HashMap<String, Integer>();
    this.additionalArtifacts = new HashMap<String, Object>();
   
    // Create new process
    bpmnModel = new BpmnModel();
    process = new Process();
    bpmnModel.addProcess(process);

    // Let conversion listeners know initialization is finished
    if (conversionFactory.getAllWorkflowDefinitionConversionListeners() != null) {
      for (WorkflowDefinitionConversionListener conversionListener : conversionFactory.getAllWorkflowDefinitionConversionListeners()) {
View Full Code Here

  protected String getResource() {
    return "customnamespaceattributemodel.bpmn";
  }
 
  private void validateModel(BpmnModel model) {
    Process process = model.getMainProcess();
    assertNotNull(process.getAttributes());
    assertEquals(1, process.getAttributes().size());
    List<ExtensionAttribute> attributes = process.getAttributes().get("version");
    assertNotNull(attributes);
    assertEquals(1, attributes.size());
    ExtensionAttribute attribute = attributes.get(0);
    //custom:version = "9"
    assertNotNull(attribute);
View Full Code Here

  private void validateModel(BpmnModel model) {
    assertEquals(1, model.getPools().size());
    Pool pool = model.getPools().get(0);
    assertEquals("pool1", pool.getId());
    assertEquals("Pool", pool.getName());
    Process process = model.getProcess(pool.getId());
    assertNotNull(process);
    assertEquals(2, process.getLanes().size());
    Lane lane = process.getLanes().get(0);
    assertEquals("lane1", lane.getId());
    assertEquals("Lane 1", lane.getName());
    assertEquals(2, lane.getFlowReferences().size());
    lane = process.getLanes().get(1);
    assertEquals("lane2", lane.getId());
    assertEquals("Lane 2", lane.getName());
    assertEquals(2, lane.getFlowReferences().size());
    FlowElement flowElement = process.getFlowElement("flow1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SequenceFlow);
  }
View Full Code Here

  protected String getResource() {
    return "eventlistenersmodel.bpmn20.xml";
  }
 
  private void validateModel(BpmnModel model) {
    Process process = model.getMainProcess();
    assertNotNull(process);
    assertNotNull(process.getEventListeners());
    assertEquals(8, process.getEventListeners().size());
   
    // Listener with class
    EventListener listener = process.getEventListeners().get(0);
    assertEquals("ENTITY_CREATE", listener.getEvents());
    assertEquals("org.activiti.test.MyListener", listener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listener.getImplementationType());
   
    // Listener with class, but no specific event (== all events)
    listener = process.getEventListeners().get(1);
    assertNull(listener.getEvents());
    assertEquals("org.activiti.test.AllEventTypesListener", listener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listener.getImplementationType());
   
    // Listener with delegate expression
    listener = process.getEventListeners().get(2);
    assertEquals("ENTITY_DELETE", listener.getEvents());
    assertEquals("${myListener}", listener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION, listener.getImplementationType());
   
    // Listener that throws a signal-event
    listener = process.getEventListeners().get(3);
    assertEquals("ENTITY_DELETE", listener.getEvents());
    assertEquals("theSignal", listener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_SIGNAL_EVENT, listener.getImplementationType());
   
    // Listener that throws a global signal-event
    listener = process.getEventListeners().get(4);
    assertEquals("ENTITY_DELETE", listener.getEvents());
    assertEquals("theSignal", listener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_GLOBAL_SIGNAL_EVENT, listener.getImplementationType());
   
    // Listener that throws a message-event
    listener = process.getEventListeners().get(5);
    assertEquals("ENTITY_DELETE", listener.getEvents());
    assertEquals("theMessage", listener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT, listener.getImplementationType());
   
    // Listener that throws an error-event
    listener = process.getEventListeners().get(6);
    assertEquals("ENTITY_DELETE", listener.getEvents());
    assertEquals("123", listener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT, listener.getImplementationType());
   
    // Listener restricted to a specific entity
    listener = process.getEventListeners().get(7);
    assertEquals("ENTITY_DELETE", listener.getEvents());
    assertEquals("123", listener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT, listener.getImplementationType());
    assertEquals("job", listener.getEntityType());
  }
View Full Code Here

      }
    }
    listener.setEvents(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EVENTS));
    listener.setEntityType(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_ENTITY_TYPE));
   
    Process parentProcess = (Process) parentElement;
    parentProcess.getEventListeners().add(listener);
  }
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.Process

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.