Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.MultiInstanceLoopCharacteristics


    UserTask feedbackTask = new UserTask();
    feedbackTask.setId(conversion.getUniqueNumberedId(ConversionConstants.USER_TASK_ID_PREFIX));
    feedbackTask.setName(getProvideFeedbackTaskName());
    feedbackTask.setAssignee("${" + VARIABLE_FEEDBACK_PROVIDER + "}");
   
    MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = new MultiInstanceLoopCharacteristics();
    multiInstanceLoopCharacteristics.setSequential(false);
    multiInstanceLoopCharacteristics.setInputDataItem(VARIABLE_FEEDBACK_PROVIDERS);
    multiInstanceLoopCharacteristics.setElementVariable(VARIABLE_FEEDBACK_PROVIDER);
    feedbackTask.setLoopCharacteristics(multiInstanceLoopCharacteristics);
   
    addFlowElement(conversion, feedbackTask);
    processElements.put(FEEDBACK_USER_TASK, feedbackTask);
    return feedbackTask;
View Full Code Here


      if (activity.isNotExclusive()) {
        propertiesNode.put(PROPERTY_EXCLUSIVE, PROPERTY_VALUE_NO);
      }
     
      if (activity.getLoopCharacteristics() != null) {
        MultiInstanceLoopCharacteristics loopDef = activity.getLoopCharacteristics();
        if (StringUtils.isNotEmpty(loopDef.getLoopCardinality()) || StringUtils.isNotEmpty(loopDef.getInputDataItem()) ||
            StringUtils.isNotEmpty(loopDef.getCompletionCondition())) {
         
          if (loopDef.isSequential() == false) {
            propertiesNode.put(PROPERTY_MULTIINSTANCE_SEQUENTIAL, PROPERTY_VALUE_NO);
          }
          if (StringUtils.isNotEmpty(loopDef.getLoopCardinality())) {
            propertiesNode.put(PROPERTY_MULTIINSTANCE_CARDINALITY, loopDef.getLoopCardinality());
          }
          if (StringUtils.isNotEmpty(loopDef.getInputDataItem())) {
            propertiesNode.put(PROPERTY_MULTIINSTANCE_COLLECTION, loopDef.getInputDataItem());
          }
          if (StringUtils.isNotEmpty(loopDef.getElementVariable())) {
            propertiesNode.put(PROPERTY_MULTIINSTANCE_VARIABLE, loopDef.getElementVariable());
          }
          if (StringUtils.isNotEmpty(loopDef.getCompletionCondition())) {
            propertiesNode.put(PROPERTY_MULTIINSTANCE_CONDITION, loopDef.getCompletionCondition());
          }
        }
      }
     
      if (activity instanceof UserTask) {
View Full Code Here

      if (StringUtils.isNotEmpty(multiInstanceCardinality) || StringUtils.isNotEmpty(multiInstanceCollection) ||
          StringUtils.isNotEmpty(multiInstanceCondition) || StringUtils.isNotEmpty(multiInstanceLoopType)) {
       
        String multiInstanceVariable = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_VARIABLE, elementNode);
       
        MultiInstanceLoopCharacteristics multiInstanceObject = new MultiInstanceLoopCharacteristics();
        multiInstanceObject.setSequential(getPropertyValueAsBoolean(PROPERTY_MULTIINSTANCE_SEQUENTIAL, elementNode));
       
        // There is another property used for multi-instance sequential control, that is used for rendering the correct
        // BPMN loop symbol on the task. In case this is set, also take that into account.
       
        if(multiInstanceLoopType != null) {
          if(PROPERTY_MULTIINSTANCE_LOOP_TYPE_SEQUENTIAL.equals(multiInstanceLoopType)) {
            multiInstanceObject.setSequential(true);
          } else if(PROPERTY_MULTIINSTANCE_LOOP_TYPE_PARALLEL.equals(multiInstanceLoopType)) {
            multiInstanceObject.setSequential(false);
          }
        }
       
       
        multiInstanceObject.setLoopCardinality(multiInstanceCardinality);
        multiInstanceObject.setInputDataItem(multiInstanceCollection);
        multiInstanceObject.setElementVariable(multiInstanceVariable);
        multiInstanceObject.setCompletionCondition(multiInstanceCondition);
        activity.setLoopCharacteristics(multiInstanceObject);
      }
    }
    if (parentElement instanceof Process) {
      ((Process) parentElement).addFlowElement(flowElement);
View Full Code Here

  }
 
  public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
    if (parentElement instanceof Activity == false) return;
   
    MultiInstanceLoopCharacteristics multiInstanceDef = new MultiInstanceLoopCharacteristics();
    BpmnXMLUtil.addXMLLocation(multiInstanceDef, xtr);
    if (xtr.getAttributeValue(null, ATTRIBUTE_MULTIINSTANCE_SEQUENTIAL) != null) {
      multiInstanceDef.setSequential(Boolean.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_MULTIINSTANCE_SEQUENTIAL)));
    }
    multiInstanceDef.setInputDataItem(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_MULTIINSTANCE_COLLECTION));
    multiInstanceDef.setElementVariable(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_MULTIINSTANCE_VARIABLE));
    multiInstanceDef.setElementIndexVariable(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_MULTIINSTANCE_INDEX_VARIABLE));

    boolean readyWithMultiInstance = false;
    try {
      while (readyWithMultiInstance == false && xtr.hasNext()) {
        xtr.next();
        if (xtr.isStartElement() && ELEMENT_MULTIINSTANCE_CARDINALITY.equalsIgnoreCase(xtr.getLocalName())) {
          multiInstanceDef.setLoopCardinality(xtr.getElementText());

        } else if (xtr.isStartElement() && ELEMENT_MULTIINSTANCE_DATAINPUT.equalsIgnoreCase(xtr.getLocalName())) {
          multiInstanceDef.setInputDataItem(xtr.getElementText());

        } else if (xtr.isStartElement() && ELEMENT_MULTIINSTANCE_DATAITEM.equalsIgnoreCase(xtr.getLocalName())) {
          if (xtr.getAttributeValue(null, ATTRIBUTE_NAME) != null) {
            multiInstanceDef.setElementVariable(xtr.getAttributeValue(null, ATTRIBUTE_NAME));
          }

        } else if (xtr.isStartElement() && ELEMENT_MULTIINSTANCE_CONDITION.equalsIgnoreCase(xtr.getLocalName())) {
          multiInstanceDef.setCompletionCondition(xtr.getElementText());

        } else if (xtr.isEndElement() && getElementName().equalsIgnoreCase(xtr.getLocalName())) {
          readyWithMultiInstance = true;
        }
      }
View Full Code Here

public class MultiInstanceExport implements BpmnXMLConstants {

  public static void writeMultiInstance(Activity activity, XMLStreamWriter xtw) throws Exception {
    if (activity.getLoopCharacteristics() != null) {
      MultiInstanceLoopCharacteristics multiInstanceObject = activity.getLoopCharacteristics();
      if (StringUtils.isNotEmpty(multiInstanceObject.getLoopCardinality()) ||
          StringUtils.isNotEmpty(multiInstanceObject.getInputDataItem()) ||
          StringUtils.isNotEmpty(multiInstanceObject.getCompletionCondition())) {
       
        xtw.writeStartElement(ELEMENT_MULTIINSTANCE);
        BpmnXMLUtil.writeDefaultAttribute(ATTRIBUTE_MULTIINSTANCE_SEQUENTIAL, String.valueOf(multiInstanceObject.isSequential()).toLowerCase(), xtw);
        if (StringUtils.isNotEmpty(multiInstanceObject.getInputDataItem())) {
          BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_MULTIINSTANCE_COLLECTION, multiInstanceObject.getInputDataItem(), xtw);
        }
        if (StringUtils.isNotEmpty(multiInstanceObject.getElementVariable())) {
          BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_MULTIINSTANCE_VARIABLE, multiInstanceObject.getElementVariable(), xtw);
        }
        if (StringUtils.isNotEmpty(multiInstanceObject.getLoopCardinality())) {
          xtw.writeStartElement(ELEMENT_MULTIINSTANCE_CARDINALITY);
          xtw.writeCharacters(multiInstanceObject.getLoopCardinality());
          xtw.writeEndElement();
        }
        if (StringUtils.isNotEmpty(multiInstanceObject.getCompletionCondition())) {
          xtw.writeStartElement(ELEMENT_MULTIINSTANCE_CONDITION);
          xtw.writeCharacters(multiInstanceObject.getCompletionCondition());
          xtw.writeEndElement();
        }
        xtw.writeEndElement();
      }
    }
View Full Code Here

      // Gather info on the multi instance marker
      boolean multiInstanceSequential = false, multiInstanceParallel = false, collapsed = false;
      if (flowNode instanceof Activity) {
        Activity activity = (Activity) flowNode;
        MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics();
        if (multiInstanceLoopCharacteristics != null) {
          multiInstanceSequential = multiInstanceLoopCharacteristics.isSequential();
          multiInstanceParallel = !multiInstanceSequential;
        }
      }

      // Gather info on the collapsed marker
View Full Code Here

    }
  }
 
  protected void createMultiInstanceLoopCharacteristics(BpmnParse bpmnParse, Activity modelActivity) {
   
    MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics();
   
    // Activity Behavior
    MultiInstanceActivityBehavior miActivityBehavior = null;
    ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(modelActivity.getId());
    if (activity == null) {
      throw new ActivitiException("Activity " + modelActivity.getId() + " needed for multi instance cannot bv found");
    }
           
    if (loopCharacteristics.isSequential()) {
      miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createSequentialMultiInstanceBehavior(
              activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior());
    } else {
      miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createParallelMultiInstanceBehavior(
              activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior());
    }
   
    // ActivityImpl settings
    activity.setScope(true);
    activity.setProperty("multiInstance", loopCharacteristics.isSequential() ? "sequential" : "parallel");
    activity.setActivityBehavior(miActivityBehavior);
   
    ExpressionManager expressionManager = bpmnParse.getExpressionManager();
    BpmnModel bpmnModel = bpmnParse.getBpmnModel();
   
    // loopcardinality
    if (StringUtils.isNotEmpty(loopCharacteristics.getLoopCardinality())) {
      miActivityBehavior.setLoopCardinalityExpression(expressionManager.createExpression(loopCharacteristics.getLoopCardinality()));
    }
   
    // completion condition
    if (StringUtils.isNotEmpty(loopCharacteristics.getCompletionCondition())) {
      miActivityBehavior.setCompletionConditionExpression(expressionManager.createExpression(loopCharacteristics.getCompletionCondition()));
    }
   
    // activiti:collection
    if (StringUtils.isNotEmpty(loopCharacteristics.getInputDataItem())) {
      if (loopCharacteristics.getInputDataItem().contains("{")) {
        miActivityBehavior.setCollectionExpression(expressionManager.createExpression(loopCharacteristics.getInputDataItem()));
      } else {
        miActivityBehavior.setCollectionVariable(loopCharacteristics.getInputDataItem());
      }
    }

    // activiti:elementVariable
    if (StringUtils.isNotEmpty(loopCharacteristics.getElementVariable())) {
      miActivityBehavior.setCollectionElementVariable(loopCharacteristics.getElementVariable());
    }

    // activiti:elementIndexVariable
    if (StringUtils.isNotEmpty(loopCharacteristics.getElementIndexVariable())) {
      miActivityBehavior.setCollectionElementIndexVariable(loopCharacteristics.getElementIndexVariable());
    }

  }
View Full Code Here

     
      userTaskType.getAssociations().add(reviewAssignee);
      userTask.setAssignee(new PropertyReference(assignmentVariableName).getUsernameReferenceExpression(namespacePrefix));
     
      // Finally, add the multi-instance characteristics to the userTask
      MultiInstanceLoopCharacteristics mi = new MultiInstanceLoopCharacteristics();
      mi.setCompletionCondition(getCompletionCondition(id, namespacePrefix));
      mi.setElementVariable(new PropertyReference(assignmentVariableName).getVariableReference(namespacePrefix));
     
      PropertyReference reference = null;
      if(PropertyReference.isPropertyReference(stepDefinition.getAssignmentPropertyName())) {
        reference = PropertyReference.createReference(stepDefinition.getAssignmentPropertyName());
      } else {
        reference = new PropertyReference(stepDefinition.getAssignmentPropertyName());
      }
      mi.setInputDataItem(reference.getVariableReference(namespacePrefix));
      AlfrescoConversionUtil.getPropertyReferences(conversion).add(reference);
      mi.setSequential(false);
      userTask.setLoopCharacteristics(mi);
    }

    if (stepDefinition.getRejectionSteps() != null) {
      // Create choice-step
View Full Code Here

    }
   
  }
 
  protected void handleMultiInstanceLoopCharacteristics(Process process, Activity activity, List<ValidationError> errors) {
    MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics();
    if (multiInstanceLoopCharacteristics != null) {

      if (StringUtils.isEmpty(multiInstanceLoopCharacteristics.getLoopCardinality())
          && StringUtils.isEmpty(multiInstanceLoopCharacteristics.getInputDataItem())) {
        addError(errors, Problems.MULTI_INSTANCE_MISSING_COLLECTION, process, activity,
            "Either loopCardinality or loopDataInputRef/activiti:collection must been set");
      }

    }
View Full Code Here

    Object bo = getBusinessObject(pe);
    if (bo == null || bo instanceof Activity == false)
      return;
   
    Activity activity = (Activity) bo;
    MultiInstanceLoopCharacteristics multiInstanceDef = (MultiInstanceLoopCharacteristics) activity.getLoopCharacteristics();
   
    loopCardinaltyText.removeFocusListener(listener);
    collectionText.removeFocusListener(listener);
    elementVariableText.removeFocusListener(listener);
    completionConditionText.removeFocusListener(listener);
   
   
    if(multiInstanceDef == null || (multiInstanceDef.isSequential() == true && yesButton.getSelection() == false)) {
      yesButton.setSelection(true);
      noButton.setSelection(false);
    }
   
    if(multiInstanceDef != null && multiInstanceDef.isSequential() == false && yesButton.getSelection() == true) {
      yesButton.setSelection(false);
      noButton.setSelection(true);
    }
   
    if(multiInstanceDef != null && StringUtils.isNotEmpty(multiInstanceDef.getLoopCardinality())) {
      loopCardinaltyText.setText(multiInstanceDef.getLoopCardinality());
    } else {
      loopCardinaltyText.setText("");
    }
   
    if(multiInstanceDef != null && StringUtils.isNotEmpty(multiInstanceDef.getInputDataItem())) {
      collectionText.setText(multiInstanceDef.getInputDataItem());
    } else {
      collectionText.setText("");
    }
   
    if(multiInstanceDef != null && StringUtils.isNotEmpty(multiInstanceDef.getElementVariable())) {
      elementVariableText.setText(multiInstanceDef.getElementVariable());
    } else {
      elementVariableText.setText("");
    }
   
    if(multiInstanceDef != null && StringUtils.isNotEmpty(multiInstanceDef.getCompletionCondition())) {
      completionConditionText.setText(multiInstanceDef.getCompletionCondition());
    } else {
      completionConditionText.setText("");
    }
   
    loopCardinaltyText.addFocusListener(listener);
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.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.