Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/attribute/AttributeDataStore.java11
-rw-r--r--plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/search/SearchEngine.java17
2 files changed, 18 insertions, 10 deletions
diff --git a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/attribute/AttributeDataStore.java b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/attribute/AttributeDataStore.java
index 662c4c9ec1e..ab1f80b8d7c 100644
--- a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/attribute/AttributeDataStore.java
+++ b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/attribute/AttributeDataStore.java
@@ -68,12 +68,12 @@ public final class AttributeDataStore {
return attributeData;
}
- public static Set<AttributeData> getAttributesByTags(int branchId, DeletionFlag deletionFlag, final Collection<Long> tagData, final AttributeType... attributeTypes) throws OseeCoreException {
+ public static Set<AttributeData> getAttributesByTags(int branchId, DeletionFlag deletionFlag, final Collection<Long> tagData, final Collection<AttributeType> attributeTypes) throws OseeCoreException {
final Set<AttributeData> toReturn = new HashSet<AttributeData>();
IdJoinQuery oseeIdJoin = null;
IOseeStatement chStmt = ConnectionHandler.getStatement();
- boolean useAttrTypeJoin = attributeTypes.length > 1;
+ boolean useAttrTypeJoin = attributeTypes.size() > 1;
try {
String sqlQuery =
@@ -81,7 +81,7 @@ public final class AttributeDataStore {
List<Object> params = new ArrayList<Object>();
params.addAll(tagData);
- if (attributeTypes.length == 1) {
+ if (attributeTypes.size() == 1) {
sqlQuery += " and attr1.attr_type_id = ?";
} else if (useAttrTypeJoin) {
oseeIdJoin = JoinUtility.createIdJoinQuery();
@@ -95,8 +95,9 @@ public final class AttributeDataStore {
if (branchId > -1) {
params.add(branchId);
}
- if (attributeTypes.length == 1) {
- params.add(attributeTypes[0].getId());
+ if (attributeTypes.size() == 1) {
+ AttributeType type = attributeTypes.iterator().next();
+ params.add(type.getId());
}
chStmt.runPreparedQuery(sqlQuery, params.toArray(new Object[params.size()]));
diff --git a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/search/SearchEngine.java b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/search/SearchEngine.java
index 67a70dc1bd5..c178e8600c1 100644
--- a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/search/SearchEngine.java
+++ b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/search/SearchEngine.java
@@ -11,11 +11,13 @@
package org.eclipse.osee.framework.search.engine.internal.search;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.message.SearchOptions;
import org.eclipse.osee.framework.core.message.SearchRequest;
import org.eclipse.osee.framework.core.message.SearchResponse;
@@ -51,11 +53,16 @@ public class SearchEngine implements ISearchEngine {
this.branchCache = branchCache;
}
- private AttributeType[] getAttributeTypes(Collection<IAttributeType> tokens) throws OseeCoreException {
- AttributeType[] attributeTypes = new AttributeType[tokens.size()];
- int index = 0;
+ private Collection<AttributeType> getAttributeTypes(Collection<IAttributeType> tokens) throws OseeCoreException {
+ Collection<AttributeType> attributeTypes = new HashSet<AttributeType>();
for (IAttributeType identity : tokens) {
- attributeTypes[index++] = attributeTypeCache.get(identity);
+ AttributeType type = attributeTypeCache.get(identity);
+ if (type != null) {
+ attributeTypes.add(type);
+ } else {
+ throw new OseeStateException(String.format("Search Attribute Type Filter - attribute type [%s] not found",
+ identity));
+ }
}
return attributeTypes;
}
@@ -82,7 +89,7 @@ public class SearchEngine implements ISearchEngine {
SearchOptions options = searchRequest.getOptions();
Collection<IAttributeType> attributeTypeTokens = options.getAttributeTypeFilter();
- AttributeType[] attributeTypes = getAttributeTypes(attributeTypeTokens);
+ Collection<AttributeType> attributeTypes = getAttributeTypes(attributeTypeTokens);
int branchId = branchCache.get(searchRequest.getBranch()).getId();
Collection<AttributeData> tagMatches =

Back to the top