use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method applyTimerEventProperties.
protected void applyTimerEventProperties(TimerEventDefinition timerEventDef, Map<String, String> properties) {
String timeDate;
String timeDuration;
String timeCycle;
String timeCycleLanguage;
String timerSettings;
timerSettings = properties.get(TIMERSETTINGS);
if (timerSettings != null && !"".equals(timerSettings)) {
TimerSettingsValue timerSettingsObj = new TimerSettingsTypeSerializer().parse(timerSettings);
timeDate = timerSettingsObj.getTimeDate();
timeDuration = timerSettingsObj.getTimeDuration();
timeCycle = timerSettingsObj.getTimeCycle();
timeCycleLanguage = timerSettingsObj.getTimeCycleLanguage();
} else {
timeDate = properties.get(TIMEDATE);
timeDuration = properties.get(TIMEDURATION);
timeCycle = properties.get(TIMECYCLE);
timeCycleLanguage = properties.get(TIMECYCLELANGUAGE);
}
if (timeDate != null && !"".equals(timeDate)) {
FormalExpression timeDateExpression = Bpmn2Factory.eINSTANCE.createFormalExpression();
timeDateExpression.setBody(timeDate);
timerEventDef.setTimeDate(timeDateExpression);
}
if (timeDuration != null && !"".equals(timeDuration)) {
FormalExpression timeDurationExpression = Bpmn2Factory.eINSTANCE.createFormalExpression();
timeDurationExpression.setBody(timeDuration);
timerEventDef.setTimeDuration(timeDurationExpression);
}
if (timeCycle != null && !"".equals(timeCycle)) {
FormalExpression timeCycleExpression = Bpmn2Factory.eINSTANCE.createFormalExpression();
timeCycleExpression.setBody(timeCycle);
if (timeCycleLanguage != null && timeCycleLanguage.length() > 0) {
timeCycleExpression.setLanguage(timeCycleLanguage);
}
timerEventDef.setTimeCycle(timeCycleExpression);
}
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue in project kie-wb-common by kiegroup.
the class TimerSettingsTypeSerializerTest method setUp.
@Before
public void setUp() {
timerSettings = new TimerSettingsValue(TIME_DATE, TIME_DURATION, TIME_CYCLE, TIME_CYCLE_LANGUAGE);
serializer = new TimerSettingsTypeSerializer();
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue in project kie-wb-common by kiegroup.
the class TimerSettingsFieldEditorPresenter method onTimerDurationChange.
protected void onTimerDurationChange() {
TimerSettingsValue oldValue = value;
value = copy(oldValue, true);
value.setTimeDuration(view.getTimeDuration());
value.setTimeDate(null);
value.setTimeCycle(null);
value.setTimeCycleLanguage(null);
notifyChange(oldValue, value);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue in project kie-wb-common by kiegroup.
the class TimerSettingsFieldEditorPresenter method copy.
private TimerSettingsValue copy(TimerSettingsValue source, boolean createIfSourceNull) {
if (source == null) {
return createIfSourceNull ? new TimerSettingsValue() : null;
}
TimerSettingsValue copy = new TimerSettingsValue();
copy.setTimeDuration(source.getTimeDuration());
copy.setTimeDate(source.getTimeDate());
copy.setTimeCycle(source.getTimeCycle());
copy.setTimeCycleLanguage(source.getTimeCycleLanguage());
return copy;
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue in project kie-wb-common by kiegroup.
the class TimerSettingsFieldEditorPresenterTest method testOnTimeCycleLanguage.
@Test
public void testOnTimeCycleLanguage() {
TimerSettingsValue value = new TimerSettingsValue();
editor.setValue(value);
when(view.getTimeCycle()).thenReturn(VALUE_1);
when(view.getTimeCycleLanguage()).thenReturn(VALUE_2);
editor.onTimeCycleLanguageChange();
verifyMultipleTimerChange(value);
}
Aggregations