summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2011-06-07 15:03:51 (EDT)
committer Ryan D. Brooks2011-06-07 15:03:51 (EDT)
commitf5477b2170393f191c27f325f1c248b839d4be31 (patch)
tree156987d80645a5ba980b6280e4560c68c0bed13c
parent61390ccbe15bcde4d4007aebdb93ac37ec44a2a7 (diff)
downloadorg.eclipse.osee-f5477b2170393f191c27f325f1c248b839d4be31.zip
org.eclipse.osee-f5477b2170393f191c27f325f1c248b839d4be31.tar.gz
org.eclipse.osee-f5477b2170393f191c27f325f1c248b839d4be31.tar.bz2
refactor: Artifact.getNames() quality refactor
-rw-r--r--plugins/org.eclipse.osee.ats.config.demo.test/src/org/eclipse/osee/ats/config/demo/PopulateDemoActionsTest.java8
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/TeamWorkflowSearchWorkflowSearchItem.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewSearchWorkflowSearchItem.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewWorldSearchItem.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GoalSearchItem.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TeamWorldSearchItem.java2
-rw-r--r--plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/jobs/ImportTraceUnitsOperationTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DirtyArtifactCacheTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/Artifacts.java7
13 files changed, 22 insertions, 18 deletions
diff --git a/plugins/org.eclipse.osee.ats.config.demo.test/src/org/eclipse/osee/ats/config/demo/PopulateDemoActionsTest.java b/plugins/org.eclipse.osee.ats.config.demo.test/src/org/eclipse/osee/ats/config/demo/PopulateDemoActionsTest.java
index e9bb839..f3762ed 100644
--- a/plugins/org.eclipse.osee.ats.config.demo.test/src/org/eclipse/osee/ats/config/demo/PopulateDemoActionsTest.java
+++ b/plugins/org.eclipse.osee.ats.config.demo.test/src/org/eclipse/osee/ats/config/demo/PopulateDemoActionsTest.java
@@ -29,6 +29,7 @@ import org.eclipse.osee.ats.util.DemoTestUtil;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
import org.eclipse.osee.support.test.util.DemoArtifactTypes;
import org.eclipse.osee.support.test.util.DemoSawBuilds;
import org.eclipse.osee.support.test.util.DemoTeam;
@@ -103,7 +104,7 @@ public class PopulateDemoActionsTest {
Assert.assertNotNull(rev1);
Assert.assertNotNull(rev2);
testReviewContents(rev1, "Peer Review algorithm used in code", PeerToPeerReviewState.Review.getPageName(),
- "Joe Smith; Kay Jones");
+ new String[] {"Joe Smith", "Kay Jones"});
testReviewContents(rev2, "Peer Review first set of code changes", PeerToPeerReviewState.Prepare.getPageName(),
"Joe Smith");
@@ -450,11 +451,12 @@ public class PopulateDemoActionsTest {
}
- private static void testReviewContents(AbstractReviewArtifact revArt, String title, String currentStateName, String assigneeStr) throws OseeCoreException {
+ private static void testReviewContents(AbstractReviewArtifact revArt, String title, String currentStateName, String... assigneeStrs) throws OseeCoreException {
Assert.assertEquals(title, revArt.getName());
Assert.assertEquals(currentStateName, revArt.getCurrentStateName());
- Assert.assertEquals(assigneeStr, revArt.getStateMgr().getAssigneesStr());
+
Collection<String> assigneeNames = Artifacts.getNames(revArt.getStateMgr().getAssignees());
+
Assert.assertEquals(assigneeNames.size(), assigneeStrs.length);
for (String assignee : assigneeStrs) {
if (!assigneeNames.contains(assignee)) {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/TeamWorkflowSearchWorkflowSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/TeamWorkflowSearchWorkflowSearchItem.java
index d730f73..f1f657f 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/TeamWorkflowSearchWorkflowSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/TeamWorkflowSearchWorkflowSearchItem.java
@@ -213,7 +213,7 @@ public class TeamWorkflowSearchWorkflowSearchItem extends WorldEditorParameterSe
versionCombo.setDataStrings(new String[] {});
return;
}
- Collection<String> names = Artifacts.artNames(teamDefHoldingVersions.getVersionsArtifacts());
+ Collection<String> names = Artifacts.getNames(teamDefHoldingVersions.getVersionsArtifacts());
if (names.isEmpty()) {
versionCombo.setDataStrings(new String[] {});
return;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java
index ef1bab3..c301038 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java
@@ -248,7 +248,7 @@ public class UserSearchWorkflowSearchItem extends WorldEditorParameterSearchItem
return;
}
Collection<String> names =
- Artifacts.artNames(teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both,
+ Artifacts.getNames(teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both,
VersionLockedType.Both));
if (names.isEmpty()) {
versionCombo.setDataStrings(new String[] {});
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewSearchWorkflowSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewSearchWorkflowSearchItem.java
index 5ccfd37..3d5adfa 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewSearchWorkflowSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewSearchWorkflowSearchItem.java
@@ -198,7 +198,7 @@ public class ReviewSearchWorkflowSearchItem extends WorldEditorParameterSearchIt
versionCombo.setDataStrings(new String[] {});
return;
}
- Collection<String> names = Artifacts.artNames(versions);
+ Collection<String> names = Artifacts.getNames(versions);
if (names.isEmpty()) {
versionCombo.setDataStrings(new String[] {});
return;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewWorldSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewWorldSearchItem.java
index bc50672..4a6981b 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewWorldSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/review/ReviewWorldSearchItem.java
@@ -106,7 +106,7 @@ public class ReviewWorldSearchItem extends WorldUISearchItem {
if (aiNames != null) {
return aiNames;
} else if (aias != null) {
- return Artifacts.artNames(aias);
+ return Artifacts.getNames(aias);
}
return new ArrayList<String>();
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java
index 2c4629e..813bd2c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java
@@ -80,9 +80,9 @@ public class ActionableItemWorldSearchItem extends WorldUISearchItem {
if (actionItemNames != null) {
return actionItemNames;
} else if (actionItems != null) {
- return Artifacts.artNames(actionItems);
+ return Artifacts.getNames(actionItems);
} else if (selectedActionItems != null) {
- return Artifacts.artNames(selectedActionItems);
+ return Artifacts.getNames(selectedActionItems);
}
return new ArrayList<String>();
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GoalSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GoalSearchItem.java
index f05cfd0..1d7e7a2 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GoalSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GoalSearchItem.java
@@ -70,7 +70,7 @@ public class GoalSearchItem extends WorldUISearchItem {
if (teamDefNames != null && teamDefNames.size() > 0) {
return String.valueOf(teamDefNames);
} else if (teamDefs != null && teamDefs.size() > 0) {
- return String.valueOf(Artifacts.artNames(teamDefs));
+ return String.valueOf(Artifacts.getNames(teamDefs));
}
return "";
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java
index 3859d6f..ff255de 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java
@@ -324,7 +324,7 @@ public class TaskSearchWorldSearchItem extends TaskEditorParameterSearchItem {
return;
}
Collection<String> names =
- Artifacts.artNames(teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both,
+ Artifacts.getNames(teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both,
VersionLockedType.Both));
if (names.isEmpty()) {
versionCombo.setDataStrings(new String[] {});
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TeamWorldSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TeamWorldSearchItem.java
index f3be96b..54dce77 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TeamWorldSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TeamWorldSearchItem.java
@@ -115,7 +115,7 @@ public class TeamWorldSearchItem extends WorldUISearchItem {
if (teamDefNames != null) {
return teamDefNames;
} else if (teamDefs != null) {
- return Artifacts.artNames(teamDefs);
+ return Artifacts.getNames(teamDefs);
}
return new ArrayList<String>();
}
diff --git a/plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/jobs/ImportTraceUnitsOperationTest.java b/plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/jobs/ImportTraceUnitsOperationTest.java
index a06b6f1..e48507f 100644
--- a/plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/jobs/ImportTraceUnitsOperationTest.java
+++ b/plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/jobs/ImportTraceUnitsOperationTest.java
@@ -111,7 +111,7 @@ public final class ImportTraceUnitsOperationTest {
List<Artifact> reqArtifacts = artifact.getRelatedArtifacts(CoreRelationTypes.CodeRequirement_Requirement);
Assert.assertEquals(5, reqArtifacts.size());
- Collection<String> actual = Artifacts.artNames(reqArtifacts);
+ Collection<String> actual = Artifacts.getNames(reqArtifacts);
List<String> expected =
Arrays.asList("Robot Object", "Haptic Constraints", "Robot Interfaces", "Individual robot events",
"Collaborative Robot");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DirtyArtifactCacheTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DirtyArtifactCacheTest.java
index 55b6ad4..e09976e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DirtyArtifactCacheTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DirtyArtifactCacheTest.java
@@ -19,6 +19,6 @@ public class DirtyArtifactCacheTest {
public void testArtifactCacheNotDirty() {
Assert.assertTrue(String.format(
"After all tests are run, there should be no dirty artifacts in Artifact Cache; Found [%s]",
- Artifacts.artNames(ArtifactCache.getDirtyArtifacts())), ArtifactCache.getDirtyArtifacts().isEmpty());
+ Artifacts.getNames(ArtifactCache.getDirtyArtifacts())), ArtifactCache.getDirtyArtifacts().isEmpty());
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java
index 1ec0064..8f4e122 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java
@@ -18,6 +18,7 @@ import java.util.Arrays;
import java.util.logging.Level;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
@@ -103,7 +104,7 @@ public abstract class Attribute<T> implements Comparable<Attribute<T>> {
}
public boolean setFromString(String value) throws OseeCoreException {
- if (attributeType.getName().equals("Name") && !value.equals(getValue())) {
+ if (attributeType.equals(CoreAttributeTypes.Name) && !value.equals(getValue())) {
// Confirm artifact is fit to rename
for (IArtifactCheck check : ArtifactChecks.getArtifactChecks()) {
IStatus result = check.isRenamable(Arrays.asList(getArtifact()));
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/Artifacts.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/Artifacts.java
index 521d3fb..201a956 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/Artifacts.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/Artifacts.java
@@ -21,6 +21,7 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.Named;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
@@ -101,10 +102,10 @@ public final class Artifacts {
return "";
}
- public static Collection<String> artNames(Collection<? extends Artifact> arts) {
+ public static Collection<String> getNames(Collection<? extends Named> artifacts) {
ArrayList<String> names = new ArrayList<String>();
- for (Artifact art : arts) {
- names.add(art.getName());
+ for (Named namedArtifact : artifacts) {
+ names.add(namedArtifact.getName());
}
return names;
}