Package org.eclipse.bpmn2

Examples of org.eclipse.bpmn2.MultiInstanceLoopCharacteristics


      for (BoundaryEvent boundaryEvent : activity.getBoundaryEventRefs()) {
        outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(boundaryEvent.getId()));
      }
 
      if (activity.getLoopCharacteristics() != null) {
        MultiInstanceLoopCharacteristics loopDef = (MultiInstanceLoopCharacteristics)activity.getLoopCharacteristics();//.getLoopCharacteristics();
        propertiesNode.put(PROPERTY_MULTIINSTANCE, StringUtil.getString(true));
          propertiesNode.put(PROPERTY_MULTIINSTANCE_SEQUENTIAL, StringUtil.getString(loopDef.isIsSequential()));
          if(activity.getLoopDataInputCollectionExpression() != null){
            propertiesNode.put(PROPERTY_MULTIINSTANCE_INPUT_COLLECTION, activity.getLoopDataInputCollectionExpression());
          }
          if(activity.getLoopDataOutputCollectionExpression() !=null){
            propertiesNode.put(PROPERTY_MULTIINSTANCE_OUTPUT_COLLECTION, activity.getLoopDataOutputCollectionExpression());
          }
         
          if(loopDef.getInputDataItem()!=null){
            propertiesNode.put(PROPERTY_MULTIINSTANCE_INPUT_ITEM, activity.getInputDataItemExpression());
          }
          if(loopDef.getOutputDataItem() !=null){
            propertiesNode.put(PROPERTY_MULTIINSTANCE_OUTPUT_ITEM, activity.getOutputDataItemExpression());
          }
          if(BpmnModelUtil.getExpression(loopDef.getCompletionCondition()) !=null){
            propertiesNode.put(PROPERTY_MULTIINSTANCE_CONDITION, BpmnModelUtil.getExpression(loopDef.getCompletionCondition()));
          }
      }
     
    //跳过策略
      SkipStrategy skipStrategy = activity.getSkipStrategy();
View Full Code Here


    if (flowElement instanceof Activity) {
      ActivityImpl activity = (ActivityImpl) flowElement;
     
      boolean isMulti = getPropertyValueAsBoolean(PROPERTY_MULTIINSTANCE, elementNode);
      if(isMulti){
        MultiInstanceLoopCharacteristics newLoopCharacteristics = Bpmn2Factory.eINSTANCE.createMultiInstanceLoopCharacteristics();
        String inputDataCollection = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_INPUT_COLLECTION, elementNode);
        String inputDataItem = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_INPUT_ITEM, elementNode);
        String outputDataCollection = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_OUTPUT_COLLECTION, elementNode);
        String outputDataItem = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_OUTPUT_ITEM, elementNode);
        String completeExpression = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_CONDITION, elementNode);
       
        //输出变量
        DataOutput dataOutput = Bpmn2Factory.eINSTANCE.createDataOutput();
        Expression dataOutputExpression = FixFlowFactory.eINSTANCE.createExpression();
        dataOutputExpression.setName(outputDataItem);
        dataOutputExpression.setValue(outputDataItem);
        BpmnModelUtil.addExtensionElement(dataOutput, FixFlowPackage.Literals.RESOURCE_FILTER__EXPRESSION, dataOutputExpression);
        newLoopCharacteristics.setOutputDataItem(dataOutput);
       
        //输入变量
        DataInput dataInput = Bpmn2Factory.eINSTANCE.createDataInput();
        Expression dataInputExpression = FixFlowFactory.eINSTANCE.createExpression();
        dataInputExpression.setName(inputDataItem);
        dataInputExpression.setValue(inputDataItem);
        BpmnModelUtil.addExtensionElement(dataInput, FixFlowPackage.Literals.RESOURCE_FILTER__EXPRESSION, dataInputExpression);
        newLoopCharacteristics.setInputDataItem(dataInput);
       
        //输入数据集
        LoopDataInputCollection loopDataInputCollection = FixFlowFactory.eINSTANCE.createLoopDataInputCollection();
        Expression inputCollectionExpression = FixFlowFactory.eINSTANCE.createExpression();
        inputCollectionExpression.setName(inputDataCollection);
        inputCollectionExpression.setValue(inputDataCollection);
        loopDataInputCollection.setExpression(inputCollectionExpression);
        BpmnModelUtil.addExtensionElement(newLoopCharacteristics, FixFlowPackage.Literals.DOCUMENT_ROOT__LOOP_DATA_INPUT_COLLECTION, loopDataInputCollection);

        //输出数据集
        LoopDataOutputCollection loopDataOutputCollection = FixFlowFactory.eINSTANCE.createLoopDataOutputCollection();
        Expression outputCollectionExpression = FixFlowFactory.eINSTANCE.createExpression();
        outputCollectionExpression.setName(outputDataCollection);
        outputCollectionExpression.setValue(outputDataCollection);
        loopDataOutputCollection.setExpression(outputCollectionExpression);
        BpmnModelUtil.addExtensionElement(newLoopCharacteristics, FixFlowPackage.Literals.DOCUMENT_ROOT__LOOP_DATA_OUTPUT_COLLECTION, loopDataOutputCollection);

        //完成表达式
        FormalExpression formalExpression= Bpmn2Factory.eINSTANCE.createFormalExpression();
        formalExpression.setId(completeExpression);
        formalExpression.setBody(completeExpression);
        newLoopCharacteristics.setCompletionCondition(formalExpression);
       
        activity.setLoopCharacteristics(newLoopCharacteristics);
       
      }
     
View Full Code Here

  public String getInputDataItemExpression() {
   
   
   
    if(this.inputDataItemExpression==null){
      MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics=(MultiInstanceLoopCharacteristics)loopCharacteristics;
      DataInput dataInput =multiInstanceLoopCharacteristics.getInputDataItem();
      Expression expression=getExtensionExpression(dataInput);
      if(expression!=null){
        this.inputDataItemExpression=expression.getValue();
      }
View Full Code Here

  }

  public String getOutputDataItemExpression() {
   
    if(this.outputDataItemExpression==null){
      MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics=(MultiInstanceLoopCharacteristics)loopCharacteristics;
      DataOutput dataOutput =multiInstanceLoopCharacteristics.getOutputDataItem();
      Expression expression=getExtensionExpression(dataOutput);
      if(expression!=null){
        this.outputDataItemExpression=expression.getValue();
      }
View Full Code Here

  }

  public String getCompletionConditionExpression() {

    if (this.completionConditionExpression == null) {
      MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = (MultiInstanceLoopCharacteristics) loopCharacteristics;

      FormalExpression completionConditionExpression = (FormalExpression) multiInstanceLoopCharacteristics
          .getCompletionCondition();
      if (completionConditionExpression != null) {
        String evalue = completionConditionExpression.getBody();
        this.completionConditionExpression = evalue;
      }
View Full Code Here

    LoopCharacteristics loopCharacteristics = activity.getLoopCharacteristics();
    LoopCharacteristicType type = LoopCharacteristicType.NULL;

    if (loopCharacteristics != null) {
      if (loopCharacteristics instanceof MultiInstanceLoopCharacteristics) {
        MultiInstanceLoopCharacteristics multi = (MultiInstanceLoopCharacteristics) loopCharacteristics;
        type = multi.isIsSequential() ? LoopCharacteristicType.MULTI_SEQUENTIAL
                : LoopCharacteristicType.MULTI_PARALLEL;
      } else {
        type = LoopCharacteristicType.LOOP;
      }
    }
View Full Code Here

    public void testParallelGatewayUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("parallelGateway.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        ParallelGateway g = (ParallelGateway) process.getFlowElements().get(0);
        assertEquals("parallel gateway", g.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    public void testPoolUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("pool.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        assertTrue(definitions.getRootElements().get(0) instanceof Process);
        Process process = getRootProcess(definitions);
        assertEquals("pool", process.getName());
        assertEquals(ProcessType.PRIVATE, process.getProcessType());
        assertTrue(process.isIsClosed());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    public void testLaneUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("pool.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        assertTrue(definitions.getRootElements().get(0) instanceof Process);
        Process process = getRootProcess(definitions);
        assertTrue(process.getLaneSets().size() == 1);
        assertTrue(process.getLaneSets().get(0).getLanes().size() == 1);
        Lane l = process.getLaneSets().get(0).getLanes().get(0);
        assertEquals("my first lane", l.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    @Test
    public void testSequenceFlowUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("sequenceFlow.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        assertTrue(process.getFlowElements().get(0) instanceof Task);
        Task task = (Task) process.getFlowElements().get(0);
        assertEquals("task1", task.getName());
        Task task2 = (Task) process.getFlowElements().get(1);
        assertEquals("task2", task2.getName());
        SequenceFlow flow = (SequenceFlow) process.getFlowElements().get(2);
        assertEquals("seqFlow", flow.getName());
        assertEquals(task, flow.getSourceRef());
        assertEquals(task2, flow.getTargetRef());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.bpmn2.MultiInstanceLoopCharacteristics

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.