Skip to content

Commit

Permalink
manual merging for preview changes page
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Aug 23, 2018
1 parent 99175cf commit f001bcc
Showing 1 changed file with 15 additions and 9 deletions.
Expand Up @@ -462,10 +462,8 @@ public void saveOrPreviewPerformed(AjaxRequestTarget target, OperationResult res

Task task = createSimpleTask(OPERATION_SEND_TO_SUBMIT);

ModelExecuteOptions options = getExecuteChangesOptions();
if (previewOnly) {
options.getOrCreatePartialProcessing().setApprovals(PartialProcessingTypeType.PROCESS);
}
ModelExecuteOptions options = getOptions(previewOnly);

LOGGER.debug("Using execute options {}.", options);

try {
Expand Down Expand Up @@ -556,17 +554,21 @@ public void saveOrPreviewPerformed(AjaxRequestTarget target, OperationResult res
return;
}
progressPanel.executeChanges(deltas, previewOnly, options, task, result, target);
} else if (previewOnly && delta.isEmpty() && delegationChangesExist){
progressPanel.executeChanges(deltas, previewOnly, options, task, result, target);
} else {
progressPanel.clearProgressPanel(); // from previous attempts (useful only if we would call finishProcessing at the end, but that's not the case now)
if (!previewOnly) {
if (!isAnythingChanged) {
if (!delegationChangesExist) {
result.recordWarning(getString("PageAdminObjectDetails.noChangesSave"));
showResult(result);
}
redirectBack();
} else {
warn(getString("PageAdminObjectDetails.noChangesPreview"));
target.add(getFeedbackPanel());
if (!delegationChangesExist) {
warn(getString("PageAdminObjectDetails.noChangesPreview"));
target.add(getFeedbackPanel());
}
}
}

Expand Down Expand Up @@ -622,8 +624,12 @@ public void startProcessing(AjaxRequestTarget target, OperationResult result) {
}

@NotNull
protected ModelExecuteOptions getEisaxecuteChangesOptions() {
return mainPanel.getExecuteChangeOptionsDto().createOptions();
protected ModelExecuteOptions getOptions(boolean previewOnly) {
ModelExecuteOptions options = mainPanel.getExecuteChangeOptionsDto().createOptions();
if (previewOnly) {
options.getOrCreatePartialProcessing().setApprovals(PartialProcessingTypeType.PROCESS);
}
return options;
}

protected void prepareObjectForAdd(PrismObject<O> object) throws SchemaException {
Expand Down

0 comments on commit f001bcc

Please sign in to comment.