schedule.getTrigger(), schedule.getConstraints(), schedule.getTimeoutMillis());
schedule.getTrigger(), schedule.getConstraints(), schedule.getTimeoutMillis());
private ConstraintResult.SatisfiedState constraintsSatisfied(Job job, long now) { ConstraintResult.SatisfiedState satisfiedState = ConstraintResult.SatisfiedState.SATISFIED; ConstraintContext constraintContext = new ConstraintContext(job, now, store); for (Constraint constraint : job.getSchedule().getConstraints()) { if (!(constraint instanceof CheckableConstraint)) { // this shouldn't happen, since implementation of Constraint in ProgramSchedule // should implement CheckableConstraint throw new IllegalArgumentException("Implementation of Constraint in ProgramSchedule" + " must implement CheckableConstraint"); } CheckableConstraint abstractConstraint = (CheckableConstraint) constraint; ConstraintResult result = abstractConstraint.check(job.getSchedule(), constraintContext); if (result.getSatisfiedState() == ConstraintResult.NEVER_SATISFIED.getSatisfiedState()) { // if any of the constraints are NEVER_SATISFIED, return NEVER_SATISFIED return ConstraintResult.NEVER_SATISFIED.getSatisfiedState(); } if (result.getSatisfiedState() == ConstraintResult.SatisfiedState.NOT_SATISFIED) { satisfiedState = ConstraintResult.SatisfiedState.NOT_SATISFIED; } } return satisfiedState; }
private ConstraintResult.SatisfiedState constraintsSatisfied(Job job, long now) { ConstraintResult.SatisfiedState satisfiedState = ConstraintResult.SatisfiedState.SATISFIED; ConstraintContext constraintContext = new ConstraintContext(job, now, store); for (Constraint constraint : job.getSchedule().getConstraints()) { if (!(constraint instanceof CheckableConstraint)) { // this shouldn't happen, since implementation of Constraint in ProgramSchedule // should implement CheckableConstraint throw new IllegalArgumentException("Implementation of Constraint in ProgramSchedule" + " must implement CheckableConstraint"); } CheckableConstraint abstractConstraint = (CheckableConstraint) constraint; ConstraintResult result = abstractConstraint.check(job.getSchedule(), constraintContext); if (result.getSatisfiedState() == ConstraintResult.NEVER_SATISFIED.getSatisfiedState()) { // if any of the constraints are NEVER_SATISFIED, return NEVER_SATISFIED return ConstraintResult.NEVER_SATISFIED.getSatisfiedState(); } if (result.getSatisfiedState() == ConstraintResult.SatisfiedState.NOT_SATISFIED) { satisfiedState = ConstraintResult.SatisfiedState.NOT_SATISFIED; } } return satisfiedState; }
addScheduleWithStatus(new ProgramSchedule(schedule.getName(), schedule.getDescription(), schedule.getProgramId(), schedule.getProperties(), updatedTrigger, schedule.getConstraints(), schedule.getTimeoutMillis()), scheduleRecord.getMeta().getStatus(), System.currentTimeMillis()); } catch (AlreadyExistsException e) {
addScheduleWithStatus(new ProgramSchedule(schedule.getName(), schedule.getDescription(), schedule.getProgramId(), schedule.getProperties(), updatedTrigger, schedule.getConstraints(), schedule.getTimeoutMillis()), scheduleRecord.getMeta().getStatus(), System.currentTimeMillis()); } catch (AlreadyExistsException e) {
Trigger trigger = Objects.firstNonNull(scheduleDetail.getTrigger(), existing.getTrigger()); List<? extends Constraint> constraints = Objects.firstNonNull(scheduleDetail.getConstraints(), existing.getConstraints()); Long timeoutMillis = Objects.firstNonNull(scheduleDetail.getTimeoutMillis(), existing.getTimeoutMillis()); ProgramSchedule updatedSchedule = new ProgramSchedule(existing.getName(), description, programId, properties,
Trigger trigger = Objects.firstNonNull(scheduleDetail.getTrigger(), existing.getTrigger()); List<? extends Constraint> constraints = Objects.firstNonNull(scheduleDetail.getConstraints(), existing.getConstraints()); Long timeoutMillis = Objects.firstNonNull(scheduleDetail.getTimeoutMillis(), existing.getTimeoutMillis()); ProgramSchedule updatedSchedule = new ProgramSchedule(existing.getName(), description, programId, properties,
public ScheduleDetail toScheduleDetail() { ScheduleProgramInfo programInfo = new ScheduleProgramInfo(schedule.getProgramId().getType().getSchedulableType(), schedule.getProgramId().getProgram()); ScheduleId scheduleId = schedule.getScheduleId(); return new ScheduleDetail(scheduleId.getNamespace(), scheduleId.getApplication(), scheduleId.getVersion(), scheduleId.getSchedule(), schedule.getDescription(), programInfo, schedule.getProperties(), schedule.getTrigger(), schedule.getConstraints(), schedule.getTimeoutMillis(), meta.getStatus().name()); } }
public ScheduleDetail toScheduleDetail() { ScheduleProgramInfo programInfo = new ScheduleProgramInfo(schedule.getProgramId().getType().getSchedulableType(), schedule.getProgramId().getProgram()); ScheduleId scheduleId = schedule.getScheduleId(); return new ScheduleDetail(scheduleId.getNamespace(), scheduleId.getApplication(), scheduleId.getVersion(), scheduleId.getSchedule(), schedule.getDescription(), programInfo, schedule.getProperties(), schedule.getTrigger(), schedule.getConstraints(), schedule.getTimeoutMillis(), meta.getStatus().name()); } }
ProgramSchedule updatedSchedule = new ProgramSchedule(schedule.getName(), schedule.getDescription(), schedule.getProgramId(), updatedProperties, schedule.getTrigger(), schedule.getConstraints()); if ("update".equals(howToUpdate)) { scheduler.updateSchedule(updatedSchedule);