Skip to content

Commit

Permalink
Fixed MID-3170: Workflow notification shows work item has been comple…
Browse files Browse the repository at this point in the history
…ted, but nothing about being approved or rejected
  • Loading branch information
mederly committed Jun 16, 2016
1 parent f25a802 commit 8bd86fe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
Expand Up @@ -20,6 +20,7 @@
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.LightweightIdentifierGenerator;
import com.evolveum.midpoint.xml.ns._public.common.common_3.DecisionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.EventCategoryType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemType;
Expand Down Expand Up @@ -72,7 +73,16 @@ public void createExpressionVariables(Map<QName, Object> variables, OperationRes
variables.put(SchemaConstants.C_WORK_ITEM, workItem);
}

@Override
@Override
protected String getAnswer() {
DecisionType decision = workItem.getDecision();
if (decision == null) {
return null;
}
return decision.getResultAsString();
}

@Override
public String toString() {
return "WorkflowProcessEvent{" +
"workflowEvent=" + super.toString() +
Expand Down
Expand Up @@ -29,7 +29,7 @@
*/
abstract public class WorkflowEvent extends BaseEvent {

private final WfContextType workflowContext;
protected final WfContextType workflowContext;
private final ChangeType changeType; // ADD = process/task start, DELETE = process/task finish (for now)

public WorkflowEvent(LightweightIdentifierGenerator lightweightIdentifierGenerator, ChangeType changeType, WfContextType workflowContext) {
Expand All @@ -46,10 +46,12 @@ public String getProcessInstanceName() {
}

public OperationStatus getOperationStatus() {
return resultToStatus(changeType, workflowContext.getAnswer());
return resultToStatus(changeType, getAnswer());
}

@Override
protected abstract String getAnswer();

@Override
public boolean isStatusType(EventStatusType eventStatusType) {
return getOperationStatus().matchesEventStatusType(eventStatusType);
}
Expand Down Expand Up @@ -133,7 +135,7 @@ public String toString() {
"event=" + super.toString() +
", processInstanceName='" + getProcessInstanceName() + '\'' +
", changeType=" + changeType +
", answer=" + workflowContext.getAnswer() +
", answer=" + getAnswer() +
'}';
}

Expand Down
Expand Up @@ -35,7 +35,12 @@ public boolean isCategoryType(EventCategoryType eventCategoryType) {
return eventCategoryType == EventCategoryType.WORKFLOW_PROCESS_EVENT || eventCategoryType == EventCategoryType.WORKFLOW_EVENT;
}

@Override
@Override
protected String getAnswer() {
return workflowContext.getAnswer();
}

@Override
public String toString() {
return "WorkflowProcessEvent{" +
"workflowEvent=" + super.toString() +
Expand Down

0 comments on commit 8bd86fe

Please sign in to comment.