本文整理汇总了Java中org.activiti.bpmn.model.SequenceFlow类的典型用法代码示例。如果您正苦于以下问题:Java SequenceFlow类的具体用法?Java SequenceFlow怎么用?Java SequenceFlow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SequenceFlow类属于org.activiti.bpmn.model包,在下文中一共展示了SequenceFlow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
@Override
public void parse(BpmnParse bpmnParse, BaseElement element) {
if (element instanceof Process) {
ProcessDefinitionEntity processDefinition = bpmnParse.getCurrentProcessDefinition();
String key = processDefinition.getKey();
processDefinition.setKey(key + "-modified-by-post-parse-handler");
} else if (element instanceof UserTask) {
UserTask userTask = (UserTask) element;
List<SequenceFlow> outgoingFlows = userTask.getOutgoingFlows();
System.out.println("UserTask:[" + userTask.getName() + "]的输出流:");
for (SequenceFlow outgoingFlow : outgoingFlows) {
System.out.println("\t" + outgoingFlow.getTargetRef());
}
System.out.println();
}
}
示例2: assertFirstTaskIsAsync
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
/**
* Asserts that the first asyncable task in the given model is indeed asynchronous. Only asserts when the configuration is set to true.
*
* @param bpmnModel The BPMN model
*/
private void assertFirstTaskIsAsync(BpmnModel bpmnModel)
{
if (Boolean.TRUE.equals(configurationHelper.getProperty(ConfigurationValue.ACTIVITI_JOB_DEFINITION_ASSERT_ASYNC, Boolean.class)))
{
Process process = bpmnModel.getMainProcess();
for (StartEvent startEvent : process.findFlowElementsOfType(StartEvent.class))
{
for (SequenceFlow sequenceFlow : startEvent.getOutgoingFlows())
{
String targetRef = sequenceFlow.getTargetRef();
FlowElement targetFlowElement = process.getFlowElement(targetRef);
if (targetFlowElement instanceof Activity)
{
Assert.isTrue(((Activity) targetFlowElement).isAsynchronous(), "Element with id \"" + targetRef +
"\" must be set to activiti:async=true. All tasks which start the workflow must be asynchronous to prevent certain undesired " +
"transactional behavior, such as records of workflow not being saved on errors. Please refer to Activiti and herd documentations " +
"for details.");
}
}
}
}
}
示例3: processFlowElements
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
private void processFlowElements(Collection<FlowElement> flowElementList, BaseElement parentScope) {
for (FlowElement flowElement : flowElementList) {
if (flowElement instanceof SequenceFlow) {
SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
FlowNode sourceNode = getFlowNodeFromScope(sequenceFlow.getSourceRef(), parentScope);
if (sourceNode != null) {
sourceNode.getOutgoingFlows().add(sequenceFlow);
}
FlowNode targetNode = getFlowNodeFromScope(sequenceFlow.getTargetRef(), parentScope);
if (targetNode != null) {
targetNode.getIncomingFlows().add(sequenceFlow);
}
} else if (flowElement instanceof BoundaryEvent) {
BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
FlowElement attachedToElement = getFlowNodeFromScope(boundaryEvent.getAttachedToRefId(), parentScope);
if(attachedToElement != null) {
boundaryEvent.setAttachedToRef((Activity) attachedToElement);
((Activity) attachedToElement).getBoundaryEvents().add(boundaryEvent);
}
} else if(flowElement instanceof SubProcess) {
SubProcess subProcess = (SubProcess) flowElement;
processFlowElements(subProcess.getFlowElements(), subProcess);
}
}
}
示例4: validateModel
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
private void validateModel(BpmnModel model) {
assertEquals(1, model.getPools().size());
Pool pool = model.getPools().get(0);
assertEquals("pool1", pool.getId());
assertEquals("Pool", pool.getName());
Process process = model.getProcess(pool.getId());
assertNotNull(process);
assertEquals(2, process.getLanes().size());
Lane lane = process.getLanes().get(0);
assertEquals("lane1", lane.getId());
assertEquals("Lane 1", lane.getName());
assertEquals(2, lane.getFlowReferences().size());
lane = process.getLanes().get(1);
assertEquals("lane2", lane.getId());
assertEquals("Lane 2", lane.getName());
assertEquals(2, lane.getFlowReferences().size());
FlowElement flowElement = process.getFlowElement("flow1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SequenceFlow);
}
示例5: hasSequenceFlow
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
private FlowElementAssert hasSequenceFlow(String expectedSourceRef, String expectedTargetRef, String conditionExpression) {
for (SequenceFlow flow : getFlowElements(SequenceFlow.class)) {
if(flow.getSourceRef().equals(expectedSourceRef) &&
flow.getTargetRef().equals(expectedTargetRef) &&
( (flow.getConditionExpression() == null && conditionExpression == null) ||
flow.getConditionExpression().equals(conditionExpression))) {
return this;
}
}
throw new AssertionError("sequence flow with condition: " + conditionExpression + " source: " + expectedSourceRef + " and target: " + expectedTargetRef + " not found");
}
示例6: getPrecedingEventBasedGateway
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
protected String getPrecedingEventBasedGateway(BpmnParse bpmnParse, IntermediateCatchEvent event) {
String eventBasedGatewayId = null;
for (SequenceFlow sequenceFlow : event.getIncomingFlows()) {
FlowElement sourceElement = bpmnParse.getBpmnModel().getFlowElement(sequenceFlow.getSourceRef());
if (sourceElement instanceof EventGateway) {
eventBasedGatewayId = sourceElement.getId();
break;
}
}
return eventBasedGatewayId;
}
示例7: executeParse
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的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);
}
}
}
示例8: executeParse
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的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);
}
}
示例9: testStartEventWithExecutionListener
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
public void testStartEventWithExecutionListener() throws Exception {
BpmnModel bpmnModel = new BpmnModel();
Process process = new Process();
process.setId("simpleProcess");
process.setName("Very simple process");
bpmnModel.getProcesses().add(process);
StartEvent startEvent = new StartEvent();
startEvent.setId("startEvent1");
TimerEventDefinition timerDef = new TimerEventDefinition();
timerDef.setTimeDuration("PT5M");
startEvent.getEventDefinitions().add(timerDef);
ActivitiListener listener = new ActivitiListener();
listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
listener.setImplementation("${test}");
listener.setEvent("end");
startEvent.getExecutionListeners().add(listener);
process.addFlowElement(startEvent);
UserTask task = new UserTask();
task.setId("reviewTask");
task.setAssignee("kermit");
process.addFlowElement(task);
SequenceFlow flow1 = new SequenceFlow();
flow1.setId("flow1");
flow1.setSourceRef("startEvent1");
flow1.setTargetRef("reviewTask");
process.addFlowElement(flow1);
EndEvent endEvent = new EndEvent();
endEvent.setId("endEvent1");
process.addFlowElement(endEvent);
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml)));
Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy();
repositoryService.deleteDeployment(deployment.getId());
}
示例10: convertXMLToElement
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr) throws Exception {
SequenceFlow sequenceFlow = new SequenceFlow();
BpmnXMLUtil.addXMLLocation(sequenceFlow, xtr);
sequenceFlow.setSourceRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_SOURCE_REF));
sequenceFlow.setTargetRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_TARGET_REF));
sequenceFlow.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME));
parseChildElements(getXMLElementName(), sequenceFlow, xtr);
return sequenceFlow;
}
示例11: writeAdditionalChildElements
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
@Override
protected void writeAdditionalChildElements(BaseElement element, XMLStreamWriter xtw) throws Exception {
SequenceFlow sequenceFlow = (SequenceFlow) element;
if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) {
xtw.writeStartElement(ELEMENT_FLOW_CONDITION);
xtw.writeAttribute(XSI_PREFIX, XSI_NAMESPACE, "type", "tFormalExpression");
xtw.writeCData(sequenceFlow.getConditionExpression());
xtw.writeEndElement();
}
}
示例12: validateModel
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
private void validateModel(BpmnModel model) {
assertEquals("simpleProcess", model.getMainProcess().getId());
assertEquals("Simple process", model.getMainProcess().getName());
assertEquals(true, model.getMainProcess().isExecutable());
FlowElement flowElement = model.getMainProcess().getFlowElement("flow1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SequenceFlow);
assertEquals("flow1", flowElement.getId());
flowElement = model.getMainProcess().getFlowElement("catchEvent");
assertNotNull(flowElement);
assertTrue(flowElement instanceof IntermediateCatchEvent);
assertEquals("catchEvent", flowElement.getId());
IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) flowElement;
assertTrue(catchEvent.getEventDefinitions().size() == 1);
EventDefinition eventDefinition = catchEvent.getEventDefinitions().get(0);
assertTrue(eventDefinition instanceof TimerEventDefinition);
TimerEventDefinition timerDefinition = (TimerEventDefinition) eventDefinition;
assertEquals("PT5M", timerDefinition.getTimeDuration());
flowElement = model.getMainProcess().getFlowElement("flow1Condition");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SequenceFlow);
assertEquals("flow1Condition", flowElement.getId());
SequenceFlow flow = (SequenceFlow) flowElement;
assertEquals("${number <= 1}", flow.getConditionExpression());
}
示例13: FlowWithContainer
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
public FlowWithContainer(SequenceFlow sequenceFlow,
FlowElementsContainer flowContainer) {
this.sequenceFlow = sequenceFlow;
this.flowContainer = flowContainer;
}
示例14: getSequenceFlow
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
public SequenceFlow getSequenceFlow() {
return sequenceFlow;
}
示例15: setSequenceFlow
import org.activiti.bpmn.model.SequenceFlow; //导入依赖的package包/类
public void setSequenceFlow(SequenceFlow sequenceFlow) {
this.sequenceFlow = sequenceFlow;
}