Skip to content

Commit

Permalink
MID-7844 improving work with correlation cases (better redirects afte…
Browse files Browse the repository at this point in the history
…r resolving, better messages)
  • Loading branch information
1azyman committed Apr 7, 2022
1 parent 8eb0ca1 commit e918445
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

package com.evolveum.midpoint.gui.impl.page.admin.cases.component;

import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.model.api.CorrelationProperty;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
Expand Down Expand Up @@ -64,6 +66,7 @@ public class CorrelationContextPanel extends AbstractObjectMainPanel<CaseType, C
private static final String ID_COLUMN = "column";

private static final String OP_LOAD = CorrelationContextPanel.class.getName() + ".load";
private static final String OP_DECIDE_CORRELATION = CorrelationContextPanel.class.getName() + ".decideCorrelation";

// Move into properties
private static final String TEXT_CREATE_NEW = "Create new";
Expand Down Expand Up @@ -114,16 +117,23 @@ public void onClick(AjaxRequestTarget target) {
.outcome(item.getModelObject().getIdentifier())
.comment(workItem.getOutput() != null ? workItem.getOutput().getComment() : null);

Task task = getPageBase().createSimpleTask("DecideCorrelation");
PageBase page = getPageBase();
Task task = page.createSimpleTask(OP_DECIDE_CORRELATION);
OperationResult result = task.getResult();
try {
getPageBase().getCaseService().completeWorkItem(workItemId, output, task, result);
page.getCaseService().completeWorkItem(workItemId, output, task, result);
result.computeStatusIfUnknown();
} catch (Throwable e) {
result.recordFatalError("Cannot finish correlation process, " + e.getMessage(), e);
}
getPageBase().showResult(result);
target.add(getPageBase().getFeedbackPanel());

page.showResult(result);

if (!WebComponentUtil.isSuccessOrHandledError(result)) {
target.add(page.getFeedbackPanel());
} else {
page.redirectBack();
}
}
};

Expand Down

0 comments on commit e918445

Please sign in to comment.