org.camunda.bpm.engine.impl.util.xml.Element Java Examples

The following examples show how to use org.camunda.bpm.engine.impl.util.xml.Element. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultFailedJobParseListener.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void setFailedJobRetryTimeCycleValue(Element element, ActivityImpl activity) {
  String failedJobRetryTimeCycleConfiguration = null;

  Element extensionElements = element.element(EXTENSION_ELEMENTS);
  if (extensionElements != null) {
    Element failedJobRetryTimeCycleElement = extensionElements.elementNS(FOX_ENGINE_NS, FAILED_JOB_RETRY_TIME_CYCLE);
    if (failedJobRetryTimeCycleElement == null) {
      // try to get it from the activiti namespace
      failedJobRetryTimeCycleElement = extensionElements.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, FAILED_JOB_RETRY_TIME_CYCLE);
    }

    if (failedJobRetryTimeCycleElement != null) {
      failedJobRetryTimeCycleConfiguration = failedJobRetryTimeCycleElement.getText();
    }
  }

  if (failedJobRetryTimeCycleConfiguration == null || failedJobRetryTimeCycleConfiguration.isEmpty()) {
    failedJobRetryTimeCycleConfiguration = Context.getProcessEngineConfiguration().getFailedJobRetryTimeCycle();
  }

  if (failedJobRetryTimeCycleConfiguration != null) {
    FailedJobRetryConfiguration configuration = ParseUtil.parseRetryIntervals(failedJobRetryTimeCycleConfiguration);
    activity.getProperties().set(FAILED_JOB_CONFIGURATION, configuration);
  }
}
 
Example #2
Source File: CustomBpmnParse.java    From wecube-platform with Apache License 2.0 6 votes vote down vote up
protected Condition parseConditionExpression(Element conditionExprElement) {
    String expression = translateConditionExpressionElementText(conditionExprElement);
    String type = conditionExprElement.attributeNS(XSI_NS, TYPE);
    String language = conditionExprElement.attribute(PROPERTYNAME_LANGUAGE);
    String resource = conditionExprElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, PROPERTYNAME_RESOURCE);
    if (type != null) {
        String value = type.contains(":") ? resolveName(type) : BpmnParser.BPMN20_NS + ":" + type;
        if (!value.equals(ATTRIBUTEVALUE_T_FORMAL_EXPRESSION)) {
            addError("Invalid type, only tFormalExpression is currently supported", conditionExprElement);
        }
    }
    Condition condition = null;
    if (language == null) {
        condition = new UelExpressionCondition(expressionManager.createExpression(expression));
    } else {
        try {
            ExecutableScript script = ScriptUtil.getScript(language, expression, resource, expressionManager);
            condition = new ScriptCondition(script);
        } catch (ProcessEngineException e) {
            addError("Unable to process condition expression:" + e.getMessage(), conditionExprElement);
        }
    }
    return condition;
}
 
Example #3
Source File: PathCoverageParseListener.java    From camunda-bpm-process-test-coverage with Apache License 2.0 5 votes vote down vote up
@Override
public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement,
        org.camunda.bpm.engine.impl.pvm.process.TransitionImpl transition) {

    final PathCoverageExecutionListener pathCoverageExecutionListener = new PathCoverageExecutionListener(
            coverageTestRunState);
    transition.addListener(ExecutionListener.EVENTNAME_TAKE, pathCoverageExecutionListener);

}
 
Example #4
Source File: ProblemImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProblemImpl(String errorMessage, Element element, String... elementIds) {
  this(errorMessage, element);
  this.mainElementId = elementIds[0];
  for (String elementId : elementIds) {
    if(elementId != null && elementId.length() > 0) {
      this.elementIds.add(elementId);
    }
  }
}
 
Example #5
Source File: BpmnParseUtil.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a output parameter and adds it to the {@link IoMapping}.
 *
 * @param outputParameterElement the output parameter element
 * @param ioMapping the mapping to add the element
 * @throws BpmnParseException if the output parameter element is malformed
 */
public static void parseOutputParameterElement(Element outputParameterElement, IoMapping ioMapping) {
  String nameAttribute = outputParameterElement.attribute("name");
  if(nameAttribute == null || nameAttribute.isEmpty()) {
    throw new BpmnParseException("Missing attribute 'name' for outputParameter", outputParameterElement);
  }

  ParameterValueProvider valueProvider = parseNestedParamValueProvider(outputParameterElement);

  // add parameter
  ioMapping.addOutputParameter(new OutputParameter(nameAttribute, valueProvider));
}
 
Example #6
Source File: FormTypes.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public AbstractFormFieldType parseFormPropertyType(Element formFieldElement, BpmnParse bpmnParse) {
  AbstractFormFieldType formType = null;

  String typeText = formFieldElement.attribute("type");
  String datePatternText = formFieldElement.attribute("datePattern");

  if (typeText == null && DefaultFormHandler.FORM_FIELD_ELEMENT.equals(formFieldElement.getTagName())) {
    bpmnParse.addError("form field must have a 'type' attribute", formFieldElement);
  }

  if ("date".equals(typeText) && datePatternText!=null) {
    formType = new DateFormType(datePatternText);

  } else if ("enum".equals(typeText)) {
    // ACT-1023: Using linked hashmap to preserve the order in which the entries are defined
    Map<String, String> values = new LinkedHashMap<String, String>();
    for (Element valueElement: formFieldElement.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS,"value")) {
      String valueId = valueElement.attribute("id");
      String valueName = valueElement.attribute("name");
      values.put(valueId, valueName);
    }
    formType = new EnumFormType(values);

  } else if (typeText!=null) {
    formType = formTypes.get(typeText);
    if (formType==null) {
      bpmnParse.addError("unknown type '"+typeText+"'", formFieldElement);
    }
  }
  return formType;
}
 
Example #7
Source File: CustomBpmnParse.java    From wecube-platform with Apache License 2.0 5 votes vote down vote up
protected String translateConditionExpressionElementText(Element conditionExprElement) {
    String original = conditionExprElement.getText().trim();
    if ("0".equals(original)) {
        return "${ok}";
    }

    if ("1".equals(original)) {
        return "${!ok}";
    }

    return original;
}
 
Example #8
Source File: PublishDelegateParseListener.java    From camunda-bpm-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
@Override
public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
  if (executionListener != null) {
    for (String event : EXECUTION_EVENTS) {
      processDefinition.addListener(event, executionListener);
    }
  }
}
 
Example #9
Source File: JobDefinitionCreationAndDeletionWithParseListenerTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public ProcessEngineConfiguration configureEngine(ProcessEngineConfigurationImpl configuration) {
  List<BpmnParseListener> listeners = new ArrayList<>();
  listeners.add(new AbstractBpmnParseListener(){

    @Override
    public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {
      activity.setAsyncBefore(false);
      activity.setAsyncAfter(true);
    }
  });

  configuration.setCustomPreBPMNParseListeners(listeners);
  return configuration;
}
 
Example #10
Source File: GlobalOSGiEventBridgeActivator.java    From camunda-bpm-platform-osgi with Apache License 2.0 5 votes vote down vote up
@Override
public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
  addStartEventListener(activity);
  addEndEventListener(activity);
  UserTaskActivityBehavior activityBehavior = (UserTaskActivityBehavior) activity.getActivityBehavior();
  TaskDefinition taskDefinition = activityBehavior.getTaskDefinition();
  addTaskCreateListeners(taskDefinition);
  addTaskAssignmentListeners(taskDefinition);
  addTaskCompleteListeners(taskDefinition);
  addTaskDeleteListeners(taskDefinition);
}
 
Example #11
Source File: HistoryParseListener.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
  ensureHistoryLevelInitialized();
  addActivityHandlers(activity);

  if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_CREATE, null)) {
    TaskDefinition taskDefinition = ((UserTaskActivityBehavior) activity.getActivityBehavior()).getTaskDefinition();
    taskDefinition.addBuiltInTaskListener(TaskListener.EVENTNAME_ASSIGNMENT, USER_TASK_ASSIGNMENT_HANDLER);
    taskDefinition.addBuiltInTaskListener(TaskListener.EVENTNAME_CREATE, USER_TASK_ID_HANDLER);
  }
}
 
Example #12
Source File: ProcessApplicationEventParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void parseMultiInstanceLoopCharacteristics(Element activityElement, Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) {
  addStartEventListener(activity);
  addEndEventListener(activity);
}
 
Example #13
Source File: AddSendEventListenerToBpmnParseListener.java    From camunda-spring-boot-amqp-microservice-cloud-example with Apache License 2.0 4 votes vote down vote up
@Override
public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) {
}
 
Example #14
Source File: AbstractBpmnParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void parseBoundaryErrorEventDefinition(Element errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) {
}
 
Example #15
Source File: RegisterAllBpmnParseListener.java    From camunda-bpm-reactor with Apache License 2.0 4 votes vote down vote up
@Override
public void parseEventBasedGateway(final Element eventBasedGwElement, final ScopeImpl scope, final ActivityImpl activity) {
  addExecutionListener(activity);
}
 
Example #16
Source File: MetricsBpmnParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void parseBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope, ActivityImpl activity) {
  addListeners(activity);
}
 
Example #17
Source File: AbstractBpmnParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
}
 
Example #18
Source File: PublishDelegateParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) {
  addExecutionListener(activity);
}
 
Example #19
Source File: RegisterAllBpmnParseListener.java    From camunda-bpm-reactor with Apache License 2.0 4 votes vote down vote up
@Override
public void parseProcess(final Element processElement, final ProcessDefinitionEntity processDefinition) {
  // FIXME: is it a good idea to implement genenric global process listeners?
}
 
Example #20
Source File: CdiEventSupportBpmnParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) {
  addStartEventListener(signalActivity);
  addEndEventListener(signalActivity);
}
 
Example #21
Source File: HistoryParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) {
  addActivityHandlers(activity);
}
 
Example #22
Source File: CdiEventSupportBpmnParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void parseTask(Element taskElement, ScopeImpl scope, ActivityImpl activity) {
  addStartEventListener(activity);
  addEndEventListener(activity);
}
 
Example #23
Source File: GlobalOSGiEventBridgeActivator.java    From camunda-bpm-platform-osgi with Apache License 2.0 4 votes vote down vote up
@Override
public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) {
  addStartEventListener(activity);
  addEndEventListener(activity);
}
 
Example #24
Source File: AddSendEventListenerToBpmnParseListener.java    From camunda-spring-boot-amqp-microservice-cloud-example with Apache License 2.0 4 votes vote down vote up
@Override
public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition, ActivityImpl signalActivity) {
}
 
Example #25
Source File: PublishDelegateParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) {
  addExecutionListener(activity);
}
 
Example #26
Source File: AddSendEventListenerToBpmnParseListener.java    From camunda-spring-boot-amqp-microservice-cloud-example with Apache License 2.0 4 votes vote down vote up
@Override
public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) {
}
 
Example #27
Source File: AddSendEventListenerToBpmnParseListener.java    From camunda-spring-boot-amqp-microservice-cloud-example with Apache License 2.0 4 votes vote down vote up
@Override
public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) {
}
 
Example #28
Source File: AddSendEventListenerToBpmnParseListener.java    From camunda-spring-boot-amqp-microservice-cloud-example with Apache License 2.0 4 votes vote down vote up
@Override
public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) {
}
 
Example #29
Source File: CdiEventSupportBpmnParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) {
  addStartEventListener(activity);
  addEndEventListener(activity);
}
 
Example #30
Source File: MetricsBpmnParseListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) {
  addListeners(activity);
}