Skip to content

Commit

Permalink
Fix open approval process display
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jun 26, 2019
1 parent a8a4232 commit ddbdb42
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
Expand Up @@ -72,7 +72,7 @@ static ApprovalStageExecutionInformationDto createFrom(ApprovalSchemaExecutionIn
int stageNumber = stageIndex+1;
int currentStageNumber = defaultIfNull(processInfo.getCurrentStageNumber(), 0);
if (stageNumber <= currentStageNumber) {
addInformationFromRecordedStage(rv, stageInfo.getExecutionRecord(), resolver, session, opTask, result);
addInformationFromRecordedStage(rv, processInfo, stageInfo.getExecutionRecord(), resolver, session, opTask, result);
} else {
addInformationFromPreviewedStage(rv, stageInfo.getExecutionPreview(), resolver, session, opTask, result);
}
Expand Down Expand Up @@ -118,6 +118,7 @@ private static void resolve(ObjectReferenceType ref, ObjectResolver resolver, Ob
}

private static void addInformationFromRecordedStage(ApprovalStageExecutionInformationDto rv,
ApprovalSchemaExecutionInformationType processInfo,
ApprovalStageExecutionRecordType executionRecord, ObjectResolver resolver,
ObjectResolver.Session session, Task opTask, OperationResult result) {
for (CaseEventType event : executionRecord.getEvent()) {
Expand All @@ -128,11 +129,11 @@ private static void addInformationFromRecordedStage(ApprovalStageExecutionInform
LOGGER.warn("No original assignee in work item event {} -- ignoring it", workItemEvent);
continue;
}
WorkItemId externalWorkItemId = WorkItemId.create(workItemEvent.getExternalWorkItemId());
if (externalWorkItemId == null) {
if (workItemEvent.getExternalWorkItemId() == null) {
LOGGER.warn("No external work item ID in work item event {} -- ignoring it", workItemEvent);
continue;
}
WorkItemId externalWorkItemId = WorkItemId.create(workItemEvent.getExternalWorkItemId());
ApproverEngagementDto engagement = rv.findApproverEngagement(approver, externalWorkItemId);
if (engagement == null) {
resolve(approver, resolver, session, opTask, result);
Expand All @@ -156,24 +157,20 @@ private static void addInformationFromRecordedStage(ApprovalStageExecutionInform
}
}
// not needed after "create work item" events will be implemented
// for (CaseWorkItemType workItem : executionRecord.getWorkItem()) {
// ObjectReferenceType approver = workItem.getOriginalAssigneeRef();
// if (approver == null) {
// LOGGER.warn("No original assignee in work item {} -- ignoring it", workItem);
// continue;
// }
// WorkItemId externalWorkItemId = WorkItemId.of(workItem); // fixme work item has no parent here!!!
// if (externalWorkItemId == null) {
// LOGGER.warn("No external work item ID in work item {} -- ignoring it", workItem);
// continue;
// }
// ApproverEngagementDto engagement = rv.findApproverEngagement(approver, externalWorkItemId);
// if (engagement == null) {
// resolve(approver, resolver, session, opTask, result);
// engagement = new ApproverEngagementDto(approver, externalWorkItemId);
// rv.addApproverEngagement(engagement);
// }
// }
for (CaseWorkItemType workItem : executionRecord.getWorkItem()) {
ObjectReferenceType approver = workItem.getOriginalAssigneeRef();
if (approver == null) {
LOGGER.warn("No original assignee in work item {} -- ignoring it", workItem);
continue;
}
WorkItemId externalWorkItemId = WorkItemId.create(processInfo.getCaseRef().getOid(), workItem.getId());
ApproverEngagementDto engagement = rv.findApproverEngagement(approver, externalWorkItemId);
if (engagement == null) {
resolve(approver, resolver, session, opTask, result);
engagement = new ApproverEngagementDto(approver, externalWorkItemId);
rv.addApproverEngagement(engagement);
}
}
}

private void addApproverEngagement(ApproverEngagementDto engagement) {
Expand Down
Expand Up @@ -58,7 +58,6 @@ public class ApprovalSchemaExecutionInformationHelper {

@Autowired private ModelService modelService;
@Autowired private PrismContext prismContext;
@Autowired private SchemaHelper schemaHelper;
@Autowired private StageComputeHelper computeHelper;
@Autowired private PrimaryChangeProcessor primaryChangeProcessor;
@Autowired private ConfigurationHelper configurationHelper;
Expand All @@ -70,9 +69,7 @@ ApprovalSchemaExecutionInformationType getApprovalSchemaExecutionInformation(Str
OperationResult result)
throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException,
ConfigurationException, ExpressionEvaluationException {
Collection<SelectorOptions<GetOperationOptions>> options = schemaHelper.getOperationOptionsBuilder()
.build();
CaseType aCase = modelService.getObject(CaseType.class, caseOid, options, opTask, result).asObjectable();
CaseType aCase = modelService.getObject(CaseType.class, caseOid, null, opTask, result).asObjectable();
return getApprovalSchemaExecutionInformation(aCase, false, opTask, result);
}

Expand Down

0 comments on commit ddbdb42

Please sign in to comment.