本文整理汇总了Java中org.camunda.bpm.engine.impl.util.xml.Element类的典型用法代码示例。如果您正苦于以下问题:Java Element类的具体用法?Java Element怎么用?Java Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Element类属于org.camunda.bpm.engine.impl.util.xml包,在下文中一共展示了Element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createActivityOnScope
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
/**
* Parses the generic information of an activity element (id, name,
* documentation, etc.), and creates a new {@link ActivityImpl} on the given
* scope element.
*/
public ActivityImpl createActivityOnScope(Element activityElement, ScopeImpl scopeElement) {
String id = activityElement.attribute("id");
LOG.parsingElement("activity", id);
ActivityImpl activity = scopeElement.createActivity(id);
activity.setProperty("name", activityElement.attribute("name"));
activity.setProperty("documentation", parseDocumentation(activityElement));
activity.setProperty("default", activityElement.attribute("default"));
activity.getProperties().set(BpmnProperties.TYPE, activityElement.getTagName());
activity.setProperty("line", activityElement.getLine());
setActivityAsyncDelegates(activity);
activity.setProperty(PROPERTYNAME_JOB_PRIORITY, parsePriority(activityElement, PROPERTYNAME_JOB_PRIORITY));
if (isCompensationHandler(activityElement)) {
activity.setProperty(PROPERTYNAME_IS_FOR_COMPENSATION, true);
}
return activity;
}
示例2: validateFieldDeclarationsForShell
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
protected void validateFieldDeclarationsForShell(Element serviceTaskElement, List<FieldDeclaration> fieldDeclarations) {
boolean shellCommandDefined = false;
for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
String fieldName = fieldDeclaration.getName();
FixedValue fieldFixedValue = (FixedValue) fieldDeclaration.getValue();
String fieldValue = fieldFixedValue.getExpressionText();
shellCommandDefined |= fieldName.equals("command");
if ((fieldName.equals("wait") || fieldName.equals("redirectError") || fieldName.equals("cleanEnv")) && !fieldValue.toLowerCase().equals(TRUE)
&& !fieldValue.toLowerCase().equals("false")) {
addError("undefined value for shell " + fieldName + " parameter :" + fieldValue.toString(), serviceTaskElement);
}
}
if (!shellCommandDefined) {
addError("No shell command is defined on the shell activity", serviceTaskElement);
}
}
示例3: parsePriority
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
protected ParameterValueProvider parsePriority(Element element, String priorityAttribute) {
String priorityAttributeValue = element.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, priorityAttribute);
if (priorityAttributeValue == null) {
return null;
} else {
Object value = priorityAttributeValue;
if (!StringUtil.isExpression(priorityAttributeValue)) {
// constant values must be valid integers
try {
value = Integer.parseInt(priorityAttributeValue);
} catch (NumberFormatException e) {
addError("Value '" + priorityAttributeValue + "' for attribute '" + priorityAttribute + "' is not a valid number", element);
}
}
return createParameterValueProvider(value, expressionManager);
}
}
示例4: validateFieldDeclarationsForEmail
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
protected void validateFieldDeclarationsForEmail(Element serviceTaskElement, List<FieldDeclaration> fieldDeclarations) {
boolean toDefined = false;
boolean textOrHtmlDefined = false;
for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
if (fieldDeclaration.getName().equals("to")) {
toDefined = true;
}
if (fieldDeclaration.getName().equals("html")) {
textOrHtmlDefined = true;
}
if (fieldDeclaration.getName().equals("text")) {
textOrHtmlDefined = true;
}
}
if (!toDefined) {
addError("No recipient is defined on the mail activity", serviceTaskElement);
}
if (!textOrHtmlDefined) {
addError("Text or html field should be provided", serviceTaskElement);
}
}
示例5: parseCompensationEventSubprocess
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
protected void parseCompensationEventSubprocess(ActivityImpl startEventActivity, Element startEventElement, ActivityImpl scopeActivity, Element compensateEventDefinition) {
startEventActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_COMPENSATION);
scopeActivity.setProperty(PROPERTYNAME_IS_FOR_COMPENSATION, Boolean.TRUE);
if (scopeActivity.getFlowScope() instanceof ProcessDefinitionEntity) {
addError("event subprocess with compensation start event is only supported for embedded subprocess "
+ "(since throwing compensation through a call activity-induced process hierarchy is not supported)", startEventElement);
}
ScopeImpl subprocess = scopeActivity.getFlowScope();
ActivityImpl compensationHandler = ((ActivityImpl) subprocess).findCompensationHandler();
if (compensationHandler == null) {
// add property to subprocess
subprocess.setProperty(PROPERTYNAME_COMPENSATION_HANDLER_ID, scopeActivity.getActivityId());
} else {
if (compensationHandler.isSubProcessScope()) {
addError("multiple event subprocesses with compensation start event are not supported on the same scope", startEventElement);
} else {
addError("compensation boundary event and event subprocess with compensation start event are not supported on the same scope", startEventElement);
}
}
validateCatchCompensateEventDefinition(compensateEventDefinition);
}
示例6: parsePotentialOwnerResourceAssignment
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
protected void parsePotentialOwnerResourceAssignment(Element performerElement, TaskDefinition taskDefinition) {
Element raeElement = performerElement.element(RESOURCE_ASSIGNMENT_EXPR);
if (raeElement != null) {
Element feElement = raeElement.element(FORMAL_EXPRESSION);
if (feElement != null) {
List<String> assignmentExpressions = parseCommaSeparatedList(feElement.getText());
for (String assignmentExpression : assignmentExpressions) {
assignmentExpression = assignmentExpression.trim();
if (assignmentExpression.startsWith(USER_PREFIX)) {
String userAssignementId = getAssignmentId(assignmentExpression, USER_PREFIX);
taskDefinition.addCandidateUserIdExpression(expressionManager.createExpression(userAssignementId));
} else if (assignmentExpression.startsWith(GROUP_PREFIX)) {
String groupAssignementId = getAssignmentId(assignmentExpression, GROUP_PREFIX);
taskDefinition.addCandidateGroupIdExpression(expressionManager.createExpression(groupAssignementId));
} else { // default: given string is a goupId, as-is.
taskDefinition.addCandidateGroupIdExpression(expressionManager.createExpression(assignmentExpression));
}
}
}
}
}
示例7: parseTransaction
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
protected ActivityImpl parseTransaction(Element transactionElement, ScopeImpl scope) {
ActivityImpl activity = createActivityOnScope(transactionElement, scope);
parseAsynchronousContinuationForActivity(transactionElement, activity);
activity.setScope(true);
activity.setSubProcessScope(true);
activity.setActivityBehavior(new SubProcessActivityBehavior());
activity.getProperties().set(BpmnProperties.TRIGGERED_BY_EVENT, false);
parseScope(transactionElement, activity);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseTransaction(transactionElement, scope, activity);
}
return activity;
}
示例8: 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;
}
}
示例9: parseConfiguration
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
public void parseConfiguration(Element activityElement, DeploymentEntity deployment, ProcessDefinitionEntity processDefinition, BpmnParse bpmnParse) {
this.deploymentId = deployment.getId();
ExpressionManager expressionManager = Context
.getProcessEngineConfiguration()
.getExpressionManager();
Element extensionElement = activityElement.element("extensionElements");
if (extensionElement != null) {
// provide support for deprecated form properties
parseFormProperties(bpmnParse, expressionManager, extensionElement);
// provide support for new form field metadata
parseFormData(bpmnParse, expressionManager, extensionElement);
}
}
示例10: parseServiceTask
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
@Override
public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {
Element connectorDefinition = findCamundaExtensionElement(serviceTaskElement, "connector");
if (connectorDefinition != null) {
Element connectorIdElement = connectorDefinition.element("connectorId");
String connectorId = null;
if (connectorIdElement != null) {
connectorId = connectorIdElement.getText().trim();
}
if (connectorIdElement == null || connectorId.isEmpty()) {
throw new BpmnParseException("No 'id' defined for connector.", connectorDefinition);
}
IoMapping ioMapping = parseInputOutput(connectorDefinition);
activity.setActivityBehavior(new ServiceTaskConnectorActivityBehavior(connectorId, ioMapping));
}
}
示例11: parseCompensationHandlerForCompensationBoundaryEvent
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
protected ActivityImpl parseCompensationHandlerForCompensationBoundaryEvent(ScopeImpl parentScope, ActivityImpl sourceActivity, String targetRef,
Map<String, Element> compensationHandlers) {
Element compensationHandler = compensationHandlers.get(targetRef);
ActivityImpl eventScope = (ActivityImpl) sourceActivity.getEventScope();
ActivityImpl compensationHandlerActivity = null;
if (eventScope.isMultiInstance()) {
ScopeImpl miBody = eventScope.getFlowScope();
compensationHandlerActivity = parseActivity(compensationHandler, null, miBody);
} else {
compensationHandlerActivity = parseActivity(compensationHandler, null, parentScope);
}
compensationHandlerActivity.getProperties().set(BpmnProperties.COMPENSATION_BOUNDARY_EVENT, sourceActivity);
return compensationHandlerActivity;
}
示例12: getImporter
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
protected XMLImporter getImporter(String importType, Element theImport) {
if (this.importers.containsKey(importType)) {
return this.importers.get(importType);
} else {
if (importType.equals("http://schemas.xmlsoap.org/wsdl/")) {
Class<?> wsdlImporterClass;
try {
wsdlImporterClass = Class.forName("org.camunda.bpm.engine.impl.webservice.CxfWSDLImporter", true, Thread.currentThread().getContextClassLoader());
XMLImporter newInstance = (XMLImporter) wsdlImporterClass.newInstance();
this.importers.put(importType, newInstance);
return newInstance;
} catch (Exception e) {
addError("Could not find importer for type " + importType, theImport);
}
}
return null;
}
}
示例13: parseCamundaScript
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
/**
* Parses a camunda script element.
*
* @param scriptElement the script element ot parse
* @return the generated executable script
* @throws BpmnParseException if the a attribute is missing or the script cannot be processed
*/
public static ExecutableScript parseCamundaScript(Element scriptElement) {
String scriptLanguage = scriptElement.attribute("scriptFormat");
if (scriptLanguage == null || scriptLanguage.isEmpty()) {
throw new BpmnParseException("Missing attribute 'scriptFormatAttribute' for 'script' element", scriptElement);
}
else {
String scriptResource = scriptElement.attribute("resource");
String scriptSource = scriptElement.getText();
try {
return ScriptUtil.getScript(scriptLanguage, scriptSource, scriptResource, getExpressionManager());
}
catch (ProcessEngineException e) {
throw new BpmnParseException("Unable to process script", scriptElement, e);
}
}
}
示例14: parseUserTask
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
/**
* Hooks listeners to assignment and creation of tasks.
* @param userTaskElement task to hook to
* @param scope a BPMN scope
* @param activity an Activity scope
*/
@Override
public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
UserTaskActivityBehavior activityBehavior = (UserTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = activityBehavior.getTaskDefinition();
addTaskAssignmentListeners(taskDefinition);
}
示例15: preInit
import org.camunda.bpm.engine.impl.util.xml.Element; //导入依赖的package包/类
@Override
public void preInit(final ProcessEngineConfigurationImpl configuration) {
new ShowcaseSetup().run();
customPreBPMNParseListeners(configuration).add(new AbstractBpmnParseListener() {
@Override
public void parseUserTask(final Element userTaskElement, final ScopeImpl scope, final ActivityImpl activity) {
taskDefinition(activity).addTaskListener(EVENTNAME_CREATE, new SkillBasedRoutingListener());
}
});
}