Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2012-08-17 17:17:59 +0000
committerdonald.g.dunne2012-08-17 18:47:06 +0000
commite9458542fbfc876a4fc75f9bc22230be4c202e33 (patch)
tree750acccda451bd214115a0d8bfeb80afd3706265
parent8ceacd168a64f1f7e99eb9d994870689e71c1fc5 (diff)
downloadorg.eclipse.osee-e9458542fbfc876a4fc75f9bc22230be4c202e33.tar.gz
org.eclipse.osee-e9458542fbfc876a4fc75f9bc22230be4c202e33.tar.xz
org.eclipse.osee-e9458542fbfc876a4fc75f9bc22230be4c202e33.zip
bug: Fix error handling and message when duplicate states exist
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/StateManager.java5
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkStateFactory.java5
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/WorkStateFactory.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateProviderImpl.java10
4 files changed, 20 insertions, 2 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/StateManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/StateManager.java
index 10d58c1039..6080dc5804 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/StateManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/StateManager.java
@@ -677,4 +677,9 @@ public class StateManager implements IAtsNotificationListener, WorkStateProvider
return getStateProvider().isSame(workState);
}
+ @Override
+ public String getId() {
+ return awa.getHumanReadableId();
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkStateFactory.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkStateFactory.java
index 228dc47a8e..9b189929ff 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkStateFactory.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkStateFactory.java
@@ -31,4 +31,9 @@ public class MockWorkStateFactory implements WorkStateFactory {
return new WorkStateImpl(name, assignees, hoursSpent, percentComplete);
}
+ @Override
+ public String getId() {
+ return "Mock ID";
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/WorkStateFactory.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/WorkStateFactory.java
index f94e4780d9..b98f0ec726 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/WorkStateFactory.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/WorkStateFactory.java
@@ -20,4 +20,6 @@ public interface WorkStateFactory {
WorkState createStateData(String name, List<? extends IAtsUser> assignees, double hoursSpent, int percentComplete);
+ String getId();
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateProviderImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateProviderImpl.java
index ccac6d3a11..4f8a70df3e 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateProviderImpl.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/impl/WorkStateProviderImpl.java
@@ -17,9 +17,11 @@ import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
+import java.util.logging.Level;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.workflow.WorkState;
import org.eclipse.osee.ats.api.workflow.WorkStateProvider;
+import org.eclipse.osee.ats.core.internal.Activator;
import org.eclipse.osee.ats.core.model.WorkStateFactory;
import org.eclipse.osee.ats.core.notify.IAtsNotificationListener;
import org.eclipse.osee.ats.core.users.AtsUsers;
@@ -27,6 +29,7 @@ import org.eclipse.osee.ats.core.util.AtsObjects;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.logging.OseeLog;
/**
* @author Donald G. Dunne
@@ -218,9 +221,12 @@ public class WorkStateProviderImpl implements WorkStateProvider {
@Override
public void addState(String name, List<? extends IAtsUser> assignees, double hoursSpent, int percentComplete) throws OseeArgumentException {
if (getVisitedStateNames().contains(name)) {
- throw new OseeArgumentException("State [%s] already exists", name);
+ String errorStr = String.format("Error: Duplicate state [%s] for [%s]", name, factory.getId());
+ OseeLog.log(Activator.class, Level.SEVERE, errorStr);
+ return;
+ } else {
+ addState(factory.createStateData(name, assignees, hoursSpent, percentComplete));
}
- addState(factory.createStateData(name, assignees, hoursSpent, percentComplete));
}
@Override

Back to the top