public ScriptTypeValue getConditionExpression() { if (conditionExpression == null) { return new ScriptTypeValue("java", ""); } else { return new ScriptTypeValue( Scripts.scriptLanguageFromUri(conditionExpression.getLanguage()), conditionExpression.getBody()); } }
public ScriptTypeValue getAdHocCompletionCondition() { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage()), completionCondition.getBody() ); }
public void setConditionExpressionProperties(final FormalExpression conditionExpression, final Map<String, Object> properties, final String defaultLanguage) { String language = Utils.getScriptLanguage(conditionExpression.getLanguage()); final String script = conditionExpression.getBody(); if (language != null || script != null) { if (language == null) { language = defaultLanguage; } properties.put(CONDITIONEXPRESSION, new ScriptTypeTypeSerializer().serialize(new ScriptTypeValue(language, script))); } }
private void setAdHocSubProcessProperties(final AdHocSubProcess subProcess, final Map<String, Object> properties) { if (subProcess.getOrdering().equals(AdHocOrdering.PARALLEL)) { properties.put(ADHOCORDERING, "Parallel"); } else if (subProcess.getOrdering().equals(AdHocOrdering.SEQUENTIAL)) { properties.put(ADHOCORDERING, "Sequential"); } else { // default to parallel properties.put(ADHOCORDERING, "Parallel"); } if (subProcess.getCompletionCondition() != null) { final FormalExpression expression = (FormalExpression) subProcess.getCompletionCondition(); final String language = Utils.getScriptLanguage(expression.getLanguage()); final String script = expression.getBody().replaceAll("\n", "\\\\n"); final ScriptTypeValue value = new ScriptTypeValue(language, script); properties.put(ADHOCCOMPLETIONCONDITION, new ScriptTypeTypeSerializer().serialize(value)); } }
public ConditionExpression getConditionExpression(ConditionalEventDefinition conditionalEvent) { FormalExpression formalExpression = (FormalExpression) conditionalEvent.getCondition(); if (formalExpression == null) { return null; } String language = Scripts.scriptLanguageFromUri(formalExpression.getLanguage(), Scripts.LANGUAGE.DROOLS.language()); String script = formalExpression.getBody(); return new ConditionExpression(new ScriptTypeValue(language, script)); } }
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; }
private void setTimerEventProperties(TimerEventDefinition timerEventDef, Map<String, Object> properties) { final TimerSettingsValue timerSettings = new TimerSettingsValue(); if (timerEventDef.getTimeDate() != null) { timerSettings.setTimeDate(((FormalExpression) timerEventDef.getTimeDate()).getBody()); } if (timerEventDef.getTimeDuration() != null) { timerSettings.setTimeDuration(((FormalExpression) timerEventDef.getTimeDuration()).getBody()); } if (timerEventDef.getTimeCycle() != null) { timerSettings.setTimeCycle(((FormalExpression) timerEventDef.getTimeCycle()).getBody()); if (((FormalExpression) timerEventDef.getTimeCycle()).getLanguage() != null) { timerSettings.setTimeCycleLanguage(((FormalExpression) timerEventDef.getTimeCycle()).getLanguage()); } } properties.put(TIMERSETTINGS, new TimerSettingsTypeSerializer().serialize(timerSettings)); }