Search in sources :

Example 1 with TimerSettings

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

the class IntermediateCatchEventConverter method timerEvent.

private BpmnNode timerEvent(CatchEvent event, TimerEventDefinition e) {
    String nodeId = event.getId();
    Node<View<IntermediateTimerEvent>, Edge> node = factoryManager.newNode(nodeId, IntermediateTimerEvent.class);
    IntermediateTimerEvent definition = node.getContent().getDefinition();
    EventPropertyReader p = propertyReaderFactory.of(event);
    definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setExecutionSet(new CancellingTimerEventExecutionSet(new CancelActivity(p.isCancelActivity()), new TimerSettings(p.getTimerSettings(e))));
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getCircleDimensionSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    return BpmnNode.of(node);
}
Also used : TimerSettings(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings) CancellingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.CancellingTimerEventExecutionSet) IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) 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) CancelActivity(org.kie.workbench.common.stunner.bpmn.definition.property.event.CancelActivity)

Example 2 with TimerSettings

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings 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.setExecutionSet(new InterruptingTimerEventExecutionSet(new IsInterrupting(event.isIsInterrupting()), new TimerSettings(p.getTimerSettings(e))));
    definition.setSimulationSet(p.getSimulationSet());
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getCircleDimensionSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    return BpmnNode.of(node);
}
Also used : InterruptingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet) 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) Edge(org.kie.workbench.common.stunner.core.graph.Edge) 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)

Example 3 with TimerSettings

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

the class EventPropertyReader method getTimerSettings.

public TimerSettingsValue getTimerSettings(TimerEventDefinition eventDefinition) {
    TimerSettingsValue timerSettingsValue = new TimerSettings().getValue();
    toFormalExpression(eventDefinition.getTimeCycle()).ifPresent(timeCycle -> {
        timerSettingsValue.setTimeCycle(timeCycle.getBody());
        timerSettingsValue.setTimeCycleLanguage(timeCycle.getLanguage());
    });
    toFormalExpression(eventDefinition.getTimeDate()).ifPresent(timeDate -> {
        timerSettingsValue.setTimeDate(timeDate.getBody());
    });
    toFormalExpression(eventDefinition.getTimeDuration()).ifPresent(timeDateDuration -> {
        timerSettingsValue.setTimeDuration(timeDateDuration.getBody());
    });
    return timerSettingsValue;
}
Also used : TimerSettings(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings) TimerSettingsValue(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue)

Example 4 with TimerSettings

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

the class BPMNDirectDiagramMarshallerTest method testUnmarshallEventDefinitionRef.

@Test
public void testUnmarshallEventDefinitionRef() {
    try {
        Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_DEFINITION_REF);
        Node<? extends Definition<IntermediateTimerEvent>, ?> intermediateTimerEvent = diagram.getGraph().getNode("FLOWNODE_9e71d692-986c-11e7-40d3-005056844bde");
        IntermediateTimerEvent definition = intermediateTimerEvent.getContent().getDefinition();
        CancellingTimerEventExecutionSet executionSet = definition.getExecutionSet();
        TimerSettings timerSettings = executionSet.getTimerSettings();
    } catch (Exception ex) {
        fail(ex.getMessage());
    }
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) TimerSettings(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings) CancellingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.CancellingTimerEventExecutionSet) IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Aggregations

TimerSettings (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings)4 CatchEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader)2 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)2 IntermediateTimerEvent (org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent)2 CancellingTimerEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.CancellingTimerEventExecutionSet)2 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)2 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)2 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)2 Edge (org.kie.workbench.common.stunner.core.graph.Edge)2 View (org.kie.workbench.common.stunner.core.graph.content.view.View)2 Test (org.junit.Test)1 StartTimerEvent (org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent)1 CancelActivity (org.kie.workbench.common.stunner.bpmn.definition.property.event.CancelActivity)1 IsInterrupting (org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting)1 InterruptingTimerEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet)1 TimerSettingsValue (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue)1 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)1 Graph (org.kie.workbench.common.stunner.core.graph.Graph)1