Search in sources :

Example 1 with InterruptingTimerEventExecutionSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet in project kie-wb-common by kiegroup.

the class StartEventConverter method timerEvent.

private BpmnNode timerEvent(StartEvent event, TimerEventDefinition e) {
    Node<View<StartTimerEvent>, Edge> node = factoryManager.newNode(event.getId(), StartTimerEvent.class);
    StartTimerEvent definition = node.getContent().getDefinition();
    EventPropertyReader p = propertyReaderFactory.of(event);
    definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setBackgroundSet(p.getBackgroundSet());
    definition.setFontSet(p.getFontSet());
    definition.setDimensionsSet(p.getCircleDimensionSet());
    definition.setSimulationSet(p.getSimulationSet());
    definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
    IsInterrupting isInterrupting = new IsInterrupting(event.isIsInterrupting());
    SLADueDate slaDueDate = new SLADueDate(p.getSlaDueDate());
    TimerSettings timerSettings = new TimerSettings(p.getTimerSettings(e));
    InterruptingTimerEventExecutionSet executionSet = new InterruptingTimerEventExecutionSet(isInterrupting, slaDueDate, timerSettings);
    definition.setExecutionSet(executionSet);
    node.getContent().setBounds(p.getBounds());
    return BpmnNode.of(node, p);
}
Also used : TimerSettings(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings) StartTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) IsInterrupting(org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting) View(org.kie.workbench.common.stunner.core.graph.content.view.View) EventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader) CatchEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) SLADueDate(org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) InterruptingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Example 2 with InterruptingTimerEventExecutionSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testUnmarshallIsInterruptingStartTimerEvent.

@Test
public void testUnmarshallIsInterruptingStartTimerEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_SUBPROCESS_STARTTIMEREVENT);
    assertDiagram(diagram, 7);
    assertEquals("EventSubprocessStartTimerEvent", diagram.getMetadata().getTitle());
    // Check first start event with all FILLED properties
    Node<? extends Definition, ?> startEventNode = diagram.getGraph().getNode("_4A4F40C5-C9F1-4761-BD95-C61DDBDC9C19");
    StartTimerEvent startTimerEvent = (StartTimerEvent) startEventNode.getContent().getDefinition();
    BPMNGeneralSet eventGeneralSet = startTimerEvent.getGeneral();
    assertNotNull(eventGeneralSet);
    assertEquals("StartTimerEvent", eventGeneralSet.getName().getValue());
    assertEquals("Some not empty\nDocumentation\n~`!@#$%^&*()_+=-{}|[]\\:\";'<>/?.,", eventGeneralSet.getDocumentation().getValue());
    InterruptingTimerEventExecutionSet eventExecutionSet = startTimerEvent.getExecutionSet();
    assertNotNull(eventExecutionSet);
    assertNotNull(eventExecutionSet.getTimerSettings());
    assertEquals("*/2 * * * *", eventExecutionSet.getTimerSettings().getValue().getTimeCycle());
    assertEquals("cron", eventExecutionSet.getTimerSettings().getValue().getTimeCycleLanguage());
    assertEquals("201702081535", eventExecutionSet.getTimerSettings().getValue().getTimeDate());
    assertEquals("P4H", eventExecutionSet.getTimerSettings().getValue().getTimeDuration());
    assertEquals(true, eventExecutionSet.getIsInterrupting().getValue());
    // Check second start event with all EMPTY properties
    Node<? extends Definition, ?> emptyEventNode = diagram.getGraph().getNode("_BF94EA1F-519D-4E52-AB2A-C7687E11ABDC");
    StartTimerEvent emptyTimerEvent = (StartTimerEvent) emptyEventNode.getContent().getDefinition();
    BPMNGeneralSet emptyEventGeneralSet = emptyTimerEvent.getGeneral();
    assertNotNull(emptyEventGeneralSet);
    assertEquals("", emptyEventGeneralSet.getName().getValue());
    assertEquals("", emptyEventGeneralSet.getDocumentation().getValue());
    InterruptingTimerEventExecutionSet emptyExecutionSet = emptyTimerEvent.getExecutionSet();
    assertNotNull(emptyExecutionSet);
    assertNotNull(emptyExecutionSet.getTimerSettings());
    assertNull(emptyExecutionSet.getTimerSettings().getValue().getTimeCycle());
    assertNull(emptyExecutionSet.getTimerSettings().getValue().getTimeCycleLanguage());
    assertNull(emptyExecutionSet.getTimerSettings().getValue().getTimeDate());
    assertNull(emptyExecutionSet.getTimerSettings().getValue().getTimeDuration());
    assertEquals(false, emptyExecutionSet.getIsInterrupting().getValue());
}
Also used : InterruptingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet) Graph(org.kie.workbench.common.stunner.core.graph.Graph) StartTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) Test(org.junit.Test)

Example 3 with InterruptingTimerEventExecutionSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet in project kie-wb-common by kiegroup.

the class StartEventConverter method timerEvent.

private PropertyWriter timerEvent(Node<View<StartTimerEvent>, ?> n) {
    StartEvent event = bpmn2.createStartEvent();
    event.setId(n.getUUID());
    StartTimerEvent definition = n.getContent().getDefinition();
    CatchEventPropertyWriter p = propertyWriterFactory.of(event);
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
    p.setSimulationSet(definition.getSimulationSet());
    InterruptingTimerEventExecutionSet executionSet = definition.getExecutionSet();
    event.setIsInterrupting(executionSet.getIsInterrupting().getValue());
    p.addSlaDueDate(executionSet.getSlaDueDate());
    p.setAbsoluteBounds(n);
    p.addTimer(executionSet.getTimerSettings());
    return p;
}
Also used : InterruptingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet) CatchEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter) StartTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent) StartEvent(org.eclipse.bpmn2.StartEvent) BaseStartEvent(org.kie.workbench.common.stunner.bpmn.definition.BaseStartEvent) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)

Aggregations

StartTimerEvent (org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent)3 InterruptingTimerEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet)3 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)3 StartEvent (org.eclipse.bpmn2.StartEvent)1 Test (org.junit.Test)1 CatchEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter)1 CatchEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader)1 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)1 BaseStartEvent (org.kie.workbench.common.stunner.bpmn.definition.BaseStartEvent)1 IsInterrupting (org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting)1 TimerSettings (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings)1 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)1 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)1 SLADueDate (org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate)1 AdvancedData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData)1 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 Graph (org.kie.workbench.common.stunner.core.graph.Graph)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1