Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/plugin-support
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Sep 12, 2019
2 parents 6817acc + bfc765f commit c0aef03
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Expand Up @@ -100,7 +100,7 @@ public void onClick(AjaxRequestTarget ajaxRequestTarget) {
actionButtonsContainer.add(workItemRejectButton);

AjaxButton workItemDelegateButton = new AjaxButton(ID_WORK_ITEM_DELEGATE_BUTTON,
createStringResource("pageWorkItem.button.delegate")) {
createStringResource("pageWorkItem.button.forward")) {
private static final long serialVersionUID = 1L;

@Override
Expand Down Expand Up @@ -161,7 +161,7 @@ private void delegateConfirmedPerformed(AjaxRequestTarget target, UserType deleg
List<ObjectReferenceType> delegates = Collections.singletonList(ObjectTypeUtil.createObjectRef(delegate, getPrismContext()));
try {
WebComponentUtil.assumePowerOfAttorneyIfRequested(result, getPowerDonor(), getPageBase());
getPageBase().getWorkflowService().delegateWorkItem(WorkItemId.of(getModelObject()), delegates, WorkItemDelegationMethodType.ADD_ASSIGNEES,
getPageBase().getWorkflowService().delegateWorkItem(WorkItemId.of(getModelObject()), delegates, WorkItemDelegationMethodType.REPLACE_ASSIGNEES,
task, result);
} finally {
WebComponentUtil.dropPowerOfAttorneyIfRequested(result, getPowerDonor(), getPageBase());
Expand Down
Expand Up @@ -17,6 +17,7 @@
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.wf.util.ApprovalUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.collections.CollectionUtils;

import java.io.Serializable;
import java.util.ArrayList;
Expand Down Expand Up @@ -115,7 +116,13 @@ private static void addInformationFromRecordedStage(ApprovalStageExecutionInform
for (CaseEventType event : executionRecord.getEvent()) {
if (event instanceof WorkItemEventType) {
WorkItemEventType workItemEvent = (WorkItemEventType) event;
ObjectReferenceType approver = workItemEvent.getOriginalAssigneeRef();
ObjectReferenceType approver;
if (event instanceof WorkItemDelegationEventType){
List<ObjectReferenceType> delegateToList = ((WorkItemDelegationEventType)event).getDelegatedTo();
approver = CollectionUtils.isNotEmpty(delegateToList) ? delegateToList.get(0) : null;
} else {
approver = workItemEvent.getOriginalAssigneeRef();
}
if (approver == null) {
LOGGER.warn("No original assignee in work item event {} -- ignoring it", workItemEvent);
continue;
Expand Down Expand Up @@ -152,7 +159,8 @@ private static void addInformationFromRecordedStage(ApprovalStageExecutionInform
if (workItem.getStageNumber() == null || workItem.getStageNumber() != currentStageNumber){
continue;
}
ObjectReferenceType approver = workItem.getOriginalAssigneeRef();
ObjectReferenceType approver = CollectionUtils.isNotEmpty(workItem.getAssigneeRef()) ?
workItem.getAssigneeRef().get(0) : workItem.getOriginalAssigneeRef();
if (approver == null) {
LOGGER.warn("No original assignee in work item {} -- ignoring it", workItem);
continue;
Expand Down

0 comments on commit c0aef03

Please sign in to comment.