public void add(UserKey userKey, Timer timer, int dashId, long deviceTilesId, long templateId) {
if (timer.isValid()) {
if (timer.isValidStart()) {
TimerTime timerTime = new TimerTime(timer.startTime);
SetPinAction action = new SetPinAction(timer.pin, timer.pinType, timer.startValue);
TimerKey timerKey = new TimerKey(userKey, dashId, timer.deviceId, timer.id, 0,
deviceTilesId, templateId, timerTime);
getExecutorOrCreate(timerTime.time).put(timerKey, new BaseAction[]{action});
}
if (timer.isValidStop()) {
TimerTime timerTime = new TimerTime(timer.stopTime);
SetPinAction action = new SetPinAction(timer.pin, timer.pinType, timer.stopValue);
TimerKey timerKey = new TimerKey(userKey, dashId, timer.deviceId, timer.id, 1,
deviceTilesId, templateId, timerTime);
getExecutorOrCreate(timerTime.time).put(timerKey, new BaseAction[]{action});
}
}
}