Skip to content

Commit

Permalink
removing recurrence and scheduling checks from GUI after the computat…
Browse files Browse the repository at this point in the history
…ion algorithm was implemented in 74280c5
  • Loading branch information
katkav committed Sep 24, 2021
1 parent 63b7587 commit 60f5718
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
Expand Up @@ -504,24 +504,12 @@ private void savePerformed(AjaxRequestTarget target, boolean run) {
setTaskInitialState(taskWrapper, run);

setupOwner(taskWrapper);
setupRecurrence(taskWrapper);

} catch (SchemaException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Error while finishing task settings.", e);
target.add(getFeedbackPanel());
return;
}

if (!checkScheduleFilledForReccurentTask(taskWrapper)) {
if (run) {
getSession().error("Cannot run recurring task without setting scheduling for it.");
} else {
getSession().warn("Cannot run recurring task without setting scheduling for it.");
}
target.add(getFeedbackPanel());
return;
}

super.savePerformed(target);
}

Expand Down Expand Up @@ -572,24 +560,6 @@ private void setupOwner(PrismObjectWrapper<TaskType> taskWrapper) throws SchemaE
}
}

private void setupRecurrence(PrismObjectWrapper<TaskType> taskWrapper) throws SchemaException {
// TODO resolve (MID-7221)
PrismPropertyWrapper<TaskRecurrenceType> recurrenceWrapper = taskWrapper.findProperty(ItemPath.create(TaskType.F_RECURRENCE));
if (recurrenceWrapper == null) {
return;
}

PrismPropertyValueWrapper<TaskRecurrenceType> recurrenceWrapperValue = recurrenceWrapper.getValue();
if (recurrenceWrapperValue == null) {
return;
}

if (recurrenceWrapperValue.getNewValue() == null || recurrenceWrapperValue.getNewValue().isEmpty()) {
recurrenceWrapperValue.setRealValue(TaskRecurrenceType.SINGLE);
}

}

@Override
public void finishProcessing(AjaxRequestTarget target, Collection<ObjectDeltaOperation<? extends ObjectType>> executedDeltas, boolean returningFromAsync, OperationResult result) {
if (isPreviewRequested()) {
Expand All @@ -609,27 +579,6 @@ public void finishProcessing(AjaxRequestTarget target, Collection<ObjectDeltaOpe
super.finishProcessing(target, executedDeltas, returningFromAsync, result);
}

private boolean checkScheduleFilledForReccurentTask(PrismObjectWrapper<TaskType> taskWrapper) {
PrismObject<TaskType> task = taskWrapper.getObject();

// TODO resolve (MID-7221)
PrismProperty<TaskRecurrenceType> recurrenceType = task.findProperty(ItemPath.create(TaskType.F_RECURRENCE));
if (recurrenceType == null) {
return true;
}

TaskRecurrenceType recurenceValue = recurrenceType.getRealValue();
if (recurenceValue == null || TaskRecurrenceType.SINGLE == recurenceValue) {
return true;
}

ScheduleType schedule = task.asObjectable().getSchedule();
//if schedule is not set and task is recurring, show warning.
return schedule.getCronLikePattern() != null || schedule.getEarliestStartTime() != null
|| schedule.getInterval() != null || schedule.getLatestFinishTime() != null
|| schedule.getLatestStartTime() != null || schedule.getMisfireAction() != null;
}

private String createRefreshingLabel() {
if (isRefreshEnabled()) {
return createStringResource("autoRefreshPanel.refreshingEach", getRefreshInterval() / 1000).getString();
Expand Down
Expand Up @@ -300,10 +300,6 @@ private boolean satisfyArchetypeAssignment() {

private ItemMandatoryHandler getItemMandatoryHandler() {
return itemWrapper -> {
// TODO resolve (MID-7221)
if (TaskType.F_RECURRENCE.equivalent(itemWrapper.getPath())) {
return false;
}
return itemWrapper.isMandatory();
};
}
Expand Down

0 comments on commit 60f5718

Please sign in to comment.