Search in sources :

Example 16 with TimerEventDefinition

use of org.activiti.bpmn.model.TimerEventDefinition 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());
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) StartEvent(org.activiti.bpmn.model.StartEvent) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 17 with TimerEventDefinition

use of org.activiti.bpmn.model.TimerEventDefinition 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());
}
Also used : SubProcess(org.activiti.bpmn.model.SubProcess) BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) FlowElement(org.activiti.bpmn.model.FlowElement) StartEvent(org.activiti.bpmn.model.StartEvent) UserTask(org.activiti.bpmn.model.UserTask) ActivitiListener(org.activiti.bpmn.model.ActivitiListener) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 18 with TimerEventDefinition

use of org.activiti.bpmn.model.TimerEventDefinition in project Activiti by Activiti.

the class DelayStepDefinitionConverter method createProcessArtifact.

@Override
protected IntermediateCatchEvent createProcessArtifact(DelayStepDefinition stepDefinition, WorkflowDefinitionConversion conversion) {
    IntermediateCatchEvent event = new IntermediateCatchEvent();
    event.setId(conversion.getUniqueNumberedId(ConversionConstants.INTERMEDIATE_EVENT_ID_PREVIX));
    event.setName(stepDefinition.getName());
    event.setDocumentation(stepDefinition.getDescription());
    TimerEventDefinition timer = new TimerEventDefinition();
    event.addEventDefinition(timer);
    if (stepDefinition.getTimeDate() != null) {
        timer.setTimeDate(stepDefinition.getTimeDate());
    } else if (stepDefinition.getTimeDuration() != null) {
        timer.setTimeDuration(stepDefinition.getTimeDuration().toISO8601DurationString());
    }
    addFlowElement(conversion, event, true);
    return event;
}
Also used : IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 19 with TimerEventDefinition

use of org.activiti.bpmn.model.TimerEventDefinition 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.getFlowElements().size() == 5);
    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);
}
Also used : SubProcess(org.activiti.bpmn.model.SubProcess) BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) FlowElement(org.activiti.bpmn.model.FlowElement) StartEvent(org.activiti.bpmn.model.StartEvent) UserTask(org.activiti.bpmn.model.UserTask) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Aggregations

TimerEventDefinition (org.activiti.bpmn.model.TimerEventDefinition)19 EventDefinition (org.activiti.bpmn.model.EventDefinition)7 FlowElement (org.activiti.bpmn.model.FlowElement)7 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)6 MessageEventDefinition (org.activiti.bpmn.model.MessageEventDefinition)6 SignalEventDefinition (org.activiti.bpmn.model.SignalEventDefinition)6 IntermediateCatchEvent (org.activiti.bpmn.model.IntermediateCatchEvent)4 StartEvent (org.activiti.bpmn.model.StartEvent)4 UserTask (org.activiti.bpmn.model.UserTask)4 ActivitiListener (org.activiti.bpmn.model.ActivitiListener)3 ErrorEventDefinition (org.activiti.bpmn.model.ErrorEventDefinition)3 SequenceFlow (org.activiti.bpmn.model.SequenceFlow)3 CancelEventDefinition (org.activiti.bpmn.model.CancelEventDefinition)2 Process (org.activiti.bpmn.model.Process)2 SubProcess (org.activiti.bpmn.model.SubProcess)2 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 HashMap (java.util.HashMap)1 List (java.util.List)1 BpmnXMLConverter (org.activiti.bpmn.converter.BpmnXMLConverter)1