Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2011-10-24 22:51:38 +0000
committerRoberto E. Escobar2011-10-24 22:51:38 +0000
commit6571c958e276f3538860bca7b9f8276e741d3e98 (patch)
tree4c0fe283809792ad3a08cd5c7ecca98e369f92e1
parentae7dc679885b0f03947e7d481459ce6b17db0679 (diff)
downloadorg.eclipse.osee-6571c958e276f3538860bca7b9f8276e741d3e98.tar.gz
org.eclipse.osee-6571c958e276f3538860bca7b9f8276e741d3e98.tar.xz
org.eclipse.osee-6571c958e276f3538860bca7b9f8276e741d3e98.zip
feature[ats_Q9NLC]: Update query to use executor admin
-rw-r--r--plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java5
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java15
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeLoadingTest.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeSearchTest.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java31
-rw-r--r--plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OsrcsRelationLoadingTest.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/build.properties3
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryPostProcessor.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/GraphImpl.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java22
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsObjectLoader.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java25
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryExecutor.java77
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetImpl.java81
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetLocatorImpl.java111
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/SearchResultSet.java57
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/DefaultQueryPostProcessor.java65
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchCallable.java74
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchCountCallable.java80
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchMatchesCallable.java (renamed from plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetFactory.java)57
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/AbstractQueryPostProcessor.java64
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java4
-rw-r--r--plugins/org.eclipse.osee.orcs/build.properties3
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApiTester.java9
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java58
28 files changed, 535 insertions, 358 deletions
diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java
index 6016263ea6f..664be64394c 100644
--- a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java
+++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java
@@ -22,7 +22,6 @@ import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.orcs.ApplicationContext;
@@ -74,7 +73,7 @@ public class ArtifactProviderImpl implements ArtifactProvider {
@Override
public ReadableArtifact getArtifactByGuid(IOseeBranch branch, String guid) throws OseeCoreException {
- return sanitizeResult(getFactory().fromBranch(branch).andGuidsOrHrids(guid).build(LoadLevel.FULL).getOneOrNull());
+ return sanitizeResult(getFactory().fromBranch(branch).andGuidsOrHrids(guid).getResults().getOneOrNull());
}
@Override
@@ -86,7 +85,7 @@ public class ArtifactProviderImpl implements ArtifactProvider {
QueryBuilder builder = getFactory().fromBranch(branch);
builder.and(type, StringOperator.TOKENIZED_ANY_ORDER, CaseType.IGNORE_CASE, searchPhrase);
- List<Match<ReadableArtifact, ReadableAttribute<?>>> results = builder.buildMatches(LoadLevel.FULL).getList();
+ List<Match<ReadableArtifact, ReadableAttribute<?>>> results = builder.getMatches().getList();
for (Match<ReadableArtifact, ReadableAttribute<?>> match : results) {
ReadableArtifact matchedArtifact = match.getItem();
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java
index a5d8c7c26be..fde35081fde 100644
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java
@@ -40,9 +40,20 @@ public class ExecutorThreadFactory implements ThreadFactory {
@Override
public Thread newThread(Runnable runnable) {
- Thread thread = new Thread(runnable, threadName + ":" + threads.size());
+ Thread thread = new Thread(runnable);
+
+ String name = String.format("%s: %s", threadName, threads.size());
+ thread.setName(name);
+
+ int priorityToSet = priority;
+ if (priorityToSet > Thread.MAX_PRIORITY) {
+ priorityToSet = Thread.MAX_PRIORITY;
+ } else if (priorityToSet < Thread.MIN_PRIORITY) {
+ priorityToSet = Thread.MIN_PRIORITY;
+ }
thread.setPriority(priority);
- this.threads.add(new WeakReference<Thread>(thread));
+
+ threads.add(new WeakReference<Thread>(thread));
return thread;
}
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeLoadingTest.java b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeLoadingTest.java
index 80dfd6c9a41..c655dad83d5 100644
--- a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeLoadingTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeLoadingTest.java
@@ -17,7 +17,6 @@ import java.util.Map;
import junit.framework.Assert;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.orcs.ApplicationContext;
@@ -47,7 +46,7 @@ public class OrcsAttributeLoadingTest {
QueryFactory queryFactory = orcsApi.getQueryFactory(context);
QueryBuilder builder = queryFactory.fromBranch(CoreBranches.COMMON).andLocalIds(Arrays.asList(7, 8, 9));
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
List<ReadableArtifact> moreArts = resultSet.getList();
Assert.assertEquals(3, moreArts.size());
@@ -76,7 +75,7 @@ public class OrcsAttributeLoadingTest {
queryFactory.fromBranch(branchCache.getByName("SAW_Bld_1").iterator().next()).and(CoreAttributeTypes.Name,
Operator.EQUAL, "Haptic Constraints");
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
List<ReadableArtifact> moreArts = resultSet.getList();
Assert.assertFalse(moreArts.isEmpty());
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeSearchTest.java b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeSearchTest.java
index b5ac2f767f9..d7ffb1cd925 100644
--- a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeSearchTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsAttributeSearchTest.java
@@ -16,7 +16,6 @@ import java.util.Map;
import junit.framework.Assert;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.orcs.ApplicationContext;
@@ -54,7 +53,7 @@ public class OrcsAttributeSearchTest {
QueryBuilder builder =
queryFactory.fromBranch(CoreBranches.COMMON).and(CoreAttributeTypes.Name, Operator.NOT_EQUAL, "User Groups");
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
List<ReadableArtifact> moreArts = resultSet.getList();
for (ReadableArtifact artifact : moreArts) {
@@ -66,7 +65,7 @@ public class OrcsAttributeSearchTest {
QueryBuilder builder =
queryFactory.fromBranch(CoreBranches.COMMON).and(CoreAttributeTypes.Name, Operator.EQUAL, "User Groups");
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
List<ReadableArtifact> moreArts = resultSet.getList();
Assert.assertEquals(1, moreArts.size());
@@ -84,7 +83,7 @@ public class OrcsAttributeSearchTest {
queryFactory.fromBranch(branchCache.getByName("SAW_Bld_1").iterator().next()).and(
CoreAttributeTypes.WholeWordContent, Operator.EQUAL, "commands");
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
List<ReadableArtifact> moreArts = resultSet.getList();
Assert.assertFalse(moreArts.isEmpty());
@@ -94,7 +93,7 @@ public class OrcsAttributeSearchTest {
public void testBooleanAttributeSearch(QueryFactory queryFactory) throws OseeCoreException {
QueryBuilder builder =
queryFactory.fromBranch(CoreBranches.COMMON).and(CoreAttributeTypes.DefaultGroup, Operator.EQUAL, "yes");
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
List<ReadableArtifact> moreArts = resultSet.getList();
Assert.assertEquals(1, moreArts.size());
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java
index be94267189f..566e2aab94b 100644
--- a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OrcsQueryTest.java
@@ -21,7 +21,6 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.orcs.ApplicationContext;
@@ -79,7 +78,7 @@ public class OrcsQueryTest {
QueryBuilder builder = factory.fromBranch(CoreBranches.COMMON).andGuidsOrHrids("AEmLGXnw0WaGLxcK5qwA");
Assert.assertEquals(1, builder.getCount());
- ReadableArtifact artifact = builder.build(LoadLevel.ATTRIBUTE).getExactlyOne();
+ ReadableArtifact artifact = builder.getResults().getExactlyOne();
Assert.assertEquals("AEmLGXnw0WaGLxcK5qwA", artifact.getGuid());
}
@@ -88,7 +87,7 @@ public class OrcsQueryTest {
Assert.assertEquals(5, builder.getCount());
- List<ReadableArtifact> artifacts = builder.build(LoadLevel.ATTRIBUTE).getList();
+ List<ReadableArtifact> artifacts = builder.getResults().getList();
Assert.assertEquals(5, artifacts.size());
checkContainsTypes(artifacts, CoreArtifactTypes.Folder);
@@ -103,8 +102,7 @@ public class OrcsQueryTest {
Assert.assertEquals("Work Definitions", iterator.next().getName());
if (includeMatchLocationTests) {
- List<Match<ReadableArtifact, ReadableAttribute<?>>> matches =
- builder.buildMatches(LoadLevel.ATTRIBUTE).getList();
+ List<Match<ReadableArtifact, ReadableAttribute<?>>> matches = builder.getMatches().getList();
Assert.assertEquals(5, matches.size());
Iterator<Match<ReadableArtifact, ReadableAttribute<?>>> matchIterator = matches.iterator();
@@ -123,13 +121,13 @@ public class OrcsQueryTest {
builder.excludeTypeInheritance();
Assert.assertEquals(0, builder.getCount());
- ReadableArtifact artifact = builder.build(LoadLevel.ATTRIBUTE).getOneOrNull();
+ ReadableArtifact artifact = builder.getResults().getOneOrNull();
Assert.assertNull(artifact);
builder.includeTypeInheritance();
Assert.assertEquals(24, builder.getCount());
- List<ReadableArtifact> artifacts = builder.build(LoadLevel.ATTRIBUTE).getList();
+ List<ReadableArtifact> artifacts = builder.getResults().getList();
Assert.assertEquals(24, artifacts.size());
checkContainsTypes(artifacts, CoreArtifactTypes.SoftwareRequirement);
@@ -142,7 +140,7 @@ public class OrcsQueryTest {
Assert.assertEquals(10, builder.getCount());
- List<ReadableArtifact> artifacts = builder.build(LoadLevel.ATTRIBUTE).getList();
+ List<ReadableArtifact> artifacts = builder.getResults().getList();
Assert.assertEquals(10, artifacts.size());
checkContainsTypes(artifacts, CoreArtifactTypes.OseeTypeDefinition, CoreArtifactTypes.Folder);
@@ -169,14 +167,13 @@ public class OrcsQueryTest {
Assert.assertEquals(1, builder.getCount());
- ReadableArtifact artifact = builder.build(LoadLevel.ATTRIBUTE).getExactlyOne();
+ ReadableArtifact artifact = builder.getResults().getExactlyOne();
Assert.assertEquals("Action Tracking System", artifact.getName());
Assert.assertEquals(CoreArtifactTypes.Folder, artifact.getArtifactType());
if (includeMatchLocationTests) {
- Match<ReadableArtifact, ReadableAttribute<?>> result =
- builder.buildMatches(LoadLevel.ATTRIBUTE).getExactlyOne();
+ Match<ReadableArtifact, ReadableAttribute<?>> result = builder.getMatches().getExactlyOne();
Assert.assertEquals(artifact, result.getItem());
checkMatch(result, "Action Tracking System", CoreAttributeTypes.Name);
@@ -197,7 +194,7 @@ public class OrcsQueryTest {
builder.and(CoreAttributeTypes.Name, Operator.EQUAL, "%Requirement%");
Assert.assertEquals(7, builder.getCount());
- List<ReadableArtifact> artifacts = builder.build(LoadLevel.ATTRIBUTE).getList();
+ List<ReadableArtifact> artifacts = builder.getResults().getList();
Assert.assertEquals(7, artifacts.size());
checkContainsTypes(artifacts, CoreArtifactTypes.Folder, CoreArtifactTypes.SubsystemRequirement,
CoreArtifactTypes.SystemRequirement);
@@ -205,7 +202,7 @@ public class OrcsQueryTest {
builder.andIsOfType(CoreArtifactTypes.Folder);
Assert.assertEquals(4, builder.getCount());
- List<ReadableArtifact> folders = builder.build(LoadLevel.ATTRIBUTE).getList();
+ List<ReadableArtifact> folders = builder.getResults().getList();
Assert.assertEquals(4, folders.size());
Collections.sort(folders, new ArtifactNameComparator(SortOrder.ASCENDING));
Iterator<ReadableArtifact> folderIterator = folders.iterator();
@@ -220,7 +217,7 @@ public class OrcsQueryTest {
builder1.and(CoreAttributeTypes.Name, Operator.EQUAL, "%Requirement%");
builder1.andIsOfType(CoreArtifactTypes.SubsystemRequirement);
Assert.assertEquals(1, builder1.getCount());
- List<ReadableArtifact> subSystemReqs = builder1.build(LoadLevel.ATTRIBUTE).getList();
+ List<ReadableArtifact> subSystemReqs = builder1.getResults().getList();
Assert.assertEquals(1, subSystemReqs.size());
Assert.assertEquals("Subsystem Requirements", subSystemReqs.get(0).getName());
checkContainsTypes(subSystemReqs, CoreArtifactTypes.SubsystemRequirement);
@@ -232,7 +229,7 @@ public class OrcsQueryTest {
builder2.andIsOfType(CoreArtifactTypes.Requirement);
Assert.assertEquals(3, builder2.getCount());
- List<ReadableArtifact> requirements = builder2.build(LoadLevel.ATTRIBUTE).getList();
+ List<ReadableArtifact> requirements = builder2.getResults().getList();
Assert.assertEquals(3, requirements.size());
Collections.sort(requirements, new ArtifactNameComparator(SortOrder.ASCENDING));
Iterator<ReadableArtifact> reqIterator = requirements.iterator();
@@ -247,7 +244,7 @@ public class OrcsQueryTest {
builder.and(CoreAttributeTypes.Name, StringOperator.TOKENIZED_ANY_ORDER, CaseType.IGNORE_CASE, "REQUIREMENTS");
Assert.assertEquals(7, builder.getCount());
- List<ReadableArtifact> requirements = builder.build(LoadLevel.ATTRIBUTE).getList();
+ List<ReadableArtifact> requirements = builder.getResults().getList();
Assert.assertEquals(7, requirements.size());
checkContainsTypes(requirements, CoreArtifactTypes.Folder, CoreArtifactTypes.SubsystemRequirement,
CoreArtifactTypes.SystemRequirement);
@@ -262,7 +259,7 @@ public class OrcsQueryTest {
Assert.assertEquals("System Requirements", reqIterator.next().getName());
// if (includeMatchLocationTests) {
- List<Match<ReadableArtifact, ReadableAttribute<?>>> matches = builder.buildMatches(LoadLevel.ATTRIBUTE).getList();
+ List<Match<ReadableArtifact, ReadableAttribute<?>>> matches = builder.getMatches().getList();
Assert.assertEquals(7, matches.size());
Collections.sort(matches, new ArtifactMatchComparator(SortOrder.ASCENDING));
diff --git a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OsrcsRelationLoadingTest.java b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OsrcsRelationLoadingTest.java
index 594e450994a..b6434622577 100644
--- a/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OsrcsRelationLoadingTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.integration.test/src/org/eclipse/osee/orcs/core/internal/OsrcsRelationLoadingTest.java
@@ -17,7 +17,6 @@ import java.util.Map;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.Graph;
@@ -60,7 +59,7 @@ public class OsrcsRelationLoadingTest {
private void checkRelationsForCommonBranch(OrcsApi oseeApi, QueryFactory queryFactory, ApplicationContext context) throws OseeCoreException {
QueryBuilder builder = queryFactory.fromBranch(CoreBranches.COMMON).andLocalIds(Arrays.asList(7, 8, 9));
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
List<ReadableArtifact> moreArts = resultSet.getList();
Assert.assertEquals(3, moreArts.size());
@@ -117,7 +116,7 @@ public class OsrcsRelationLoadingTest {
QueryBuilder builder =
queryFactory.fromBranch(oseeApi.getBranchCache().getByName("SAW_Bld_1").iterator().next()).and(
CoreAttributeTypes.Name, Operator.EQUAL, "Design Constraints");
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
List<ReadableArtifact> moreArts = resultSet.getList();
Assert.assertFalse(moreArts.isEmpty());
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml
index 8d62ee49f94..69af76dd18e 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml
@@ -10,4 +10,5 @@
<reference bind="setDataLoader" cardinality="1..1" interface="org.eclipse.osee.orcs.core.ds.DataLoader" name="DataLoader" policy="static"/>
<reference bind="setCacheService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
<reference bind="setDataStoreTypeCache" cardinality="1..1" interface="org.eclipse.osee.orcs.DataStoreTypeCache" name="DataStoreTypeCache" policy="static"/>
+ <reference bind="setExecutorAdmin" cardinality="1..1" interface="org.eclipse.osee.executor.admin.ExecutorAdmin" name="ExecutorAdmin" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/build.properties b/plugins/org.eclipse.osee.orcs.core/build.properties
index c4e468b368b..2410df16adb 100644
--- a/plugins/org.eclipse.osee.orcs.core/build.properties
+++ b/plugins/org.eclipse.osee.orcs.core/build.properties
@@ -9,4 +9,5 @@ additional.bundles = org.eclipse.osee.logger,\
org.eclipse.osee.framework.jdk.core,\
org.eclipse.osee.framework.core.model,\
org.eclipse.core.runtime,\
- com.google.collect
+ com.google.collect,\
+ org.eclipse.osee.executor.admin
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryPostProcessor.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryPostProcessor.java
index 593d24f3fca..8e8a8f37bc1 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryPostProcessor.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryPostProcessor.java
@@ -11,7 +11,7 @@
package org.eclipse.osee.orcs.core.ds;
import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import java.util.concurrent.Callable;
import org.eclipse.osee.orcs.data.ReadableArtifact;
import org.eclipse.osee.orcs.data.ReadableAttribute;
import org.eclipse.osee.orcs.search.Match;
@@ -19,9 +19,8 @@ import org.eclipse.osee.orcs.search.Match;
/**
* @author Roberto E. Escobar
*/
-public interface QueryPostProcessor {
+public interface QueryPostProcessor extends Callable<List<Match<ReadableArtifact, ReadableAttribute<?>>>> {
- List<ReadableArtifact> getMatching(List<ReadableArtifact> artifacts) throws OseeCoreException;
+ void setItemsToProcess(List<ReadableArtifact> artifacts);
- List<Match<ReadableArtifact, ReadableAttribute<?>>> getLocationMatches(List<ReadableArtifact> artifacts) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/GraphImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/GraphImpl.java
index 6af4563febc..47db278a0e7 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/GraphImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/GraphImpl.java
@@ -17,7 +17,6 @@ import java.util.List;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
@@ -57,7 +56,7 @@ public class GraphImpl implements Graph {
toReturn = Collections.emptyList();
} else {
QueryBuilder builder = queryFactory.fromBranch(art.getBranch()).andLocalIds(results);
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
toReturn = resultSet.getList();
}
return toReturn;
@@ -71,7 +70,7 @@ public class GraphImpl implements Graph {
return null;
} else {
QueryBuilder builder = queryFactory.fromBranch(art.getBranch()).andLocalIds(results);
- ResultSet<ReadableArtifact> resultSet = builder.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> resultSet = builder.getResults();
return resultSet.getOneOrNull();
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
index 5a6583e67e8..63eb8a103e5 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.jdk.core.util.GUID;
@@ -25,8 +25,8 @@ import org.eclipse.osee.orcs.core.internal.artifact.ArtifactFactory;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeClassResolver;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeFactory;
import org.eclipse.osee.orcs.core.internal.search.CriteriaFactory;
+import org.eclipse.osee.orcs.core.internal.search.QueryExecutor;
import org.eclipse.osee.orcs.core.internal.search.QueryFactoryImpl;
-import org.eclipse.osee.orcs.core.internal.search.ResultSetFactory;
import org.eclipse.osee.orcs.core.internal.session.SessionContextImpl;
import org.eclipse.osee.orcs.search.QueryFacade;
import org.eclipse.osee.orcs.search.QueryFactory;
@@ -42,10 +42,11 @@ public class OrcsApiImpl implements OrcsApi {
private AttributeClassResolver resolver;
private IOseeCachingService cacheService;
private DataStoreTypeCache dataStoreTypeCache;
+ private ExecutorAdmin executorAdmin;
private OrcsObjectLoader objectLoader;
private CriteriaFactory criteriaFctry;
- private ResultSetFactory rsetFctry;
+ private QueryExecutor queryExecutor;
public void setLogger(Log logger) {
this.logger = logger;
@@ -71,6 +72,10 @@ public class OrcsApiImpl implements OrcsApi {
this.dataStoreTypeCache = dataStoreTypeCache;
}
+ public void setExecutorAdmin(ExecutorAdmin executorAdmin) {
+ this.executorAdmin = executorAdmin;
+ }
+
public void start() {
ArtifactFactory artifactFactory = new ArtifactFactory(dataStoreTypeCache.getRelationTypeCache());
AttributeFactory attributeFactory =
@@ -80,25 +85,20 @@ public class OrcsApiImpl implements OrcsApi {
dataStoreTypeCache.getArtifactTypeCache(), cacheService.getBranchCache());
criteriaFctry = new CriteriaFactory();
- rsetFctry = new ResultSetFactory(queryEngine, objectLoader);
- try {
- cacheService.reloadAll();
- } catch (OseeCoreException ex) {
- // logger.log(Level.SEVERE, ex.toString(), ex);
- }
+ queryExecutor = new QueryExecutor(executorAdmin, queryEngine, objectLoader);
}
public void stop() {
criteriaFctry = null;
- rsetFctry = null;
objectLoader = null;
+ queryExecutor = null;
}
@Override
public QueryFactory getQueryFactory(ApplicationContext context) {
String sessionId = GUID.create(); // TODO context.getSessionId() attach to application context
SessionContext sessionContext = getSessionContext(sessionId);
- return new QueryFactoryImpl(criteriaFctry, rsetFctry, sessionContext);
+ return new QueryFactoryImpl(sessionContext, criteriaFctry, queryExecutor);
}
private SessionContext getSessionContext(String sessionId) {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsObjectLoader.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsObjectLoader.java
index 08171a3531a..49e05e6ddc5 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsObjectLoader.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsObjectLoader.java
@@ -11,9 +11,9 @@
package org.eclipse.osee.orcs.core.internal;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
@@ -80,8 +80,10 @@ public class OrcsObjectLoader {
private static class ArtifactCollectorImpl implements ArtifactCollector, RelationRowHandlerFactory, AttributeRowHandlerFactory {
- private final Map<Integer, RelationContainer> relationContainers = new HashMap<Integer, RelationContainer>();;
- private final Map<Integer, AttributeContainer> attributeContainers = new HashMap<Integer, AttributeContainer>();
+ private final Map<Integer, RelationContainer> relationContainers =
+ new ConcurrentHashMap<Integer, RelationContainer>();;
+ private final Map<Integer, AttributeContainer> attributeContainers =
+ new ConcurrentHashMap<Integer, AttributeContainer>();
private final List<ReadableArtifact> artifacts;
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java
index 36246ceac5f..a7d1bb5acca 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java
@@ -335,35 +335,16 @@ public class QueryBuilderImpl implements QueryBuilder {
@Override
public Future<Integer> computeCount(ExecutionCallback<Integer> callback) throws OseeCoreException {
- Future<Integer> toReturn = null;
- try {
- toReturn = queryExecutor.scheduleCount(sessionContext, criteriaSet.clone(), options.clone(), callback);
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return toReturn;
+ return queryExecutor.scheduleCount(sessionContext, criteriaSet.clone(), options.clone(), callback);
}
@Override
public Future<ResultSet<ReadableArtifact>> search(ExecutionCallback<ResultSet<ReadableArtifact>> callback) throws OseeCoreException {
- Future<ResultSet<ReadableArtifact>> toReturn = null;
- try {
- toReturn = queryExecutor.scheduleSearch(sessionContext, criteriaSet.clone(), options.clone(), callback);
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return toReturn;
+ return queryExecutor.scheduleSearch(sessionContext, criteriaSet.clone(), options.clone(), callback);
}
@Override
public Future<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> searchWithMatches(ExecutionCallback<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> callback) throws OseeCoreException {
- Future<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> toReturn = null;
- try {
- toReturn =
- queryExecutor.scheduleSearchWithMatches(sessionContext, criteriaSet.clone(), options.clone(), callback);
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return toReturn;
+ return queryExecutor.scheduleSearchWithMatches(sessionContext, criteriaSet.clone(), options.clone(), callback);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryExecutor.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryExecutor.java
new file mode 100644
index 00000000000..d2eb55216ca
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryExecutor.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.core.internal.search;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+import org.eclipse.osee.executor.admin.ExecutionCallback;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
+import org.eclipse.osee.framework.core.enums.LoadLevel;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.orcs.core.ds.CriteriaSet;
+import org.eclipse.osee.orcs.core.ds.QueryEngine;
+import org.eclipse.osee.orcs.core.ds.QueryOptions;
+import org.eclipse.osee.orcs.core.internal.OrcsObjectLoader;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.core.internal.search.callable.SearchCallable;
+import org.eclipse.osee.orcs.core.internal.search.callable.SearchCountCallable;
+import org.eclipse.osee.orcs.core.internal.search.callable.SearchMatchesCallable;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.data.ReadableAttribute;
+import org.eclipse.osee.orcs.search.Match;
+import org.eclipse.osee.orcs.search.ResultSet;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class QueryExecutor {
+
+ private final ExecutorAdmin executorAdmin;
+ private final QueryEngine queryEngine;
+ private final OrcsObjectLoader objectLoader;
+
+ public QueryExecutor(ExecutorAdmin executorAdmin, QueryEngine queryEngine, OrcsObjectLoader objectLoader) {
+ super();
+ this.executorAdmin = executorAdmin;
+ this.queryEngine = queryEngine;
+ this.objectLoader = objectLoader;
+ }
+
+ public Future<Integer> scheduleCount(SessionContext sessionContext, CriteriaSet criteriaSet, QueryOptions options, ExecutionCallback<Integer> callback) throws OseeCoreException {
+ Callable<Integer> callable =
+ new SearchCountCallable(queryEngine, objectLoader, sessionContext, LoadLevel.ATTRIBUTE, criteriaSet, options);
+ try {
+ return executorAdmin.schedule(callable, callback);
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+
+ public Future<ResultSet<ReadableArtifact>> scheduleSearch(SessionContext sessionContext, CriteriaSet criteriaSet, QueryOptions options, ExecutionCallback<ResultSet<ReadableArtifact>> callback) throws OseeCoreException {
+ Callable<ResultSet<ReadableArtifact>> callable =
+ new SearchCallable(queryEngine, objectLoader, sessionContext, LoadLevel.FULL, criteriaSet, options);
+ try {
+ return executorAdmin.schedule(callable, callback);
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+
+ public Future<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> scheduleSearchWithMatches(SessionContext sessionContext, CriteriaSet criteriaSet, QueryOptions options, ExecutionCallback<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> callback) throws OseeCoreException {
+ Callable<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> callable =
+ new SearchMatchesCallable(queryEngine, objectLoader, sessionContext, LoadLevel.FULL, criteriaSet, options);
+ try {
+ return executorAdmin.schedule(callable, callback);
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java
index f7584bb3304..a942115de54 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java
@@ -31,20 +31,20 @@ public class QueryFactoryImpl implements QueryFactory {
private final SessionContext context;
private final CriteriaFactory criteriaFctry;
- private final ResultSetFactory rsetFctry;
+ private final QueryExecutor queryExecutor;
- public QueryFactoryImpl(CriteriaFactory criteriaFctry, ResultSetFactory rsetFctry, SessionContext context) {
+ public QueryFactoryImpl(SessionContext context, CriteriaFactory criteriaFctry, QueryExecutor queryExecutor) {
super();
this.context = context;
this.criteriaFctry = criteriaFctry;
- this.rsetFctry = rsetFctry;
+ this.queryExecutor = queryExecutor;
}
@SuppressWarnings("unused")
private QueryBuilder createBuilder(IOseeBranch branch) throws OseeCoreException {
QueryOptions options = new QueryOptions();
CriteriaSet criteriaSet = new CriteriaSet(branch);
- QueryBuilder builder = new QueryBuilderImpl(rsetFctry, criteriaFctry, context, criteriaSet, options);
+ QueryBuilder builder = new QueryBuilderImpl(queryExecutor, criteriaFctry, context, criteriaSet, options);
return builder;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetImpl.java
deleted file mode 100644
index f1aff853bf1..00000000000
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetImpl.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.core.internal.search;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
-import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.orcs.core.ds.LoadOptions;
-import org.eclipse.osee.orcs.core.ds.QueryContext;
-import org.eclipse.osee.orcs.core.ds.QueryPostProcessor;
-import org.eclipse.osee.orcs.core.internal.OrcsObjectLoader;
-import org.eclipse.osee.orcs.core.internal.SessionContext;
-import org.eclipse.osee.orcs.data.ReadableArtifact;
-import org.eclipse.osee.orcs.search.ResultSet;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ResultSetImpl implements ResultSet<ReadableArtifact> {
-
- private final OrcsObjectLoader objectLoader;
- private final SessionContext sessionContext;
- private final QueryContext queryContext;
- private final LoadOptions loadOptions;
-
- public ResultSetImpl(OrcsObjectLoader objectLoader, SessionContext sessionContext, QueryContext queryContext, LoadOptions loadOptions) {
- super();
- this.objectLoader = objectLoader;
- this.sessionContext = sessionContext;
- this.queryContext = queryContext;
- this.loadOptions = loadOptions;
- }
-
- @Override
- public ReadableArtifact getOneOrNull() throws OseeCoreException {
- List<ReadableArtifact> result = getList();
- return result.isEmpty() ? null : result.iterator().next();
- }
-
- @Override
- public ReadableArtifact getExactlyOne() throws OseeCoreException {
- List<ReadableArtifact> result = getList();
- if (result.isEmpty()) {
- throw new ArtifactDoesNotExist("No artifacts found");
- } else if (result.size() > 1) {
- throw new MultipleArtifactsExist("Multiple artifact found - total [%s]", result.size());
- }
- return result.iterator().next();
- }
-
- @Override
- public List<ReadableArtifact> getList() throws OseeCoreException {
- List<ReadableArtifact> artifacts = objectLoader.load(queryContext, loadOptions, sessionContext);
-
- List<ReadableArtifact> results;
- if (!queryContext.getPostProcessors().isEmpty()) {
- results = new ArrayList<ReadableArtifact>();
- for (QueryPostProcessor processor : queryContext.getPostProcessors()) {
- results.addAll(processor.getMatching(artifacts));
- }
- } else {
- results = artifacts;
- }
- return results;
- }
-
- @Override
- public Iterable<ReadableArtifact> getIterable(int fetchSize) throws OseeCoreException {
- return getList();
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetLocatorImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetLocatorImpl.java
deleted file mode 100644
index efd18288821..00000000000
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetLocatorImpl.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.core.internal.search;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
-import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
-import org.eclipse.osee.orcs.core.ds.LoadOptions;
-import org.eclipse.osee.orcs.core.ds.QueryContext;
-import org.eclipse.osee.orcs.core.ds.QueryPostProcessor;
-import org.eclipse.osee.orcs.core.internal.OrcsObjectLoader;
-import org.eclipse.osee.orcs.core.internal.SessionContext;
-import org.eclipse.osee.orcs.data.ReadableArtifact;
-import org.eclipse.osee.orcs.data.ReadableAttribute;
-import org.eclipse.osee.orcs.search.Match;
-import org.eclipse.osee.orcs.search.ResultSet;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ResultSetLocatorImpl implements ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>> {
-
- private final OrcsObjectLoader objectLoader;
- private final SessionContext sessionContext;
- private final QueryContext queryContext;
- private final LoadOptions loadOptions;
-
- public ResultSetLocatorImpl(OrcsObjectLoader objectLoader, SessionContext sessionContext, QueryContext queryContext, LoadOptions loadOptions) {
- super();
- this.objectLoader = objectLoader;
- this.sessionContext = sessionContext;
- this.queryContext = queryContext;
- this.loadOptions = loadOptions;
- }
-
- @Override
- public Match<ReadableArtifact, ReadableAttribute<?>> getOneOrNull() throws OseeCoreException {
- List<Match<ReadableArtifact, ReadableAttribute<?>>> result = getList();
- return result.isEmpty() ? null : result.iterator().next();
- }
-
- @Override
- public Match<ReadableArtifact, ReadableAttribute<?>> getExactlyOne() throws OseeCoreException {
- List<Match<ReadableArtifact, ReadableAttribute<?>>> result = getList();
- if (result.isEmpty()) {
- throw new ArtifactDoesNotExist("No artifacts found");
- } else if (result.size() > 1) {
- throw new MultipleArtifactsExist("Multiple artifact found - total [%s]", result.size());
- }
- return result.iterator().next();
- }
-
- @Override
- public List<Match<ReadableArtifact, ReadableAttribute<?>>> getList() throws OseeCoreException {
- List<Match<ReadableArtifact, ReadableAttribute<?>>> results =
- new ArrayList<Match<ReadableArtifact, ReadableAttribute<?>>>();
-
- List<ReadableArtifact> artifacts = objectLoader.load(queryContext, loadOptions, sessionContext);
-
- Collection<QueryPostProcessor> processors = queryContext.getPostProcessors();
- if (processors.isEmpty()) {
- for (final ReadableArtifact art : artifacts) {
- results.add(new Match<ReadableArtifact, ReadableAttribute<?>>() {
-
- @Override
- public boolean hasLocationData() {
- return false;
- }
-
- @Override
- public ReadableArtifact getItem() {
- return art;
- }
-
- @Override
- public Collection<ReadableAttribute<?>> getElements() throws OseeCoreException {
- return Collections.emptyList();
- }
-
- @Override
- public List<MatchLocation> getLocation(ReadableAttribute<?> element) throws OseeCoreException {
- return Collections.emptyList();
- }
- });
- }
- } else {
- for (QueryPostProcessor processor : processors) {
- results.addAll(processor.getLocationMatches(artifacts));
- }
- }
- return results;
- }
-
- @Override
- public Iterable<Match<ReadableArtifact, ReadableAttribute<?>>> getIterable(int fetchSize) throws OseeCoreException {
- return getList();
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/SearchResultSet.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/SearchResultSet.java
new file mode 100644
index 00000000000..eabc0c2c855
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/SearchResultSet.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.core.internal.search;
+
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
+import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.orcs.search.ResultSet;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class SearchResultSet<T> implements ResultSet<T> {
+
+ private final List<T> data;
+
+ public SearchResultSet(List<T> data) {
+ super();
+ this.data = data;
+ }
+
+ @Override
+ public T getOneOrNull() {
+ List<T> result = getList();
+ return result.isEmpty() ? null : result.iterator().next();
+ }
+
+ @Override
+ public T getExactlyOne() throws OseeCoreException {
+ List<T> result = getList();
+ if (result.isEmpty()) {
+ throw new ArtifactDoesNotExist("No artifacts found");
+ } else if (result.size() > 1) {
+ throw new MultipleArtifactsExist("Multiple artifact found - total [%s]", result.size());
+ }
+ return result.iterator().next();
+ }
+
+ @Override
+ public List<T> getList() {
+ return data;
+ }
+
+ @Override
+ public Iterable<T> getIterable(int fetchSize) {
+ return getList();
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/DefaultQueryPostProcessor.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/DefaultQueryPostProcessor.java
new file mode 100644
index 00000000000..616cb8f345c
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/DefaultQueryPostProcessor.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.core.internal.search.callable;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
+import org.eclipse.osee.orcs.core.ds.QueryPostProcessor;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.data.ReadableAttribute;
+import org.eclipse.osee.orcs.search.Match;
+
+public class DefaultQueryPostProcessor implements QueryPostProcessor {
+ private List<ReadableArtifact> artifacts;
+
+ @Override
+ public void setItemsToProcess(List<ReadableArtifact> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ @Override
+ public List<Match<ReadableArtifact, ReadableAttribute<?>>> call() throws Exception {
+ Conditions.checkNotNull(artifacts, "Query first pass results");
+
+ List<Match<ReadableArtifact, ReadableAttribute<?>>> results =
+ new ArrayList<Match<ReadableArtifact, ReadableAttribute<?>>>();
+
+ for (final ReadableArtifact art : artifacts) {
+ results.add(new Match<ReadableArtifact, ReadableAttribute<?>>() {
+
+ @Override
+ public boolean hasLocationData() {
+ return false;
+ }
+
+ @Override
+ public ReadableArtifact getItem() {
+ return art;
+ }
+
+ @Override
+ public Collection<ReadableAttribute<?>> getElements() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<MatchLocation> getLocation(ReadableAttribute<?> element) {
+ return Collections.emptyList();
+ }
+ });
+ }
+ return results;
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchCallable.java
new file mode 100644
index 00000000000..7785affc689
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchCallable.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.core.internal.search.callable;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.enums.LoadLevel;
+import org.eclipse.osee.orcs.core.ds.CriteriaSet;
+import org.eclipse.osee.orcs.core.ds.LoadOptions;
+import org.eclipse.osee.orcs.core.ds.QueryContext;
+import org.eclipse.osee.orcs.core.ds.QueryEngine;
+import org.eclipse.osee.orcs.core.ds.QueryOptions;
+import org.eclipse.osee.orcs.core.ds.QueryPostProcessor;
+import org.eclipse.osee.orcs.core.internal.OrcsObjectLoader;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.core.internal.search.SearchResultSet;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.data.ReadableAttribute;
+import org.eclipse.osee.orcs.search.Match;
+import org.eclipse.osee.orcs.search.ResultSet;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class SearchCallable implements Callable<ResultSet<ReadableArtifact>> {
+ private final QueryEngine queryEngine;
+ private final OrcsObjectLoader objectLoader;
+
+ private final SessionContext sessionContext;
+ private final LoadLevel loadLevel;
+ private final CriteriaSet criteriaSet;
+ private final QueryOptions options;
+
+ public SearchCallable(QueryEngine queryEngine, OrcsObjectLoader objectLoader, SessionContext sessionContext, LoadLevel loadLevel, CriteriaSet criteriaSet, QueryOptions options) {
+ super();
+ this.queryEngine = queryEngine;
+ this.objectLoader = objectLoader;
+ this.sessionContext = sessionContext;
+ this.loadLevel = loadLevel;
+ this.criteriaSet = criteriaSet;
+ this.options = options;
+ }
+
+ @Override
+ public ResultSet<ReadableArtifact> call() throws Exception {
+ QueryContext queryContext = queryEngine.create(sessionContext.getSessionId(), criteriaSet, options);
+ LoadOptions loadOptions = new LoadOptions(options.isHistorical(), options.areDeletedIncluded(), loadLevel);
+ List<ReadableArtifact> artifacts = objectLoader.load(queryContext, loadOptions, sessionContext);
+
+ List<ReadableArtifact> results;
+ if (!queryContext.getPostProcessors().isEmpty()) {
+ results = new ArrayList<ReadableArtifact>();
+ for (QueryPostProcessor processor : queryContext.getPostProcessors()) {
+ processor.setItemsToProcess(artifacts);
+ List<Match<ReadableArtifact, ReadableAttribute<?>>> matches = processor.call();
+ for (Match<ReadableArtifact, ReadableAttribute<?>> match : matches) {
+ results.add(match.getItem());
+ }
+ }
+ } else {
+ results = artifacts;
+ }
+ return new SearchResultSet<ReadableArtifact>(results);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchCountCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchCountCallable.java
new file mode 100644
index 00000000000..ed176b0973e
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchCountCallable.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.core.internal.search.callable;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.enums.LoadLevel;
+import org.eclipse.osee.orcs.core.ds.CriteriaSet;
+import org.eclipse.osee.orcs.core.ds.LoadOptions;
+import org.eclipse.osee.orcs.core.ds.QueryContext;
+import org.eclipse.osee.orcs.core.ds.QueryEngine;
+import org.eclipse.osee.orcs.core.ds.QueryOptions;
+import org.eclipse.osee.orcs.core.ds.QueryPostProcessor;
+import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeKeyword;
+import org.eclipse.osee.orcs.core.internal.OrcsObjectLoader;
+import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.data.ReadableAttribute;
+import org.eclipse.osee.orcs.search.Match;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class SearchCountCallable implements Callable<Integer> {
+ private final QueryEngine queryEngine;
+ private final OrcsObjectLoader objectLoader;
+
+ private final SessionContext sessionContext;
+ private final LoadLevel loadLevel;
+ private final CriteriaSet criteriaSet;
+ private final QueryOptions options;
+
+ public SearchCountCallable(QueryEngine queryEngine, OrcsObjectLoader objectLoader, SessionContext sessionContext, LoadLevel loadLevel, CriteriaSet criteriaSet, QueryOptions options) {
+ super();
+ this.queryEngine = queryEngine;
+ this.objectLoader = objectLoader;
+ this.sessionContext = sessionContext;
+ this.loadLevel = loadLevel;
+ this.criteriaSet = criteriaSet;
+ this.options = options;
+ }
+
+ @Override
+ public Integer call() throws Exception {
+ int count = -1;
+ if (criteriaSet.hasCriteriaType(CriteriaAttributeKeyword.class)) {
+ QueryContext queryContext = queryEngine.create(sessionContext.getSessionId(), criteriaSet, options);
+ LoadOptions loadOptions = new LoadOptions(options.isHistorical(), options.areDeletedIncluded(), loadLevel);
+ List<ReadableArtifact> artifacts = objectLoader.load(queryContext, loadOptions, sessionContext);
+
+ List<ReadableArtifact> results;
+ if (!queryContext.getPostProcessors().isEmpty()) {
+ results = new ArrayList<ReadableArtifact>();
+ for (QueryPostProcessor processor : queryContext.getPostProcessors()) {
+ processor.setItemsToProcess(artifacts);
+ List<Match<ReadableArtifact, ReadableAttribute<?>>> matches = processor.call();
+ for (Match<ReadableArtifact, ReadableAttribute<?>> match : matches) {
+ results.add(match.getItem());
+ }
+ }
+ } else {
+ results = artifacts;
+ }
+ count = results.size();
+ } else {
+ QueryContext queryContext = queryEngine.createCount(sessionContext.getSessionId(), criteriaSet, options);
+ count = objectLoader.countObjects(queryContext);
+ }
+ return count;
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchMatchesCallable.java
index 468516c0ba8..1233e211269 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ResultSetFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/callable/SearchMatchesCallable.java
@@ -8,18 +8,23 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.orcs.core.internal.search;
+package org.eclipse.osee.orcs.core.internal.search.callable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.Callable;
import org.eclipse.osee.framework.core.enums.LoadLevel;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.CriteriaSet;
import org.eclipse.osee.orcs.core.ds.LoadOptions;
import org.eclipse.osee.orcs.core.ds.QueryContext;
import org.eclipse.osee.orcs.core.ds.QueryEngine;
import org.eclipse.osee.orcs.core.ds.QueryOptions;
-import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeKeyword;
+import org.eclipse.osee.orcs.core.ds.QueryPostProcessor;
import org.eclipse.osee.orcs.core.internal.OrcsObjectLoader;
import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.core.internal.search.SearchResultSet;
import org.eclipse.osee.orcs.data.ReadableArtifact;
import org.eclipse.osee.orcs.data.ReadableAttribute;
import org.eclipse.osee.orcs.search.Match;
@@ -28,40 +33,42 @@ import org.eclipse.osee.orcs.search.ResultSet;
/**
* @author Roberto E. Escobar
*/
-public class ResultSetFactory {
-
+public class SearchMatchesCallable implements Callable<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> {
private final QueryEngine queryEngine;
private final OrcsObjectLoader objectLoader;
- public ResultSetFactory(QueryEngine queryEngine, OrcsObjectLoader objectLoader) {
+ private final SessionContext sessionContext;
+ private final LoadLevel loadLevel;
+ private final CriteriaSet criteriaSet;
+ private final QueryOptions options;
+
+ public SearchMatchesCallable(QueryEngine queryEngine, OrcsObjectLoader objectLoader, SessionContext sessionContext, LoadLevel loadLevel, CriteriaSet criteriaSet, QueryOptions options) {
super();
this.queryEngine = queryEngine;
this.objectLoader = objectLoader;
+ this.sessionContext = sessionContext;
+ this.loadLevel = loadLevel;
+ this.criteriaSet = criteriaSet;
+ this.options = options;
}
- public ResultSet<ReadableArtifact> createResultSet(SessionContext sessionContext, LoadLevel loadLevel, CriteriaSet criteriaSet, QueryOptions options) throws OseeCoreException {
+ @Override
+ public ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>> call() throws Exception {
QueryContext queryContext = queryEngine.create(sessionContext.getSessionId(), criteriaSet, options);
LoadOptions loadOptions = new LoadOptions(options.isHistorical(), options.areDeletedIncluded(), loadLevel);
- return new ResultSetImpl(objectLoader, sessionContext, queryContext, loadOptions);
- }
+ List<ReadableArtifact> artifacts = objectLoader.load(queryContext, loadOptions, sessionContext);
- public ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>> createMatchesResultSet(SessionContext sessionContext, LoadLevel loadLevel, CriteriaSet criteriaSet, QueryOptions options) throws OseeCoreException {
- QueryContext queryContext = queryEngine.create(sessionContext.getSessionId(), criteriaSet, options);
- LoadOptions loadOptions = new LoadOptions(options.isHistorical(), options.areDeletedIncluded(), loadLevel);
- return new ResultSetLocatorImpl(objectLoader, sessionContext, queryContext, loadOptions);
- }
+ List<Match<ReadableArtifact, ReadableAttribute<?>>> results =
+ new ArrayList<Match<ReadableArtifact, ReadableAttribute<?>>>();
- public int getCount(SessionContext sessionContext, CriteriaSet criteriaSet, QueryOptions options) throws OseeCoreException {
- int count = -1;
- if (criteriaSet.hasCriteriaType(CriteriaAttributeKeyword.class)) {
- ResultSet<ReadableArtifact> items = createResultSet(sessionContext, LoadLevel.ATTRIBUTE, criteriaSet, options);
- count = items.getList().size();
- } else {
- QueryContext queryContext = queryEngine.createCount(sessionContext.getSessionId(), criteriaSet, options);
- count = objectLoader.countObjects(queryContext);
+ Collection<QueryPostProcessor> processors = queryContext.getPostProcessors();
+ if (processors.isEmpty()) {
+ processors = Collections.<QueryPostProcessor> singleton(new DefaultQueryPostProcessor());
}
- return count;
-
+ for (QueryPostProcessor processor : processors) {
+ processor.setItemsToProcess(artifacts);
+ results.addAll(processor.call());
+ }
+ return new SearchResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>(results);
}
-
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/AbstractQueryPostProcessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/AbstractQueryPostProcessor.java
index e0b905cb732..485429c7f20 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/AbstractQueryPostProcessor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/AbstractQueryPostProcessor.java
@@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.core.ds.QueryPostProcessor;
@@ -34,6 +35,7 @@ public abstract class AbstractQueryPostProcessor implements QueryPostProcessor {
private final Log logger;
private CriteriaAttributeKeyword criteria;
+ private List<ReadableArtifact> artifacts;
protected AbstractQueryPostProcessor(Log logger) {
super();
@@ -56,49 +58,15 @@ public abstract class AbstractQueryPostProcessor implements QueryPostProcessor {
return criteria.getValue();
}
- @SuppressWarnings("unchecked")
- private <T> List<ReadableAttribute<T>> getAttributes(ReadableArtifact artifact) throws OseeCoreException {
- List<ReadableAttribute<T>> toReturn;
-
- Collection<? extends IAttributeType> toCheck = getTypes();
- if (toCheck != null && !toCheck.isEmpty()) {
- toReturn = new ArrayList<ReadableAttribute<T>>();
- for (IAttributeType attributeType : toCheck) {
- for (ReadableAttribute<?> attr : artifact.getAttributes(attributeType)) {
- toReturn.add((ReadableAttribute<T>) attr);
- }
- }
- } else {
- toReturn = artifact.getAttributes();
- }
- return toReturn;
- }
-
@Override
- public List<ReadableArtifact> getMatching(List<ReadableArtifact> artifacts) throws OseeCoreException {
- List<ReadableArtifact> filtered = new ArrayList<ReadableArtifact>();
- for (ReadableArtifact artifact : artifacts) {
- for (ReadableAttribute<?> attribute : getAttributes(artifact)) {
- try {
- if (getTypes().contains(attribute.getAttributeType())) {
- Tagger tagger = getTagger(attribute);
- List<MatchLocation> locations = tagger.find(attribute, getQuery(), getCaseType(), false);
- if (!locations.isEmpty()) {
- filtered.add(artifact);
- break;
- }
- }
- } catch (Exception ex) {
- logger.error(ex, "Error processing: [%s]", attribute);
- }
-
- }
- }
- return filtered;
+ public void setItemsToProcess(List<ReadableArtifact> artifacts) {
+ this.artifacts = artifacts;
}
@Override
- public List<Match<ReadableArtifact, ReadableAttribute<?>>> getLocationMatches(List<ReadableArtifact> artifacts) throws OseeCoreException {
+ public List<Match<ReadableArtifact, ReadableAttribute<?>>> call() throws Exception {
+ Conditions.checkNotNull(artifacts, "Query first pass results");
+
List<Match<ReadableArtifact, ReadableAttribute<?>>> results =
new ArrayList<Match<ReadableArtifact, ReadableAttribute<?>>>();
@@ -128,5 +96,23 @@ public abstract class AbstractQueryPostProcessor implements QueryPostProcessor {
return results;
}
+ @SuppressWarnings("unchecked")
+ private <T> List<ReadableAttribute<T>> getAttributes(ReadableArtifact artifact) throws OseeCoreException {
+ List<ReadableAttribute<T>> toReturn;
+
+ Collection<? extends IAttributeType> toCheck = getTypes();
+ if (toCheck != null && !toCheck.isEmpty()) {
+ toReturn = new ArrayList<ReadableAttribute<T>>();
+ for (IAttributeType attributeType : toCheck) {
+ for (ReadableAttribute<?> attr : artifact.getAttributes(attributeType)) {
+ toReturn.add((ReadableAttribute<T>) attr);
+ }
+ }
+ } else {
+ toReturn = artifact.getAttributes();
+ }
+ return toReturn;
+ }
+
protected abstract Tagger getTagger(ReadableAttribute<?> attribute) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java
index d46a12620eb..06b22e96b9e 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java
@@ -20,7 +20,6 @@ import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.orcs.Graph;
import org.eclipse.osee.orcs.data.ReadableArtifact;
@@ -57,8 +56,7 @@ public class ArtifactResource {
IOseeBranch branch = TokenFactory.createBranch(branchUuid, "");
QueryFactory factory = OrcsApplication.getOrcsApi().getQueryFactory(null);
Graph graph = OrcsApplication.getOrcsApi().getGraph(null);
- List<ReadableArtifact> arts =
- factory.fromBranch(branch).andGuidsOrHrids(artifactUuid).build(LoadLevel.FULL).getList();
+ List<ReadableArtifact> arts = factory.fromBranch(branch).andGuidsOrHrids(artifactUuid).getResults().getList();
HtmlWriter writer = new HtmlWriter(uriInfo, graph);
return writer.toHtml(arts);
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java
index cb0ded496ad..3637b473360 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java
@@ -22,7 +22,6 @@ import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.orcs.Graph;
import org.eclipse.osee.orcs.data.ReadableArtifact;
@@ -59,8 +58,7 @@ public class ArtifactsResource {
public String getAsHtml() throws OseeCoreException {
IOseeBranch branch = TokenFactory.createBranch(branchUuid, "");
QueryFactory factory = OrcsApplication.getOrcsApi().getQueryFactory(null);
- ResultSet<ReadableArtifact> results =
- factory.fromBranch(branch).andNameEquals(DEFAULT_HIERARCHY_ROOT_NAME).build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> results = factory.fromBranch(branch).andNameEquals(DEFAULT_HIERARCHY_ROOT_NAME).getResults();
ReadableArtifact rootArtifact = results.getExactlyOne();
Graph graph = OrcsApplication.getOrcsApi().getGraph(null);
diff --git a/plugins/org.eclipse.osee.orcs/build.properties b/plugins/org.eclipse.osee.orcs/build.properties
index f82961efb23..19899692e76 100644
--- a/plugins/org.eclipse.osee.orcs/build.properties
+++ b/plugins/org.eclipse.osee.orcs/build.properties
@@ -5,4 +5,5 @@ bin.includes = META-INF/,\
additional.bundles = org.eclipse.osee.framework.core,\
org.eclipse.osee.framework.jdk.core,\
org.eclipse.core.runtime,\
- org.eclipse.osee.framework.core.model
+ org.eclipse.osee.framework.core.model,\
+ org.eclipse.osee.executor.admin
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApiTester.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApiTester.java
index 9fa1ba430ec..657b90ee9e5 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApiTester.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApiTester.java
@@ -13,7 +13,6 @@ package org.eclipse.osee.orcs.search;
import java.util.List;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.OrcsApi;
@@ -35,14 +34,14 @@ public class ApiTester {
ReadableArtifact art1 = query.fromBranch(CoreBranches.COMMON).andNameEquals("WPN_PAGE")//
.includeCache()//
.includeDeleted()//
- .build(LoadLevel.FULL)//
+ .getResults()//
.getExactlyOne();
List<ReadableArtifact> arts = query//
.fromBranch(CoreBranches.COMMON).andNameEquals("WPN_PAGE")//
.includeCache()//
.includeDeleted()//
- .build(LoadLevel.ATTRIBUTE)//
+ .getResults()//
.getList();
/// Chained
@@ -53,7 +52,7 @@ public class ApiTester {
.and(CoreAttributeTypes.ParagraphNumber, Operator.LESS_THAN, "1.2.3")//
.and(CoreAttributeTypes.Company, Operator.NOT_EQUAL, "company")//
.andExists(CoreAttributeTypes.Active)//
- .build(LoadLevel.FULL)//
+ .getResults()//
.getExactlyOne();
// None Chained
@@ -62,7 +61,7 @@ public class ApiTester {
builder1.and(CoreAttributeTypes.ParagraphNumber, Operator.LESS_THAN, "1.2.3");
builder1.and(CoreAttributeTypes.Company, Operator.NOT_EQUAL, "company");
- ResultSet<ReadableArtifact> result = builder1.build(LoadLevel.FULL);
+ ResultSet<ReadableArtifact> result = builder1.getResults();
ReadableArtifact art3 = result.getExactlyOne();
List<ReadableArtifact> items = result.getList();
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java
index 35031439f92..2fe47029b8d 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java
@@ -11,12 +11,13 @@
package org.eclipse.osee.orcs.search;
import java.util.Collection;
+import java.util.concurrent.Future;
+import org.eclipse.osee.executor.admin.ExecutionCallback;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.orcs.data.ReadableArtifact;
import org.eclipse.osee.orcs.data.ReadableAttribute;
@@ -156,21 +157,60 @@ public interface QueryBuilder {
QueryBuilder and(Collection<? extends IAttributeType> attributeTypes, StringOperator operator, CaseType match, String value) throws OseeCoreException;
/**
- * Creates a result set based on query settings
+ * Executes query
*
- * @see LoadLevel level
+ * @return artifact search results
*/
- ResultSet<ReadableArtifact> build(LoadLevel loadLevel) throws OseeCoreException;
+ public ResultSet<ReadableArtifact> getResults() throws OseeCoreException;
/**
- * Creates a result set based on query settings
+ * Executes query
*
- * @see LoadLevel level
+ * @return artifact search results with match locations
*/
- ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>> buildMatches(LoadLevel loadLevel) throws OseeCoreException;
+ public ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>> getMatches() throws OseeCoreException;
/**
- * Count potential results
+ * Count search results
*/
- int getCount() throws OseeCoreException;
+ public int getCount() throws OseeCoreException;
+
+ /**
+ * Schedule a count search results
+ */
+ public Future<Integer> computeCount() throws OseeCoreException;
+
+ /**
+ * Schedule query
+ *
+ * @return artifact search results
+ */
+ public Future<ResultSet<ReadableArtifact>> search() throws OseeCoreException;
+
+ /**
+ * Schedule query and find matching locations
+ *
+ * @return artifact search results with match locations
+ */
+ public Future<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> searchWithMatches() throws OseeCoreException;
+
+ /**
+ * Schedule a count search results with callback
+ */
+ public Future<Integer> computeCount(ExecutionCallback<Integer> callback) throws OseeCoreException;
+
+ /**
+ * Schedule query with callback
+ *
+ * @return artifact search results
+ */
+ public Future<ResultSet<ReadableArtifact>> search(ExecutionCallback<ResultSet<ReadableArtifact>> callback) throws OseeCoreException;
+
+ /**
+ * Schedule query and find matching locations with callback
+ *
+ * @return artifact search results with match locations
+ */
+ public Future<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> searchWithMatches(ExecutionCallback<ResultSet<Match<ReadableArtifact, ReadableAttribute<?>>>> callback) throws OseeCoreException;
+
}

Back to the top