Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2014-08-08 19:24:59 +0000
committerRoberto E. Escobar2014-08-28 23:59:50 +0000
commit3d6127c7a233c284d27a231c6bb65c7c50af9c72 (patch)
tree86145ca6d756215d60f89a9c49d823f0a48cb627
parent0b7acf61c02a6b5ff7cdd4b267547ed7bc152af5 (diff)
downloadorg.eclipse.osee-3d6127c7a233c284d27a231c6bb65c7c50af9c72.tar.gz
org.eclipse.osee-3d6127c7a233c284d27a231c6bb65c7c50af9c72.tar.xz
org.eclipse.osee-3d6127c7a233c284d27a231c6bb65c7c50af9c72.zip
feature[ats_ATS64164]: CPA: Fix null in new action creation
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateImpl.java8
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/AtsConfigObject.java4
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Conditions.java7
4 files changed, 18 insertions, 4 deletions
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java
index a370c50ca4..4ffd6f7c3c 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java
@@ -44,6 +44,7 @@ import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -541,6 +542,7 @@ public class StateManager implements IAtsStateManager {
@Override
public WorkState createStateData(String name, List<? extends IAtsUser> assignees) {
+ Conditions.checkNotNullOrContainNull(assignees, "assignees");
return new WorkStateImpl(name, assignees);
}
@@ -551,6 +553,7 @@ public class StateManager implements IAtsStateManager {
@Override
public WorkState createStateData(String name, List<? extends IAtsUser> assignees, double hoursSpent, int percentComplete) {
+ Conditions.checkNotNullOrContainNull(assignees, "assignees");
return new WorkStateImpl(name, assignees, hoursSpent, percentComplete);
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateImpl.java
index eb9266e922..0d3de12af2 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateImpl.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateImpl.java
@@ -14,6 +14,7 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.workflow.WorkState;
+import org.eclipse.osee.framework.jdk.core.util.Conditions;
/**
* @author Donald G. Dunne
@@ -71,9 +72,10 @@ public class WorkStateImpl implements WorkState {
}
@Override
- public void addAssignee(IAtsUser steve) {
- if (!assignees.contains(steve)) {
- assignees.add(steve);
+ public void addAssignee(IAtsUser user) {
+ Conditions.checkNotNull(user, "user");
+ if (!assignees.contains(user)) {
+ assignees.add(user);
}
}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/AtsConfigObject.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/AtsConfigObject.java
index 962de5fd4d..0544346627 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/AtsConfigObject.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/AtsConfigObject.java
@@ -109,7 +109,9 @@ public abstract class AtsConfigObject extends org.eclipse.osee.ats.core.model.im
Set<IAtsUser> results = new HashSet<IAtsUser>();
try {
for (ArtifactReadable userArt : artifact.getRelated(relation)) {
- IAtsUser lead = getAtsServer().getUserService().getUserById(userArt.getGuid());
+ IAtsUser lead =
+ getAtsServer().getUserService().getUserById(
+ (String) userArt.getSoleAttributeValue(CoreAttributeTypes.UserId));
results.add(lead);
}
} catch (OseeCoreException ex) {
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Conditions.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Conditions.java
index 0361a954b6..42860dd158 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Conditions.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Conditions.java
@@ -160,4 +160,11 @@ public final class Conditions {
checkNotNull(object, objectName);
}
}
+
+ public static void checkNotNullOrContainNull(Collection<? extends Object> collection, String objectName) throws OseeCoreException {
+ checkNotNull(collection, objectName);
+ for (Object object : collection) {
+ checkNotNull(object, objectName);
+ }
+ }
}

Back to the top