diff options
author | Morgan E. Cook | 2015-11-05 21:44:32 +0000 |
---|---|---|
committer | donald.g.dunne | 2015-12-04 21:28:30 +0000 |
commit | f4c5d449969bb1cca005a4f3e0d3d5441bba3f48 (patch) | |
tree | 63a3616801eefa0f263e2f8254d17c6d06b9cf2c /plugins | |
parent | b46d57a4fa94cf254efbec4dc211661e5d0517b4 (diff) | |
download | org.eclipse.osee-f4c5d449969bb1cca005a4f3e0d3d5441bba3f48.tar.gz org.eclipse.osee-f4c5d449969bb1cca005a4f3e0d3d5441bba3f48.tar.xz org.eclipse.osee-f4c5d449969bb1cca005a4f3e0d3d5441bba3f48.zip |
bug: Fix multiple artifact type search
Change-Id: I850e8591a6cadf09828cb09bf3d237185d456ce3
Signed-off-by: Morgan E. Cook <Morgan.e.cook@boeing.com>
Signed-off-by: donald.g.dunne <donald.g.dunne@boeing.com>
Diffstat (limited to 'plugins')
2 files changed, 31 insertions, 13 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java index a373aa5bf2b..497f88bcdd7 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.artifact.search; +import java.util.ArrayList; +import java.util.List; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.TokenFactory; @@ -17,31 +19,43 @@ import org.eclipse.osee.framework.core.data.TokenFactory; * @author Robert A. Fisher */ public class ArtifactTypeSearch implements ISearchPrimitive { - private final IArtifactType artifactType; + private final List<IArtifactType> artifactTypes; - public ArtifactTypeSearch(IArtifactType type) { + public ArtifactTypeSearch(List<IArtifactType> artifactTypes) { super(); - this.artifactType = type; + this.artifactTypes = artifactTypes; } @Override public String toString() { - return "Artifact type: " + artifactType; + return "Artifact type: " + artifactTypes.toString(); } @Override public String getStorageString() { - return artifactType.getGuid().toString(); + StringBuilder storageString = new StringBuilder(); + + for (IArtifactType a : artifactTypes) { + storageString.append(a.getGuid().toString()); + storageString.append(","); + } + storageString.deleteCharAt(storageString.length() - 1); + return storageString.toString(); } public static ArtifactTypeSearch getPrimitive(String storageString) { - IArtifactType type = TokenFactory.createArtifactType(Long.parseLong(storageString), "SearchArtType"); - return new ArtifactTypeSearch(type); + ArrayList<IArtifactType> artifactTypes = new ArrayList<>(); + + for (String artifactTypeId : storageString.split(",")) { + artifactTypes.add(TokenFactory.createArtifactType(Long.parseLong(artifactTypeId), "SearchArtType")); + } + + return new ArtifactTypeSearch(artifactTypes); } @Override public void addToQuery(QueryBuilderArtifact builder) { - builder.andIsOfType(artifactType); + builder.andIsOfType(artifactTypes); } } diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java index e59cbb1f1dd..fd2481c44f4 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java @@ -11,7 +11,11 @@ package org.eclipse.osee.framework.ui.skynet.search; import org.eclipse.jface.viewers.ListViewer; +import java.util.List; +import java.util.Collection; +import java.util.List; import org.eclipse.osee.framework.core.data.IArtifactType; +import org.eclipse.osee.framework.jdk.core.util.Collections; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactTypeSearch; import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive; import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer; @@ -30,11 +34,11 @@ public class ArtifactTypeFilter extends SearchFilter { @Override public void addFilterTo(FilterTableViewer filterViewer) { - for (String type : searchTypeList.getList().getSelection()) { - IArtifactType artType = (IArtifactType) searchTypeList.getData(type); - ISearchPrimitive primitive = new ArtifactTypeSearch(artType); - filterViewer.addItem(primitive, getFilterName(), type, ""); - } + List<?> artifactTypesObj = searchTypeList.getStructuredSelection().toList(); + List<IArtifactType> artifactTypes = Collections.castAll(artifactTypesObj); + + ISearchPrimitive primitive = new ArtifactTypeSearch(artifactTypes); + filterViewer.addItem(primitive, getFilterName(), artifactTypes.toString(), ""); } @Override |