Search in sources :

Example 1 with TimerEventDefinition

use of org.eclipse.bpmn2.TimerEventDefinition in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method setCatchEventProperties.

private void setCatchEventProperties(CatchEvent event, Map<String, Object> properties, Definitions def) {
    if (event.getOutputSet() != null) {
        List<DataOutput> dataOutputs = event.getOutputSet().getDataOutputRefs();
        StringBuffer doutbuff = new StringBuffer();
        for (DataOutput dout : dataOutputs) {
            doutbuff.append(dout.getName());
            String dtype = getAnyAttributeValue(dout, "dtype");
            if (dtype != null && !dtype.isEmpty()) {
                doutbuff.append(":").append(dtype);
            }
            doutbuff.append(",");
        }
        if (doutbuff.length() > 0) {
            doutbuff.setLength(doutbuff.length() - 1);
        }
        String dataoutput = doutbuff.toString();
        properties.put(DATAOUTPUT, dataoutput);
        List<DataOutputAssociation> outputAssociations = event.getDataOutputAssociation();
        StringBuffer doutassociationbuff = new StringBuffer();
        for (DataOutputAssociation doa : outputAssociations) {
            String doaName = ((DataOutput) doa.getSourceRef().get(0)).getName();
            if (doaName != null && doaName.length() > 0) {
                doutassociationbuff.append("[dout]" + ((DataOutput) doa.getSourceRef().get(0)).getName());
                doutassociationbuff.append("->");
                doutassociationbuff.append(doa.getTargetRef().getId());
                doutassociationbuff.append(",");
            }
        }
        if (doutassociationbuff.length() > 0) {
            doutassociationbuff.setLength(doutassociationbuff.length() - 1);
        }
        String assignments = doutassociationbuff.toString();
        properties.put(DATAOUTPUTASSOCIATIONS, assignments);
        setAssignmentsInfoProperty(null, null, dataoutput, null, assignments, properties);
    }
    // event definitions
    List<EventDefinition> eventdefs = event.getEventDefinitions();
    for (EventDefinition ed : eventdefs) {
        if (ed instanceof TimerEventDefinition) {
            setTimerEventProperties((TimerEventDefinition) ed, properties);
        } else if (ed instanceof SignalEventDefinition) {
            if (((SignalEventDefinition) ed).getSignalRef() != null) {
                // find signal with the corresponding id
                boolean foundSignalRef = false;
                List<RootElement> rootElements = def.getRootElements();
                for (RootElement re : rootElements) {
                    if (re instanceof Signal) {
                        if (re.getId().equals(((SignalEventDefinition) ed).getSignalRef())) {
                            properties.put("signalref", ((Signal) re).getName());
                            foundSignalRef = true;
                        }
                    }
                }
                if (!foundSignalRef) {
                    properties.put(SIGNALREF, "");
                }
            } else {
                properties.put(SIGNALREF, "");
            }
        } else if (ed instanceof ErrorEventDefinition) {
            if (((ErrorEventDefinition) ed).getErrorRef() != null && ((ErrorEventDefinition) ed).getErrorRef().getErrorCode() != null) {
                properties.put(ERRORREF, ((ErrorEventDefinition) ed).getErrorRef().getErrorCode());
            } else {
                properties.put(ERRORREF, "");
            }
        } else if (ed instanceof ConditionalEventDefinition) {
            FormalExpression conditionalExp = (FormalExpression) ((ConditionalEventDefinition) ed).getCondition();
            if (conditionalExp != null) {
                setConditionExpressionProperties(conditionalExp, properties, "drools");
            }
        } else if (ed instanceof EscalationEventDefinition) {
            if (((EscalationEventDefinition) ed).getEscalationRef() != null) {
                Escalation esc = ((EscalationEventDefinition) ed).getEscalationRef();
                if (esc.getEscalationCode() != null && esc.getEscalationCode().length() > 0) {
                    properties.put(ESCALATIONCODE, esc.getEscalationCode());
                } else {
                    properties.put(ESCALATIONCODE, "");
                }
            }
        } else if (ed instanceof MessageEventDefinition) {
            if (((MessageEventDefinition) ed).getMessageRef() != null) {
                Message msg = ((MessageEventDefinition) ed).getMessageRef();
                properties.put(MESSAGEREF, msg.getName());
            }
        } else if (ed instanceof CompensateEventDefinition) {
            if (((CompensateEventDefinition) ed).getActivityRef() != null) {
                Activity act = ((CompensateEventDefinition) ed).getActivityRef();
                properties.put(ACTIVITYREF, act.getName());
            }
        }
    }
}
Also used : DataOutput(org.eclipse.bpmn2.DataOutput) Message(org.eclipse.bpmn2.Message) Escalation(org.eclipse.bpmn2.Escalation) Activity(org.eclipse.bpmn2.Activity) CallActivity(org.eclipse.bpmn2.CallActivity) EventDefinition(org.eclipse.bpmn2.EventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) TerminateEventDefinition(org.eclipse.bpmn2.TerminateEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) CancelEventDefinition(org.eclipse.bpmn2.CancelEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) FormalExpression(org.eclipse.bpmn2.FormalExpression) Signal(org.eclipse.bpmn2.Signal) RootElement(org.eclipse.bpmn2.RootElement) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition)

Example 2 with TimerEventDefinition

use of org.eclipse.bpmn2.TimerEventDefinition in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method marshallBoundaryEvent.

protected void marshallBoundaryEvent(BoundaryEvent boundaryEvent, BPMNPlane plane, JsonGenerator generator, float xOffset, float yOffset, Map<String, Object> catchEventProperties) throws JsonGenerationException, IOException {
    List<EventDefinition> eventDefinitions = boundaryEvent.getEventDefinitions();
    if (boundaryEvent.isCancelActivity()) {
        catchEventProperties.put(BOUNDARYCANCELACTIVITY, "true");
    } else {
        catchEventProperties.put(BOUNDARYCANCELACTIVITY, "false");
    }
    // simulation properties
    setSimulationProperties(boundaryEvent.getId(), catchEventProperties);
    if (eventDefinitions.size() == 1) {
        EventDefinition eventDefinition = eventDefinitions.get(0);
        if (eventDefinition instanceof SignalEventDefinition) {
            marshallNode(boundaryEvent, catchEventProperties, "IntermediateSignalEventCatching", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof EscalationEventDefinition) {
            marshallNode(boundaryEvent, catchEventProperties, "IntermediateEscalationEvent", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof ErrorEventDefinition) {
            marshallNode(boundaryEvent, catchEventProperties, "IntermediateErrorEvent", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof TimerEventDefinition) {
            marshallNode(boundaryEvent, catchEventProperties, "IntermediateTimerEvent", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof CompensateEventDefinition) {
            marshallNode(boundaryEvent, catchEventProperties, "IntermediateCompensationEventCatching", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof ConditionalEventDefinition) {
            marshallNode(boundaryEvent, catchEventProperties, "IntermediateConditionalEvent", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof MessageEventDefinition) {
            marshallNode(boundaryEvent, catchEventProperties, "IntermediateMessageEventCatching", plane, generator, xOffset, yOffset);
        } else {
            throw new UnsupportedOperationException("Event definition not supported: " + eventDefinition);
        }
    } else {
        throw new UnsupportedOperationException("None or multiple event definitions not supported for boundary event");
    }
}
Also used : EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) EventDefinition(org.eclipse.bpmn2.EventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) TerminateEventDefinition(org.eclipse.bpmn2.TerminateEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) CancelEventDefinition(org.eclipse.bpmn2.CancelEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition)

Example 3 with TimerEventDefinition

use of org.eclipse.bpmn2.TimerEventDefinition in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method applyCatchEventProperties.

protected void applyCatchEventProperties(CatchEvent event, Map<String, String> properties) {
    parseAssignmentsInfo(properties);
    if (properties.get("dataoutput") != null && !"".equals(properties.get("dataoutput"))) {
        String[] allDataOutputs = properties.get("dataoutput").split(",\\s*");
        OutputSet outSet = Bpmn2Factory.eINSTANCE.createOutputSet();
        for (String dataOutput : allDataOutputs) {
            if (dataOutput.trim().length() > 0) {
                DataOutput nextOutput = Bpmn2Factory.eINSTANCE.createDataOutput();
                String[] doutputParts = dataOutput.split(":\\s*");
                if (doutputParts.length == 2) {
                    nextOutput.setId(event.getId() + "_" + doutputParts[0]);
                    nextOutput.setName(doutputParts[0]);
                    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
                    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "dtype", false, false);
                    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, doutputParts[1]);
                    nextOutput.getAnyAttribute().add(extensionEntry);
                } else {
                    nextOutput.setId(event.getId() + "_" + dataOutput);
                    nextOutput.setName(dataOutput);
                    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
                    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "dtype", false, false);
                    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, "Object");
                    nextOutput.getAnyAttribute().add(extensionEntry);
                }
                event.getDataOutputs().add(nextOutput);
                outSet.getDataOutputRefs().add(nextOutput);
            }
        }
        event.setOutputSet(outSet);
    }
    if (properties.get("boundarycancelactivity") != null) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "boundaryca", false, false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("boundarycancelactivity"));
        event.getAnyAttribute().add(extensionEntry);
    }
    // data output associations
    if (properties.get("dataoutputassociations") != null && !"".equals(properties.get("dataoutputassociations"))) {
        String[] allAssociations = properties.get("dataoutputassociations").split(",\\s*");
        for (String association : allAssociations) {
            // data outputs are uni-directional
            String[] associationParts = association.split("->\\s*");
            String fromPart = associationParts[0];
            if (fromPart.startsWith("[dout]")) {
                fromPart = fromPart.substring(6, fromPart.length());
            }
            DataOutputAssociation doa = Bpmn2Factory.eINSTANCE.createDataOutputAssociation();
            // for source refs we loop through already defined data outputs
            List<DataOutput> dataOutputs = event.getDataOutputs();
            if (dataOutputs != null) {
                for (DataOutput ddo : dataOutputs) {
                    if (ddo.getId().equals(event.getId() + "_" + fromPart)) {
                        doa.getSourceRef().add(ddo);
                    }
                }
            }
            // since we dont have the process vars defined yet..need to improvise
            ItemAwareElement e = Bpmn2Factory.eINSTANCE.createItemAwareElement();
            e.setId(associationParts[1]);
            doa.setTargetRef(e);
            event.getDataOutputAssociation().add(doa);
        }
    }
    try {
        if (event.getEventDefinitions() != null && event.getEventDefinitions().size() > 0) {
            EventDefinition ed = event.getEventDefinitions().get(0);
            if (ed instanceof TimerEventDefinition) {
                applyTimerEventProperties((TimerEventDefinition) ed, properties);
            } else if (ed instanceof SignalEventDefinition) {
                if (properties.get("signalref") != null && !"".equals(properties.get("signalref"))) {
                    ((SignalEventDefinition) ed).setSignalRef(properties.get("signalref"));
                // ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
                // EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                // "http://www.jboss.org/drools", "signalrefname", false, false);
                // EStructuralFeatureImpl.SimpleFeatureMapEntry extensionEntry = new EStructuralFeatureImpl.SimpleFeatureMapEntry(extensionAttribute,
                // properties.get("signalref"));
                // ((SignalEventDefinition) event.getEventDefinitions().get(0)).getAnyAttribute().add(extensionEntry);
                }
            } else if (ed instanceof ErrorEventDefinition) {
                if (properties.get("errorref") != null && !"".equals(properties.get("errorref"))) {
                    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
                    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "erefname", false, false);
                    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("errorref"));
                    ((ErrorEventDefinition) event.getEventDefinitions().get(0)).getAnyAttribute().add(extensionEntry);
                }
            } else if (ed instanceof ConditionalEventDefinition) {
                applyConditionalEventProperties((ConditionalEventDefinition) ed, properties);
            } else if (ed instanceof EscalationEventDefinition) {
                if (properties.get("escalationcode") != null && !"".equals(properties.get("escalationcode"))) {
                    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
                    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "esccode", false, false);
                    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("escalationcode"));
                    ((EscalationEventDefinition) event.getEventDefinitions().get(0)).getAnyAttribute().add(extensionEntry);
                }
            } else if (ed instanceof MessageEventDefinition) {
                if (properties.get("messageref") != null && !"".equals(properties.get("messageref"))) {
                    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
                    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "msgref", false, false);
                    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("messageref"));
                    ((MessageEventDefinition) event.getEventDefinitions().get(0)).getAnyAttribute().add(extensionEntry);
                }
            } else if (ed instanceof CompensateEventDefinition) {
                if (properties.get("activityref") != null && !"".equals(properties.get("activityref"))) {
                    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
                    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "actrefname", false, false);
                    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("activityref"));
                    ((CompensateEventDefinition) event.getEventDefinitions().get(0)).getAnyAttribute().add(extensionEntry);
                }
            }
        }
    } catch (Exception e) {
        _logger.warn(e.getMessage());
    }
    // simulation
    if (properties.get("distributiontype") != null && properties.get("distributiontype").length() > 0) {
        TimeParameters timeParams = BpsimFactory.eINSTANCE.createTimeParameters();
        Parameter processingTimeParam = BpsimFactory.eINSTANCE.createParameter();
        if (properties.get("distributiontype").equals("normal")) {
            NormalDistributionType normalDistributionType = BpsimFactory.eINSTANCE.createNormalDistributionType();
            normalDistributionType.setStandardDeviation(Double.valueOf(properties.get("standarddeviation")));
            normalDistributionType.setMean(Double.valueOf(properties.get("mean")));
            processingTimeParam.getParameterValue().add(normalDistributionType);
        } else if (properties.get("distributiontype").equals("uniform")) {
            UniformDistributionType uniformDistributionType = BpsimFactory.eINSTANCE.createUniformDistributionType();
            uniformDistributionType.setMax(Double.valueOf(properties.get("max")));
            uniformDistributionType.setMin(Double.valueOf(properties.get("min")));
            processingTimeParam.getParameterValue().add(uniformDistributionType);
        // random distribution type not supported in bpsim 1.0
        // } else if(properties.get("distributiontype").equals("random")) {
        // RandomDistributionType randomDistributionType = DroolsFactory.eINSTANCE.createRandomDistributionType();
        // randomDistributionType.setMax(Double.valueOf(properties.get("max")));
        // randomDistributionType.setMin(Double.valueOf(properties.get("min")));
        // processingTimeParam.getParameterValue().add(randomDistributionType);
        } else if (properties.get("distributiontype").equals("poisson")) {
            PoissonDistributionType poissonDistributionType = BpsimFactory.eINSTANCE.createPoissonDistributionType();
            poissonDistributionType.setMean(Double.valueOf(properties.get("mean")));
            processingTimeParam.getParameterValue().add(poissonDistributionType);
        }
        // no specific time unit available in 1.0 bpsim - use global
        // if(properties.get("timeunit") != null) {
        // timeParams.setTimeUnit(TimeUnit.getByName(properties.get("timeunit")));
        // }
        timeParams.setProcessingTime(processingTimeParam);
        if (_simulationElementParameters.containsKey(event.getId())) {
            _simulationElementParameters.get(event.getId()).add(timeParams);
        } else {
            List<EObject> values = new ArrayList<EObject>();
            values.add(timeParams);
            _simulationElementParameters.put(event.getId(), values);
        }
    }
    if (properties.get("probability") != null && properties.get("probability").length() > 0) {
        ControlParameters controlParams = BpsimFactory.eINSTANCE.createControlParameters();
        Parameter probParam = BpsimFactory.eINSTANCE.createParameter();
        FloatingParameterType probParamValueParam = BpsimFactory.eINSTANCE.createFloatingParameterType();
        DecimalFormat twoDForm = new DecimalFormat("#.##");
        probParamValueParam.setValue(Double.valueOf(twoDForm.format(Double.valueOf(properties.get("probability")))));
        probParam.getParameterValue().add(probParamValueParam);
        controlParams.setProbability(probParam);
        if (_simulationElementParameters.containsKey(event.getId())) {
            _simulationElementParameters.get(event.getId()).add(controlParams);
        } else {
            List<EObject> values = new ArrayList<EObject>();
            values.add(controlParams);
            _simulationElementParameters.put(event.getId(), values);
        }
    }
}
Also used : DataOutput(org.eclipse.bpmn2.DataOutput) NormalDistributionType(bpsim.NormalDistributionType) DecimalFormat(java.text.DecimalFormat) ArrayList(java.util.ArrayList) EventDefinition(org.eclipse.bpmn2.EventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) EAttributeImpl(org.eclipse.emf.ecore.impl.EAttributeImpl) EObject(org.eclipse.emf.ecore.EObject) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) SimpleFeatureMapEntry(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) UniformDistributionType(bpsim.UniformDistributionType) OutputSet(org.eclipse.bpmn2.OutputSet) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) IOException(java.io.IOException) JsonParseException(com.fasterxml.jackson.core.JsonParseException) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) FloatingParameterType(bpsim.FloatingParameterType) PoissonDistributionType(bpsim.PoissonDistributionType) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) ControlParameters(bpsim.ControlParameters) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) Parameter(bpsim.Parameter) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) ExtendedMetaData(org.eclipse.emf.ecore.util.ExtendedMetaData) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) TimeParameters(bpsim.TimeParameters)

Example 4 with TimerEventDefinition

use of org.eclipse.bpmn2.TimerEventDefinition in project kie-wb-common by kiegroup.

the class EventPropertyWriter method addTimer.

public void addTimer(TimerSettings timerSettings) {
    TimerEventDefinition eventDefinition = bpmn2.createTimerEventDefinition();
    TimerSettingsValue timerSettingsValue = timerSettings.getValue();
    String date = timerSettingsValue.getTimeDate();
    if (date != null) {
        FormalExpression timeDate = bpmn2.createFormalExpression();
        timeDate.setBody(date);
        eventDefinition.setTimeDate(timeDate);
    }
    String duration = timerSettingsValue.getTimeDuration();
    if (duration != null) {
        FormalExpression timeDuration = bpmn2.createFormalExpression();
        timeDuration.setBody(duration);
        eventDefinition.setTimeDuration(timeDuration);
    }
    String cycle = timerSettingsValue.getTimeCycle();
    String cycleLanguage = timerSettingsValue.getTimeCycleLanguage();
    if (cycle != null && cycleLanguage != null) {
        FormalExpression timeCycleExpression = bpmn2.createFormalExpression();
        timeCycleExpression.setBody(cycle);
        timeCycleExpression.setLanguage(cycleLanguage);
        eventDefinition.setTimeCycle(timeCycleExpression);
    }
    addEventDefinition(eventDefinition);
}
Also used : TimerSettingsValue(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) FormalExpression(org.eclipse.bpmn2.FormalExpression)

Example 5 with TimerEventDefinition

use of org.eclipse.bpmn2.TimerEventDefinition in project kie-wb-common by kiegroup.

the class IntermediateCatchEventConverterTest method verifyBoundaryTimerEventConvert.

private void verifyBoundaryTimerEventConvert() {
    IntermediateTimerEvent definition = mock(IntermediateTimerEvent.class);
    TimerEventDefinition eventDefinition = mock(TimerEventDefinition.class);
    BoundaryEvent boundaryEvent = mockBoundaryEvent(definition);
    eventDefinitions.clear();
    eventDefinitions.add(eventDefinition);
    tested.convertBoundaryEvent(boundaryEvent);
    verify(tested).timerEvent(boundaryEvent, eventDefinition);
}
Also used : BoundaryEvent(org.eclipse.bpmn2.BoundaryEvent) IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition)

Aggregations

TimerEventDefinition (org.eclipse.bpmn2.TimerEventDefinition)11 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)6 ConditionalEventDefinition (org.eclipse.bpmn2.ConditionalEventDefinition)6 ErrorEventDefinition (org.eclipse.bpmn2.ErrorEventDefinition)6 EscalationEventDefinition (org.eclipse.bpmn2.EscalationEventDefinition)6 EventDefinition (org.eclipse.bpmn2.EventDefinition)6 FormalExpression (org.eclipse.bpmn2.FormalExpression)6 MessageEventDefinition (org.eclipse.bpmn2.MessageEventDefinition)6 SignalEventDefinition (org.eclipse.bpmn2.SignalEventDefinition)6 ArrayList (java.util.ArrayList)4 CancelEventDefinition (org.eclipse.bpmn2.CancelEventDefinition)4 TerminateEventDefinition (org.eclipse.bpmn2.TerminateEventDefinition)4 List (java.util.List)3 IntermediateTimerEvent (org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent)3 TimerSettingsValue (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue)3 NormalDistributionType (bpsim.NormalDistributionType)2 Parameter (bpsim.Parameter)2 PoissonDistributionType (bpsim.PoissonDistributionType)2 TimeParameters (bpsim.TimeParameters)2 UniformDistributionType (bpsim.UniformDistributionType)2