Search in sources :

Example 11 with TimerEventDefinition

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

the class SimpleConverterTest method validateModel.

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());
}
Also used : FlowElement(org.activiti.bpmn.model.FlowElement) SequenceFlow(org.activiti.bpmn.model.SequenceFlow) IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) EventDefinition(org.activiti.bpmn.model.EventDefinition) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 12 with TimerEventDefinition

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

the class TimeDateParser method parseChildElement.

public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
    if (parentElement instanceof TimerEventDefinition == false)
        return;
    TimerEventDefinition eventDefinition = (TimerEventDefinition) parentElement;
    eventDefinition.setTimeDate(xtr.getElementText());
}
Also used : TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 13 with TimerEventDefinition

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

the class IntermediateCatchEventParseHandler method executeParse.

protected void executeParse(BpmnParse bpmnParse, IntermediateCatchEvent event) {
    ActivityImpl nestedActivity = null;
    EventDefinition eventDefinition = null;
    if (!event.getEventDefinitions().isEmpty()) {
        eventDefinition = event.getEventDefinitions().get(0);
    }
    if (eventDefinition == null) {
        nestedActivity = createActivityOnCurrentScope(bpmnParse, event, BpmnXMLConstants.ELEMENT_EVENT_CATCH);
        nestedActivity.setAsync(event.isAsynchronous());
        nestedActivity.setExclusive(!event.isNotExclusive());
    } 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);
        }
        nestedActivity.setAsync(event.isAsynchronous());
        nestedActivity.setExclusive(!event.isNotExclusive());
        // 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 {
            logger.warn("Unsupported intermediate catch event type for event " + event.getId());
        }
    }
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) EventDefinition(org.activiti.bpmn.model.EventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition) ScopeImpl(org.activiti.engine.impl.pvm.process.ScopeImpl) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 14 with TimerEventDefinition

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

the class TimeCycleParser method parseChildElement.

public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
    if (parentElement instanceof TimerEventDefinition == false)
        return;
    TimerEventDefinition eventDefinition = (TimerEventDefinition) parentElement;
    if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_END_DATE))) {
        eventDefinition.setEndDate(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_END_DATE));
    }
    eventDefinition.setTimeCycle(xtr.getElementText());
}
Also used : TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 15 with TimerEventDefinition

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

the class BoundaryEventParseHandler method executeParse.

protected void executeParse(BpmnParse bpmnParse, BoundaryEvent boundaryEvent) {
    ActivityImpl parentActivity = findActivity(bpmnParse, boundaryEvent.getAttachedToRefId());
    if (parentActivity == null) {
        logger.warn("Invalid reference in boundary event. Make sure that the referenced activity is defined in the same scope as the boundary event " + boundaryEvent.getId());
        return;
    }
    ActivityImpl nestedActivity = createActivityOnScope(bpmnParse, boundaryEvent, BpmnXMLConstants.ELEMENT_EVENT_BOUNDARY, parentActivity);
    bpmnParse.setCurrentActivity(nestedActivity);
    EventDefinition eventDefinition = null;
    if (!boundaryEvent.getEventDefinitions().isEmpty()) {
        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 {
        logger.warn("Unsupported boundary event type for boundary event " + boundaryEvent.getId());
    }
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) CancelEventDefinition(org.activiti.bpmn.model.CancelEventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) CancelEventDefinition(org.activiti.bpmn.model.CancelEventDefinition) EventDefinition(org.activiti.bpmn.model.EventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition) 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