Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.FlowElement


  }

  public static FlowElement clone(final FlowElement element, final Diagram diagram) {

    FlowElement cloneElement = null;
    List<FormProperty> formProperties = null;

    if (element instanceof StartEvent) {
      cloneElement = clone((StartEvent) element, diagram);
      formProperties = ((StartEvent) element).getFormProperties();
    } else if (element instanceof ServiceTask) {
      cloneElement = clone((ServiceTask) element, diagram);
    } else if (element instanceof EndEvent) {
      cloneElement = clone((EndEvent) element, diagram);
    } else if (element instanceof ExclusiveGateway) {
      cloneElement = clone((ExclusiveGateway) element, diagram);
    } else if (element instanceof InclusiveGateway) {
      cloneElement = clone((InclusiveGateway) element, diagram);
    } else if (element instanceof ManualTask) {
      cloneElement = clone((ManualTask) element, diagram);
    } else if (element instanceof ParallelGateway) {
      cloneElement = clone((ParallelGateway) element, diagram);
    } else if (element instanceof ScriptTask) {
      cloneElement = clone((ScriptTask) element, diagram);
    } else if (element instanceof UserTask) {
      cloneElement = clone((UserTask) element, diagram);
      formProperties = ((UserTask) element).getFormProperties();

      List<ActivitiListener> resultListenerList = new ArrayList<ActivitiListener>();
      for (ActivitiListener listener : ((UserTask) element).getTaskListeners()) {
        resultListenerList.add(clone(listener));
      }
      ((UserTask) cloneElement).setTaskListeners(resultListenerList);
    }

    if (element instanceof Activity && element instanceof UserTask == false) {
      List<ActivitiListener> resultListenerList = new ArrayList<ActivitiListener>();
      for (ActivitiListener listener : ((Activity) element).getExecutionListeners()) {
        resultListenerList.add(clone(listener));
      }
      ((Activity) cloneElement).setExecutionListeners(resultListenerList);
    }

    if (element instanceof Activity) {
      ((Activity) cloneElement).setAsynchronous(((Activity) element).isAsynchronous());
      ((Activity) cloneElement).setDefaultFlow(((Activity) element).getDefaultFlow());
    }

    if (formProperties != null) {
      List<FormProperty> resultPropertyList = new ArrayList<FormProperty>();
      for (FormProperty formProperty : formProperties) {
        resultPropertyList.add(clone(formProperty));
      }
      if (cloneElement instanceof UserTask) {
        ((UserTask) cloneElement).setFormProperties(resultPropertyList);
      } else {
        ((StartEvent) cloneElement).setFormProperties(resultPropertyList);
      }
    }

    if (cloneElement != null) {
      cloneElement.setName(element.getName());
      ModelHandler.getModel(EcoreUtil.getURI(diagram)).getBpmnModel().getMainProcess().addFlowElement(cloneElement);
    }

    return cloneElement;
View Full Code Here


      xtr.next();
      if (xtr.isStartElement() && ELEMENT_DI_BOUNDS.equalsIgnoreCase(xtr.getLocalName())) {
        GraphicInfo graphicInfo = new GraphicInfo();
        graphicInfo.x = Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_X)).intValue();
        graphicInfo.y = Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_Y)).intValue();
        FlowElement flowElement = model.getMainProcess().getFlowElement(id);
        if (flowElement instanceof Event) {
          graphicInfo.width = 30;
          graphicInfo.height = 30;
        } else {
          graphicInfo.width = Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_WIDTH)).intValue();
View Full Code Here

  public void convertToBpmnModel(JsonNode elementNode, JsonNode modelNode,
      ActivityProcessor processor, BaseElement parentElement, Map<String, JsonNode> shapeMap) {
   
    this.processor = processor;
   
    FlowElement flowElement = convertJsonToElement(elementNode, modelNode, shapeMap);
    flowElement.setId(BpmnJsonConverterUtil.getElementId(elementNode));
    flowElement.setName(getPropertyValueAsString(PROPERTY_NAME, elementNode));
    flowElement.setDocumentation(getPropertyValueAsString(PROPERTY_DOCUMENTATION, elementNode));
   
    convertJsonToListeners(elementNode, flowElement);
   
    if (flowElement instanceof Activity) {
      Activity activity = (Activity) flowElement;
View Full Code Here

 
  private void validateModel(BpmnModel model) {
    assertEquals("simpleProcess", model.getMainProcess().getId());
    assertEquals("Simple process", model.getMainProcess().getName());
   
    FlowElement flowElement = model.getMainProcess().getFlowElement("flow1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SequenceFlow);
    assertEquals("flow1", flowElement.getId());
   
    flowElement = model.getMainProcess().getFlowElement("catchEvent");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof IntermediateCatchEvent);
    assertEquals("catchEvent", flowElement.getId());
    IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) flowElement;
    assertTrue(catchEvent.getEventDefinitions().size() == 1);
    EventDefinition eventDefinition = catchEvent.getEventDefinitions().get(0);
    assertTrue(eventDefinition instanceof TimerEventDefinition);
    TimerEventDefinition timerDefinition = (TimerEventDefinition) eventDefinition;
    assertEquals("PT5M", timerDefinition.getTimeDuration());
   
    flowElement = model.getMainProcess().getFlowElement("flow1Condition");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SequenceFlow);
    assertEquals("flow1Condition", flowElement.getId());
    SequenceFlow flow = (SequenceFlow) flowElement;
    assertEquals("${number <= 1}", flow.getConditionExpression());
  }
View Full Code Here

  protected String getResource() {
    return "test.servicetaskmodel.json";
  }
 
  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElementMap().get("servicetask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof ServiceTask);
    assertEquals("servicetask", flowElement.getId());
    ServiceTask serviceTask = (ServiceTask) flowElement;
    assertEquals("servicetask", serviceTask.getId());
    assertEquals("Service task", serviceTask.getName());
   
    List<FieldExtension> fields = serviceTask.getFieldExtensions();
View Full Code Here

  protected String getResource() {
    return "test.subprocessmodel.json";
  }
 
  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElementMap().get("start1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof StartEvent);
    assertEquals("start1", flowElement.getId());
   
    flowElement = model.getMainProcess().getFlowElementMap().get("userTask1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("userTask1", flowElement.getId());
    UserTask userTask = (UserTask) flowElement;
    assertTrue(userTask.getCandidateUsers().size() == 1);
    assertTrue(userTask.getCandidateGroups().size() == 1);
    assertTrue(userTask.getFormProperties().size() == 2);
   
    flowElement = model.getMainProcess().getFlowElementMap().get("subprocess1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess1", flowElement.getId());
    SubProcess subProcess = (SubProcess) flowElement;
    assertTrue(subProcess.getFlowElements().size() == 5);
   
    flowElement = model.getMainProcess().getFlowElementMap().get("boundaryEvent1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof BoundaryEvent);
    assertEquals("boundaryEvent1", flowElement.getId());
    BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
    assertNotNull(boundaryEvent.getAttachedToRef());
    assertEquals("subprocess1", boundaryEvent.getAttachedToRef().getId());
    assertEquals(1, boundaryEvent.getEventDefinitions().size());
    assertTrue(boundaryEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition);
View Full Code Here

  protected String getResource() {
    return "test.scopedmodel.json";
  }
 
  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElementMap().get("outerSubProcess");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("outerSubProcess", flowElement.getId());
    SubProcess outerSubProcess = (SubProcess) flowElement;
    List<BoundaryEvent> eventList = outerSubProcess.getBoundaryEvents();
    assertEquals(1, eventList.size());
    BoundaryEvent boundaryEvent = eventList.get(0);
    assertEquals("outerBoundaryEvent", boundaryEvent.getId());
   
    FlowElement subElement = outerSubProcess.getFlowElement("innerSubProcess");
    assertNotNull(subElement);
    assertTrue(subElement instanceof SubProcess);
    assertEquals("innerSubProcess", subElement.getId());
    SubProcess innerSubProcess = (SubProcess) subElement;
    eventList = innerSubProcess.getBoundaryEvents();
    assertEquals(1, eventList.size());
    boundaryEvent = eventList.get(0);
    assertEquals("innerBoundaryEvent", boundaryEvent.getId());
   
    FlowElement taskElement = innerSubProcess.getFlowElement("usertask");
    assertNotNull(taskElement);
    assertTrue(taskElement instanceof UserTask);
    UserTask userTask = (UserTask) taskElement;
    assertEquals("usertask", userTask.getId());
    eventList = userTask.getBoundaryEvents();
View Full Code Here

  protected String getResource() {
    return "test.usertaskmodel.json";
  }
 
  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElementMap().get("usertask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("usertask", flowElement.getId());
    UserTask userTask = (UserTask) flowElement;
    assertEquals("usertask", userTask.getId());
    assertEquals("User task", userTask.getName());
    assertEquals("testKey", userTask.getFormKey());
    assertEquals(40l, userTask.getPriority().longValue());
View Full Code Here

  protected String getResource() {
    return "test.completemodel.json";
  }
 
  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElement("userTask1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("userTask1", flowElement.getId());
    UserTask userTask = (UserTask) flowElement;
   
    flowElement = model.getMainProcess().getFlowElement("catchsignal");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof IntermediateCatchEvent);
    assertEquals("catchsignal", flowElement.getId());
    IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) flowElement;
    assertEquals(1, catchEvent.getEventDefinitions().size());
    assertTrue(catchEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition);
    SignalEventDefinition signalEvent = (SignalEventDefinition) catchEvent.getEventDefinitions().get(0);
    assertEquals("testSignal", signalEvent.getSignalRef());
   
    flowElement = model.getMainProcess().getFlowElement("subprocess");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess", flowElement.getId());
    SubProcess subProcess = (SubProcess) flowElement;
   
    flowElement = subProcess.getFlowElement("receiveTask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof ReceiveTask);
    assertEquals("receiveTask", flowElement.getId());
  }
View Full Code Here

  protected String getResource() {
    return "test.callactivitymodel.json";
  }
 
  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElementMap().get("callactivity");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof CallActivity);
    CallActivity callActivity = (CallActivity) flowElement;
    assertEquals("callactivity", callActivity.getId());
    assertEquals("Call activity", callActivity.getName());
View Full Code Here

TOP

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

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.