本文整理汇总了Java中org.activiti.bpmn.model.BpmnModel.addProblem方法的典型用法代码示例。如果您正苦于以下问题:Java BpmnModel.addProblem方法的具体用法?Java BpmnModel.addProblem怎么用?Java BpmnModel.addProblem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.bpmn.model.BpmnModel
的用法示例。
在下文中一共展示了BpmnModel.addProblem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMuleActivityBehavior
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected ActivityBehavior createMuleActivityBehavior(Task task, List<FieldExtension> fieldExtensions, BpmnModel bpmnModel) {
try {
Class< ? > theClass = Class.forName("org.activiti.mule.MuleSendActivitiBehavior");
List<FieldDeclaration> fieldDeclarations = createFieldDeclarations(fieldExtensions);
return (ActivityBehavior) ClassDelegate.instantiateDelegate(theClass, fieldDeclarations);
} catch (ClassNotFoundException e) {
bpmnModel.addProblem("Could not find org.activiti.mule.MuleSendActivitiBehavior: " + e.getMessage(), task);
return null;
}
}
示例2: createCamelActivityBehavior
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected ActivityBehavior createCamelActivityBehavior(Task task, List<FieldExtension> fieldExtensions, BpmnModel bpmnModel) {
try {
Class< ? > theClass = null;
FieldExtension behaviorExtension = null;
for (FieldExtension fieldExtension : fieldExtensions) {
if ("camelBehaviorClass".equals(fieldExtension.getFieldName()) && StringUtils.isNotEmpty(fieldExtension.getStringValue())) {
theClass = Class.forName(fieldExtension.getStringValue());
behaviorExtension = fieldExtension;
break;
}
}
if (behaviorExtension != null) {
fieldExtensions.remove(behaviorExtension);
}
if (theClass == null) {
// Default Camel behavior class
theClass = Class.forName("org.activiti.camel.impl.CamelBehaviorDefaultImpl");
}
List<FieldDeclaration> fieldDeclarations = createFieldDeclarations(fieldExtensions);
return (ActivityBehavior) ClassDelegate.instantiateDelegate(theClass, fieldDeclarations);
} catch (ClassNotFoundException e) {
bpmnModel.addProblem("Could not find org.activiti.camel.CamelBehavior: " + e.getMessage(), task);
return null;
}
}
示例3: executeParse
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, ThrowEvent intermediateEvent) {
BpmnModel bpmnModel = bpmnParse.getBpmnModel();
ActivityImpl nestedActivityImpl = createActivityOnCurrentScope(bpmnParse, intermediateEvent, BpmnXMLConstants.ELEMENT_EVENT_THROW);
EventDefinition eventDefinition = null;
if (intermediateEvent.getEventDefinitions().size() > 0) {
eventDefinition = intermediateEvent.getEventDefinitions().get(0);
}
if (eventDefinition instanceof SignalEventDefinition) {
bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
} else if (eventDefinition instanceof org.activiti.bpmn.model.CompensateEventDefinition) {
bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
} else if (eventDefinition == null) {
nestedActivityImpl.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateThrowNoneEventActivityBehavior(intermediateEvent));
} else {
bpmnModel.addProblem("Unsupported intermediate throw event type " + eventDefinition, intermediateEvent);
}
}
示例4: parseChildElement
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
if (parentElement instanceof Event == false) return;
SignalEventDefinition eventDefinition = new SignalEventDefinition();
BpmnXMLUtil.addXMLLocation(eventDefinition, xtr);
eventDefinition.setSignalRef(xtr.getAttributeValue(null, ATTRIBUTE_SIGNAL_REF));
if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_ACTIVITY_ASYNCHRONOUS))) {
eventDefinition.setAsync(Boolean.parseBoolean(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_ACTIVITY_ASYNCHRONOUS)));
}
if (StringUtils.isEmpty(eventDefinition.getSignalRef())) {
model.addProblem("signalEventDefinition does not have required property 'signalRef'", xtr);
}
((Event) parentElement).getEventDefinitions().add(eventDefinition);
}
示例5: parseChildElement
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
listener = new ActivitiListener();
BpmnXMLUtil.addXMLLocation(listener, xtr);
if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CLASS))) {
listener.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CLASS));
listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
} else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EXPRESSION))) {
listener.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EXPRESSION));
listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
} else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_DELEGATEEXPRESSION))) {
listener.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_DELEGATEEXPRESSION));
listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
} else {
model.addProblem("Element 'class' or 'expression' is mandatory on executionListener", xtr);
}
listener.setEvent(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EVENT));
parseChildElements(xtr, listener, model, new FieldExtensionParser());
}
示例6: parseChildElement
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
if (parentElement instanceof Event == false) return;
MessageEventDefinition eventDefinition = new MessageEventDefinition();
BpmnXMLUtil.addXMLLocation(eventDefinition, xtr);
eventDefinition.setMessageRef(xtr.getAttributeValue(null, ATTRIBUTE_MESSAGE_REF));
if(StringUtils.isEmpty(eventDefinition.getMessageRef())) {
model.addProblem("attribute 'messageRef' is required", xtr);
} else {
int indexOfP = eventDefinition.getMessageRef().indexOf(':');
if (indexOfP != -1) {
String prefix = eventDefinition.getMessageRef().substring(0, indexOfP);
String resolvedNamespace = model.getNamespace(prefix);
eventDefinition.setMessageRef(resolvedNamespace + ":" + eventDefinition.getMessageRef().substring(indexOfP + 1));
} else {
eventDefinition.setMessageRef(model.getTargetNamespace() + ":" + eventDefinition.getMessageRef());
}
if(model.containsMessageId(eventDefinition.getMessageRef()) == false) {
model.addProblem("Invalid 'messageRef': no message with id '" + eventDefinition.getMessageRef() + "' found.", xtr);
}
}
((Event) parentElement).getEventDefinitions().add(eventDefinition);
}
示例7: executeParse
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, IntermediateCatchEvent event) {
BpmnModel bpmnModel = bpmnParse.getBpmnModel();
ActivityImpl nestedActivity = null;
EventDefinition eventDefinition = null;
if (event.getEventDefinitions().size() > 0) {
eventDefinition = event.getEventDefinitions().get(0);
}
if (eventDefinition == null) {
bpmnModel.addProblem("No event definition for intermediate catch event " + event.getId(), event);
nestedActivity = createActivityOnCurrentScope(bpmnParse, event, BpmnXMLConstants.ELEMENT_EVENT_CATCH);
} else {
ScopeImpl scope = bpmnParse.getCurrentScope();
String eventBasedGatewayId = getPrecedingEventBasedGateway(bpmnParse, event);
if (eventBasedGatewayId != null) {
ActivityImpl gatewayActivity = scope.findActivity(eventBasedGatewayId);
nestedActivity = createActivityOnScope(bpmnParse, event, BpmnXMLConstants.ELEMENT_EVENT_CATCH, gatewayActivity);
} else {
nestedActivity = createActivityOnScope(bpmnParse, event, BpmnXMLConstants.ELEMENT_EVENT_CATCH, scope);
}
// Catch event behavior is the same for all types
nestedActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateCatchEventActivityBehavior(event));
if (eventDefinition instanceof TimerEventDefinition
|| eventDefinition instanceof SignalEventDefinition
|| eventDefinition instanceof MessageEventDefinition) {
bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
} else {
bpmnModel.addProblem("Unsupported intermediate catch event type.", event);
}
}
}
示例8: createAssociation
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected void createAssociation(BpmnParse bpmnParse, Association association, ScopeImpl parentScope) {
BpmnModel bpmnModel = bpmnParse.getBpmnModel();
if (bpmnModel.getArtifact(association.getSourceRef()) != null ||
bpmnModel.getArtifact(association.getTargetRef()) != null) {
// connected to a text annotation so skipping it
return;
}
ActivityImpl sourceActivity = parentScope.findActivity(association.getSourceRef());
ActivityImpl targetActivity = parentScope.findActivity(association.getTargetRef());
// an association may reference elements that are not parsed as activities (like for instance
// text annotations so do not throw an exception if sourceActivity or targetActivity are null)
// However, we make sure they reference 'something':
if (sourceActivity == null) {
//bpmnModel.addProblem("Invalid reference sourceRef '" + association.getSourceRef() + "' of association element ", association.getId());
} else if (targetActivity == null) {
//bpmnModel.addProblem("Invalid reference targetRef '" + association.getTargetRef() + "' of association element ", association.getId());
} else {
if (sourceActivity.getProperty("type").equals("compensationBoundaryCatch")) {
Object isForCompensation = targetActivity.getProperty(PROPERTYNAME_IS_FOR_COMPENSATION);
if (isForCompensation == null || !(Boolean) isForCompensation) {
bpmnModel.addProblem("compensation boundary catch must be connected to element with isForCompensation=true", association);
} else {
ActivityImpl compensatedActivity = sourceActivity.getParentActivity();
compensatedActivity.setProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID, targetActivity.getId());
}
}
}
}
示例9: executeParse
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, EventGateway gateway) {
ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, gateway, BpmnXMLConstants.ELEMENT_GATEWAY_EVENT);
activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createEventBasedGatewayActivityBehavior(gateway));
activity.setScope(true);
// find all outgoing sequence flows
BpmnModel bpmnModel = bpmnParse.getBpmnModel();
for (SequenceFlow sequenceFlow : gateway.getOutgoingFlows()) {
FlowElement flowElement = bpmnModel.getFlowElement(sequenceFlow.getTargetRef());
if (flowElement != null && flowElement instanceof IntermediateCatchEvent == false) {
bpmnModel.addProblem("Event based gateway can only be connected to elements of type intermediateCatchEvent.", flowElement);
}
}
}
示例10: executeParse
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, SequenceFlow sequenceFlow) {
BpmnModel bpmnModel = bpmnParse.getBpmnModel();
ScopeImpl scope = bpmnParse.getCurrentScope();
// Implicit check: sequence flow cannot cross (sub) process boundaries: we
// don't do a processDefinition.findActivity here
ActivityImpl sourceActivity = scope.findActivity(sequenceFlow.getSourceRef());
ActivityImpl destinationActivity = scope.findActivity(sequenceFlow.getTargetRef());
if (sourceActivity == null) {
bpmnModel.addProblem("Invalid source '" + sequenceFlow.getSourceRef() + "' of sequence flow '" + sequenceFlow.getId() + "'", sequenceFlow);
} else if (destinationActivity == null) {
throw new ActivitiException("Invalid destination '" + sequenceFlow.getTargetRef() + "' of sequence flow '" + sequenceFlow.getId() + "'");
} else if (!(sourceActivity.getActivityBehavior() instanceof EventBasedGatewayActivityBehavior)
&& destinationActivity.getActivityBehavior() instanceof IntermediateCatchEventActivityBehavior && (destinationActivity.getParentActivity() != null)
&& (destinationActivity.getParentActivity().getActivityBehavior() instanceof EventBasedGatewayActivityBehavior)) {
bpmnModel.addProblem("Invalid incoming sequenceflow " + sequenceFlow.getId() + " for intermediateCatchEvent with id '" + destinationActivity.getId()
+ "' connected to an event-based gateway.", sequenceFlow);
} else {
TransitionImpl transition = sourceActivity.createOutgoingTransition(sequenceFlow.getId());
bpmnParse.getSequenceFlows().put(sequenceFlow.getId(), transition);
transition.setProperty("name", sequenceFlow.getName());
transition.setProperty("documentation", sequenceFlow.getDocumentation());
transition.setDestination(destinationActivity);
if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) {
Condition expressionCondition = new UelExpressionCondition(bpmnParse.getExpressionManager().createExpression(sequenceFlow.getConditionExpression()));
transition.setProperty(PROPERTYNAME_CONDITION_TEXT, sequenceFlow.getConditionExpression());
transition.setProperty(PROPERTYNAME_CONDITION, expressionCondition);
}
createExecutionListenersOnTransition(bpmnParse, sequenceFlow.getExecutionListeners(), transition);
}
}
示例11: executeParse
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, BoundaryEvent boundaryEvent) {
BpmnModel bpmnModel = bpmnParse.getBpmnModel();
ActivityImpl parentActivity = findActivity(bpmnParse, boundaryEvent.getAttachedToRefId());
if (parentActivity == null) {
bpmnModel.addProblem("Invalid reference in boundary event. Make sure that the referenced activity is defined in the same scope as the boundary event", boundaryEvent);
return;
}
ActivityImpl nestedActivity = createActivityOnScope(bpmnParse, boundaryEvent, BpmnXMLConstants.ELEMENT_EVENT_BOUNDARY, parentActivity);
bpmnParse.setCurrentActivity(nestedActivity);
EventDefinition eventDefinition = null;
if (boundaryEvent.getEventDefinitions().size() > 0) {
eventDefinition = boundaryEvent.getEventDefinitions().get(0);
}
if (eventDefinition instanceof TimerEventDefinition
|| eventDefinition instanceof org.activiti.bpmn.model.ErrorEventDefinition
|| eventDefinition instanceof SignalEventDefinition
|| eventDefinition instanceof CancelEventDefinition
|| eventDefinition instanceof MessageEventDefinition
|| eventDefinition instanceof org.activiti.bpmn.model.CompensateEventDefinition) {
bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
} else {
bpmnModel.addProblem("Unsupported boundary event type", boundaryEvent);
}
}
示例12: parseChildElement
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
UserTask userTask = (UserTask) parentElement;
if (StringUtils.isNotEmpty(userTask.getAssignee())) {
model.addProblem("No duplicate assignee and humanPerformer definition allowed", xtr);
}
String resourceElement = XMLStreamReaderUtil.moveDown(xtr);
if (StringUtils.isNotEmpty(resourceElement) && "resourceAssignmentExpression".equals(resourceElement)) {
String expression = XMLStreamReaderUtil.moveDown(xtr);
if (StringUtils.isNotEmpty(expression) && "formalExpression".equals(expression)) {
((UserTask) parentElement).setAssignee(xtr.getElementText());
}
}
}
示例13: parseChildElement
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
if (parentElement instanceof Event == false) return;
ErrorEventDefinition eventDefinition = new ErrorEventDefinition();
BpmnXMLUtil.addXMLLocation(eventDefinition, xtr);
eventDefinition.setErrorCode(xtr.getAttributeValue(null, "errorRef"));
if (parentElement instanceof EndEvent && StringUtils.isEmpty(eventDefinition.getErrorCode())) {
model.addProblem("errorRef is required for an error event", xtr);
}
((Event) parentElement).getEventDefinitions().add(eventDefinition);
}
示例14: createMultiInstanceLoopCharacteristics
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected void createMultiInstanceLoopCharacteristics(BpmnParse bpmnParse, org.activiti.bpmn.model.Activity modelActivity) {
MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics();
// Activity Behavior
MultiInstanceActivityBehavior miActivityBehavior = null;
ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(modelActivity.getId());
if (activity == null) {
bpmnParse.getBpmnModel().addProblem("Activity " + modelActivity.getId() + " needed for multi instance cannot bv found", modelActivity);
}
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());
}
// Validation
if (miActivityBehavior.getLoopCardinalityExpression() == null && miActivityBehavior.getCollectionExpression() == null
&& miActivityBehavior.getCollectionVariable() == null) {
bpmnModel.addProblem("Either loopCardinality or loopDataInputRef/activiti:collection must been set.", loopCharacteristics);
}
// Validation
if (miActivityBehavior.getCollectionExpression() == null && miActivityBehavior.getCollectionVariable() == null
&& miActivityBehavior.getCollectionElementVariable() != null) {
bpmnModel.addProblem("LoopDataInputRef/activiti:collection must be set when using inputDataItem or activiti:elementVariable.", loopCharacteristics);
}
}
示例15: executeParse
import org.activiti.bpmn.model.BpmnModel; //导入方法依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, CancelEventDefinition cancelEventDefinition) {
BpmnModel bpmnModel = bpmnParse.getBpmnModel();
if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
ActivityImpl activity = bpmnParse.getCurrentActivity();
activity.setProperty("type", "cancelBoundaryCatch");
ActivityImpl parent = (ActivityImpl) activity.getParent();
if (!parent.getProperty("type").equals("transaction")) {
bpmnModel.addProblem("boundary event with cancelEventDefinition only supported on transaction subprocesses.", cancelEventDefinition);
}
for (ActivityImpl child : parent.getActivities()) {
if (child.getProperty("type").equals("cancelBoundaryCatch") && child != activity) {
bpmnModel.addProblem("multiple boundary events with cancelEventDefinition not supported on same transaction subprocess.", cancelEventDefinition);
}
}
activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createCancelBoundaryEventActivityBehavior(cancelEventDefinition));
}
}