Skip to content

Commit

Permalink
Fixed MID-3579: It is not possible to click on approval task after GU…
Browse files Browse the repository at this point in the history
…I operation is switched into background
  • Loading branch information
mederly committed Dec 6, 2016
1 parent e9343e6 commit 1b8cf79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Expand Up @@ -1391,6 +1391,10 @@ public String getBackgroundTaskOid() {
return oid != null ? String.valueOf(oid) : null;
}

public void setMinor(boolean value) {
this.minor = value;
}

// primitive implementation - uncomment it if needed
// public OperationResult clone() {
// return CloneUtil.clone(this);
Expand Down
Expand Up @@ -91,7 +91,10 @@ public <O extends ObjectType> HookOperationMode invoke(@NotNull ModelContext<O>
Validate.notNull(taskFromModel);
Validate.notNull(parentResult);

OperationResult result = parentResult.createMinorSubresult(OPERATION_INVOKE);
// Generally this cannot be minor as we need the "task switched to background" flag.
// But if the hook does nothing (returns FOREGROUND flag), we mark the result
// as minor afterwards.
OperationResult result = parentResult.createSubresult(OPERATION_INVOKE);
result.addParam("taskFromModel", taskFromModel.toString());
result.addContext("model state", context.getState());
try {
Expand All @@ -113,6 +116,9 @@ public <O extends ObjectType> HookOperationMode invoke(@NotNull ModelContext<O>

HookOperationMode retval = processModelInvocation(context, wfConfigurationType, taskFromModel, result);
result.computeStatus();
if (retval == HookOperationMode.FOREGROUND) {
result.setMinor(true);
}
return retval;
} catch (RuntimeException e) {
result.recordFatalError("Couldn't process model invocation in workflow module: " + e.getMessage(), e);
Expand Down

0 comments on commit 1b8cf79

Please sign in to comment.