当前位置: 首页>>代码示例>>Java>>正文


Java Element.attribute方法代码示例

本文整理汇总了Java中org.camunda.bpm.engine.impl.util.xml.Element.attribute方法的典型用法代码示例。如果您正苦于以下问题:Java Element.attribute方法的具体用法?Java Element.attribute怎么用?Java Element.attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.engine.impl.util.xml.Element的用法示例。


在下文中一共展示了Element.attribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseBPMNPlane

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
public void parseBPMNPlane(Element bpmnPlaneElement) {
  String bpmnElement = bpmnPlaneElement.attribute("bpmnElement");
  if (bpmnElement != null && !"".equals(bpmnElement)) {
    // there seems to be only on process without collaboration
    if (getProcessDefinition(bpmnElement) != null) {
      getProcessDefinition(bpmnElement).setGraphicalNotationDefined(true);
    }

    List<Element> shapes = bpmnPlaneElement.elementsNS(BPMN_DI_NS, "BPMNShape");
    for (Element shape : shapes) {
      parseBPMNShape(shape);
    }

    List<Element> edges = bpmnPlaneElement.elementsNS(BPMN_DI_NS, "BPMNEdge");
    for (Element edge : edges) {
      parseBPMNEdge(edge);
    }

  } else {
    addError("'bpmnElement' attribute is required on BPMNPlane ", bpmnPlaneElement);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:BpmnParse.java

示例2: parseInputParameter

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
protected void parseInputParameter(Element callActivityElement, ActivityImpl activity, CallableElement callableElement) {
  Element extensionsElement = callActivityElement.element("extensionElements");

  if (extensionsElement != null) {
    // input data elements
    for (Element inElement : extensionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, "in")) {

      String businessKey = inElement.attribute("businessKey");

      if (businessKey != null && !businessKey.isEmpty()) {
        ParameterValueProvider businessKeyValueProvider = createParameterValueProvider(businessKey, expressionManager);
        callableElement.setBusinessKeyValueProvider(businessKeyValueProvider);

      } else {

        CallableElementParameter parameter = parseCallableElementProvider(inElement);

        if (attributeValueEquals(inElement, "local", TRUE)) {
          parameter.setReadLocal(true);
        }

        callableElement.addInput(parameter);
      }
    }
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:BpmnParse.java

示例3: getStringValueFromAttributeOrElement

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
protected String getStringValueFromAttributeOrElement(String attributeName, String elementName, Element element) {
  String value = null;

  String attributeValue = element.attribute(attributeName);
  Element childElement = element.elementNS(CAMUNDA_BPMN_EXTENSIONS_NS, elementName);
  String stringElementText = null;

  if (attributeValue != null && childElement != null) {
    addError("Can't use attribute '" + attributeName + "' and element '" + elementName + "' together, only use one", element);
  } else if (childElement != null) {
    stringElementText = childElement.getText();
    if (stringElementText == null || stringElementText.length() == 0) {
      addError("No valid value found in attribute '" + attributeName + "' nor element '" + elementName + "'", element);
    } else {
      // Use text of element
      value = stringElementText;
    }
  } else if (attributeValue != null && attributeValue.length() > 0) {
    // Using attribute
    value = attributeValue;
  }

  return value;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:BpmnParse.java

示例4: parseProperties

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
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);
    }

  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:DefaultFormHandler.java

示例5: parseValidation

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
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);
         }
      }
    }
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:DefaultFormHandler.java

示例6: parseSignalEventDefinition

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
protected EventSubscriptionDeclaration parseSignalEventDefinition(Element signalEventDefinitionElement) {
  String signalRef = signalEventDefinitionElement.attribute("signalRef");
  if (signalRef == null) {
    addError("signalEventDefinition does not have required property 'signalRef'", signalEventDefinitionElement);
    return null;
  } else {
    SignalDefinition signalDefinition = signals.get(resolveName(signalRef));
    if (signalDefinition == null) {
      addError("Could not find signal with id '" + signalRef + "'", signalEventDefinitionElement);
    }
    EventSubscriptionDeclaration signalEventDefinition = new EventSubscriptionDeclaration(signalDefinition.getExpression(), EventType.SIGNAL);

    boolean throwingAsynch = TRUE.equals(signalEventDefinitionElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "async", "false"));
    signalEventDefinition.setAsync(throwingAsynch);

    return signalEventDefinition;
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:BpmnParse.java

示例7: parseIntermediateLinkEventCatchBehavior

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
protected void parseIntermediateLinkEventCatchBehavior(Element intermediateEventElement, ActivityImpl activity, Element linkEventDefinitionElement) {

    activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.INTERMEDIATE_EVENT_LINK);

    String linkName = linkEventDefinitionElement.attribute("name");
    String elementName = intermediateEventElement.attribute("name");
    String elementId = intermediateEventElement.attribute("id");

    if (eventLinkTargets.containsKey(linkName)) {
      addError("Multiple Intermediate Catch Events with the same link event name ('" + linkName + "') are not allowed.", intermediateEventElement);
    } else {
      if (!linkName.equals(elementName)) {
        // this is valid - but not a good practice (as it is really confusing
        // for the reader of the process model) - hence we log a warning
        addWarning("Link Event named '" + elementName + "' containes link event definition with name '" + linkName
            + "' - it is recommended to use the same name for both.", intermediateEventElement);
      }

      // now we remember the link in order to replace the sequence flow later on
      eventLinkTargets.put(linkName, elementId);
    }
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:BpmnParse.java

示例8: parseConditionExpression

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
protected Condition parseConditionExpression(Element conditionExprElement) {
  String expression = conditionExprElement.getText().trim();
  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;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:BpmnParse.java

示例9: parseScriptTaskElement

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
/**
 * Returns a {@link ScriptTaskActivityBehavior} for the script task element
 * corresponding to the script source or resource specified.
 *
 * @param scriptTaskElement
 *          the script task element
 * @return the corresponding {@link ScriptTaskActivityBehavior}
 */
protected ScriptTaskActivityBehavior parseScriptTaskElement(Element scriptTaskElement) {
  // determine script language
  String language = scriptTaskElement.attribute("scriptFormat");
  if (language == null) {
    language = ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE;
  }
  String resultVariableName = parseResultVariable(scriptTaskElement);

  // determine script source
  String scriptSource = null;
  Element scriptElement = scriptTaskElement.element("script");
  if (scriptElement != null) {
    scriptSource = scriptElement.getText();
  }
  String scriptResource = scriptTaskElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, PROPERTYNAME_RESOURCE);

  try {
    ExecutableScript script = ScriptUtil.getScript(language, scriptSource, scriptResource, expressionManager);
    return new ScriptTaskActivityBehavior(script, resultVariableName);
  } catch (ProcessEngineException e) {
    addError("Unable to process ScriptTask: " + e.getMessage(), scriptElement);
    return null;
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:33,代码来源:BpmnParse.java

示例10: parseSignals

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
/**
 * Parses the signals of the given definitions file. Signals are not contained
 * within a process element, but they can be referenced from inner process
 * elements.
 */
protected void parseSignals() {
  for (Element signalElement : rootElement.elements("signal")) {
    String id = signalElement.attribute("id");
    String signalName = signalElement.attribute("name");

    for (SignalDefinition signalDefinition : signals.values()) {
      if (signalDefinition.getName().equals(signalName)) {
        addError("duplicate signal name '" + signalName + "'.", signalElement);
      }
    }

    if (id == null) {
      addError("signal must have an id", signalElement);
    } else if (signalName == null) {
      addError("signal with id '" + id + "' has no name", signalElement);
    } else {
      Expression signalExpression = expressionManager.createExpression(signalName);
      SignalDefinition signal = new SignalDefinition();
      signal.setId(this.targetNamespace + ":" + id);
      signal.setExpression(signalExpression);

      this.signals.put(signal.getId(), signal);
    }
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:31,代码来源:BpmnParse.java

示例11: parseErrors

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
public void parseErrors() {
  for (Element errorElement : rootElement.elements("error")) {
    Error error = new Error();

    String id = errorElement.attribute("id");
    if (id == null) {
      addError("'id' is mandatory on error definition", errorElement);
    }
    error.setId(id);

    String errorCode = errorElement.attribute("errorCode");
    if (errorCode != null) {
      error.setErrorCode(errorCode);
    }

    errors.put(id, error);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:BpmnParse.java

示例12: parseCollaboration

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
/**
 * Parses the collaboration definition defined within the 'definitions' root
 * element and get all participants to lookup their process references during
 * DI parsing.
 */
public void parseCollaboration() {
  Element collaboration = rootElement.element("collaboration");
  if (collaboration != null) {
    for (Element participant : collaboration.elements("participant")) {
      String processRef = participant.attribute("processRef");
      if (processRef != null) {
        ProcessDefinitionImpl procDef = getProcessDefinition(processRef);
        if (procDef != null) {
          // Set participant process on the procDef, so it can get rendered
          // later on if needed
          ParticipantProcess participantProcess = new ParticipantProcess();
          participantProcess.setId(participant.attribute("id"));
          participantProcess.setName(participant.attribute("name"));
          procDef.setParticipantProcess(participantProcess);

          participantProcesses.put(participantProcess.getId(), processRef);
        }
      }
    }
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:BpmnParse.java

示例13: validateCatchCompensateEventDefinition

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
protected void validateCatchCompensateEventDefinition(Element compensateEventDefinitionElement) {
  String activityRef = compensateEventDefinitionElement.attribute("activityRef");
  if (activityRef != null) {
    addWarning("attribute 'activityRef' is not supported on catching compensation event. attribute will be ignored", compensateEventDefinitionElement);
  }

  String waitForCompletion = compensateEventDefinitionElement.attribute("waitForCompletion");
  if (waitForCompletion != null) {
    addWarning("attribute 'waitForCompletion' is not supported on catching compensation event. attribute will be ignored", compensateEventDefinitionElement);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:12,代码来源:BpmnParse.java

示例14: parseFormPropertyType

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
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;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:32,代码来源:FormTypes.java

示例15: findEscalationForEscalationEventDefinition

import org.camunda.bpm.engine.impl.util.xml.Element; //导入方法依赖的package包/类
/**
 * Find the referenced escalation of the given escalation event definition.
 * Add errors if the referenced escalation not found.
 *
 * @return referenced escalation or <code>null</code>, if referenced escalation not found
 */
protected Escalation findEscalationForEscalationEventDefinition(Element escalationEventDefinition) {
  String escalationRef = escalationEventDefinition.attribute("escalationRef");
  if (escalationRef == null) {
    addError("escalationEventDefinition does not have required attribute 'escalationRef'", escalationEventDefinition);
  } else if (!escalations.containsKey(escalationRef)) {
    addError("could not find escalation with id '" + escalationRef + "'", escalationEventDefinition);
  } else {
    return escalations.get(escalationRef);
  }
  return null;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:BpmnParse.java


注:本文中的org.camunda.bpm.engine.impl.util.xml.Element.attribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。