Java Code Examples for org.camunda.bpm.engine.impl.util.xml.Element#elementNS()

The following examples show how to use org.camunda.bpm.engine.impl.util.xml.Element#elementNS() . 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: DefaultFormHandler.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void parseProperties(Element formField, FormFieldHandler formFieldHandler, BpmnParse bpmnParse, ExpressionManager expressionManager) {

    Element propertiesElement = formField.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "properties");

    if(propertiesElement != null) {
      List<Element> propertyElements = propertiesElement.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "property");

      // use linked hash map to preserve item ordering as provided in XML
      Map<String, String> propertyMap = new LinkedHashMap<String, String>();
      for (Element property : propertyElements) {
        String id = property.attribute("id");
        String value = property.attribute("value");
        propertyMap.put(id, value);
      }

      formFieldHandler.setProperties(propertyMap);
    }

  }
 
Example 2
Source File: DefaultFormHandler.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void parseValidation(Element formField, FormFieldHandler formFieldHandler, BpmnParse bpmnParse, ExpressionManager expressionManager) {

    Element validationElement = formField.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "validation");

    if(validationElement != null) {
      List<Element> constraintElements = validationElement.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "constraint");

      for (Element property : constraintElements) {
         FormFieldValidator validator = Context.getProcessEngineConfiguration()
           .getFormValidators()
           .createValidator(property, bpmnParse, expressionManager);

         String validatorName = property.attribute("name");
         String validatorConfig = property.attribute("config");

         if(validator != null) {
           FormFieldValidationConstraintHandler handler = new FormFieldValidationConstraintHandler();
           handler.setName(validatorName);
           handler.setConfig(validatorConfig);
           handler.setValidator(validator);
           formFieldHandler.getValidationHandlers().add(handler);
         }
      }
    }
  }
 
Example 3
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 4
Source File: DefaultFormHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void parseFormData(BpmnParse bpmnParse, ExpressionManager expressionManager, Element extensionElement) {
  Element formData = extensionElement.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "formData");
  if(formData != null) {
    this.businessKeyFieldId = formData.attribute(BUSINESS_KEY_ATTRIBUTE);
    parseFormFields(formData, bpmnParse, expressionManager);
  }
}
 
Example 5
Source File: BpmnParseUtil.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the camunda extension element in the camunda namespace
 * and the given name.
 *
  * @param element the parent element of the extension element
 * @param extensionElementName the name of the extension element to find
 * @return the extension element or null if not found
 */
public static Element findCamundaExtensionElement(Element element, String extensionElementName) {
  Element extensionElements = element.element("extensionElements");
  if(extensionElements != null) {
    return extensionElements.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, extensionElementName);
  } else {
    return null;
  }
}
 
Example 6
Source File: BpmnParseUtil.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the {@link IoMapping} of an element.
 *
 * @param element the element to parse
 * @return the input output mapping or null if non defined
 * @throws BpmnParseException if a input/output parameter element is malformed
 */
public static IoMapping parseInputOutput(Element element) {
  Element inputOutputElement = element.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "inputOutput");
  if(inputOutputElement != null) {
    IoMapping ioMapping = new IoMapping();
    parseCamundaInputParameters(inputOutputElement, ioMapping);
    parseCamundaOutputParameters(inputOutputElement, ioMapping);
    return ioMapping;
  }
  return null;
}