Skip to content

Commit

Permalink
Fixed null values in legacy approval aspects.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Nov 17, 2016
1 parent 85a42a8 commit 15215a7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
Expand Up @@ -45,6 +45,7 @@
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -80,11 +81,11 @@ public abstract class AddAssignmentAspect<T extends ObjectType, F extends FocusT
@Override
public List<PcpChildWfTaskCreationInstruction> prepareTasks(@NotNull ModelContext<?> modelContext, PrimaryChangeProcessorConfigurationType wfConfigurationType, @NotNull ObjectTreeDeltas objectTreeDeltas, @NotNull Task taskFromModel, @NotNull OperationResult result) throws SchemaException {
if (!isFocusRelevant(modelContext) || objectTreeDeltas.getFocusChange() == null) {
return null;
return Collections.emptyList();
}
List<ApprovalRequest<AssignmentType>> approvalRequestList = getApprovalRequests(modelContext, wfConfigurationType, objectTreeDeltas.getFocusChange(), result);
if (approvalRequestList == null || approvalRequestList.isEmpty()) {
return null;
return Collections.emptyList();
}
return prepareTaskInstructions(modelContext, taskFromModel, result, approvalRequestList);
}
Expand Down
Expand Up @@ -79,11 +79,11 @@ public abstract class ModifyAssignmentAspect<T extends ObjectType, F extends Foc
@Override
public List<PcpChildWfTaskCreationInstruction> prepareTasks(@NotNull ModelContext<?> modelContext, PrimaryChangeProcessorConfigurationType wfConfigurationType, @NotNull ObjectTreeDeltas objectTreeDeltas, @NotNull Task taskFromModel, @NotNull OperationResult result) throws SchemaException {
if (!isFocusRelevant(modelContext) || objectTreeDeltas.getFocusChange() == null) {
return null;
return Collections.emptyList();
}
List<ApprovalRequest<AssignmentModification>> approvalRequestList = getApprovalRequests(modelContext, wfConfigurationType, objectTreeDeltas.getFocusChange(), result);
if (approvalRequestList == null || approvalRequestList.isEmpty()) {
return null;
return Collections.emptyList();
}
return prepareJobCreateInstructions(modelContext, taskFromModel, result, approvalRequestList);
}
Expand Down
Expand Up @@ -84,12 +84,12 @@ public class AddAssociationAspect extends BasePrimaryChangeAspect {
@Override
public List<PcpChildWfTaskCreationInstruction> prepareTasks(@NotNull ModelContext<?> modelContext, PrimaryChangeProcessorConfigurationType wfConfigurationType, @NotNull ObjectTreeDeltas objectTreeDeltas, @NotNull Task taskFromModel, @NotNull OperationResult result) throws SchemaException, ObjectNotFoundException {
if (!isFocusRelevant(modelContext)) {
return null;
return Collections.emptyList();
}
List<ApprovalRequest<AssociationAdditionType>> approvalRequestList =
getApprovalRequests(modelContext, wfConfigurationType, objectTreeDeltas, taskFromModel, result);
if (approvalRequestList == null || approvalRequestList.isEmpty()) {
return null;
return Collections.emptyList();
}
return prepareJobCreateInstructions(modelContext, taskFromModel, result, approvalRequestList);
}
Expand Down
Expand Up @@ -41,6 +41,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
Expand All @@ -65,14 +66,14 @@ public List<PcpChildWfTaskCreationInstruction> prepareTasks(@NotNull ModelContex
@NotNull Task taskFromModel, @NotNull OperationResult result) throws SchemaException {
PcpAspectConfigurationType config = primaryChangeAspectHelper.getPcpAspectConfigurationType(wfConfigurationType, this);
if (config == null) {
return null; // this should not occur (because this aspect is not enabled by default), but check it just to be sure
return Collections.emptyList(); // this should not occur (because this aspect is not enabled by default), but check it just to be sure
}
if (!primaryChangeAspectHelper.isRelatedToType(modelContext, getObjectClass()) || objectTreeDeltas.getFocusChange() == null) {
return null;
return Collections.emptyList();
}
List<ApprovalRequest<T>> approvalRequestList = getApprovalRequests(modelContext, config, objectTreeDeltas.getFocusChange(), result);
if (approvalRequestList == null || approvalRequestList.isEmpty()) {
return null;
return Collections.emptyList();
}
return prepareJobCreateInstructions(modelContext, taskFromModel, result, approvalRequestList);
}
Expand Down
Expand Up @@ -42,6 +42,7 @@
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -78,7 +79,7 @@ public List<PcpChildWfTaskCreationInstruction> prepareTasks(@NotNull ModelContex
ObjectDelta changeRequested = objectTreeDeltas.getFocusChange();

if (changeRequested == null || changeRequested.getChangeType() != ChangeType.MODIFY) {
return null;
return Collections.emptyList();
}

Iterator<? extends ItemDelta> deltaIterator = changeRequested.getModifications().iterator();
Expand Down

0 comments on commit 15215a7

Please sign in to comment.