use of org.activiti.bpmn.model.BoundaryEvent in project Activiti by Activiti.
the class TimerDefinitionConverterTest method validateModel.
private void validateModel(BpmnModel model) {
IntermediateCatchEvent timer = (IntermediateCatchEvent) model.getMainProcess().getFlowElement("timer");
assertNotNull(timer);
TimerEventDefinition timerEvent = (TimerEventDefinition) timer.getEventDefinitions().get(0);
assertThat(timerEvent.getCalendarName(), is("custom"));
assertEquals("PT5M", timerEvent.getTimeDuration());
StartEvent start = (StartEvent) model.getMainProcess().getFlowElement("theStart");
assertNotNull(start);
TimerEventDefinition startTimerEvent = (TimerEventDefinition) start.getEventDefinitions().get(0);
assertThat(startTimerEvent.getCalendarName(), is("custom"));
assertEquals("R2/PT5S", startTimerEvent.getTimeCycle());
assertEquals("${EndDate}", startTimerEvent.getEndDate());
BoundaryEvent boundaryTimer = (BoundaryEvent) model.getMainProcess().getFlowElement("boundaryTimer");
assertNotNull(boundaryTimer);
TimerEventDefinition boundaryTimerEvent = (TimerEventDefinition) boundaryTimer.getEventDefinitions().get(0);
assertThat(boundaryTimerEvent.getCalendarName(), is("custom"));
assertEquals("PT10S", boundaryTimerEvent.getTimeDuration());
}
use of org.activiti.bpmn.model.BoundaryEvent in project Activiti by Activiti.
the class SubProcessConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("start1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof StartEvent);
assertEquals("start1", flowElement.getId());
flowElement = model.getMainProcess().getFlowElement("userTask1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("userTask1", flowElement.getId());
UserTask userTask = (UserTask) flowElement;
assertTrue(userTask.getCandidateUsers().size() == 1);
assertTrue(userTask.getCandidateGroups().size() == 1);
assertTrue(userTask.getFormProperties().size() == 2);
flowElement = model.getMainProcess().getFlowElement("subprocess1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SubProcess);
assertEquals("subprocess1", flowElement.getId());
SubProcess subProcess = (SubProcess) flowElement;
assertTrue(subProcess.getLoopCharacteristics().isSequential());
assertEquals("10", subProcess.getLoopCharacteristics().getLoopCardinality());
assertEquals("${assignee == \"\"}", subProcess.getLoopCharacteristics().getCompletionCondition());
assertTrue(subProcess.getFlowElements().size() == 5);
assertEquals(1, subProcess.getExecutionListeners().size());
ActivitiListener listenerSubProcess = subProcess.getExecutionListeners().get(0);
assertEquals("SubProcessTestClass", listenerSubProcess.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listenerSubProcess.getImplementationType());
assertEquals("start", listenerSubProcess.getEvent());
flowElement = model.getMainProcess().getFlowElement("boundaryEvent1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof BoundaryEvent);
assertEquals("boundaryEvent1", flowElement.getId());
BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
assertNotNull(boundaryEvent.getAttachedToRef());
assertEquals("subprocess1", boundaryEvent.getAttachedToRef().getId());
assertEquals(1, boundaryEvent.getEventDefinitions().size());
assertTrue(boundaryEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition);
assertEquals(1, model.getMainProcess().getExecutionListeners().size());
ActivitiListener listenerMainProcess = model.getMainProcess().getExecutionListeners().get(0);
assertEquals("TestClass", listenerMainProcess.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listenerMainProcess.getImplementationType());
assertEquals("start", listenerMainProcess.getEvent());
}
use of org.activiti.bpmn.model.BoundaryEvent in project Activiti by Activiti.
the class BpmnAutoLayout method handleSequenceFlow.
protected void handleSequenceFlow() {
Hashtable<String, Object> edgeStyle = new Hashtable<String, Object>();
edgeStyle.put(mxConstants.STYLE_ORTHOGONAL, true);
edgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.ElbowConnector);
edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
Hashtable<String, Object> boundaryEdgeStyle = new Hashtable<String, Object>();
boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_X, 0.5);
boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_Y, 1.0);
boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.5);
boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.orthConnector);
graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);
for (SequenceFlow sequenceFlow : sequenceFlows.values()) {
Object sourceVertex = generatedVertices.get(sequenceFlow.getSourceRef());
Object targetVertex = generatedVertices.get(sequenceFlow.getTargetRef());
String style = null;
if (handledFlowElements.get(sequenceFlow.getSourceRef()) instanceof BoundaryEvent) {
// Sequence flow out of boundary events are handled in a different way,
// to make them visually appealing for the eye of the dear end user.
style = STYLE_BOUNDARY_SEQUENCEFLOW;
} else {
style = STYLE_SEQUENCEFLOW;
}
Object sequenceFlowEdge = graph.insertEdge(cellParent, sequenceFlow.getId(), "", sourceVertex, targetVertex, style);
generatedSequenceFlowEdges.put(sequenceFlow.getId(), sequenceFlowEdge);
}
}
use of org.activiti.bpmn.model.BoundaryEvent in project Activiti by Activiti.
the class BpmnAutoLayout method handleAssociations.
protected void handleAssociations() {
Hashtable<String, Object> edgeStyle = new Hashtable<String, Object>();
edgeStyle.put(mxConstants.STYLE_ORTHOGONAL, true);
edgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.ElbowConnector);
edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
Hashtable<String, Object> boundaryEdgeStyle = new Hashtable<String, Object>();
boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_X, 0.5);
boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_Y, 1.0);
boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.5);
boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.orthConnector);
graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);
for (Association association : associations.values()) {
Object sourceVertex = generatedVertices.get(association.getSourceRef());
Object targetVertex = generatedVertices.get(association.getTargetRef());
String style = null;
if (handledFlowElements.get(association.getSourceRef()) instanceof BoundaryEvent) {
// Sequence flow out of boundary events are handled in a different way,
// to make them visually appealing for the eye of the dear end user.
style = STYLE_BOUNDARY_SEQUENCEFLOW;
} else {
style = STYLE_SEQUENCEFLOW;
}
Object associationEdge = graph.insertEdge(cellParent, association.getId(), "", sourceVertex, targetVertex, style);
generatedAssociationEdges.put(association.getId(), associationEdge);
}
}
use of org.activiti.bpmn.model.BoundaryEvent in project Activiti by Activiti.
the class BoundaryEventXMLConverter method writeAdditionalChildElements.
@Override
protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
BoundaryEvent boundaryEvent = (BoundaryEvent) element;
writeEventDefinitions(boundaryEvent, boundaryEvent.getEventDefinitions(), model, xtw);
}
Aggregations