Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-08-04 17:44:34 -0400
committerRoberto E. Escobar2014-09-29 18:55:05 -0400
commit118d50b87fab3db2615d2f23a5d9b7ff8642ecfc (patch)
tree89b10f5c9d507e063f3319410fd312ef8010ef34
parentdcb326ebb42d136dfcf2e550f2323dcfad7979ca (diff)
downloadorg.eclipse.osee-118d50b87fab3db2615d2f23a5d9b7ff8642ecfc.tar.gz
org.eclipse.osee-118d50b87fab3db2615d2f23a5d9b7ff8642ecfc.tar.xz
org.eclipse.osee-118d50b87fab3db2615d2f23a5d9b7ff8642ecfc.zip
refactor[ats_ATS56804]: Simplify artifact searching options
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/user/AtsUserServiceImpl.java12
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java3
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workdef/AtsWorkDefinitionStoreImpl.java4
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java8
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ActionResource.java3
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TeamWorldSearchItem.java3
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java38
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/AbstractAuthenticationProvider.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CaseType.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/MatchTokenCountType.java28
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Operator.java44
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/OptionVisitor.java26
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/QueryOption.java37
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TokenDelimiterMatch.java37
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TokenOrderType.java32
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteriaTest.java18
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java19
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteria.java53
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryOptions.java20
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/QueryStatisticsTest.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeOther.java53
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java44
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java21
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/handlers/SqlHandlerFactoryUtilTest.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcherTest.java228
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScannerTest.java18
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java105
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/CheckedOptions.java93
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/MatcherFactory.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcher.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScanner.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/QueryBuilder.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/OptionConverter.java81
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactory.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactoryImpl.java83
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryBuilderImpl.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/OutputFormat.java18
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/Predicate.java46
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchFlag.java46
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchOp.java46
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchParameters.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchRequest.java25
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/InternalTestSuite.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/dsl/DslTranslatorImplTest.java180
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/dsl/SearchDslTest.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/AttributeTypePredicateHandlerTest.java52
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/ExistsTypePredicateHandlerTest.java43
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/GuidsPredicateHandlerTest.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IdsPredicateHandlerTest.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IsOfTypePredicateHandlerTest.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/RelatedToPredicateHandlerTest.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/TypeEqualsPredicateHandlerTest.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/ArtifactSearch_V1.java66
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslFactory.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslTranslator.java24
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslTranslatorImpl_V1.java104
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/AttributeTypePredicateHandler.java72
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/ExistsTypePredicateHandler.java27
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeSearchTest.java29
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java27
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java4
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java11
-rw-r--r--plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java9
69 files changed, 592 insertions, 1562 deletions
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/user/AtsUserServiceImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/user/AtsUserServiceImpl.java
index d29303bd5e..6dba0c5833 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/user/AtsUserServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/user/AtsUserServiceImpl.java
@@ -71,8 +71,7 @@ public class AtsUserServiceImpl extends AbstractAtsUserService {
IAtsUser atsUser = null;
ResultSet<ArtifactReadable> results =
orcsApi.getQueryFactory(AtsUtilServer.getApplicationContext()).fromBranch(AtsUtilCore.getAtsBranch()).andIsOfType(
- CoreArtifactTypes.User).and(CoreAttributeTypes.UserId,
- org.eclipse.osee.framework.core.enums.Operator.EQUAL, userId).getResults();
+ CoreArtifactTypes.User).and(CoreAttributeTypes.UserId, userId).getResults();
if (!results.isEmpty()) {
ArtifactReadable userArt = results.getExactlyOne();
atsUser = new AtsUser(userArt);
@@ -85,8 +84,7 @@ public class AtsUserServiceImpl extends AbstractAtsUserService {
IAtsUser atsUser = null;
ArtifactReadable userArt =
orcsApi.getQueryFactory(AtsUtilServer.getApplicationContext()).fromBranch(AtsUtilCore.getAtsBranch()).andIsOfType(
- CoreArtifactTypes.User).and(CoreAttributeTypes.Name, org.eclipse.osee.framework.core.enums.Operator.EQUAL,
- name).getResults().getExactlyOne();
+ CoreArtifactTypes.User).and(CoreAttributeTypes.Name, name).getResults().getExactlyOne();
if (userArt != null) {
atsUser = new AtsUser(userArt);
}
@@ -117,8 +115,7 @@ public class AtsUserServiceImpl extends AbstractAtsUserService {
public static ArtifactReadable getCurrentUserArt() throws OseeCoreException {
// TODO Switch to real user
return orcsApi.getQueryFactory(AtsUtilServer.getApplicationContext()).fromBranch(AtsUtilCore.getAtsBranch()).andIsOfType(
- CoreArtifactTypes.User).and(CoreAttributeTypes.UserId, org.eclipse.osee.framework.core.enums.Operator.EQUAL,
- SystemUser.OseeSystem.getUserId()).getResults().getExactlyOne();
+ CoreArtifactTypes.User).and(CoreAttributeTypes.UserId, SystemUser.OseeSystem.getUserId()).getResults().getExactlyOne();
}
@Override
@@ -157,8 +154,7 @@ public class AtsUserServiceImpl extends AbstractAtsUserService {
if (Strings.isValid(userId) && !userId.equals(SystemUser.Guest.getUserId())) {
ResultSet<ArtifactReadable> results =
orcsApi.getQueryFactory(AtsUtilServer.getApplicationContext()).fromBranch(AtsUtilCore.getAtsBranch()).andIsOfType(
- CoreArtifactTypes.User).and(CoreAttributeTypes.UserId,
- org.eclipse.osee.framework.core.enums.Operator.EQUAL, userId).getResults();
+ CoreArtifactTypes.User).and(CoreAttributeTypes.UserId, userId).getResults();
hasPermission = (results.size() == 1);
}
}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java
index 10c8e395d3..bc523fe5f4 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java
@@ -79,8 +79,7 @@ public class AtsUtilServer {
}
public static ArtifactReadable getArtifactByAtsId(OrcsApi orcsApi, String id) {
- return orcsApi.getQueryFactory(null).fromBranch(AtsUtilServer.getAtsBranch()).and(AtsAttributeTypes.AtsId,
- org.eclipse.osee.framework.core.enums.Operator.EQUAL, id).getResults().getOneOrNull();
+ return orcsApi.getQueryFactory(null).fromBranch(AtsUtilServer.getAtsBranch()).and(AtsAttributeTypes.AtsId, id).getResults().getOneOrNull();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workdef/AtsWorkDefinitionStoreImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workdef/AtsWorkDefinitionStoreImpl.java
index 8a1e3ba2e2..ef1ebac51d 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workdef/AtsWorkDefinitionStoreImpl.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workdef/AtsWorkDefinitionStoreImpl.java
@@ -17,7 +17,7 @@ import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.api.workdef.IAtsWorkDefinitionStore;
import org.eclipse.osee.ats.impl.internal.util.AtsUtilServer;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -63,7 +63,7 @@ public class AtsWorkDefinitionStoreImpl implements IAtsWorkDefinitionStore {
private String loadWorkDefinitionFromArtifact(String name) throws OseeCoreException {
ArtifactReadable artifact =
orcsApi.getQueryFactory(null).fromBranch(AtsUtilServer.getAtsBranch()).andTypeEquals(
- AtsArtifactTypes.WorkDefinition).and(CoreAttributeTypes.Name, name, TokenDelimiterMatch.EXACT).getResults().getExactlyOne();
+ AtsArtifactTypes.WorkDefinition).and(CoreAttributeTypes.Name, name, QueryOption.TOKEN_DELIMITER__EXACT).getResults().getExactlyOne();
return loadWorkDefinitionFromArtifact(artifact);
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java
index a798af347b..bd5eb494dd 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java
@@ -47,7 +47,6 @@ import org.eclipse.osee.ats.core.workflow.state.TeamState;
import org.eclipse.osee.ats.core.workflow.transition.TransitionFactory;
import org.eclipse.osee.ats.core.workflow.transition.TransitionHelper;
import org.eclipse.osee.ats.impl.IAtsServer;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.util.AHTML;
@@ -101,10 +100,9 @@ public final class CpaResource {
public List<IAtsCpaDecision> getDecisionByProgram(@PathParam("uuid") String uuid, @QueryParam("open") Boolean open) throws Exception {
List<IAtsCpaDecision> decisions = new ArrayList<IAtsCpaDecision>();
QueryBuilder queryBuilder =
- atsServer.getQuery().andTypeEquals(AtsArtifactTypes.TeamWorkflow).and(AtsAttributeTypes.ProgramUuid,
- Operator.EQUAL, uuid);
+ atsServer.getQuery().andTypeEquals(AtsArtifactTypes.TeamWorkflow).and(AtsAttributeTypes.ProgramUuid, uuid);
if (open != null) {
- queryBuilder.and(AtsAttributeTypes.CurrentStateType, Operator.EQUAL,
+ queryBuilder.and(AtsAttributeTypes.CurrentStateType,
(open ? StateType.Working.name() : StateType.Completed.name()));
}
for (ArtifactReadable art : queryBuilder.getResults()) {
@@ -182,7 +180,7 @@ public final class CpaResource {
@Path("decision")
public Response putDecision(final DecisionUpdate update) throws Exception {
ResultSet<ArtifactReadable> results =
- atsServer.getQuery().and(AtsAttributeTypes.AtsId, Operator.EQUAL, update.getUuids()).getResults();
+ atsServer.getQuery().and(AtsAttributeTypes.AtsId, update.getUuids()).getResults();
IAtsChangeSet changes =
atsServer.getStoreFactory().createAtsChangeSet("Update CPA Decision", AtsCoreUsers.SYSTEM_USER);
for (ArtifactReadable art : results) {
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ActionResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ActionResource.java
index 434aeb16e8..636278715d 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ActionResource.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ActionResource.java
@@ -177,8 +177,7 @@ public final class ActionResource {
}
if (!Strings.isValid(results)) {
for (IAttributeType attrType : Arrays.asList(AtsAttributeTypes.AtsId, AtsAttributeTypes.LegacyPcrId)) {
- ResultSet<ArtifactReadable> legacyQueryResults =
- atsServer.getQuery().and(attrType, org.eclipse.osee.framework.core.enums.Operator.EQUAL, searchId).getResults();
+ ResultSet<ArtifactReadable> legacyQueryResults = atsServer.getQuery().and(attrType, searchId).getResults();
if (legacyQueryResults.size() == 1) {
results =
atsServer.getWorkItemPage().getHtml(legacyQueryResults.getExactlyOne(), "Action - " + searchId,
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 5c96d497fb..704d7b1e8a 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
@@ -34,7 +34,6 @@ import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.core.workflow.state.TeamState;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -133,7 +132,7 @@ public class TeamWorldSearchItem extends WorldUISearchItem {
// If set, add attrType and attrValue to search criteria
if (getAttrValueSearchType() != null && !attrValueSearchOrValues.isEmpty()) {
- criteria.add(new AttributeCriteria(getAttrValueSearchType(), attrValueSearchOrValues, Operator.EQUAL));
+ criteria.add(new AttributeCriteria(getAttrValueSearchType(), attrValueSearchOrValues));
}
if (changeType != null) {
diff --git a/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF
index 3e447790a7..df7a09d7a1 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF
@@ -42,6 +42,7 @@ Import-Package: org.eclipse.core.runtime,
org.eclipse.osee.framework.ui.plugin,
org.eclipse.osee.framework.ui.plugin.util,
org.eclipse.osee.framework.ui.swt,
+ org.eclipse.osee.orcs.rest.client,
org.eclipse.swt.graphics,
org.osgi.framework
Require-Bundle: org.junit,
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
index a29200dba0..b4e387fc65 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.client.integration.tests.integration.skynet.core;
import static org.eclipse.osee.client.demo.DemoChoice.OSEE_CLIENT_DEMO;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
@@ -27,7 +28,9 @@ import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.BranchType;
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.DeletionFlag;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
@@ -44,6 +47,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactMatch;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactSearchCriteria;
import org.eclipse.osee.framework.skynet.core.artifact.search.AttributeCriteria;
+import org.eclipse.osee.framework.skynet.core.artifact.search.QueryBuilderArtifact;
import org.eclipse.osee.framework.skynet.core.artifact.search.QueryOptions;
import org.eclipse.osee.framework.skynet.core.artifact.search.SearchOptions;
import org.eclipse.osee.framework.skynet.core.artifact.search.SearchRequest;
@@ -142,7 +146,7 @@ public class ArtifactQueryTest {
public void testNotTaggableGetArtifactListFromAttributeType() {
List<ArtifactSearchCriteria> criteria = new ArrayList<ArtifactSearchCriteria>();
- criteria.add(new AttributeCriteria(CoreAttributeTypes.FavoriteBranch, "Common"));
+ criteria.add(new AttributeCriteria(CoreAttributeTypes.FavoriteBranch, "Common", QueryOption.TOKEN_DELIMITER__ANY));
// test against a couple of attributes types that are not taggable; expect exception
try {
ArtifactQuery.getArtifactListFromCriteria(BranchManager.getCommonBranch(), 1000, criteria);
@@ -153,14 +157,15 @@ public class ArtifactQueryTest {
try {
ArtifactQuery.getArtifactListFromTypeAndAttribute(CoreArtifactTypes.User, CoreAttributeTypes.Active, "true",
- BranchManager.getCommonBranch());
+ BranchManager.getCommonBranch(), QueryOption.TOKEN_DELIMITER__ANY);
Assert.fail("Should have thrown an exception as the attribute type are not taggable");
} catch (OseeCoreException e) {
Assert.assertTrue(e.getMessage(), Boolean.TRUE);
}
// test against a couple attributes types that are taggable; do not expect exception
criteria.clear();
- criteria.add(new AttributeCriteria(CoreAttributeTypes.Email, "john.doe@somewhere.com"));
+ criteria.add(new AttributeCriteria(CoreAttributeTypes.Email, "john.doe@somewhere.com",
+ QueryOption.TOKEN_DELIMITER__ANY));
try {
ArtifactQuery.getArtifactListFromCriteria(BranchManager.getCommonBranch(), 1000, criteria);
Assert.assertTrue("This attribute type is taggable", Boolean.TRUE);
@@ -170,7 +175,7 @@ public class ArtifactQueryTest {
try {
ArtifactQuery.getArtifactListFromTypeAndAttribute(CoreArtifactTypes.User, CoreAttributeTypes.Notes,
- "My Notes", BranchManager.getCommonBranch());
+ "My Notes", BranchManager.getCommonBranch(), QueryOption.TOKEN_DELIMITER__ANY);
Assert.assertTrue("This attribute type is taggable", Boolean.TRUE);
} catch (OseeCoreException e) {
Assert.fail(e.getMessage());
@@ -265,6 +270,31 @@ public class ArtifactQueryTest {
Assert.assertTrue(found);
}
+ @Test
+ public void testMultipleValues() {
+ QueryBuilderArtifact builder = ArtifactQuery.createQueryBuilder(CoreBranches.COMMON);
+ builder.and(CoreAttributeTypes.Name, Arrays.asList("Everyone", "OseeAdmin"));
+ int count = builder.getCount();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testMultipleValuesIgnoreCase() {
+ QueryBuilderArtifact builder = ArtifactQuery.createQueryBuilder(CoreBranches.COMMON);
+ builder.and(CoreAttributeTypes.Name, Arrays.asList("everyone", "oseeadmin"), QueryOption.CASE__IGNORE);
+ int count = builder.getCount();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testMultipleTypes() {
+ QueryBuilderArtifact builder = ArtifactQuery.createQueryBuilder(CoreBranches.COMMON);
+ builder.and(Arrays.asList(CoreAttributeTypes.Name, CoreAttributeTypes.StaticId), "everyone",
+ QueryOption.CASE__IGNORE);
+ int count = builder.getCount();
+ Assert.assertEquals(1, count);
+ }
+
private String longStr() {
return "Wiki From Wikipedia, the free encyclopedia Jump to: navigation, search This article is about the type of website. For other uses, see Wiki (disambiguation). Not to be confused with Wikipedia. Edit summary redirects here. For edit summaries as used in Wikipedia, see Help:Edit summary. WikiNode redirects here. For the WikiNode of Wikipedia, see Wikipedia:WikiNode. Page semi-protected Ward Cunningham, inventor of the wiki A wiki (Listeni/'w?ki?/ WIK-ee) is a website which allows its users to add, modify, or delete its content via a web browser usually using a simplified markup language or a rich-text editor.[1][2][3] Wikis are powered by wiki software. Most are created collaboratively. Wikis serve many different purposes, such as knowledge management and notetaking. Wikis can be community websites and intranets, for example. Some permit control over different functions (levels of access). For example, editing rights may permit changing, adding or removing material. Others may permit access without enforcing access control. Other rules may also be imposed for organizing content. Ward Cunningham, the developer of the first wiki software, WikiWikiWeb, originally described it as the simplest online database that could possibly work.[4] Wiki (pronounced ['witi] or ['viti]) is a Hawaiian word meaning fast or quick.[5] Contents 1 Characteristics 1.1 Editing wiki pages 1.2 Navigation 1.3 Linking and creating pages 1.4 Searching 2 History 3 Implementations 4 Trust and security 4.1 Controlling changes 4.2 Trustworthiness 4.3 Security 4.3.1 Potential malware vector 5 Communities 5.1 Growth factors 6 Conferences 7 Rules 8 Legal environment 9 See also 10 References 11 Further reading 12 External links Characteristics Ward Cunningham and co-author Bo Leuf, in their book The Wiki Way: Quick Collaboration on the Web, described the essence of the Wiki concept as follows: A wiki invites all users to edit any page or to create new pages within the wiki Web site, using only a plain-vanilla Web browser without any extra add-ons. Wiki promotes meaningful topic associations between different pages by making page link creation almost intuitively easy and showing whether an intended target page exists or not. A wiki is not a carefully crafted site for casual visitors. Instead, it seeks to involve the visitor in an ongoing process of creation and collaboration that constantly changes the Web site landscape. A wiki enables communities to write documents collaboratively, using a simple markup language and a web browser. A single page in a wiki website is referred to as a wiki page, while the entire collection of pages, which are usually well interconnected by hyperlinks, is the wiki. A wiki is essentially a database for creating, browsing, and searching through information. A wiki allows for non-linear, evolving, complex and networked text, argument and interaction.[6] A defining characteristic of wiki technology is the ease with which pages can be created and updated. Generally, there is no review before modifications are accepted. Many wikis are open to alteration by the general public without requiring them to register user accounts. Many edits can be made in real-time and appear almost instantly online. This can facilitate abuse of the system. Private wiki servers require user authentication to edit pages, and sometimes even to read them. Maged N. Kamel Boulos, Cito Maramba and Steve Wheeler write that it is the openness of wikis that gives rise to the concept of 'Darwikinism', which is a concept that describes the 'socially Darwinian process' that wiki pages are subject to. Basically, because of the openness of wikis and the rapidity with which wiki pages can be edited, the pages undergo a natural selection process like that which nature subjects to living organisms. 'Unfit' sentences and sections are ruthlessly culled, edited and replaced if they are not considered 'fit', which hopefully results in the evolution of a higher quality and more relevant page. Whilst such openness may invite 'vandalism' and the posting of untrue information, this same openness also makes it possible to rapidly correct or restore a 'quality' wiki page.[7] Editing wiki pages There are many different ways in which wikis have users edit the content. Ordinarily, the structure and formatting of wiki pages are specified with a simplified markup language, sometimes known as wikitext (for example, starting a line of text with an asterisk often sets up a bulleted list). The style and syntax of wikitexts can vary greatly among wiki implementations, some of which also allow HTML tags. Designers of wikis often take this approach because HTML, with its many cryptic tags, is not very legible, making it hard to edit. Wikis therefore favour plain-text editing, with fewer and simpler conventions than HTML, for indicating style and structure. Although limiting access to HTML and Cascading Style Sheets (CSS) of wikis limits user ability to alter the structure and formatting of wiki content, there are some benefits. Limited access to CSS promotes consistency in the look and feel, and having JavaScript disabled prevents a user from implementing code that may limit access for other users. MediaWiki syntax Equivalent HTML Rendered output Take some more [[tea]], the March Hare said to Alice, very earnestly. I've had '''nothing''' yet, Alice replied in an offended tone, so I can't take more. You mean you can't take ''less''? said the Hatter. It's very easy to take ''more'' than nothing. <p>Take some more <a href=/wiki/Tea title=Tea>tea</a>, the March Hare said to Alice, very earnestly.</p> <p>I've had <b>nothing</b> yet, Alice replied in an offended tone, so I can't take more.</p> <p>You mean you can't take <i>less</i>? said the Hatter. It's very easy to take <i>more</i> than nothing.</p> Take some more tea, the March Hare said to Alice, very earnestly. I've had nothing yet, Alice replied in an offended tone, so I can't take more. You mean you can't take less? said the Hatter. It's very easy to take more than nothing. Increasingly, wikis are making WYSIWYG editing available to users, usually by means of JavaScript or an ActiveX control that translates graphically entered formatting instructions into the corresponding HTML tags or wikitext. In those implementations, the markup of a newly edited, marked-up version of the page is generated and submitted to the server transparently, shielding the user from this technical detail. However, WYSIWYG controls do not always provide all of the features available in wikitext, and some users prefer not to use a WYSIWYG editor. Hence, many of these sites offer some means to edit the wikitext directly. Most wikis keep a record of changes made to wiki pages; often, every version of the page is stored. This means that authors can revert to an older version of the page, should it be necessary because a mistake has been made or the page has been vandalized. Many implementations, like MediaWiki, allow users to supply an edit summary when they edit a page; this is a short piece of text summarising the changes. It is not inserted into the article, but is stored along with that revision of the page, allowing users to explain what has been done and why; this is similar to a log message when making changes to a revision-control system. Navigation Within the text of most pages there are usually a large number of hypertext links to other pages. This form of non-linear navigation is more native to wiki than structured/formalized navigation schemes. That said, users can also create any number of index or table-of-contents pages, with hierarchical categorization or whatever form of organization they like. These may be challenging to maintain by hand, as multiple authors create and delete pages in an ad hoc manner. Wikis generally provide one or more ways to categorize or tag pages to support the maintenance of such index pages. Most wikis have a backlink feature, which displays all pages that link to a given page. It is typical in a wiki to create links to pages that do not yet exist, as a way to invite others to share what they know about a subject new to the wiki. Linking and creating pages Links are created using a specific syntax, the so-called link pattern (also see CURIE). Originally, most wikis used CamelCase to name pages and create links. These are produced by capitalizing words in a phrase and removing the spaces between them (the word CamelCase is itself an example). While CamelCase makes linking very easy, it also leads to links which are written in a form that deviates from the standard spelling. To link to a page with a single-word title, one must abnormally capitalize one of the letters in the word (e.g. WiKi instead of Wiki). CamelCase-based wikis are instantly recognizable because they have many links with names such as TableOfContents and BeginnerQuestions. It is possible for a wiki to render the visible anchor for such links pretty by reinserting spaces, and possibly also reverting to lower case. However, this reprocessing of the link to improve the readability of the anchor is limited by the loss of capitalization information caused by CamelCase reversal. For example, RichardWagner should be rendered as Richard Wagner, whereas PopularMusic should be rendered as popular music. There is no easy way to determine which capital letters should remain capitalized. As a result, many wikis now have free linking using brackets, and some disable CamelCase by default. Searching Most wikis offer at least a title search, and sometimes a full-text search. The scalability of the search depends on whether the wiki engine uses a database. Some wikis, such as PmWiki, use flat files.[8] MediaWiki's first versions used flat files, but it was rewritten by Lee Daniel Crocker in the early 2000s to be a database application. Indexed database access is necessary for high speed searches on large wikis. Alternatively, external search engines such as Google Search can sometimes be used on wikis with limited searching functions in order to obtain more precise results. However, a search engine's indexes can be very out of date (days, weeks or months) for many websites. History Main article: History of wikis Wiki Wiki Shuttle at Honolulu International Airport WikiWikiWeb was the first wiki.[9] Ward Cunningham started developing WikiWikiWeb in Portland, Oregon, in 1994, and installed it on the Internet domain c2.com on March 25, 1995. It was named by Cunningham, who remembered a Honolulu International Airport counter employee telling him to take the Wiki Wiki Shuttle bus that runs between the airport's terminals. According to Cunningham, I chose wiki-wiki as an alliterative substitute for 'quick' and thereby avoided naming this stuff quick-web.[10][11] Cunningham was in part inspired by Apple's HyperCard. Apple had designed a system allowing users to create virtual card stacks supporting links among the various cards. Cunningham developed Vannevar Bush's ideas by allowing users to comment on and change one another's text.[2][12] In the early 2000s, wikis were increasingly adopted in enterprise as collaborative software. Common uses included project communication, intranets, and documentation, initially for technical users. Today some companies use wikis as their only collaborative software and as a replacement for static intranets, and some schools and universities use wikis to enhance group learning. There may be greater use of wikis behind firewalls than on the public Internet. On March 15, 2007, wiki entered the online Oxford English Dictionary.[13] Implementations Wiki software is a type of collaborative software that runs a wiki system, allowing web pages to be created and edited using a common web browser. It is usually implemented as an application server[citation needed] that runs on one or more web servers. The content is stored in a file system, and changes to the content are stored in a relational database management system. A commonly implemented software package is MediaWiki, which runs this encyclopedia. See the List of wiki software for further information. Alternatively, personal wikis run as a standalone application on a single computer. WikidPad is an example. Or even single local HTML file with JavaScript inside like TiddlyWiki. Wikis can also be created on a wiki farm, where the server side software is implemented by the wiki farm owner. PBwiki, Socialtext, Wetpaint, and Wikia are popular examples of such services. Some wiki farms can also make private, password-protected wikis. Note that free wiki farms generally contain advertising on every page. For";
}
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/AbstractAuthenticationProvider.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/AbstractAuthenticationProvider.java
index 003151c010..a9b41de36f 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/AbstractAuthenticationProvider.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/AbstractAuthenticationProvider.java
@@ -15,7 +15,6 @@ import org.eclipse.osee.framework.core.data.TokenFactory;
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.Operator;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.logger.Log;
@@ -54,7 +53,7 @@ public abstract class AbstractAuthenticationProvider implements IAuthenticationP
QueryFactory queryFactory = orcsApi.getQueryFactory(null);
QueryBuilder query =
queryFactory.fromBranch(CoreBranches.COMMON).andIsOfType(CoreArtifactTypes.User).and(
- CoreAttributeTypes.UserId, Operator.EQUAL, userId);
+ CoreAttributeTypes.UserId, userId);
ArtifactReadable artifact = query.getResults().getOneOrNull();
if (artifact != null) {
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CaseType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CaseType.java
deleted file mode 100644
index d9fa1a5cfa..0000000000
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CaseType.java
+++ /dev/null
@@ -1,33 +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.framework.core.enums;
-
-/**
- * @author Ryan D. Brooks
- * @author Roberto E. Escobar
- */
-public enum CaseType implements QueryOption {
- MATCH_CASE,
- IGNORE_CASE;
-
- public boolean isCaseSensitive() {
- return MATCH_CASE == this;
- }
-
- @Override
- public void accept(OptionVisitor visitor) {
- visitor.asCaseType(this);
- }
-
- public static CaseType getCaseType(boolean isCaseSensitive) {
- return isCaseSensitive ? MATCH_CASE : IGNORE_CASE;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/MatchTokenCountType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/MatchTokenCountType.java
deleted file mode 100644
index 81148d5c26..0000000000
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/MatchTokenCountType.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.framework.core.enums;
-
-/**
- * @author John Misinco
- */
-public enum MatchTokenCountType implements QueryOption {
- MATCH_TOKEN_COUNT,
- IGNORE_TOKEN_COUNT;
-
- public boolean isMatchTokenCount() {
- return this == MATCH_TOKEN_COUNT;
- }
-
- @Override
- public void accept(OptionVisitor visitor) {
- visitor.asMatchTokenCountType(this);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Operator.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Operator.java
deleted file mode 100644
index b9a5b43897..0000000000
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Operator.java
+++ /dev/null
@@ -1,44 +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.framework.core.enums;
-
-/**
- * @author Ryan D. Brooks
- */
-public enum Operator {
- EQUAL("="), // Exact Match as in Strings.equals
- NOT_EQUAL("<>"), // inverse of exact match - !Strings.equals
- LESS_THAN("<"),
- GREATER_THAN(">");
-
- private String expression;
-
- private Operator(String expression) {
- this.expression = expression;
- }
-
- public boolean isEquals() {
- return EQUAL == this;
- }
-
- public boolean isNotEquals() {
- return NOT_EQUAL == this;
- }
-
- public boolean isGreaterThanOrLessThan() {
- return GREATER_THAN == this || LESS_THAN == this;
- }
-
- @Override
- public String toString() {
- return expression;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/OptionVisitor.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/OptionVisitor.java
deleted file mode 100644
index 9cd0ac0419..0000000000
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/OptionVisitor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.framework.core.enums;
-
-
-/**
- * @author John Misinco
- */
-public interface OptionVisitor {
-
- void asCaseType(CaseType option);
-
- void asTokenOrderType(TokenOrderType option);
-
- void asMatchTokenCountType(MatchTokenCountType option);
-
- void asTokenDelimiterMatch(TokenDelimiterMatch option);
-}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/QueryOption.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/QueryOption.java
index db3700fca8..b5fbad4613 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/QueryOption.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/QueryOption.java
@@ -13,7 +13,40 @@ package org.eclipse.osee.framework.core.enums;
/**
* @author John Misinco
*/
-public interface QueryOption {
+public enum QueryOption {
+ CASE__MATCH,
+ CASE__IGNORE,
- void accept(OptionVisitor visitor);
+ // these are used for attribute and relation existence
+ EXISTANCE__EXISTS,
+ EXISTANCE__NOT_EXISTS,
+
+ TOKEN_COUNT__MATCH,
+ TOKEN_COUNT__IGNORE,
+
+ // how to tokenize the search
+ TOKEN_DELIMITER__EXACT,
+ TOKEN_DELIMITER__WHITESPACE,
+ TOKEN_DELIMITER__ANY,
+
+ // matching the token order
+ TOKEN_MATCH_ORDER__ANY,
+ TOKEN_MATCH_ORDER__MATCH;
+
+ public static QueryOption getTokenOrderType(boolean matchOrder) {
+ return matchOrder ? TOKEN_MATCH_ORDER__MATCH : TOKEN_MATCH_ORDER__ANY;
+ }
+
+ public static boolean isMatchTokenCount(QueryOption... options) {
+ for (QueryOption option : options) {
+ if (option == TOKEN_COUNT__MATCH) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static QueryOption getCaseType(boolean isCaseSensitive) {
+ return isCaseSensitive ? CASE__MATCH : CASE__IGNORE;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TokenDelimiterMatch.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TokenDelimiterMatch.java
deleted file mode 100644
index 5a4cc3c13d..0000000000
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TokenDelimiterMatch.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.framework.core.enums;
-
-/**
- * @author John Misinco
- */
-public enum TokenDelimiterMatch implements QueryOption {
- EXACT,
- WHITESPACE,
- ANY;
-
- @Override
- public void accept(OptionVisitor visitor) {
- visitor.asTokenDelimiterMatch(this);
- }
-
- public static TokenDelimiterMatch fromString(String delimiter) {
- TokenDelimiterMatch toReturn = ANY;
- for (TokenDelimiterMatch value : values()) {
- if (value.name().equals(delimiter)) {
- toReturn = value;
- break;
- }
- }
- return toReturn;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TokenOrderType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TokenOrderType.java
deleted file mode 100644
index 185c73c48f..0000000000
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TokenOrderType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.framework.core.enums;
-
-/**
- * @author John Misinco
- */
-public enum TokenOrderType implements QueryOption {
- ANY_ORDER,
- MATCH_ORDER;
-
- public boolean isMatchOrder() {
- return MATCH_ORDER == this;
- }
-
- @Override
- public void accept(OptionVisitor visitor) {
- visitor.asTokenOrderType(this);
- }
-
- public static TokenOrderType getTokenOrderType(boolean matchOrder) {
- return matchOrder ? MATCH_ORDER : ANY_ORDER;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteriaTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteriaTest.java
index 9d549c6fc2..837c28d7ee 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteriaTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteriaTest.java
@@ -10,12 +10,13 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact.search;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.verify;
import java.util.Arrays;
import java.util.List;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.Operator;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.rest.client.QueryBuilder;
import org.junit.Test;
@@ -36,17 +37,12 @@ public class AttributeCriteriaTest {
List<String> values = Arrays.asList("true", "false");
criteria = new AttributeCriteria(CoreAttributeTypes.Active, values);
criteria.addToQueryBuilder(builder);
- verify(builder).and(CoreAttributeTypes.Active, Operator.EQUAL, values);
+ verify(builder).and(CoreAttributeTypes.Active, values);
reset(builder);
- criteria = new AttributeCriteria(CoreAttributeTypes.Active, "true", Operator.LESS_THAN);
+ criteria = new AttributeCriteria(CoreAttributeTypes.Active, "true", QueryOption.TOKEN_MATCH_ORDER__ANY);
criteria.addToQueryBuilder(builder);
- verify(builder).and(CoreAttributeTypes.Active, Operator.LESS_THAN, "true");
-
- reset(builder);
- criteria = new AttributeCriteria(CoreAttributeTypes.Active, "true", TokenOrderType.ANY_ORDER);
- criteria.addToQueryBuilder(builder);
- verify(builder).and(CoreAttributeTypes.Active, "true", TokenOrderType.ANY_ORDER);
+ verify(builder).and(CoreAttributeTypes.Active, "true", QueryOption.TOKEN_MATCH_ORDER__ANY);
reset(builder);
criteria = new AttributeCriteria(CoreAttributeTypes.Active, "true");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java
index defa195c2c..7527178465 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java
@@ -35,14 +35,11 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.CaseType;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.enums.RelationSide;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
import org.eclipse.osee.framework.core.model.Branch;
@@ -515,8 +512,8 @@ public class ArtifactQuery {
public static List<Artifact> getArtifactListFromAttributeKeywords(IOseeBranch branch, String queryString, boolean isMatchWordOrder, DeletionFlag deletionFlag, boolean isCaseSensitive, IAttributeType... attributeTypes) throws OseeCoreException {
QueryBuilderArtifact queryBuilder = createQueryBuilder(branch);
queryBuilder.includeDeleted(deletionFlag.areDeletedAllowed());
- QueryOption matchCase = CaseType.getCaseType(isCaseSensitive);
- QueryOption matchWordOrder = TokenOrderType.getTokenOrderType(isMatchWordOrder);
+ QueryOption matchCase = QueryOption.getCaseType(isCaseSensitive);
+ QueryOption matchWordOrder = QueryOption.getTokenOrderType(isMatchWordOrder);
Collection<IAttributeType> typesToSearch =
attributeTypes.length == 0 ? Collections.singleton(QueryBuilder.ANY_ATTRIBUTE_TYPE) : Arrays.asList(attributeTypes);
queryBuilder.and(typesToSearch, queryString, matchCase, matchWordOrder);
@@ -539,13 +536,13 @@ public class ArtifactQuery {
QueryBuilderArtifact queryBuilder = createQueryBuilder(searchRequest.getBranch());
SearchOptions options = searchRequest.getOptions();
queryBuilder.includeDeleted(options.getDeletionFlag().areDeletedAllowed());
- QueryOption matchCase = CaseType.getCaseType(options.isCaseSensitive());
- QueryOption matchWordOrder = TokenOrderType.getTokenOrderType(options.isMatchWordOrder());
- QueryOption matchExact = TokenDelimiterMatch.ANY;
+ QueryOption matchCase = QueryOption.getCaseType(options.isCaseSensitive());
+ QueryOption matchWordOrder = QueryOption.getTokenOrderType(options.isMatchWordOrder());
+ QueryOption matchExact = QueryOption.TOKEN_DELIMITER__ANY;
if (options.isExactMatch()) {
- matchCase = CaseType.MATCH_CASE;
- matchWordOrder = TokenOrderType.MATCH_ORDER;
- matchExact = TokenDelimiterMatch.EXACT;
+ matchCase = QueryOption.CASE__MATCH;
+ matchWordOrder = QueryOption.TOKEN_MATCH_ORDER__MATCH;
+ matchExact = QueryOption.TOKEN_DELIMITER__EXACT;
}
Collection<IAttributeType> typesToSearch =
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteria.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteria.java
index 59782df977..65dac52ef6 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteria.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteria.java
@@ -12,10 +12,10 @@ package org.eclipse.osee.framework.skynet.core.artifact.search;
import java.util.Collection;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.orcs.rest.client.QueryBuilder;
@@ -27,7 +27,6 @@ public class AttributeCriteria implements ArtifactSearchCriteria {
private final IAttributeType attributeType;
private String value;
private Collection<String> values;
- private final Operator operator;
private final QueryOption[] options;
public IAttributeType getAttributeType() {
@@ -42,10 +41,6 @@ public class AttributeCriteria implements ArtifactSearchCriteria {
return values;
}
- public Operator getOperator() {
- return operator;
- }
-
public QueryOption[] getOptions() {
return options;
}
@@ -57,33 +52,15 @@ public class AttributeCriteria implements ArtifactSearchCriteria {
* @param value to search;
*/
public AttributeCriteria(IAttributeType attributeType, String value, QueryOption... options) {
- this(attributeType, value, null, Operator.EQUAL, options);
+ this(attributeType, value, null, options);
}
/**
* Constructor for search criteria that finds an attribute of the given type and any value (i.e. checks for
* existence)
*/
- public AttributeCriteria(IAttributeType attributeType) {
- this(attributeType, null, null, Operator.EQUAL);
- }
-
- /**
- * Constructor for search criteria that finds an attribute of the given type with its current value exactly equal to
- * any one of the given literal values. If the list only contains one value, then the search is conducted exactly as
- * if the single value constructor was called. This search does not support the wildcard for multiple values. Throws
- * OseeArgumentException values is empty or null
- */
- public AttributeCriteria(IAttributeType attributeType, Collection<String> values) throws OseeCoreException {
- this(attributeType, null, validate(values), Operator.EQUAL);
- }
-
- /**
- * Constructor for search criteria that finds an attribute of the given type with its current value relative to the
- * given value based on the operator provided.
- */
- public AttributeCriteria(IAttributeType attributeType, String value, Operator operator) {
- this(attributeType, value, null, operator);
+ public AttributeCriteria(IAttributeType attributeType, QueryOption... options) {
+ this(attributeType, null, null, options);
}
/**
@@ -92,8 +69,8 @@ public class AttributeCriteria implements ArtifactSearchCriteria {
* conducted exactly as if the single value constructor was called. This search does not support the wildcard for
* multiple values.
*/
- public AttributeCriteria(IAttributeType attributeType, Collection<String> values, Operator operator) throws OseeCoreException {
- this(attributeType, null, validate(values), operator);
+ public AttributeCriteria(IAttributeType attributeType, Collection<String> values) throws OseeCoreException {
+ this(attributeType, null, validate(values));
}
private static Collection<String> validate(Collection<String> values) throws OseeArgumentException {
@@ -103,10 +80,10 @@ public class AttributeCriteria implements ArtifactSearchCriteria {
return values;
}
- public AttributeCriteria(IAttributeType attributeType, String value, Collection<String> values, Operator operator, QueryOption... options) {
+ public AttributeCriteria(IAttributeType attributeType, String value, Collection<String> values, QueryOption... options) {
this.attributeType = attributeType;
- if (values == null) {
+ if (!Conditions.hasValues(values)) {
this.value = value;
} else {
if (values.size() == 1) {
@@ -115,9 +92,7 @@ public class AttributeCriteria implements ArtifactSearchCriteria {
this.values = values;
}
}
- this.operator = operator;
-
- if (this.value != null && operator == Operator.EQUAL && options.length == 0) {
+ if (this.value != null && options.length == 0) {
this.options = QueryOptions.EXACT_MATCH_OPTIONS;
} else {
this.options = options;
@@ -133,8 +108,6 @@ public class AttributeCriteria implements ArtifactSearchCriteria {
strB.append("*");
}
strB.append(" ");
- strB.append(operator);
- strB.append(" ");
if (value != null) {
strB.append(value);
}
@@ -145,13 +118,9 @@ public class AttributeCriteria implements ArtifactSearchCriteria {
@Override
public void addToQueryBuilder(QueryBuilder builder) throws OseeCoreException {
if (Strings.isValid(getValue())) {
- if (getOperator() == Operator.EQUAL) {
- builder.and(getAttributeType(), getValue(), getOptions());
- } else {
- builder.and(getAttributeType(), getOperator(), getValue());
- }
+ builder.and(getAttributeType(), getValue(), getOptions());
} else if (getValues() != null) {
- builder.and(getAttributeType(), getOperator(), getValues());
+ builder.and(getAttributeType(), getValues(), getOptions());
} else {
builder.andExists(getAttributeType());
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryOptions.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryOptions.java
index 9e243b6ea1..1dde801b1a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryOptions.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryOptions.java
@@ -10,11 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact.search;
-import org.eclipse.osee.framework.core.enums.CaseType;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
import org.eclipse.osee.framework.core.enums.QueryOption;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
/**
* @author John Misinco
@@ -22,14 +18,14 @@ import org.eclipse.osee.framework.core.enums.TokenOrderType;
public final class QueryOptions {
public static final QueryOption[] EXACT_MATCH_OPTIONS = {
- CaseType.MATCH_CASE,
- TokenOrderType.MATCH_ORDER,
- TokenDelimiterMatch.EXACT,
- MatchTokenCountType.MATCH_TOKEN_COUNT};
+ QueryOption.CASE__MATCH,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_DELIMITER__EXACT,
+ QueryOption.TOKEN_COUNT__MATCH};
public static final QueryOption[] CONTAINS_MATCH_OPTIONS = {
- CaseType.IGNORE_CASE,
- TokenOrderType.MATCH_ORDER,
- TokenDelimiterMatch.ANY,
- MatchTokenCountType.IGNORE_TOKEN_COUNT};
+ QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_COUNT__IGNORE};
}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java
index c2fb4d9910..5b2887a8b7 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java
@@ -21,7 +21,6 @@ import org.eclipse.osee.account.admin.CreateAccountRequest;
import org.eclipse.osee.account.admin.ds.AccountStorage;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.Identifiable;
import org.eclipse.osee.framework.jdk.core.type.Identity;
@@ -105,7 +104,7 @@ public class OrcsAccountStorage extends AbstractOrcsStorage implements AccountSt
@Override
public ResultSet<Account> getAccountByEmail(String email) {
ResultSet<ArtifactReadable> results =
- newQuery().andIsOfType(CoreArtifactTypes.User).and(CoreAttributeTypes.Email, Operator.EQUAL, email).getResults();
+ newQuery().andIsOfType(CoreArtifactTypes.User).and(CoreAttributeTypes.Email, email).getResults();
return getFactory().newAccountResultSet(results);
}
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/QueryStatisticsTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/QueryStatisticsTest.java
index 834d0e0893..f64b0246a9 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/QueryStatisticsTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/QueryStatisticsTest.java
@@ -13,11 +13,8 @@ package org.eclipse.osee.orcs.core.internal.search;
import java.util.Collection;
import java.util.Collections;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.CaseType;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
@@ -51,8 +48,8 @@ public class QueryStatisticsTest {
private static QueryData createQueryData(String value) {
QueryData queryData = new QueryData(new CriteriaSet(), OptionsUtil.createOptions());
Collection<? extends IAttributeType> types = Collections.singleton(CoreAttributeTypes.Name);
- queryData.addCriteria(new CriteriaAttributeKeywords(false, types, null, value, TokenDelimiterMatch.ANY,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, CaseType.MATCH_CASE));
+ queryData.addCriteria(new CriteriaAttributeKeywords(false, types, null, value, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE, QueryOption.CASE__MATCH));
return queryData;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeOther.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeOther.java
index edd0fa7e81..a7c4c28324 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeOther.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeOther.java
@@ -10,63 +10,76 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.ds.criteria;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.Operator;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.orcs.core.ds.Criteria;
import org.eclipse.osee.orcs.core.ds.Options;
import org.eclipse.osee.orcs.search.QueryBuilder;
+import com.google.common.collect.Lists;
/**
* @author Roberto E. Escobar
*/
public class CriteriaAttributeOther extends Criteria {
- private final IAttributeType attributeType;
+ public static final List<QueryOption> VALID_OPTIONS = Arrays.asList(QueryOption.TOKEN_COUNT__MATCH,
+ QueryOption.TOKEN_DELIMITER__EXACT, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.CASE__IGNORE,
+ QueryOption.CASE__MATCH);
+
+ private final Collection<IAttributeType> attributeTypes;
private final Collection<String> values;
- private final Operator operator;
+ private final List<QueryOption> options;
- public CriteriaAttributeOther(IAttributeType attributeType, Collection<String> values, Operator operator) {
+ public CriteriaAttributeOther(Collection<IAttributeType> attributeTypes, Collection<String> values, QueryOption... options) {
super();
- this.attributeType = attributeType;
+ this.attributeTypes = attributeTypes;
this.values = values;
- this.operator = operator;
+ this.options = Lists.newArrayList(options);
}
- public IAttributeType getAttributeType() {
- return attributeType;
+ public Collection<IAttributeType> getAttributeTypes() {
+ return attributeTypes;
}
public Collection<String> getValues() {
return values;
}
- public Operator getOperator() {
- return operator;
+ public List<QueryOption> getOptions() {
+ return options;
}
@Override
public void checkValid(Options options) throws OseeCoreException {
- Conditions.checkNotNull(getAttributeType(), "attributeType");
- Conditions.checkExpressionFailOnTrue(getAttributeType().equals(QueryBuilder.ANY_ATTRIBUTE_TYPE),
+ Conditions.checkNotNullOrEmptyOrContainNull(getAttributeTypes(), "attributeType");
+ Conditions.checkExpressionFailOnTrue(getAttributeTypes().equals(QueryBuilder.ANY_ATTRIBUTE_TYPE),
"Any attribute type is not allowed");
- Operator operator = getOperator();
- for (String value : getValues()) {
- if (value != null && value.contains("%") && operator.isGreaterThanOrLessThan()) {
- throw new OseeArgumentException(
- "When value contains %%, one of the following operators must be used: %s, %s", Operator.EQUAL,
- Operator.NOT_EQUAL);
- }
+ List<QueryOption> unsupportedOptions = getUnsupportedOptions();
+ if (unsupportedOptions.size() != 0) {
+ throw new OseeArgumentException("Invalid QueryOptions present: [%s]", Collections.toString(",",
+ unsupportedOptions));
}
}
+ private List<QueryOption> getUnsupportedOptions() {
+ ArrayList<QueryOption> selectedOptions = Lists.newArrayList(options);
+ selectedOptions.removeAll(VALID_OPTIONS);
+ return selectedOptions;
+ }
+
@Override
public String toString() {
- return "CriteriaAttributeOther [attributeType=" + attributeType + ", values=" + values + ", operator=" + operator + "]";
+ return "CriteriaAttributeOther [attributeTypes=" + Collections.toString(",", attributeTypes) + ", values=" + values + ", options=" + Collections.toString(
+ ",", options) + "]";
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java
index 04bd687f2e..2818eef617 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.search;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
@@ -18,12 +19,7 @@ import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
-import org.eclipse.osee.framework.core.enums.CaseType;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.enums.QueryOption;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.Criteria;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAllArtifacts;
@@ -41,12 +37,14 @@ import org.eclipse.osee.orcs.core.ds.criteria.CriteriaRelationTypeSideNotExists;
import org.eclipse.osee.orcs.data.ArtifactTypes;
import org.eclipse.osee.orcs.data.AttributeTypes;
import org.eclipse.osee.orcs.search.QueryBuilder;
+import com.google.common.collect.Lists;
/**
* @author Roberto E. Escobar
*/
public class CriteriaFactory {
+ private static final int MAX_EXACT_SEARCH_LEN = 4000;
private final ArtifactTypes artifactTypeCache;
private final AttributeTypes attributeTypeCache;
@@ -87,19 +85,37 @@ public class CriteriaFactory {
return new CriteriaRelationTypeSideNotExists(relationTypeSide);
}
- public Criteria createAttributeCriteria(IAttributeType attributeType, Operator operator, Collection<String> values) throws OseeCoreException {
- if (operator == Operator.EQUAL) {
- return createAttributeCriteria(Collections.singleton(attributeType), values, CaseType.MATCH_CASE,
- TokenOrderType.MATCH_ORDER, TokenDelimiterMatch.EXACT, MatchTokenCountType.MATCH_TOKEN_COUNT);
+ public Criteria createAttributeCriteria(IAttributeType attributeType, Collection<String> values, QueryOption... options) throws OseeCoreException {
+ return createAttributeCriteria(Collections.singleton(attributeType), values, options);
+ }
+
+ public Criteria createAttributeCriteria(Collection<IAttributeType> attributeTypes, Collection<String> values, QueryOption... options) throws OseeCoreException {
+ if (isExactMatch(options) && checkSearchLength(values)) {
+ return new CriteriaAttributeOther(attributeTypes, values, options);
} else {
- return new CriteriaAttributeOther(attributeType, values, operator);
+ Collection<? extends IAttributeType> types = checkForAnyType(attributeTypes);
+ boolean isIncludeAllTypes = attributeTypes.contains(QueryBuilder.ANY_ATTRIBUTE_TYPE);
+ return new CriteriaAttributeKeywords(isIncludeAllTypes, types, attributeTypeCache, values, options);
}
}
- public Criteria createAttributeCriteria(Collection<? extends IAttributeType> attributeTypes, Collection<String> values, QueryOption... options) throws OseeCoreException {
- Collection<? extends IAttributeType> types = checkForAnyType(attributeTypes);
- boolean isIncludeAllTypes = attributeTypes.contains(QueryBuilder.ANY_ATTRIBUTE_TYPE);
- return new CriteriaAttributeKeywords(isIncludeAllTypes, types, attributeTypeCache, values, options);
+ private boolean checkSearchLength(Collection<String> values) {
+ for (String value : values) {
+ if (value.length() > MAX_EXACT_SEARCH_LEN) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean isExactMatch(QueryOption[] options) {
+ ArrayList<QueryOption> optionsList = Lists.newArrayList(options);
+ optionsList.removeAll(CriteriaAttributeOther.VALID_OPTIONS);
+ if (optionsList.size() == 0) {
+ return true;
+ } else {
+ return false;
+ }
}
public Criteria createArtifactTypeCriteria(Collection<? extends IArtifactType> artifactTypes) throws OseeCoreException {
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 a7a5d503bb..0480a719a0 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
@@ -21,7 +21,6 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.jdk.core.type.Identifiable;
@@ -247,28 +246,18 @@ public class QueryBuilderImpl implements QueryBuilder {
}
@Override
- public QueryBuilder and(IAttributeType attributeType, Operator operator, String value) throws OseeCoreException {
- Criteria criteria =
- criteriaFactory.createAttributeCriteria(attributeType, operator, Collections.singleton(value));
- return addAndCheck(getQueryData(), criteria);
- }
-
- @Override
- public QueryBuilder and(IAttributeType attributeType, Operator operator, Collection<String> values) throws OseeCoreException {
- Criteria criteria = criteriaFactory.createAttributeCriteria(attributeType, operator, values);
+ public QueryBuilder and(IAttributeType attributeType, Collection<String> values, QueryOption... options) throws OseeCoreException {
+ Criteria criteria = criteriaFactory.createAttributeCriteria(attributeType, values, options);
return addAndCheck(getQueryData(), criteria);
}
@Override
public QueryBuilder and(IAttributeType attributeType, String value, QueryOption... options) throws OseeCoreException {
- Criteria criteria =
- criteriaFactory.createAttributeCriteria(Collections.singleton(attributeType), Collections.singleton(value),
- options);
- return addAndCheck(getQueryData(), criteria);
+ return and(Collections.singleton(attributeType), value, options);
}
@Override
- public QueryBuilder and(Collection<? extends IAttributeType> attributeTypes, String value, QueryOption... options) throws OseeCoreException {
+ public QueryBuilder and(Collection<IAttributeType> attributeTypes, String value, QueryOption... options) throws OseeCoreException {
Criteria criteria =
criteriaFactory.createAttributeCriteria(attributeTypes, Collections.singleton(value), options);
return addAndCheck(getQueryData(), criteria);
@@ -282,7 +271,7 @@ public class QueryBuilderImpl implements QueryBuilder {
@Override
public QueryBuilder andNameEquals(String artifactName) throws OseeCoreException {
- return and(CoreAttributeTypes.Name, Operator.EQUAL, artifactName);
+ return and(CoreAttributeTypes.Name, artifactName);
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java
index 2be2358d5b..e3b235f389 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java
@@ -17,18 +17,15 @@ import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.when;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.osee.executor.admin.ExecutorAdmin;
-import org.eclipse.osee.framework.core.enums.CaseType;
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.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.Operator;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.AbstractJoinQuery;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -89,15 +86,16 @@ public class ArtifactQuerySqlContextFactoryImplTest {
private static final Criteria GUIDS = new CriteriaArtifactGuids(asList(GUID.create(), GUID.create()));
private static final Criteria IDS = new CriteriaArtifactIds(asList(1, 2, 3, 4, 5));
private static final Criteria TYPES = new CriteriaArtifactType(null, asList(CoreArtifactTypes.CodeUnit), false);
- private static final Criteria ATTRIBUTE = new CriteriaAttributeOther(CoreAttributeTypes.Name, asList("Hello"),
- Operator.EQUAL);
+ private static final Criteria ATTRIBUTE = new CriteriaAttributeOther(Collections.singleton(CoreAttributeTypes.Name),
+ asList("Hello"));
private static final Criteria ATTR_TYPE_EXITS = new CriteriaAttributeTypeExists(asList(CoreAttributeTypes.Name));
private static final Criteria REL_TYPE_EXISTS = new CriteriaRelationTypeExists(
CoreRelationTypes.Default_Hierarchical__Child);
private static final Criteria ATTRIBUTE_KEYWORD = new CriteriaAttributeKeywords(false, asList(
CoreAttributeTypes.Name, CoreAttributeTypes.WordTemplateContent), null, QUICK_SEARCH_VALUE,
- TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, CaseType.MATCH_CASE);
+ QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE,
+ QueryOption.CASE__MATCH);
private static final Criteria RELATED_TO = new CriteriaRelatedTo(CoreRelationTypes.Default_Hierarchical__Child,
asList(45, 61));
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/handlers/SqlHandlerFactoryUtilTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/handlers/SqlHandlerFactoryUtilTest.java
index 012c4163fe..5af73b0c3c 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/handlers/SqlHandlerFactoryUtilTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/handlers/SqlHandlerFactoryUtilTest.java
@@ -69,7 +69,7 @@ public class SqlHandlerFactoryUtilTest {
criteria.add(new CriteriaArtifactType(null, null, true));
criteria.add(new CriteriaRelationTypeExists(null));
criteria.add(new CriteriaAttributeTypeExists(null));
- criteria.add(new CriteriaAttributeOther(null, null, null));
+ criteria.add(new CriteriaAttributeOther(null, null));
criteria.add(new CriteriaAttributeKeywords(false, null, null, Collections.<String> emptyList(), null, null, null));
criteria.add(new CriteriaRelatedTo(null, null));
criteria.add(new CriteriaAllArtifacts());
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcherTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcherTest.java
index c47dad391d..b5745dae8f 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcherTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcherTest.java
@@ -16,10 +16,7 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.eclipse.osee.framework.core.enums.CaseType;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.orcs.db.internal.search.SearchAsserts;
import org.eclipse.osee.orcs.db.internal.search.tagger.StreamMatcher;
@@ -37,14 +34,14 @@ public class SecondPassMatcherTest {
private final String toSearch;
private final String data;
private final List<MatchLocation> expected;
- private final CaseType caseType;
+ private final QueryOption caseType;
private final boolean findAllMatchLocations;
private final StreamMatcher matcher;
- private final TokenDelimiterMatch delimiter;
- private final TokenOrderType order;
- private final MatchTokenCountType countType;
+ private final QueryOption delimiter;
+ private final QueryOption order;
+ private final QueryOption countType;
- public SecondPassMatcherTest(StreamMatcher matcher, String data, String toSearch, CaseType caseType, TokenDelimiterMatch delimiter, TokenOrderType order, MatchTokenCountType countType, boolean findAllMatchLocations, List<MatchLocation> expected) {
+ public SecondPassMatcherTest(StreamMatcher matcher, String data, String toSearch, QueryOption caseType, QueryOption delimiter, QueryOption order, QueryOption countType, boolean findAllMatchLocations, List<MatchLocation> expected) {
this.toSearch = toSearch;
this.data = data;
this.caseType = caseType;
@@ -71,128 +68,137 @@ public class SecondPassMatcherTest {
StreamMatcher matcher = MatcherFactory.createMatcher();
// MATCH_ORDER tests
- addTest(data, matcher, "THIS", "THIS", CaseType.MATCH_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, false, getLocs(1, 4));
- addTest(data, matcher, "THIS", "this", CaseType.MATCH_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, false, getLocs());
- addTest(data, matcher, "THIS", "this", CaseType.IGNORE_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, false, getLocs(1, 4));
- addTest(data, matcher, "THIS bot", "this", CaseType.IGNORE_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, false, getLocs());
- addTest(data, matcher, "What does this mean", "this", CaseType.MATCH_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, false, getLocs(12, 15));
- addTest(data, matcher, "What does this mean", "what does", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, false,
- getLocs(1, 11));
- addTest(data, matcher, "What does this mean", "what does", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, false,
- getLocs());
- addTest(data, matcher, "What does", "what does", CaseType.IGNORE_CASE, TokenDelimiterMatch.WHITESPACE,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, false, getLocs(1, 13));
- addTest(data, matcher, "What->does] .this. mean", "What does tHis", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, false,
- getLocs(1, 17));
- addTest(data, matcher, "does does does", "does does", CaseType.IGNORE_CASE, TokenDelimiterMatch.WHITESPACE,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, false, getLocs());
- addTest(data, matcher, " does does does", "does does", CaseType.IGNORE_CASE, TokenDelimiterMatch.WHITESPACE,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, false, getLocs(4, 12));
+ addTest(data, matcher, "THIS", "THIS", QueryOption.CASE__MATCH, QueryOption.TOKEN_DELIMITER__EXACT,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH, false, getLocs(1, 4));
+ addTest(data, matcher, "THIS", "this", QueryOption.CASE__MATCH, QueryOption.TOKEN_DELIMITER__EXACT,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH, false, getLocs());
+ addTest(data, matcher, "THIS", "this", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__EXACT,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH, false, getLocs(1, 4));
+ addTest(data, matcher, "THIS bot", "this", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__EXACT,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH, false, getLocs());
+ addTest(data, matcher, "What does this mean", "this", QueryOption.CASE__MATCH,
+ QueryOption.TOKEN_DELIMITER__EXACT, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE,
+ false, getLocs(12, 15));
+ addTest(data, matcher, "What does this mean", "what does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_COUNT__IGNORE, false, getLocs(1, 11));
+ addTest(data, matcher, "What does this mean", "what does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH,
+ false, getLocs());
+ addTest(data, matcher, "What does", "what does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH,
+ false, getLocs(1, 13));
+ addTest(data, matcher, "What->does] .this. mean", "What does tHis", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE,
+ false, getLocs(1, 17));
+ addTest(data, matcher, "does does does", "does does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH,
+ false, getLocs());
+ addTest(data, matcher, " does does does", "does does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_COUNT__IGNORE, false, getLocs(4, 12));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_ID] Selected -> ", "SELECTED_STRING_ID",
- CaseType.IGNORE_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, false, getLocs(18, 35));
+ QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_COUNT__IGNORE, false, getLocs(18, 35));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_ID] Selected -> ", "SELECTED_STRING_ID",
- CaseType.MATCH_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, false, getLocs(18, 35));
+ QueryOption.CASE__MATCH, QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_COUNT__IGNORE, false, getLocs(18, 35));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_IWRONG SELECTED_STRING_ID_TWO] Selected -> ",
- "SELECTED_STRING_ID", CaseType.MATCH_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, false, getLocs(41, 58));
+ "SELECTED_STRING_ID", QueryOption.CASE__MATCH, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE, false, getLocs(41, 58));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_IWRONG SELECTED_STRING_ID_TWO] Selected -> ",
- "SELECTED_STRING_ID", CaseType.IGNORE_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, false, getLocs(41, 58));
+ "SELECTED_STRING_ID", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE, false, getLocs(41, 58));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_IWRONG SELECTED_STRING_\nID_TWO] Selected -> ",
- "SELECTED_STRING_ID", CaseType.IGNORE_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, false, getLocs(41, 59));
-
- addTest(data, matcher, "THIS", "THIS", CaseType.MATCH_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, true, getLocs(1, 4));
- addTest(data, matcher, "THIS", "this", CaseType.MATCH_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, true, getLocs());
- addTest(data, matcher, "THIS", "this", CaseType.IGNORE_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, true, getLocs(1, 4));
- addTest(data, matcher, "THIS bot", "this", CaseType.IGNORE_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, true, getLocs());
- addTest(data, matcher, "What does this mean", "this", CaseType.MATCH_CASE, TokenDelimiterMatch.EXACT,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(12, 15));
- addTest(data, matcher, "What does this mean", "what does", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true,
- getLocs(1, 11));
- addTest(data, matcher, "What does this mean", "what does", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, true,
- getLocs());
- addTest(data, matcher, "What does", "what does", CaseType.IGNORE_CASE, TokenDelimiterMatch.WHITESPACE,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, true, getLocs(1, 13));
- addTest(data, matcher, "What->does] .this. mean", "What does tHis", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true,
+ "SELECTED_STRING_ID", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE, false, getLocs(41, 59));
+
+ addTest(data, matcher, "THIS", "THIS", QueryOption.CASE__MATCH, QueryOption.TOKEN_DELIMITER__EXACT,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH, true, getLocs(1, 4));
+ addTest(data, matcher, "THIS", "this", QueryOption.CASE__MATCH, QueryOption.TOKEN_DELIMITER__EXACT,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH, true, getLocs());
+ addTest(data, matcher, "THIS", "this", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__EXACT,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH, true, getLocs(1, 4));
+ addTest(data, matcher, "THIS bot", "this", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__EXACT,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH, true, getLocs());
+ addTest(data, matcher, "What does this mean", "this", QueryOption.CASE__MATCH,
+ QueryOption.TOKEN_DELIMITER__EXACT, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE,
+ true, getLocs(12, 15));
+ addTest(data, matcher, "What does this mean", "what does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(1, 11));
+ addTest(data, matcher, "What does this mean", "what does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH,
+ true, getLocs());
+ addTest(data, matcher, "What does", "what does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH,
+ true, getLocs(1, 13));
+ addTest(data, matcher, "What->does] .this. mean", "What does tHis", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE, true,
getLocs(1, 17));
- addTest(data, matcher, "does does does", "does does", CaseType.IGNORE_CASE, TokenDelimiterMatch.WHITESPACE,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, true, getLocs());
- addTest(data, matcher, " does does does", "does does", CaseType.IGNORE_CASE, TokenDelimiterMatch.WHITESPACE,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(4, 12));
+ addTest(data, matcher, "does does does", "does does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__MATCH,
+ true, getLocs());
+ addTest(data, matcher, " does does does", "does does", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(4, 12));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_ID] Selected -> ", "SELECTED_STRING_ID",
- CaseType.IGNORE_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(18, 35));
+ QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(18, 35));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_ID] Selected -> ", "SELECTED_STRING_ID",
- CaseType.MATCH_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(18, 35));
+ QueryOption.CASE__MATCH, QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__MATCH,
+ QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(18, 35));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_IWRONG SELECTED_STRING_ID_TWO] Selected -> ",
- "SELECTED_STRING_ID", CaseType.MATCH_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(41, 58));
+ "SELECTED_STRING_ID", QueryOption.CASE__MATCH, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(41, 58));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_IWRONG SELECTED_STRING_ID_TWO] Selected -> ",
- "SELECTED_STRING_ID", CaseType.IGNORE_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(41, 58));
+ "SELECTED_STRING_ID", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(41, 58));
addTest(data, matcher, " (Selected) -> [.SELECTED_STRING_IWRONG SELECTED_STRING_\nID_TWO] Selected -> ",
- "SELECTED_STRING_ID", CaseType.IGNORE_CASE, TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(41, 59));
+ "SELECTED_STRING_ID", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(41, 59));
// ANY_ORDER tests
- addTest(data, matcher, "each token should match", "should token match each", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.ANY_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, false,
- getLocs(1, 4, 6, 10, 12, 17, 19, 23));
- addTest(data, matcher, "each token should match extra token", "should token match each", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.ANY_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, false,
- getLocs(1, 4, 6, 10, 12, 17, 19, 23));
- addTest(data, matcher, "each token should match extra token", "should token match each", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.ANY_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, false,
+ addTest(data, matcher, "each token should match", "should token match each", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__ANY, QueryOption.TOKEN_COUNT__IGNORE,
+ false, getLocs(1, 4, 6, 10, 12, 17, 19, 23));
+ addTest(data, matcher, "each token should match extra token", "should token match each",
+ QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__ANY,
+ QueryOption.TOKEN_COUNT__IGNORE, false, getLocs(1, 4, 6, 10, 12, 17, 19, 23));
+ addTest(data, matcher, "each token should match extra token", "should token match each",
+ QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__ANY,
+ QueryOption.TOKEN_COUNT__MATCH, false, getLocs());
+ addTest(data, matcher, "each token should match ToKen", "should token match each", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__ANY, QueryOption.TOKEN_COUNT__IGNORE,
+ true, getLocs(1, 4, 6, 10, 12, 17, 19, 23, 27, 31));
+ addTest(data, matcher, "each each should extra token", "should token match each", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__ANY, QueryOption.TOKEN_COUNT__IGNORE, false,
getLocs());
- addTest(data, matcher, "each token should match ToKen", "should token match each", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.ANY_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true,
- getLocs(1, 4, 6, 10, 12, 17, 19, 23, 27, 31));
- addTest(data, matcher, "each each should extra token", "should token match each", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.ANY, TokenOrderType.ANY_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, false, getLocs());
-
- addTest(data, matcher, "each token should match", "should token match each", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.ANY_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true,
- getLocs(1, 4, 6, 10, 12, 17, 19, 23));
- addTest(data, matcher, "each token should match extra token", "should token match each", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.ANY_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true,
- getLocs(1, 4, 6, 10, 12, 17, 19, 23, 31, 35));
- addTest(data, matcher, "each token should match extra token", "should token match each", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.WHITESPACE, TokenOrderType.ANY_ORDER, MatchTokenCountType.MATCH_TOKEN_COUNT, true,
- getLocs());
- addTest(data, matcher, "each each should extra token", "should token match each", CaseType.IGNORE_CASE,
- TokenDelimiterMatch.ANY, TokenOrderType.ANY_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs());
- addTest(data, matcher, "Robot API", "Robot", CaseType.MATCH_CASE, TokenDelimiterMatch.ANY,
- TokenOrderType.MATCH_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(1, 5));
+ addTest(data, matcher, "each token should match", "should token match each", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__ANY, QueryOption.TOKEN_COUNT__IGNORE,
+ true, getLocs(1, 4, 6, 10, 12, 17, 19, 23));
+ addTest(data, matcher, "each token should match extra token", "should token match each",
+ QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__ANY,
+ QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(1, 4, 6, 10, 12, 17, 19, 23, 31, 35));
+ addTest(data, matcher, "each token should match extra token", "should token match each",
+ QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__WHITESPACE, QueryOption.TOKEN_MATCH_ORDER__ANY,
+ QueryOption.TOKEN_COUNT__MATCH, true, getLocs());
+ addTest(data, matcher, "each each should extra token", "should token match each", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__ANY, QueryOption.TOKEN_COUNT__IGNORE, true,
+ getLocs());
- addTest(data, matcher, "Joe Smith", "joe", CaseType.IGNORE_CASE, TokenDelimiterMatch.ANY,
- TokenOrderType.ANY_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(1, 3));
- addTest(data, matcher, "Joe Smith", "smith", CaseType.IGNORE_CASE, TokenDelimiterMatch.ANY,
- TokenOrderType.ANY_ORDER, MatchTokenCountType.IGNORE_TOKEN_COUNT, true, getLocs(5, 9));
+ addTest(data, matcher, "Robot API", "Robot", QueryOption.CASE__MATCH, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(1, 5));
+ addTest(data, matcher, "Joe Smith", "joe", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__ANY, QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(1, 3));
+ addTest(data, matcher, "Joe Smith", "smith", QueryOption.CASE__IGNORE, QueryOption.TOKEN_DELIMITER__ANY,
+ QueryOption.TOKEN_MATCH_ORDER__ANY, QueryOption.TOKEN_COUNT__IGNORE, true, getLocs(5, 9));
return data;
}
- private static void addTest(Collection<Object[]> testData, StreamMatcher matcher, String data, String toSearch, CaseType caseType, TokenDelimiterMatch delimiter, TokenOrderType order, MatchTokenCountType countType, boolean findAllMatchLocations, List<MatchLocation> expectedLocs) {
+ private static void addTest(Collection<Object[]> testData, StreamMatcher matcher, String data, String toSearch, QueryOption caseType, QueryOption delimiter, QueryOption order, QueryOption countType, boolean findAllMatchLocations, List<MatchLocation> expectedLocs) {
testData.add(new Object[] {
matcher,
data,
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScannerTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScannerTest.java
index da728eb08a..8f724733c9 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScannerTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScannerTest.java
@@ -15,7 +15,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.orcs.db.internal.search.SearchAsserts;
@@ -33,9 +33,9 @@ public class SecondPassScannerTest {
private final String input;
private final List<Pair<String, MatchLocation>> expectedMatches;
- private final TokenDelimiterMatch delimiter;
+ private final QueryOption delimiter;
- public SecondPassScannerTest(String input, List<Pair<String, MatchLocation>> expectedMatches, TokenDelimiterMatch delimiter) {
+ public SecondPassScannerTest(String input, List<Pair<String, MatchLocation>> expectedMatches, QueryOption delimiter) {
this.input = input;
this.expectedMatches = expectedMatches;
this.delimiter = delimiter;
@@ -65,27 +65,27 @@ public class SecondPassScannerTest {
data.add(new Object[] {
"What->does] .this. mean",
getExpected(Arrays.asList("What", "does", "this", "mean"), 0, 4, 6, 10, 13, 17, 19, 23),
- TokenDelimiterMatch.ANY});
+ QueryOption.TOKEN_DELIMITER__ANY});
data.add(new Object[] {
"Wh\ndo\rth. r",
getExpected(Arrays.asList("Wh", "do", "th", "r"), 0, 2, 3, 5, 6, 8, 10, 11),
- TokenDelimiterMatch.ANY});
+ QueryOption.TOKEN_DELIMITER__ANY});
data.add(new Object[] {
"Â ® …tags… the",
getExpected(Arrays.asList("tags", "the"), 5, 9, 11, 14),
- TokenDelimiterMatch.ANY});
+ QueryOption.TOKEN_DELIMITER__ANY});
data.add(new Object[] {
"What does this mean",
getExpected(Arrays.asList("What", "does", "this", "mean"), 0, 4, 7, 11, 14, 18, 19, 23),
- TokenDelimiterMatch.WHITESPACE});
+ QueryOption.TOKEN_DELIMITER__WHITESPACE});
data.add(new Object[] {
"at->do]",
getExpected(Arrays.asList("a", "t", "-", ">", "d", "o", "]"), 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7),
- TokenDelimiterMatch.EXACT});
+ QueryOption.TOKEN_DELIMITER__EXACT});
data.add(new Object[] {
"Â ® …ta]",
getExpected(Arrays.asList(" ", " ", "t", "a", "]"), 1, 2, 3, 4, 5, 6, 6, 7, 7, 8),
- TokenDelimiterMatch.EXACT});
+ QueryOption.TOKEN_DELIMITER__EXACT});
return data;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java
index 39c424c7f9..2fea68bd9c 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java
@@ -13,13 +13,15 @@ package org.eclipse.osee.orcs.db.internal.search.handlers;
import java.util.Collection;
import java.util.List;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.Operator;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.database.core.AbstractJoinQuery;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeOther;
import org.eclipse.osee.orcs.db.internal.sql.AbstractSqlWriter;
import org.eclipse.osee.orcs.db.internal.sql.SqlHandler;
import org.eclipse.osee.orcs.db.internal.sql.TableEnum;
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
/**
* @author Roberto E. Escobar
@@ -34,10 +36,15 @@ public class AttributeOtherSqlHandler extends SqlHandler<CriteriaAttributeOther>
private String artAlias2;
private String txs2Alias2;
- private String joinAlias;
- private String value;
+ private String valueJoinAlias;
+ private AbstractJoinQuery valueJoinQuery;
- private AbstractJoinQuery joinQuery;
+ private String typeJoinAlias;
+ private AbstractJoinQuery typeJoinQuery;
+
+ private Collection<String> values;
+ private boolean ignoreCase;
+ private Collection<IAttributeType> types;
@Override
public void setData(CriteriaAttributeOther criteria) {
@@ -46,15 +53,18 @@ public class AttributeOtherSqlHandler extends SqlHandler<CriteriaAttributeOther>
@Override
public void addTables(AbstractSqlWriter writer) {
- Collection<String> values = criteria.getValues();
- if (values.size() == 1) {
- this.value = values.iterator().next();
- } else {
- joinQuery = writer.writeCharJoin(values);
+ values = getValuesForSearch();
+ if (values.size() > 1) {
+ valueJoinQuery = writer.writeCharJoin(values);
+ valueJoinAlias = writer.addTable(TableEnum.CHAR_JOIN_TABLE);
}
- if (joinQuery != null && criteria.getOperator().isEquals()) {
- joinAlias = writer.addTable(TableEnum.CHAR_JOIN_TABLE);
+
+ types = criteria.getAttributeTypes();
+ if (types.size() > 1) {
+ typeJoinQuery = writer.writeIdentifiableJoin(types);
+ typeJoinAlias = writer.addTable(TableEnum.ID_JOIN_TABLE);
}
+
List<String> aliases = writer.getAliases(TableEnum.ARTIFACT_TABLE);
List<String> txs = writer.getAliases(TableEnum.TXS_TABLE);
@@ -69,50 +79,73 @@ public class AttributeOtherSqlHandler extends SqlHandler<CriteriaAttributeOther>
}
}
+ private Collection<String> getValuesForSearch() {
+ List<String> copy = Lists.newArrayList(criteria.getValues());
+ ignoreCase = criteria.getOptions().contains(QueryOption.CASE__IGNORE);
+ if (ignoreCase) {
+ copy = Lists.transform(copy, new Function<String, String>() {
+
+ @Override
+ public String apply(String arg0) {
+ return arg0.toLowerCase();
+ }
+ });
+ }
+ return copy;
+ }
+
@Override
public boolean addPredicates(AbstractSqlWriter writer) throws OseeCoreException {
- IAttributeType attributeType = criteria.getAttributeType();
- Operator operator = criteria.getOperator();
+ Collection<IAttributeType> attributeTypes = criteria.getAttributeTypes();
- if (attributeType != null) {
+ if (attributeTypes.size() == 1) {
writer.write(attrAlias);
writer.write(".attr_type_id = ?");
- writer.addParameter(attributeType.getGuid());
+ writer.addParameter(attributeTypes.iterator().next().getGuid());
+ } else if (attributeTypes.size() > 1) {
+ writer.write(attrAlias);
+ writer.write(".attr_type_id = ");
+ writer.write(typeJoinAlias);
+ writer.write(".id");
+ writer.write(" AND ");
+ writer.write(typeJoinAlias);
+ writer.write(".query_id = ?");
+ writer.addParameter(typeJoinQuery.getQueryId());
}
- if (value != null) {
+ if (values.size() == 1) {
+ String value = values.iterator().next();
writer.write(" AND ");
+ if (ignoreCase) {
+ writer.write("lower(");
+ }
writer.write(attrAlias);
- writer.write(".value ");
+ writer.write(".value");
+ String ending = ignoreCase ? ") " : " ";
+ writer.write(ending);
if (value.contains("%")) {
- if (operator.isNotEquals()) {
- writer.write(" NOT");
- }
writer.write(" LIKE ");
} else {
- writer.write(operator.toString());
+ writer.write("=");
}
writer.write(" ?");
writer.addParameter(value);
}
- if (joinQuery != null) {
+ if (valueJoinQuery != null) {
writer.write(" AND ");
- if (operator.isEquals()) {
- writer.write(attrAlias);
- writer.write(".value = ");
- writer.write(joinAlias);
- writer.write(".id AND ");
- writer.write(joinAlias);
- writer.write(".query_id = ?");
- } else {
- writer.write("NOT EXISTS (SELECT 1 FROM ");
- writer.write(TableEnum.CHAR_JOIN_TABLE.getName());
- writer.write(" WHERE id = ");
- writer.write(attrAlias);
- writer.write(".value AND query_id = ?)");
+ if (ignoreCase) {
+ writer.write("lower(");
}
- writer.addParameter(joinQuery.getQueryId());
+ writer.write(attrAlias);
+ writer.write(".value");
+ String ending = ignoreCase ? ") = " : " = ";
+ writer.write(ending);
+ writer.write(valueJoinAlias);
+ writer.write(".id AND ");
+ writer.write(valueJoinAlias);
+ writer.write(".query_id = ?");
+ writer.addParameter(valueJoinQuery.getQueryId());
}
List<String> aliases = writer.getAliases(TableEnum.ARTIFACT_TABLE);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/CheckedOptions.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/CheckedOptions.java
index 98a6751aa6..5e24238559 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/CheckedOptions.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/CheckedOptions.java
@@ -10,74 +10,77 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.search.util;
-import org.eclipse.osee.framework.core.enums.CaseType;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.OptionVisitor;
import org.eclipse.osee.framework.core.enums.QueryOption;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
/**
* @author John Misinco
*/
-public class CheckedOptions implements OptionVisitor {
+public class CheckedOptions {
- private TokenOrderType orderType;
- private CaseType caseType;
- private MatchTokenCountType countType;
- private TokenDelimiterMatch delimiter;
+ private QueryOption orderType;
+ private QueryOption caseType;
+ private QueryOption countType;
+ private QueryOption delimiter;
+ private QueryOption exists;
- public CheckedOptions() {
- initialize();
+ public CheckedOptions(QueryOption... options) {
+ initialize(options);
}
- private void initialize() {
- orderType = TokenOrderType.ANY_ORDER;
- caseType = CaseType.IGNORE_CASE;
- countType = MatchTokenCountType.IGNORE_TOKEN_COUNT;
- delimiter = TokenDelimiterMatch.ANY;
+ private void initialize(QueryOption... options) {
+ orderType = QueryOption.TOKEN_MATCH_ORDER__ANY;
+ caseType = QueryOption.CASE__IGNORE;
+ countType = QueryOption.TOKEN_COUNT__IGNORE;
+ delimiter = QueryOption.TOKEN_DELIMITER__ANY;
+ exists = QueryOption.EXISTANCE__EXISTS;
+
+ for (QueryOption option : options) {
+ switch (option) {
+ case CASE__MATCH:
+ case CASE__IGNORE:
+ caseType = option;
+ break;
+ case EXISTANCE__EXISTS:
+ case EXISTANCE__NOT_EXISTS:
+ exists = option;
+ break;
+ case TOKEN_COUNT__MATCH:
+ case TOKEN_COUNT__IGNORE:
+ countType = option;
+ break;
+ case TOKEN_DELIMITER__EXACT:
+ case TOKEN_DELIMITER__WHITESPACE:
+ case TOKEN_DELIMITER__ANY:
+ delimiter = option;
+ break;
+ case TOKEN_MATCH_ORDER__ANY:
+ case TOKEN_MATCH_ORDER__MATCH:
+ orderType = option;
+ break;
+ default:
+
+ }
+ }
}
- public TokenOrderType getOrderType() {
+ public QueryOption getOrderType() {
return orderType;
}
- public CaseType getCaseType() {
+ public QueryOption getCaseType() {
return caseType;
}
- public MatchTokenCountType getCountType() {
+ public QueryOption getCountType() {
return countType;
}
- public TokenDelimiterMatch getDelimiter() {
+ public QueryOption getDelimiter() {
return delimiter;
}
- public void accept(QueryOption... options) {
- initialize();
- for (QueryOption option : options) {
- option.accept(this);
- }
+ public QueryOption getExists() {
+ return exists;
}
- @Override
- public void asCaseType(CaseType option) {
- caseType = option;
- }
-
- @Override
- public void asTokenOrderType(TokenOrderType option) {
- orderType = option;
- }
-
- @Override
- public void asMatchTokenCountType(MatchTokenCountType option) {
- countType = option;
- }
-
- @Override
- public void asTokenDelimiterMatch(TokenDelimiterMatch delimiter) {
- this.delimiter = delimiter;
- }
}; \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/MatcherFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/MatcherFactory.java
index ea826a5973..ab0f0789b7 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/MatcherFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/MatcherFactory.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.search.util;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.orcs.db.internal.search.tagger.StreamMatcher;
/**
@@ -28,7 +29,7 @@ public class MatcherFactory {
private static final class TokenOrderProcessorFactoryImpl implements TokenOrderProcessorFactory {
@Override
public TokenOrderProcessor createTokenProcessor(CheckedOptions options) {
- return options.getOrderType().isMatchOrder() ? new MatchTokenOrderProcessor() : new AnyTokenOrderProcessor();
+ return options.getOrderType() == QueryOption.TOKEN_MATCH_ORDER__MATCH ? new MatchTokenOrderProcessor() : new AnyTokenOrderProcessor();
}
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcher.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcher.java
index 2cb56229bf..bad58bea06 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcher.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassMatcher.java
@@ -12,8 +12,6 @@ package org.eclipse.osee.orcs.db.internal.search.util;
import java.io.InputStream;
import java.util.List;
-import org.eclipse.osee.framework.core.enums.CaseType;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.orcs.db.internal.search.tagger.StreamMatcher;
@@ -29,14 +27,13 @@ public class SecondPassMatcher implements StreamMatcher {
this.processorFactory = processorFactory;
}
- private String normalizeCase(CaseType caseType, String token) {
- return caseType.isCaseSensitive() ? token : token.toLowerCase();
+ private String normalizeCase(QueryOption caseType, String token) {
+ return caseType == QueryOption.CASE__MATCH ? token : token.toLowerCase();
}
@Override
public List<MatchLocation> findInStream(InputStream inputStream, String toSearch, boolean findAllMatchLocations, QueryOption... options) {
- CheckedOptions checkedOptions = new CheckedOptions();
- checkedOptions.accept(options);
+ CheckedOptions checkedOptions = new CheckedOptions(options);
TokenOrderProcessor processor = processorFactory.createTokenProcessor(checkedOptions);
@@ -67,7 +64,7 @@ public class SecondPassMatcher implements StreamMatcher {
while (inputStreamScanner.hasNext()) {
++numTokensProcessed;
- if (numTokensProcessed > processor.getTotalTokensToMatch() && MatchTokenCountType.MATCH_TOKEN_COUNT == options.getCountType()) {
+ if (numTokensProcessed > processor.getTotalTokensToMatch() && QueryOption.TOKEN_COUNT__MATCH == options.getCountType()) {
processor.getLocations().clear();
break;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScanner.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScanner.java
index 5d0d30b03c..b19c09fcc9 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScanner.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/util/SecondPassScanner.java
@@ -13,7 +13,7 @@ package org.eclipse.osee.orcs.db.internal.search.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.framework.jdk.core.util.Lib;
@@ -30,18 +30,18 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
public final class SecondPassScanner {
private InputStream input;
- private final TokenDelimiterMatch delimiter;
+ private final QueryOption delimiter;
private String next;
private int start, end = -1, bytesRead = 0;
private boolean eof = false;
private final StringBuilder buffer = new StringBuilder();
- public SecondPassScanner(InputStream input, TokenDelimiterMatch delimiter) {
+ public SecondPassScanner(InputStream input, QueryOption delimiter) {
this.input = input;
this.delimiter = delimiter;
}
- public SecondPassScanner(String input, TokenDelimiterMatch delimiter) {
+ public SecondPassScanner(String input, QueryOption delimiter) {
try {
this.input = Lib.stringToInputStream(input);
} catch (UnsupportedEncodingException ex) {
@@ -97,7 +97,7 @@ public final class SecondPassScanner {
private boolean processChar(int read) {
boolean done = false;
switch (delimiter) {
- case ANY:
+ case TOKEN_DELIMITER__ANY:
if (Character.isLetterOrDigit(read)) {
buffer.append((char) read);
} else {
@@ -107,14 +107,14 @@ public final class SecondPassScanner {
}
}
break;
- case EXACT:
+ case TOKEN_DELIMITER__EXACT:
if (read != -1) {
end = bytesRead;
buffer.append((char) read);
}
done = true;
break;
- case WHITESPACE:
+ case TOKEN_DELIMITER__WHITESPACE:
if (Character.isWhitespace((char) read) || read == -1) {
if (buffer.length() != 0) {
end = start + buffer.length();
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java
index 5456053f3e..685820563a 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java
@@ -19,6 +19,8 @@ import org.eclipse.osee.framework.database.core.AbstractJoinQuery;
import org.eclipse.osee.framework.database.core.CharJoinQuery;
import org.eclipse.osee.framework.database.core.IdJoinQuery;
import org.eclipse.osee.framework.database.core.JoinUtility;
+import org.eclipse.osee.framework.jdk.core.type.Identifiable;
+import org.eclipse.osee.framework.jdk.core.type.Identity;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -241,6 +243,15 @@ public abstract class AbstractSqlWriter implements HasOptions {
return joinQuery;
}
+ public IdJoinQuery writeIdentifiableJoin(Collection<? extends Identifiable<Long>> ids) {
+ IdJoinQuery joinQuery = JoinUtility.createIdJoinQuery(dbService, context.getSession().getGuid());
+ for (Identity<Long> id : ids) {
+ joinQuery.add(id.getGuid());
+ }
+ addJoin(joinQuery);
+ return joinQuery;
+ }
+
@Override
public Options getOptions() {
return getContext().getOptions();
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/QueryBuilder.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/QueryBuilder.java
index d281da02e7..8b522974d2 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/QueryBuilder.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/QueryBuilder.java
@@ -18,7 +18,6 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.rest.model.search.artifact.RequestType;
@@ -143,17 +142,11 @@ public interface QueryBuilder {
QueryBuilder andNameEquals(String artifactName) throws OseeCoreException;
/**
- * Search criteria that finds an attribute of the given type with its current value relative to the given value based
- * on the operator provided.
- */
- QueryBuilder and(IAttributeType attributeType, Operator operator, String value) throws OseeCoreException;
-
- /**
* Search criteria that finds an attribute of the given type with its current value exactly equal (or not equal) to
* any one of the given literal values. If the list only contains one value, then the search is conducted exactly as
* if the single value constructor was called. This search does not support the (* wildcard) for multiple values.
*/
- QueryBuilder and(IAttributeType attributeType, Operator operator, Collection<String> values) throws OseeCoreException;
+ QueryBuilder and(IAttributeType attributeType, Collection<String> values, QueryOption... options) throws OseeCoreException;
/**
* Search criteria that finds an attribute of the given type with its current value relative to the given value based
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
index 27c9b8f825..16eac52d2e 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
@@ -31,7 +31,6 @@ import org.eclipse.osee.orcs.rest.client.internal.search.QueryBuilderImpl;
import org.eclipse.osee.orcs.rest.client.internal.search.QueryExecutor;
import org.eclipse.osee.orcs.rest.client.internal.search.QueryOptions;
import org.eclipse.osee.orcs.rest.model.Client;
-import org.eclipse.osee.orcs.rest.model.search.artifact.OutputFormat;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
import org.eclipse.osee.orcs.rest.model.search.artifact.RequestType;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchRequest;
@@ -112,17 +111,17 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
@Override
public int getCount(IOseeBranch branch, List<Predicate> predicates, QueryOptions options) throws OseeCoreException {
- SearchResponse result = performSearch(RequestType.COUNT, OutputFormat.XML, branch, predicates, options);
+ SearchResponse result = performSearch(RequestType.COUNT, branch, predicates, options);
return result.getTotal();
}
@Override
public SearchResult getResults(RequestType request, IOseeBranch branch, List<Predicate> predicates, QueryOptions options) throws OseeCoreException {
- SearchResponse result = performSearch(request, OutputFormat.XML, branch, predicates, options);
+ SearchResponse result = performSearch(request, branch, predicates, options);
return result;
}
- private SearchResponse performSearch(RequestType requestType, OutputFormat outputFormat, IOseeBranch branch, List<Predicate> predicates, QueryOptions options) throws OseeCoreException {
+ private SearchResponse performSearch(RequestType requestType, IOseeBranch branch, List<Predicate> predicates, QueryOptions options) throws OseeCoreException {
int fromTx = 0;
if (options.isHistorical()) {
fromTx = options.getFromTransaction();
@@ -133,9 +132,7 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
includeDeleted = true;
}
- SearchRequest params =
- new SearchRequest(branch.getUuid(), predicates, outputFormat.name().toLowerCase(),
- requestType.name().toLowerCase(), fromTx, includeDeleted);
+ SearchRequest params = new SearchRequest(branch.getUuid(), predicates, requestType, fromTx, includeDeleted);
JaxRsWebTarget resource = newTarget("branch/{branch-uuid}/artifact/search/v1", branch.getUuid());
try {
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/OptionConverter.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/OptionConverter.java
deleted file mode 100644
index 44e1dcf257..0000000000
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/OptionConverter.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.rest.client.internal.search;
-
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.osee.framework.core.enums.CaseType;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.OptionVisitor;
-import org.eclipse.osee.framework.core.enums.QueryOption;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
-import org.eclipse.osee.orcs.rest.client.internal.search.PredicateFactoryImpl.RestSearchOptions;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchFlag;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OptionConverter implements OptionVisitor, RestSearchOptions {
- private final List<SearchFlag> flags = new LinkedList<SearchFlag>();
- private TokenDelimiterMatch delimiter;
-
- public void accept(QueryOption[] options) {
- reset();
- for (QueryOption option : options) {
- option.accept(this);
- }
- if (delimiter == null) {
- delimiter = TokenDelimiterMatch.ANY;
- }
- }
-
- private void reset() {
- flags.clear();
- }
-
- @Override
- public void asCaseType(CaseType option) {
- if (option.isCaseSensitive()) {
- flags.add(SearchFlag.MATCH_CASE);
- }
- }
-
- @Override
- public void asTokenOrderType(TokenOrderType option) {
- if (option.isMatchOrder()) {
- flags.add(SearchFlag.MATCH_TOKEN_ORDER);
- }
- }
-
- @Override
- public void asMatchTokenCountType(MatchTokenCountType option) {
- if (option.isMatchTokenCount()) {
- flags.add(SearchFlag.MATCH_TOKEN_COUNT);
- }
- }
-
- @Override
- public void asTokenDelimiterMatch(TokenDelimiterMatch option) {
- delimiter = option;
- }
-
- @Override
- public List<SearchFlag> getFlags() {
- return flags;
- }
-
- @Override
- public TokenDelimiterMatch getDelimiter() {
- return delimiter;
- }
-
-}; \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactory.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactory.java
index 7318174712..e73754469b 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactory.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactory.java
@@ -15,7 +15,6 @@ import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.Identity;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
@@ -37,7 +36,7 @@ public interface PredicateFactory {
Predicate createAttributeTypeSearch(Collection<? extends IAttributeType> attributeTypes, String value, QueryOption... options);
- Predicate createAttributeTypeSearch(Collection<? extends IAttributeType> attributeTypes, Operator operator, Collection<String> values);
+ Predicate createAttributeTypeSearch(Collection<? extends IAttributeType> attributeTypes, Collection<String> values, QueryOption... options);
Predicate createAttributeExistsSearch(Collection<? extends IAttributeType> attributeTypes);
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactoryImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactoryImpl.java
index 42232cdb5a..1c63c42e01 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactoryImpl.java
@@ -20,17 +20,10 @@ import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
-import org.eclipse.osee.framework.core.enums.CaseType;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.enums.QueryOption;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
import org.eclipse.osee.framework.jdk.core.type.Identity;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchFlag;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
/**
* @author John Misinco
@@ -38,13 +31,11 @@ import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
public class PredicateFactoryImpl implements PredicateFactory {
private final List<String> emptyStringList = Collections.emptyList();
- private final List<SearchFlag> emptySearchFlagList = Collections.emptyList();
public static interface RestSearchOptions {
- List<SearchFlag> getFlags();
+ List<QueryOption> getOptions();
- TokenDelimiterMatch getDelimiter();
}
@Override
@@ -72,82 +63,61 @@ public class PredicateFactoryImpl implements PredicateFactory {
}
private Predicate createIdsSearch(SearchMethod method, List<String> ids) {
- return new Predicate(method, emptyStringList, SearchOp.EQUALS, emptySearchFlagList, null, ids);
+ return new Predicate(method, emptyStringList, ids);
}
@Override
public Predicate createIsOfTypeSearch(Collection<? extends IArtifactType> artifactType) {
List<String> typeIds = getLongIds(artifactType);
- return new Predicate(SearchMethod.IS_OF_TYPE, emptyStringList, SearchOp.EQUALS, emptySearchFlagList, null,
- typeIds);
+ return new Predicate(SearchMethod.IS_OF_TYPE, emptyStringList, typeIds);
}
@Override
public Predicate createTypeEqualsSearch(Collection<? extends IArtifactType> artifactType) {
List<String> typeIds = getLongIds(artifactType);
- return new Predicate(SearchMethod.TYPE_EQUALS, emptyStringList, SearchOp.EQUALS, emptySearchFlagList, null,
- typeIds);
+ return new Predicate(SearchMethod.TYPE_EQUALS, emptyStringList, typeIds);
}
@Override
public Predicate createAttributeTypeSearch(Collection<? extends IAttributeType> attributeTypes, String value, QueryOption... options) {
- List<String> typeIds = getLongIds(attributeTypes);
- List<String> values = Collections.singletonList(value);
- RestSearchOptions option = convertToSearchFlags(options);
- return new Predicate(SearchMethod.ATTRIBUTE_TYPE, typeIds, SearchOp.EQUALS, option.getFlags(),
- option.getDelimiter(), values);
+ return createAttributeTypeSearch(attributeTypes, Collections.singleton(value), options);
}
@Override
- public Predicate createAttributeTypeSearch(Collection<? extends IAttributeType> attributeTypes, Operator operator, Collection<String> values) {
+ public Predicate createAttributeTypeSearch(Collection<? extends IAttributeType> attributeTypes, Collection<String> values, QueryOption... options) {
List<String> typeIds = getLongIds(attributeTypes);
- List<String> valuesList = new LinkedList<String>(values);
- if (operator == Operator.EQUAL) {
- RestSearchOptions option =
- convertToSearchFlags(CaseType.MATCH_CASE, TokenOrderType.MATCH_ORDER,
- MatchTokenCountType.MATCH_TOKEN_COUNT, TokenDelimiterMatch.EXACT);
- return new Predicate(SearchMethod.ATTRIBUTE_TYPE, typeIds, SearchOp.EQUALS, option.getFlags(),
- option.getDelimiter(), valuesList);
- } else {
- SearchOp op = convertToSearchOp(operator);
- return new Predicate(SearchMethod.ATTRIBUTE_TYPE, typeIds, op, emptySearchFlagList, null, valuesList);
- }
-
+ return new Predicate(SearchMethod.ATTRIBUTE_TYPE, typeIds, new LinkedList<String>(values), options);
}
@Override
public Predicate createAttributeExistsSearch(Collection<? extends IAttributeType> attributeTypes) {
List<String> typeIds = getLongIds(attributeTypes);
- return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("attrType"), SearchOp.EQUALS, emptySearchFlagList,
- null, typeIds);
+ return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("attrType"), typeIds);
}
@Override
public Predicate createRelationExistsSearch(Collection<? extends IRelationType> relationTypes) {
List<String> typeIds = getLongIds(relationTypes);
- return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("relType"), SearchOp.EQUALS, emptySearchFlagList,
- null, typeIds);
+ return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("relType"), typeIds);
}
@Override
public Predicate createRelationTypeSideExistsSearch(IRelationTypeSide relationTypeSide) {
String side = relationTypeSide.getSide().isSideA() ? "A" : "B";
- return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("relTypeSide", side), SearchOp.EQUALS,
- emptySearchFlagList, null, getLongIds(relationTypeSide));
+ return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("relTypeSide", side), getLongIds(relationTypeSide));
}
@Override
public Predicate createRelationTypeSideNotExistsSearch(IRelationTypeSide relationTypeSide) {
String side = relationTypeSide.getSide().isSideA() ? "A" : "B";
- return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("relTypeSide", side), SearchOp.NOT_EQUALS,
- emptySearchFlagList, null, getLongIds(relationTypeSide));
+ return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("relTypeSide", side), getLongIds(relationTypeSide),
+ QueryOption.EXISTANCE__NOT_EXISTS);
}
@Override
public Predicate createRelationNotExistsSearch(Collection<? extends IRelationType> relationTypes) {
List<String> typeIds = getLongIds(relationTypes);
- return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("relType"), SearchOp.NOT_EQUALS,
- emptySearchFlagList, null, typeIds);
+ return new Predicate(SearchMethod.EXISTS_TYPE, Arrays.asList("relType"), typeIds, QueryOption.EXISTANCE__NOT_EXISTS);
}
@Override
@@ -161,8 +131,7 @@ public class PredicateFactoryImpl implements PredicateFactory {
values.add(id.toString());
}
}
- return new Predicate(SearchMethod.RELATED_TO, Arrays.asList(side + relationTypeSide.getGuid().toString()),
- SearchOp.EQUALS, emptySearchFlagList, null, values);
+ return new Predicate(SearchMethod.RELATED_TO, Arrays.asList(side + relationTypeSide.getGuid().toString()), values);
}
private List<String> getLongIds(Collection<? extends Identity<Long>> types) {
@@ -178,28 +147,4 @@ public class PredicateFactoryImpl implements PredicateFactory {
return getLongIds(Collections.singletonList(type));
}
- private SearchOp convertToSearchOp(Operator op) {
- SearchOp toReturn = SearchOp.EQUALS;
- switch (op) {
- case EQUAL:
- toReturn = SearchOp.EQUALS;
- break;
- case GREATER_THAN:
- toReturn = SearchOp.GREATER_THAN;
- break;
- case LESS_THAN:
- toReturn = SearchOp.LESS_THAN;
- break;
- default:
- break;
- }
- return toReturn;
- }
-
- private RestSearchOptions convertToSearchFlags(QueryOption... options) {
- OptionConverter visitor = new OptionConverter();
- visitor.accept(options);
- return visitor;
- }
-
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryBuilderImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryBuilderImpl.java
index 0abc42ad4b..86e35daeac 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryBuilderImpl.java
@@ -22,7 +22,6 @@ import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.rest.client.QueryBuilder;
@@ -188,17 +187,12 @@ public class QueryBuilderImpl implements QueryBuilder {
@Override
public QueryBuilder andNameEquals(String artifactName) {
- return and(CoreAttributeTypes.Name, Operator.EQUAL, artifactName);
+ return and(CoreAttributeTypes.Name, artifactName);
}
@Override
- public QueryBuilder and(IAttributeType attributeType, Operator operator, String value) {
- return and(attributeType, operator, Collections.singleton(value));
- }
-
- @Override
- public QueryBuilder and(IAttributeType attributeType, Operator operator, Collection<String> values) {
- predicates.add(predicateFactory.createAttributeTypeSearch(Collections.singleton(attributeType), operator, values));
+ public QueryBuilder and(IAttributeType attributeType, Collection<String> values, QueryOption... options) {
+ predicates.add(predicateFactory.createAttributeTypeSearch(Collections.singleton(attributeType), values, options));
return this;
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/OutputFormat.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/OutputFormat.java
deleted file mode 100644
index 4a5dde75c6..0000000000
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/OutputFormat.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.rest.model.search.artifact;
-
-/**
- * @author John R. Misinco
- */
-public enum OutputFormat {
- XML
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/Predicate.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/Predicate.java
index 99071dc334..a45dd31c1e 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/Predicate.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/Predicate.java
@@ -12,7 +12,7 @@ package org.eclipse.osee.orcs.rest.model.search.artifact;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.util.Collections;
/**
@@ -23,25 +23,17 @@ import org.eclipse.osee.framework.jdk.core.util.Collections;
public class Predicate {
private SearchMethod type;
private List<String> typeParameters;
- private SearchOp op;
- private List<SearchFlag> flags;
private List<String> values;
- private TokenDelimiterMatch delimiter;
+ private QueryOption[] options;
public Predicate() {
}
- public Predicate(SearchMethod type, List<String> typeParameters, SearchOp op, List<SearchFlag> flags, TokenDelimiterMatch delimiter, List<String> values) {
+ public Predicate(SearchMethod type, List<String> typeParameters, List<String> values, QueryOption... options) {
this.type = type;
this.typeParameters = typeParameters;
- this.op = op;
- this.flags = flags;
this.values = values;
- this.delimiter = delimiter;
- }
-
- public void setDelimiter(TokenDelimiterMatch delimiter) {
- this.delimiter = delimiter;
+ this.options = options;
}
public void setType(SearchMethod type) {
@@ -52,14 +44,6 @@ public class Predicate {
this.typeParameters = typeParameters;
}
- public void setOp(SearchOp op) {
- this.op = op;
- }
-
- public void setFlags(List<SearchFlag> flags) {
- this.flags = flags;
- }
-
public void setValues(List<String> values) {
this.values = values;
}
@@ -72,27 +56,23 @@ public class Predicate {
return typeParameters;
}
- public SearchOp getOp() {
- return op;
- }
-
- public List<SearchFlag> getFlags() {
- return flags;
- }
-
public List<String> getValues() {
return values;
}
- public TokenDelimiterMatch getDelimiter() {
- return delimiter;
+ public QueryOption[] getOptions() {
+ return options;
+ }
+
+ public void setOptions(QueryOption[] options) {
+ this.options = options;
}
@Override
public String toString() {
- return String.format("type:[%s],typeParameters:[%s],op[%s],flags[%s],values[%s],delimiter[%s]", type,
- Collections.toString(",", typeParameters), op, Collections.toString(",", flags),
- Collections.toString(",", values), delimiter);
+ return String.format("type:[%s],typeParameters:[%s],values[%s],options[%s]", type,
+ Collections.toString(",", typeParameters), Collections.toString(",", values),
+ Collections.toString(",", options));
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchFlag.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchFlag.java
deleted file mode 100644
index 5b03889343..0000000000
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchFlag.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.rest.model.search.artifact;
-
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
-
-/**
- * @author John R. Misinco
- * @author Roberto E. Escobar
- */
-public enum SearchFlag {
- MATCH_CASE("mc"),
- MATCH_TOKEN_COUNT("mtc"),
- MATCH_TOKEN_ORDER("mto");
-
- private final String token;
-
- private SearchFlag(String token) {
- this.token = token;
- }
-
- public String getToken() {
- return token;
- }
-
- public static SearchFlag fromString(String value) throws OseeCoreException {
- SearchFlag toReturn = null;
- for (SearchFlag op : SearchFlag.values()) {
- if (op.getToken().equals(value)) {
- toReturn = op;
- break;
- }
- }
- Conditions.checkNotNull(toReturn, "SearchFlag", "Invalid flag [%s]", value);
- return toReturn;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchOp.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchOp.java
deleted file mode 100644
index 006fe4c6fc..0000000000
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchOp.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.rest.model.search.artifact;
-
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
-
-/**
- * @author John R. Misinco
- * @author Roberto E. Escobar
- */
-public enum SearchOp {
- EQUALS("=="),
- LESS_THAN("<"),
- GREATER_THAN(">"),
- NOT_EQUALS("<>");
-
- private final String token;
-
- private SearchOp(String token) {
- this.token = token;
- }
-
- public String getToken() {
- return token;
- }
-
- public static SearchOp fromString(String value) throws OseeCoreException {
- SearchOp toReturn = null;
- for (SearchOp op : SearchOp.values()) {
- if (op.getToken().equals(value)) {
- toReturn = op;
- }
- }
- Conditions.checkNotNull(toReturn, "searchOp", "Invalid op [%s]", value);
- return toReturn;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchParameters.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchParameters.java
index 6e63241f6d..970ce60488 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchParameters.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchParameters.java
@@ -22,9 +22,7 @@ public interface SearchParameters {
List<Predicate> getPredicates();
- String getAlt();
-
- String getFields();
+ RequestType getRequestType();
boolean isIncludeDeleted();
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchRequest.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchRequest.java
index 598c8050a0..cdd5305e48 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchRequest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchRequest.java
@@ -24,8 +24,7 @@ import javax.xml.bind.annotation.XmlTransient;
public class SearchRequest implements SearchParameters {
private Long branchUuid;
- private String alt;
- private String fields;
+ private RequestType type;
private int fromTx;
private boolean includeDeleted;
@@ -36,12 +35,11 @@ public class SearchRequest implements SearchParameters {
super();
}
- public SearchRequest(Long branchUuid, List<Predicate> predicates, String alt, String fields, int fromTx, boolean includeDeleted) {
+ public SearchRequest(Long branchUuid, List<Predicate> predicates, RequestType type, int fromTx, boolean includeDeleted) {
super();
this.branchUuid = branchUuid;
this.predicates = predicates;
- this.alt = alt;
- this.fields = fields;
+ this.type = type;
this.fromTx = fromTx;
this.includeDeleted = includeDeleted;
}
@@ -59,13 +57,8 @@ public class SearchRequest implements SearchParameters {
}
@Override
- public String getAlt() {
- return alt;
- }
-
- @Override
- public String getFields() {
- return fields;
+ public RequestType getRequestType() {
+ return type;
}
public void setBranchUuid(Long uuid) {
@@ -76,12 +69,8 @@ public class SearchRequest implements SearchParameters {
this.predicates = predicates;
}
- public void setAlt(String alt) {
- this.alt = alt;
- }
-
- public void setFields(String fields) {
- this.fields = fields;
+ public void setRequestType(RequestType type) {
+ this.type = type;
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/InternalTestSuite.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/InternalTestSuite.java
index fc4d951fb0..4f6eeb91f0 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/InternalTestSuite.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/InternalTestSuite.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.orcs.rest.internal;
-import org.eclipse.osee.orcs.rest.internal.search.dsl.DslTranslatorImplTest;
import org.eclipse.osee.orcs.rest.internal.search.dsl.SearchDslTest;
import org.eclipse.osee.orcs.rest.internal.search.predicate.AttributeTypePredicateHandlerTest;
import org.eclipse.osee.orcs.rest.internal.search.predicate.ExistsTypePredicateHandlerTest;
@@ -26,7 +25,6 @@ import org.junit.runners.Suite;
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
- DslTranslatorImplTest.class,
SearchDslTest.class,
AttributeTypePredicateHandlerTest.class,
ExistsTypePredicateHandlerTest.class,
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/dsl/DslTranslatorImplTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/dsl/DslTranslatorImplTest.java
deleted file mode 100644
index 74662c3988..0000000000
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/dsl/DslTranslatorImplTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.rest.internal.search.dsl;
-
-import java.util.List;
-import java.util.Random;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.orcs.rest.internal.search.artifact.dsl.DslTranslatorImpl_V1;
-import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchFlag;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * @author John R. Misinco
- */
-public class DslTranslatorImplTest {
-
- @Test(expected = OseeArgumentException.class)
- public void testBadSearchType() throws OseeCoreException {
- DslTranslatorImpl_V1 translator = new DslTranslatorImpl_V1();
-
- //test bad search type
- String test = "[t:attrTypes&tp:1000000000000070&op:==&v:AtsAdmin]";
- translator.translate(test);
- }
-
- @Test(expected = OseeArgumentException.class)
- public void testBadOp() throws OseeCoreException {
- DslTranslatorImpl_V1 translator = new DslTranslatorImpl_V1();
-
- //test bad op
- String test = "[t:attrType&tp:1000000000000070&op:<=&v:AtsAdmin]";
- translator.translate(test);
- }
-
- @Test(expected = OseeArgumentException.class)
- public void testBadFlag() throws OseeCoreException {
- DslTranslatorImpl_V1 translator = new DslTranslatorImpl_V1();
-
- //test bad flags
- String test = "[t:attrType&tp:1000000000000070&op:==&f:ti&v:AtsAdmin]";
- translator.translate(test);
- }
-
- private int getNextInt(Random r) {
- return Math.abs(r.nextInt());
- }
-
- private String getSearchMethod(Random r) {
- int len = SearchMethod.values().length;
- return SearchMethod.values()[getNextInt(r) % len].getToken();
- }
-
- private String getOp(Random r) {
- int len = SearchOp.values().length;
- return SearchOp.values()[getNextInt(r) % len].getToken();
- }
-
- private String getFlags(Random r, int num) {
- if (num == 0) {
- return "";
- }
- StringBuilder toReturn = new StringBuilder();
- for (int i = 0; i < num; i++) {
- int len = SearchFlag.values().length;
- toReturn.append(SearchFlag.values()[getNextInt(r) % len].getToken());
- toReturn.append(",");
- }
- int last = toReturn.length();
- return toReturn.substring(0, last - 1);
- }
-
- private String getTestQuery(int num) {
- Random r = new Random();
- StringBuilder toReturn = new StringBuilder();
- for (int i = 0; i < num; i++) {
- toReturn.append("[t:");
- toReturn.append(getSearchMethod(r));
- toReturn.append("&tp:");
- toReturn.append(r.nextLong());
- toReturn.append("&op:");
- toReturn.append(getOp(r));
- toReturn.append("&f:");
- toReturn.append(getFlags(r, getNextInt(r) % 3));
- toReturn.append("&v:value1,value2]&");
- }
- int last = toReturn.length();
- return toReturn.substring(0, last - 1);
- }
-
- private boolean compareStringToPredicate(String query, Predicate predicate) {
- if (!query.contains(predicate.getType().getToken())) {
- return false;
- }
- if (!query.contains(predicate.getOp().getToken())) {
- return false;
- }
- for (SearchFlag flag : predicate.getFlags()) {
- if (!query.contains(flag.getToken())) {
- return false;
- }
- }
- for (String typeParam : predicate.getTypeParameters()) {
- if (!query.contains(typeParam)) {
- return false;
- }
- }
- for (String value : predicate.getValues()) {
- if (!query.contains(value)) {
- return false;
- }
- }
- return true;
- }
-
- @Test
- public void testMultiplePredicates() throws OseeCoreException {
- DslTranslatorImpl_V1 translator = new DslTranslatorImpl_V1();
- int size = 5;
-
- String test = getTestQuery(size);
- List<Predicate> translated = translator.translate(test);
- Assert.assertEquals(size, translated.size());
- String[] predicates = test.split("\\]&\\[");
-
- for (int i = 0; i < size; i++) {
- Assert.assertTrue(compareStringToPredicate(predicates[i], translated.get(i)));
- }
- }
-
- @Test
- public void testAttrTypeSearches() throws OseeCoreException {
- DslTranslatorImpl_V1 translator = new DslTranslatorImpl_V1();
- List<Predicate> predicates;
-
- String test = "[t:attrType&tp:0x1000000000000070&op:==&v:AtsAdmin]";
- predicates = translator.translate(test);
- Assert.assertEquals(1, predicates.size());
- Predicate predicate = predicates.iterator().next();
- Assert.assertEquals(SearchMethod.ATTRIBUTE_TYPE, predicate.getType());
- Assert.assertEquals(SearchOp.EQUALS, predicate.getOp());
- Assert.assertTrue(predicate.getValues().contains("AtsAdmin"));
-
- test = "[t:isOfType&tp:1000000000000070&op:>&v:AtsAdmin]";
- predicates = translator.translate(test);
- Assert.assertEquals(1, predicates.size());
- predicate = predicates.iterator().next();
- Assert.assertEquals(SearchMethod.IS_OF_TYPE, predicate.getType());
- Assert.assertEquals(SearchOp.GREATER_THAN, predicate.getOp());
- Assert.assertTrue(predicate.getValues().contains("AtsAdmin"));
-
- test = "[t:ids&tp:1000000000000070&op:<&v:AtsAdmin&d:ANY']";
- test += "&[t:attrType&tp:1000000000000070&op:==&v:TestAdmin&d:ANY']";
- predicates = translator.translate(test);
- Assert.assertEquals(2, predicates.size());
- predicate = predicates.get(0);
- Assert.assertEquals(SearchMethod.IDS, predicate.getType());
- Assert.assertEquals(SearchOp.LESS_THAN, predicate.getOp());
- Assert.assertTrue(predicate.getValues().contains("AtsAdmin"));
- Assert.assertEquals(TokenDelimiterMatch.ANY, predicate.getDelimiter());
- predicate = predicates.get(1);
- Assert.assertEquals(SearchMethod.ATTRIBUTE_TYPE, predicate.getType());
- Assert.assertEquals(SearchOp.EQUALS, predicate.getOp());
- Assert.assertTrue(predicate.getValues().contains("TestAdmin"));
- Assert.assertEquals(TokenDelimiterMatch.ANY, predicate.getDelimiter());
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/dsl/SearchDslTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/dsl/SearchDslTest.java
index 0a9573028a..7369a2092b 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/dsl/SearchDslTest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/dsl/SearchDslTest.java
@@ -19,12 +19,11 @@ import java.util.Map;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.orcs.rest.internal.search.artifact.PredicateHandler;
import org.eclipse.osee.orcs.rest.internal.search.artifact.dsl.SearchQueryBuilder;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
+import org.eclipse.osee.orcs.rest.model.search.artifact.RequestType;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchRequest;
import org.eclipse.osee.orcs.search.QueryBuilder;
import org.eclipse.osee.orcs.search.QueryFactory;
@@ -66,11 +65,8 @@ public class SearchDslTest {
when(queryFactory.fromBranch(any(IOseeBranch.class))).thenReturn(builder);
Predicate predicate =
- new Predicate(SearchMethod.ATTRIBUTE_TYPE, Arrays.asList("1000000000000070"), SearchOp.EQUALS, null, null,
- Arrays.asList("AtsAdmin"));
- SearchRequest params =
- new SearchRequest(BRANCH.getUuid(), Arrays.asList(predicate), Strings.EMPTY_STRING, Strings.EMPTY_STRING, 0,
- false);
+ new Predicate(SearchMethod.ATTRIBUTE_TYPE, Arrays.asList("1000000000000070"), Arrays.asList("AtsAdmin"));
+ SearchRequest params = new SearchRequest(BRANCH.getUuid(), Arrays.asList(predicate), RequestType.IDS, 0, false);
dsl.build(queryFactory, params);
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/AttributeTypePredicateHandlerTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/AttributeTypePredicateHandlerTest.java
index 6478b843c2..959a6ba14c 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/AttributeTypePredicateHandlerTest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/AttributeTypePredicateHandlerTest.java
@@ -10,29 +10,19 @@
*******************************************************************************/
package org.eclipse.osee.orcs.rest.internal.search.predicate;
-import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyCollectionOf;
import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.CaseType;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.Operator;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.rest.internal.search.artifact.predicate.AttributeTypePredicateHandler;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchFlag;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
import org.eclipse.osee.orcs.search.QueryBuilder;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -48,7 +38,7 @@ public class AttributeTypePredicateHandlerTest {
@Mock
private QueryBuilder builder;
@Captor
- private ArgumentCaptor<TokenDelimiterMatch> delimiter;
+ private ArgumentCaptor<QueryOption> delimiter;
@Captor
private ArgumentCaptor<Collection<String>> valueCaptor;
@@ -61,44 +51,10 @@ public class AttributeTypePredicateHandlerTest {
public void testStringSearchOptions() throws OseeCoreException {
AttributeTypePredicateHandler handler = new AttributeTypePredicateHandler();
List<String> typeParameters = Collections.singletonList("0x0123");
- List<SearchFlag> flags = Collections.emptyList();
List<String> values = Collections.singletonList("value");
- Predicate testPredicate =
- new Predicate(SearchMethod.ATTRIBUTE_TYPE, typeParameters, SearchOp.EQUALS, flags, TokenDelimiterMatch.ANY,
- values);
+ Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, typeParameters, values, QueryOption.TOKEN_DELIMITER__ANY);
handler.handle(builder, testPredicate);
- verify(builder).and(anyCollectionOf(IAttributeType.class), eq("value"), delimiter.capture(),
- eq(CaseType.IGNORE_CASE), eq(TokenOrderType.ANY_ORDER), eq(MatchTokenCountType.IGNORE_TOKEN_COUNT));
-
- reset(builder);
- flags = Arrays.asList(SearchFlag.values());
- testPredicate =
- new Predicate(SearchMethod.ATTRIBUTE_TYPE, typeParameters, SearchOp.EQUALS, flags, TokenDelimiterMatch.ANY,
- values);
- handler.handle(builder, testPredicate);
- verify(builder).and(anyCollectionOf(IAttributeType.class), eq("value"), delimiter.capture(),
- eq(CaseType.MATCH_CASE), eq(TokenOrderType.MATCH_ORDER), eq(MatchTokenCountType.MATCH_TOKEN_COUNT));
+ verify(builder).and(anyCollectionOf(IAttributeType.class), eq("value"), eq(QueryOption.TOKEN_DELIMITER__ANY));
}
- @Test
- public void testOperatorSelection() throws OseeCoreException {
- AttributeTypePredicateHandler handler = new AttributeTypePredicateHandler();
- List<String> typeParameters = Collections.singletonList("0x0123");
- List<SearchFlag> flags = Arrays.asList(SearchFlag.MATCH_CASE);
- List<String> values = Collections.singletonList("value");
- Predicate testPredicate =
- new Predicate(SearchMethod.ATTRIBUTE_TYPE, typeParameters, SearchOp.GREATER_THAN, flags,
- TokenDelimiterMatch.ANY, values);
- handler.handle(builder, testPredicate);
- verify(builder).and(any(IAttributeType.class), eq(Operator.GREATER_THAN), valueCaptor.capture());
- Assert.assertEquals(values, valueCaptor.getValue());
-
- reset(builder);
- testPredicate =
- new Predicate(SearchMethod.ATTRIBUTE_TYPE, typeParameters, SearchOp.LESS_THAN, flags, TokenDelimiterMatch.ANY,
- values);
- handler.handle(builder, testPredicate);
- verify(builder).and(any(IAttributeType.class), eq(Operator.LESS_THAN), valueCaptor.capture());
- Assert.assertEquals(values, valueCaptor.getValue());
- }
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/ExistsTypePredicateHandlerTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/ExistsTypePredicateHandlerTest.java
index 4e0a6b3453..cf776cf098 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/ExistsTypePredicateHandlerTest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/ExistsTypePredicateHandlerTest.java
@@ -23,13 +23,11 @@ import java.util.List;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.rest.internal.search.artifact.predicate.ExistsTypePredicateHandler;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchFlag;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
import org.eclipse.osee.orcs.search.QueryBuilder;
import org.junit.Assert;
import org.junit.Before;
@@ -61,13 +59,10 @@ public class ExistsTypePredicateHandlerTest {
public void testHandleRelationTypeSideA() throws OseeCoreException {
ExistsTypePredicateHandler handler = new ExistsTypePredicateHandler();
List<String> typeParameters = Collections.singletonList("relType");
- //no flags for exists type
- List<SearchFlag> flags = Collections.emptyList();
//for relation type sides, first char must be A or B denoting side, followed by relation type uuid
String relationValue = "12345";
List<String> values = Collections.singletonList(relationValue);
- Predicate testPredicate =
- new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, SearchOp.EQUALS, flags, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, values);
handler.handle(builder, testPredicate);
verify(builder).andExists(relationTypeCaptor.capture());
Assert.assertEquals(1, relationTypeCaptor.getAllValues().size());
@@ -79,11 +74,9 @@ public class ExistsTypePredicateHandlerTest {
ExistsTypePredicateHandler handler = new ExistsTypePredicateHandler();
List<String> typeParameters = Collections.singletonList("relType");
//no flags for exists type
- List<SearchFlag> flags = Collections.emptyList();
String relationValue = "12345";
List<String> values = Collections.singletonList(relationValue);
- Predicate testPredicate =
- new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, SearchOp.EQUALS, flags, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, values);
handler.handle(builder, testPredicate);
verify(builder).andExists(relationTypeCaptor.capture());
@@ -95,14 +88,11 @@ public class ExistsTypePredicateHandlerTest {
public void testHandleRelationTypeSideMultiples() throws OseeCoreException {
ExistsTypePredicateHandler handler = new ExistsTypePredicateHandler();
List<String> typeParameters = Collections.singletonList("relType");
- //no flags for exists type
- List<SearchFlag> flags = Collections.emptyList();
//test multiples
String relationValue1 = "12345";
String relationValue2 = "34567";
List<String> values = Arrays.asList(relationValue1, relationValue2);
- Predicate testPredicate =
- new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, SearchOp.EQUALS, flags, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, values);
handler.handle(builder, testPredicate);
verify(builder, times(2)).andExists(relationTypeCaptor.capture());
@@ -119,13 +109,10 @@ public class ExistsTypePredicateHandlerTest {
public void testHandleAttrTypeSingle() throws OseeCoreException {
ExistsTypePredicateHandler handler = new ExistsTypePredicateHandler();
List<String> typeParameters = Collections.singletonList("attrType");
- //no flags for exists type
- List<SearchFlag> flags = Collections.emptyList();
//for relation type sides, first char must be A or B denoting side, followed by relation type uuid
String attrUuid = "12345";
List<String> values = Collections.singletonList(attrUuid);
- Predicate testPredicate =
- new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, SearchOp.EQUALS, flags, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, values);
handler.handle(builder, testPredicate);
verify(builder).andExists(attrTypeSideCaptor.capture());
Assert.assertEquals(1, attrTypeSideCaptor.getAllValues().size());
@@ -137,14 +124,10 @@ public class ExistsTypePredicateHandlerTest {
public void testHandleAttrTypeMultiple() throws OseeCoreException {
ExistsTypePredicateHandler handler = new ExistsTypePredicateHandler();
List<String> typeParameters = Collections.singletonList("attrType");
- //no flags for exists type
- List<SearchFlag> flags = Collections.emptyList();
String attrType1 = "12345";
String attrType2 = "34567";
List<String> values = Arrays.asList(attrType1, attrType2);
- Predicate testPredicate =
- new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, SearchOp.EQUALS, flags, TokenDelimiterMatch.ANY,
- values);
+ Predicate testPredicate = new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, values, QueryOption.TOKEN_DELIMITER__ANY);
handler.handle(builder, testPredicate);
verify(builder).andExists(attrTypeSideCaptor.capture());
@@ -158,22 +141,16 @@ public class ExistsTypePredicateHandlerTest {
public void testHandleBadValues() throws OseeCoreException {
ExistsTypePredicateHandler handler = new ExistsTypePredicateHandler();
List<String> typeParameters = Collections.singletonList("attrType");
- //no flags for exists type
- List<SearchFlag> flags = Collections.emptyList();
String value = "12A4G";
List<String> values = Collections.singletonList(value);
- Predicate testPredicate =
- new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, SearchOp.EQUALS, flags, TokenDelimiterMatch.ANY,
- values);
+ Predicate testPredicate = new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, values, QueryOption.TOKEN_DELIMITER__ANY);
handler.handle(builder, testPredicate);
verify(builder, never()).andExists(anyCollectionOf(IAttributeType.class));
value = "12A4G";
typeParameters = Collections.singletonList("relType");
values = Collections.singletonList(value);
- testPredicate =
- new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, SearchOp.EQUALS, flags, TokenDelimiterMatch.ANY,
- values);
+ testPredicate = new Predicate(SearchMethod.EXISTS_TYPE, typeParameters, values, QueryOption.TOKEN_DELIMITER__ANY);
handler.handle(builder, testPredicate);
verify(builder, never()).andExists(any(IRelationTypeSide.class));
}
@@ -182,8 +159,8 @@ public class ExistsTypePredicateHandlerTest {
public void testBadValuesThrowException() throws OseeCoreException {
ExistsTypePredicateHandler handler = new ExistsTypePredicateHandler();
Predicate testPredicate =
- new Predicate(SearchMethod.ATTRIBUTE_TYPE, Collections.singletonList("relType"), SearchOp.EQUALS, null,
- TokenDelimiterMatch.ANY, Collections.singletonList("A12A4G"));
+ new Predicate(SearchMethod.ATTRIBUTE_TYPE, Collections.singletonList("relType"),
+ Collections.singletonList("A12A4G"), QueryOption.TOKEN_DELIMITER__ANY);
handler.handle(builder, testPredicate);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/GuidsPredicateHandlerTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/GuidsPredicateHandlerTest.java
index ec80527834..974409a0c2 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/GuidsPredicateHandlerTest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/GuidsPredicateHandlerTest.java
@@ -47,11 +47,11 @@ public class GuidsPredicateHandlerTest {
@Test
public void testHandleGuids() throws OseeCoreException {
GuidsPredicateHandler handler = new GuidsPredicateHandler();
- // no type params, op, or flags for ids - any passed are ignored
+ // no type params for ids - any passed are ignored
// if not all digits, treated as guid
String id2 = "AGUID234";
List<String> values = Collections.singletonList(id2);
- Predicate testPredicate = new Predicate(SearchMethod.GUIDS, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.GUIDS, null, values);
handler.handle(builder, testPredicate);
verify(builder).andGuids(guidsCaptor.capture());
Assert.assertEquals(1, guidsCaptor.getValue().size());
@@ -61,7 +61,7 @@ public class GuidsPredicateHandlerTest {
@Test(expected = OseeArgumentException.class)
public void testHandleBadValues() throws OseeCoreException {
GuidsPredicateHandler handler = new GuidsPredicateHandler();
- Predicate testPredicate = new Predicate(SearchMethod.GUIDS, null, null, null, null, null);
+ Predicate testPredicate = new Predicate(SearchMethod.GUIDS, null, null);
handler.handle(builder, testPredicate);
}
@@ -70,7 +70,7 @@ public class GuidsPredicateHandlerTest {
GuidsPredicateHandler handler = new GuidsPredicateHandler();
String id1 = "12345";
List<String> values = Collections.singletonList(id1);
- Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, null, values);
handler.handle(builder, testPredicate);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IdsPredicateHandlerTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IdsPredicateHandlerTest.java
index 6218001a95..d640ffa84c 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IdsPredicateHandlerTest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IdsPredicateHandlerTest.java
@@ -14,7 +14,6 @@ import static org.mockito.Mockito.verify;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import org.junit.Assert;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
@@ -22,6 +21,7 @@ import org.eclipse.osee.orcs.rest.internal.search.artifact.predicate.IdsPredicat
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
import org.eclipse.osee.orcs.search.QueryBuilder;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -55,7 +55,7 @@ public class IdsPredicateHandlerTest {
//all digits get treated as artId
String id1 = "12345";
List<String> values = Collections.singletonList(id1);
- Predicate testPredicate = new Predicate(SearchMethod.IDS, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.IDS, null, values);
handler.handle(builder, testPredicate);
verify(builder).andLocalIds(localIdsCaptor.capture());
Assert.assertEquals(1, localIdsCaptor.getValue().size());
@@ -70,14 +70,14 @@ public class IdsPredicateHandlerTest {
//all digits get treated as artId
String id1 = GUID.create();
List<String> values = Collections.singletonList(id1);
- Predicate testPredicate = new Predicate(SearchMethod.IDS, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.IDS, null, values);
handler.handle(builder, testPredicate);
}
@Test(expected = OseeArgumentException.class)
public void testHandleBadValues() throws OseeCoreException {
IdsPredicateHandler handler = new IdsPredicateHandler();
- Predicate testPredicate = new Predicate(SearchMethod.IDS, null, null, null, null, null);
+ Predicate testPredicate = new Predicate(SearchMethod.IDS, null, null);
handler.handle(builder, testPredicate);
}
@@ -86,7 +86,7 @@ public class IdsPredicateHandlerTest {
IdsPredicateHandler handler = new IdsPredicateHandler();
String id1 = "12345";
List<String> values = Collections.singletonList(id1);
- Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, null, values);
handler.handle(builder, testPredicate);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IsOfTypePredicateHandlerTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IsOfTypePredicateHandlerTest.java
index b215736be6..9d31bf521d 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IsOfTypePredicateHandlerTest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/IsOfTypePredicateHandlerTest.java
@@ -10,13 +10,12 @@
*******************************************************************************/
package org.eclipse.osee.orcs.rest.internal.search.predicate;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.verify;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-import org.junit.Assert;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -24,6 +23,7 @@ import org.eclipse.osee.orcs.rest.internal.search.artifact.predicate.IsOfTypePre
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
import org.eclipse.osee.orcs.search.QueryBuilder;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -54,7 +54,7 @@ public class IsOfTypePredicateHandlerTest {
String id1 = "12345";
List<String> values = Collections.singletonList(id1);
- Predicate testPredicate = new Predicate(SearchMethod.IS_OF_TYPE, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.IS_OF_TYPE, null, values);
handler.handle(builder, testPredicate);
verify(builder).andIsOfType(artifactTypesCaptor.capture());
Assert.assertEquals(1, artifactTypesCaptor.getValue().size());
@@ -69,7 +69,7 @@ public class IsOfTypePredicateHandlerTest {
String id2 = "45678";
List<String> values = Arrays.asList(id1, id2);
- Predicate testPredicate = new Predicate(SearchMethod.IS_OF_TYPE, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.IS_OF_TYPE, null, values);
handler.handle(builder, testPredicate);
verify(builder).andIsOfType(artifactTypesCaptor.capture());
Assert.assertEquals(2, artifactTypesCaptor.getValue().size());
@@ -81,7 +81,7 @@ public class IsOfTypePredicateHandlerTest {
@Test(expected = OseeArgumentException.class)
public void testHandleBadValues() throws OseeCoreException {
IsOfTypePredicateHandler handler = new IsOfTypePredicateHandler();
- Predicate testPredicate = new Predicate(SearchMethod.IS_OF_TYPE, null, null, null, null, null);
+ Predicate testPredicate = new Predicate(SearchMethod.IS_OF_TYPE, null, null);
handler.handle(builder, testPredicate);
}
@@ -90,7 +90,7 @@ public class IsOfTypePredicateHandlerTest {
IsOfTypePredicateHandler handler = new IsOfTypePredicateHandler();
String id1 = "12345";
List<String> values = Collections.singletonList(id1);
- Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, null, values);
handler.handle(builder, testPredicate);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/RelatedToPredicateHandlerTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/RelatedToPredicateHandlerTest.java
index 1ecc7c023b..e1e2238408 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/RelatedToPredicateHandlerTest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/RelatedToPredicateHandlerTest.java
@@ -14,18 +14,15 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.enums.RelationSide;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.orcs.rest.internal.search.artifact.predicate.RelatedToPredicateHandler;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchFlag;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
import org.eclipse.osee.orcs.search.QueryBuilder;
import org.junit.Assert;
import org.junit.Before;
@@ -55,10 +52,8 @@ public class RelatedToPredicateHandlerTest {
@Test
public void testRelatedToLocalIds() throws OseeCoreException {
RelatedToPredicateHandler handler = new RelatedToPredicateHandler();
- List<SearchFlag> emptySearchFlags = Collections.emptyList();
Predicate testPredicate =
- new Predicate(SearchMethod.RELATED_TO, Arrays.asList("A1", "B2"), SearchOp.EQUALS, emptySearchFlags,
- TokenDelimiterMatch.ANY, Arrays.asList("4", "5"));
+ new Predicate(SearchMethod.RELATED_TO, Arrays.asList("A1", "B2"), Arrays.asList("4", "5"), QueryOption.TOKEN_DELIMITER__ANY);
handler.handle(builder, testPredicate);
verify(builder, times(2)).andRelatedToLocalIds(rtsCaptor.capture(), idsCaptor.capture());
List<IRelationTypeSide> rts = rtsCaptor.getAllValues();
@@ -74,10 +69,9 @@ public class RelatedToPredicateHandlerTest {
@Test(expected = UnsupportedOperationException.class)
public void testUnsupportedOperation() throws OseeCoreException {
RelatedToPredicateHandler handler = new RelatedToPredicateHandler();
- List<SearchFlag> emptySearchFlags = Collections.emptyList();
Predicate testPredicate =
- new Predicate(SearchMethod.RELATED_TO, Arrays.asList("A1", "B2"), SearchOp.EQUALS, emptySearchFlags,
- TokenDelimiterMatch.ANY, Arrays.asList(GUID.create()));
+ new Predicate(SearchMethod.RELATED_TO, Arrays.asList("A1", "B2"), Arrays.asList(GUID.create()),
+ QueryOption.TOKEN_DELIMITER__ANY);
handler.handle(builder, testPredicate);
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/TypeEqualsPredicateHandlerTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/TypeEqualsPredicateHandlerTest.java
index 4916cd51e6..2091eb6778 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/TypeEqualsPredicateHandlerTest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/TypeEqualsPredicateHandlerTest.java
@@ -59,7 +59,7 @@ public class TypeEqualsPredicateHandlerTest {
String id1 = "12345";
List<String> values = Collections.singletonList(id1);
- Predicate testPredicate = new Predicate(SearchMethod.TYPE_EQUALS, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.TYPE_EQUALS, null, values);
handler.handle(builder, testPredicate);
verify(builder).andTypeEquals(artifactTypesCaptor.capture());
@@ -74,7 +74,7 @@ public class TypeEqualsPredicateHandlerTest {
String id2 = "45678";
List<String> values = Arrays.asList(id1, id2);
- Predicate testPredicate = new Predicate(SearchMethod.TYPE_EQUALS, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.TYPE_EQUALS, null, values);
handler.handle(builder, testPredicate);
verify(builder).andTypeEquals(artifactTypesCaptor.capture());
@@ -89,7 +89,7 @@ public class TypeEqualsPredicateHandlerTest {
@Test(expected = OseeArgumentException.class)
public void testHandleBadValues() throws OseeCoreException {
- Predicate testPredicate = new Predicate(SearchMethod.TYPE_EQUALS, null, null, null, null, null);
+ Predicate testPredicate = new Predicate(SearchMethod.TYPE_EQUALS, null, null);
handler.handle(builder, testPredicate);
}
@@ -97,7 +97,7 @@ public class TypeEqualsPredicateHandlerTest {
public void testBadSearchMethod() throws OseeCoreException {
String id1 = "12345";
List<String> values = Collections.singletonList(id1);
- Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, null, null, null, null, values);
+ Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, null, values);
handler.handle(builder, testPredicate);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/ArtifactSearch_V1.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/ArtifactSearch_V1.java
index 1a0d4cce8f..6920707a15 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/ArtifactSearch_V1.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/ArtifactSearch_V1.java
@@ -13,10 +13,8 @@ package org.eclipse.osee.orcs.rest.internal.search.artifact;
import java.util.LinkedList;
import java.util.List;
import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriInfo;
@@ -28,7 +26,6 @@ import org.eclipse.osee.orcs.data.AttributeReadable;
import org.eclipse.osee.orcs.data.HasLocalId;
import org.eclipse.osee.orcs.rest.internal.OrcsApplication;
import org.eclipse.osee.orcs.rest.internal.search.artifact.dsl.DslFactory;
-import org.eclipse.osee.orcs.rest.internal.search.artifact.dsl.DslTranslator;
import org.eclipse.osee.orcs.rest.internal.search.artifact.dsl.SearchQueryBuilder;
import org.eclipse.osee.orcs.rest.model.search.artifact.RequestType;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMatch;
@@ -51,67 +48,6 @@ public class ArtifactSearch_V1 extends ArtifactSearch {
searchQueryBuilder = DslFactory.createQueryBuilder();
}
- /**
- * @param alt The return data format. Possible values:
- * <ul>
- * <li>xml
- * <li>text (not supported)
- * <li>json (not supported)
- * <li>xhtml (not supported)
- * </ul>
- * @param fields What to do with the query. For example, once the search has produced a result set, what aspect of
- * the result set should be returned? Possible values:
- * <ul>
- * <li>count = Return an integer value counting the number of items returned by the query. Note that none of the
- * artifacts or attributes of the search result will be returned to the client. Only a count of the search result
- * items.
- * </ul>
- * @param rawQuery A query string with a custom syntax (see below). The query string syntax must be properly <a
- * href="http://en.wikipedia.org/wiki/Percent-encoding">URL-encoded</a>
- * @param fromTransaction (Optional) Transaction ID for a historical context. Use this parameter if you want the
- * search results to represent a specific point in time in the past. Without this parameter search results will
- * reflect the most current state of the data.
- * @param includeCache (Optional) Boolean parameter that configures the search to ???
- * @param includeDeleted (Optional) Boolean parameter that configures the search to include deleted artifacts in its
- * result set and analysis.
- * @return A {@link SearchResponse} object containing the results of the search, configuration and analysis
- * information.
- * @throws OseeCoreException<br>
- * <br>
- * <b>rawQuery Syntax</b><br>
- * The query syntax is composed of one or more predicates - atomic search instructions - that can be appended
- * together as compound AND or OR query statements. Each predicate is surrounded by square brackets '[' and ']' which
- * makes writing a formal definition of the syntax a little confusing since the square bracket traditionally
- * surrounds optional items in a syntax. Because of this please note in the formal definition below literal square
- * brackets - those which belong as actual characters in the syntax - are escaped with a back slash character '\'.<br>
- * <b>Example Request String</b><br>
- * <FONT FACE="Courier New">
- * http://localhost:8089/oseex/branch/AyH_fDpMERA+zDfML4gA/artifact/search/v1?alt=xml&fields=
- * count&q=[t:attrType%26tp: 123%26op:==%26v:Smith]%26[t:attrType%26tp:456%26op:==%26v:John]</FONT><br>
- * <i>Note: "%26" = "&"</i>
- * <ul>
- * <li><b>http://localhost:8089/oseex/branch/AyH_fDpMERA+zDfML4gA/artifact/search/v1</b> ==> URL address
- * <li><b>alt=xml</b> ==> Search results will be formatted as XML
- * <li><b>fields=count</b> ==> Result returned will be a count of the search results
- * <li><b>q=[...]%26[...]</b> ==> The query string. In this example there are two search predicates "AND"-ed
- * together.
- * <li><b>t:attrType%26tp: 123%26op:==%26v:Smith</b> ==> Presumably "123" is the UUID for the "Last Name" attribute
- * type. This predicate can be translated into English as
- * <b>"Find all the artifacts with a <i>Last Name</i> <i>attribute</i> that equals <i>'Smith'</i>."</b>
- * <li><b>t:attrType%26tp:456%26op:==%26v:John</b> ==> Presumably "456" is the UUID for the "First Name" attribute
- * type. <b>"Find all the artifacts with a <i>First Name</i> <i>attribute</i> that equals <i>'John'</i>."</b>
- * </ul>
- */
- @GET
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- public SearchResponse getSearchWithQueryParams(@QueryParam("alt") String alt, @QueryParam("fields") String fields, @QueryParam("q") String rawQuery, @QueryParam("fromTx") int fromTransaction, @QueryParam("includeDeleted") boolean includeDeleted) throws OseeCoreException {
- DslTranslator translator = DslFactory.createTranslator();
- SearchRequest params =
- new SearchRequest(getBranchUuid(), translator.translate(rawQuery), alt, fields, fromTransaction,
- includeDeleted);
- return search(params);
- }
-
@POST
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -133,7 +69,7 @@ public class ArtifactSearch_V1 extends ArtifactSearch {
}
SearchResponse result = new SearchResponse();
- RequestType request = RequestType.valueOf(params.getFields().toUpperCase());
+ RequestType request = params.getRequestType();
List<Integer> localIds = new LinkedList<Integer>();
switch (request) {
case COUNT:
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslFactory.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslFactory.java
index 9033b9cf86..f6c7dc0491 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslFactory.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslFactory.java
@@ -37,10 +37,6 @@ public class DslFactory {
return builder;
}
- public static DslTranslator createTranslator() {
- return new DslTranslatorImpl_V1();
- }
-
public static Map<SearchMethod, PredicateHandler> getHandlers() {
Map<SearchMethod, PredicateHandler> handlers = new HashMap<SearchMethod, PredicateHandler>();
handlers.put(SearchMethod.IDS, new IdsPredicateHandler());
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslTranslator.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslTranslator.java
deleted file mode 100644
index 9f9ce0525e..0000000000
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslTranslator.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.rest.internal.search.artifact.dsl;
-
-import java.util.List;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
-
-/**
- * @author John R. Misinco
- */
-public interface DslTranslator {
-
- List<Predicate> translate(String rawString) throws OseeCoreException;
-
-}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslTranslatorImpl_V1.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslTranslatorImpl_V1.java
deleted file mode 100644
index f4309f3ba5..0000000000
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/dsl/DslTranslatorImpl_V1.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.rest.internal.search.artifact.dsl;
-
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Scanner;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchFlag;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
-
-/**
- * @author John R. Misinco
- * @author Roberto E. Escobar
- */
-public class DslTranslatorImpl_V1 implements DslTranslator {
-
- private static final String ARGUMENT_REGEX = ":([^&\\]]+)";
- private static final Pattern queryPattern = Pattern.compile("\\]&\\[");
- private static final Pattern typePattern = Pattern.compile("t" + ARGUMENT_REGEX);
- private static final Pattern typeParametersPattern = Pattern.compile("tp" + ARGUMENT_REGEX);
- private static final Pattern opPattern = Pattern.compile("op" + ARGUMENT_REGEX);
- private static final Pattern flagsPattern = Pattern.compile("f" + ARGUMENT_REGEX);
- private static final Pattern valuePattern = Pattern.compile("v" + ARGUMENT_REGEX);
- private static final Pattern delimiterPattern = Pattern.compile("d:'(.+)'");
-
- private final Matcher typeMatcher, opMatcher, flagsMatcher, valueMatcher, typeParametersMatcher, delimiterMatcher;
- private Scanner scanner;
-
- public DslTranslatorImpl_V1() {
- typeMatcher = typePattern.matcher("");
- opMatcher = opPattern.matcher("");
- flagsMatcher = flagsPattern.matcher("");
- valueMatcher = valuePattern.matcher("");
- typeParametersMatcher = typeParametersPattern.matcher("");
- delimiterMatcher = delimiterPattern.matcher("");
- }
-
- @Override
- public List<Predicate> translate(String rawString) throws OseeCoreException {
- List<Predicate> predicates = new LinkedList<Predicate>();
- scanner = new Scanner(rawString);
- scanner.useDelimiter(queryPattern);
- while (scanner.hasNext()) {
- String queryBlock = scanner.next();
- typeMatcher.reset(queryBlock);
- typeParametersMatcher.reset(queryBlock);
- opMatcher.reset(queryBlock);
- flagsMatcher.reset(queryBlock);
- valueMatcher.reset(queryBlock);
- delimiterMatcher.reset(queryBlock);
-
- String type = getMatch(typeMatcher);
- String typeParams = getMatch(typeParametersMatcher);
- String op = getMatch(opMatcher);
- String flags = getMatch(flagsMatcher);
- String value = getMatch(valueMatcher);
- String delimiter = getMatch(delimiterMatcher);
-
- predicates.add(createPredicate(type, typeParams, op, flags, delimiter, value));
- }
- return predicates;
- }
-
- private Predicate createPredicate(String type, String typeParameters, String op, String flags, String delimiter, String value) throws OseeCoreException {
- SearchMethod searchMethod = SearchMethod.fromString(type);
- SearchOp searchOp = SearchOp.fromString(op);
-
- List<SearchFlag> searchFlags = new LinkedList<SearchFlag>();
- for (String flag : flags.split(",")) {
- if (Strings.isValid(flag)) {
- searchFlags.add(SearchFlag.fromString(flag));
- }
- }
-
- List<String> values = Arrays.asList(value.split(",\\s*"));
- List<String> typeParams = Arrays.asList(typeParameters.split(",\\s*"));
- TokenDelimiterMatch delim = TokenDelimiterMatch.fromString(delimiter);
- return new Predicate(searchMethod, typeParams, searchOp, searchFlags, delim, values);
- }
-
- private String getMatch(Matcher m) {
- if (m.find()) {
- return m.group(1);
- }
- return Strings.EMPTY_STRING;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/AttributeTypePredicateHandler.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/AttributeTypePredicateHandler.java
index bf49b68840..0ce14b9ce6 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/AttributeTypePredicateHandler.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/AttributeTypePredicateHandler.java
@@ -11,21 +11,14 @@
package org.eclipse.osee.orcs.rest.internal.search.artifact.predicate;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.CaseType;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.Operator;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.orcs.rest.internal.search.artifact.PredicateHandler;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchFlag;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
import org.eclipse.osee.orcs.search.QueryBuilder;
/**
@@ -39,78 +32,19 @@ public class AttributeTypePredicateHandler implements PredicateHandler {
if (predicate.getType() != SearchMethod.ATTRIBUTE_TYPE) {
throw new OseeArgumentException("This predicate handler only supports [%s]", SearchMethod.ATTRIBUTE_TYPE);
}
- List<SearchFlag> flags = predicate.getFlags();
List<String> typeParameters = predicate.getTypeParameters();
Collection<IAttributeType> attributeTypes = PredicateHandlerUtil.getIAttributeTypes(typeParameters);
- SearchOp op = predicate.getOp();
Collection<String> values = predicate.getValues();
Conditions.checkNotNull(values, "values");
- if (!containsAny(Collections.singleton(op), SearchOp.GREATER_THAN, SearchOp.LESS_THAN)) {
- CaseType ct = getCaseType(flags);
- TokenOrderType orderType = getTokenOrderType(flags);
- MatchTokenCountType countType = getMatchTokenCountType(flags);
- if (values.size() == 1) {
- builder =
- builder.and(attributeTypes, values.iterator().next(), predicate.getDelimiter(), ct, orderType, countType);
- } else {
- for (IAttributeType type : attributeTypes) {
- builder = builder.and(type, getOperator(op), values);
- }
- }
+ if (values.size() == 1) {
+ builder = builder.and(attributeTypes, values.iterator().next(), predicate.getOptions());
} else {
- Operator operator = getOperator(op);
for (IAttributeType type : attributeTypes) {
- builder = builder.and(type, operator, values);
+ builder = builder.and(type, values, predicate.getOptions());
}
}
return builder;
}
- private boolean containsAny(Collection<?> data, Object... values) {
- boolean result = false;
- for (Object object : values) {
- if (data.contains(object)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- private CaseType getCaseType(List<SearchFlag> flags) {
- if (flags != null && flags.contains(SearchFlag.MATCH_CASE)) {
- return CaseType.MATCH_CASE;
- }
- return CaseType.IGNORE_CASE;
- }
-
- private TokenOrderType getTokenOrderType(List<SearchFlag> flags) {
- if (flags != null && flags.contains(SearchFlag.MATCH_TOKEN_ORDER)) {
- return TokenOrderType.MATCH_ORDER;
- }
- return TokenOrderType.ANY_ORDER;
- }
-
- private MatchTokenCountType getMatchTokenCountType(List<SearchFlag> flags) {
- if (flags != null && flags.contains(SearchFlag.MATCH_TOKEN_COUNT)) {
- return MatchTokenCountType.MATCH_TOKEN_COUNT;
- }
- return MatchTokenCountType.IGNORE_TOKEN_COUNT;
- }
-
- // EQUAL("="), // Exact Match as in Strings.equals
- // NOT_EQUAL("<>"), // inverse of exact match - !Strings.equals
- // LESS_THAN("<"),
- // GREATER_THAN(">");
- private Operator getOperator(SearchOp op) {
- if (op.equals(SearchOp.GREATER_THAN)) {
- return Operator.GREATER_THAN;
- }
- if (op.equals(SearchOp.LESS_THAN)) {
- return Operator.LESS_THAN;
- }
- return Operator.EQUAL;
- }
-
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/ExistsTypePredicateHandler.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/ExistsTypePredicateHandler.java
index e02ecd7dd8..d56186e60f 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/ExistsTypePredicateHandler.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/ExistsTypePredicateHandler.java
@@ -16,6 +16,7 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.data.TokenFactory;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -23,7 +24,6 @@ import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.orcs.rest.internal.search.artifact.PredicateHandler;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchMethod;
-import org.eclipse.osee.orcs.rest.model.search.artifact.SearchOp;
import org.eclipse.osee.orcs.search.QueryBuilder;
/**
@@ -51,23 +51,23 @@ public class ExistsTypePredicateHandler implements PredicateHandler {
builder.andExists(attributeTypes);
}
} else if ("relType".equals(existsType)) {
- SearchOp op = predicate.getOp();
+ QueryOption[] options = predicate.getOptions();
for (IRelationType rt : PredicateHandlerUtil.getIRelationTypes(values)) {
- if (op == SearchOp.EQUALS) {
- builder.andExists(rt);
- } else {
+ if (searchNotExists(options)) {
builder.andNotExists(rt);
+ } else {
+ builder.andExists(rt);
}
}
} else if ("relTypeSide".equals(existsType)) {
- SearchOp op = predicate.getOp();
+ QueryOption[] options = predicate.getOptions();
RelationSide side = typeParameters.get(1).equals("A") ? RelationSide.SIDE_A : RelationSide.SIDE_B;
for (IRelationType rt : PredicateHandlerUtil.getIRelationTypes(values)) {
IRelationTypeSide rts = TokenFactory.createRelationTypeSide(side, rt.getGuid(), "SearchRelTypeSide");
- if (op == SearchOp.EQUALS) {
- builder.andExists(rts);
- } else {
+ if (searchNotExists(options)) {
builder.andNotExists(rts);
+ } else {
+ builder.andExists(rts);
}
}
}
@@ -76,4 +76,13 @@ public class ExistsTypePredicateHandler implements PredicateHandler {
return builder;
}
+ private boolean searchNotExists(QueryOption[] options) {
+ for (QueryOption option : options) {
+ if (option == QueryOption.EXISTANCE__NOT_EXISTS) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java
index 8d3c24da47..686551bb1f 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java
@@ -19,7 +19,6 @@ import java.util.HashMap;
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.Operator;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.orcs.ApplicationContext;
@@ -78,7 +77,7 @@ public class OrcsAttributeLoadingTest {
@Test
public void testLoadWordTemplateContentAttributes() throws OseeCoreException {
QueryBuilder builder =
- query.fromBranch(TestBranches.SAW_Bld_1).and(CoreAttributeTypes.Name, Operator.EQUAL, "Haptic Constraints");
+ query.fromBranch(TestBranches.SAW_Bld_1).and(CoreAttributeTypes.Name, "Haptic Constraints");
ResultSet<ArtifactReadable> resultSet = builder.getResults();
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeSearchTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeSearchTest.java
index 62f233f5d5..10ef9fcc36 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeSearchTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeSearchTest.java
@@ -13,14 +13,9 @@ package org.eclipse.osee.orcs.api;
import static org.eclipse.osee.orcs.OrcsIntegrationRule.integrationRule;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.eclipse.osee.framework.core.enums.CaseType;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.Operator;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.orcs.ApplicationContext;
@@ -54,21 +49,8 @@ public class OrcsAttributeSearchTest {
}
@Test
- public void testNameAttributeNotEqualSearch() throws OseeCoreException {
- QueryBuilder builder =
- queryFactory.fromBranch(CoreBranches.COMMON).and(CoreAttributeTypes.Name, Operator.NOT_EQUAL, "User Groups");
-
- ResultSet<ArtifactReadable> resultSet = builder.getResults();
-
- for (ArtifactReadable artifact : resultSet) {
- assertTrue(artifact.getLocalId() != 7);
- }
- }
-
- @Test
public void testNameAttributeEqualSearch() throws OseeCoreException {
- QueryBuilder builder =
- queryFactory.fromBranch(CoreBranches.COMMON).and(CoreAttributeTypes.Name, Operator.EQUAL, "User Groups");
+ QueryBuilder builder = queryFactory.fromBranch(CoreBranches.COMMON).and(CoreAttributeTypes.Name, "User Groups");
ResultSet<ArtifactReadable> resultSet = builder.getResults();
@@ -85,8 +67,8 @@ public class OrcsAttributeSearchTest {
public void testWTCAttributeEqualSearch() throws OseeCoreException {
QueryBuilder builder =
queryFactory.fromBranch(TestBranches.SAW_Bld_1).and(CoreAttributeTypes.WordTemplateContent, "commands",
- TokenDelimiterMatch.ANY, TokenOrderType.MATCH_ORDER, CaseType.IGNORE_CASE,
- MatchTokenCountType.IGNORE_TOKEN_COUNT);
+ QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_COUNT__IGNORE);
assertEquals(3, builder.getCount());
@@ -98,8 +80,7 @@ public class OrcsAttributeSearchTest {
@Test
public void testBooleanAttributeSearch() throws OseeCoreException {
- QueryBuilder builder =
- queryFactory.fromBranch(CoreBranches.COMMON).and(CoreAttributeTypes.DefaultGroup, Operator.EQUAL, "true");
+ QueryBuilder builder = queryFactory.fromBranch(CoreBranches.COMMON).and(CoreAttributeTypes.DefaultGroup, "true");
ResultSet<ArtifactReadable> resultSet = builder.getResults();
assertEquals(1, resultSet.size());
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java
index 1c8ef5f31f..c8c9ec6e23 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java
@@ -21,22 +21,17 @@ import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.CaseType;
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.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
-import org.eclipse.osee.framework.core.enums.Operator;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.enums.SystemUser;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
import org.eclipse.osee.framework.core.model.BranchReadable;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.framework.jdk.core.type.Named;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsBranch;
@@ -171,7 +166,7 @@ public class OrcsQueryTest {
@Test
public void testQueryAttributeValue() throws OseeCoreException {
QueryBuilder builder = factory.fromBranch(CoreBranches.COMMON);
- builder.and(CoreAttributeTypes.Name, Operator.EQUAL, "User Groups");
+ builder.and(CoreAttributeTypes.Name, "User Groups");
assertEquals(1, builder.getCount());
@@ -199,7 +194,7 @@ public class OrcsQueryTest {
@Test
public void testQueryArtifactTypeAndNameValue() throws OseeCoreException {
QueryBuilder builder = factory.fromBranch(TestBranches.SAW_Bld_1);
- builder.and(CoreAttributeTypes.Name, "Requirements", MatchTokenCountType.IGNORE_TOKEN_COUNT);
+ builder.and(CoreAttributeTypes.Name, "Requirements", QueryOption.TOKEN_COUNT__IGNORE);
assertEquals(7, builder.getCount());
ResultSet<ArtifactReadable> artifacts = builder.getResults();
@@ -221,7 +216,7 @@ public class OrcsQueryTest {
//////////////////////
QueryBuilder builder1 = factory.fromBranch(TestBranches.SAW_Bld_1);
- builder1.and(CoreAttributeTypes.Name, "Requirements", MatchTokenCountType.IGNORE_TOKEN_COUNT);
+ builder1.and(CoreAttributeTypes.Name, "Requirements", QueryOption.TOKEN_COUNT__IGNORE);
builder1.andTypeEquals(CoreArtifactTypes.SubsystemRequirementMSWord);
assertEquals(1, builder1.getCount());
ResultSet<ArtifactReadable> subSystemReqs = builder1.getResults();
@@ -231,7 +226,7 @@ public class OrcsQueryTest {
//////////////////////
QueryBuilder builder2 = factory.fromBranch(TestBranches.SAW_Bld_1);
- builder2.and(CoreAttributeTypes.Name, "Requirements", MatchTokenCountType.IGNORE_TOKEN_COUNT);
+ builder2.and(CoreAttributeTypes.Name, "Requirements", QueryOption.TOKEN_COUNT__IGNORE);
builder2.andIsOfType(CoreArtifactTypes.Requirement);
assertEquals(3, builder2.getCount());
@@ -248,8 +243,8 @@ public class OrcsQueryTest {
@Test
public void testQueryRequirementsAsLocalIds() throws OseeCoreException {
QueryBuilder builder = factory.fromBranch(TestBranches.SAW_Bld_1);
- builder.and(CoreAttributeTypes.Name, "REQUIREMENTS", CaseType.IGNORE_CASE, TokenOrderType.MATCH_ORDER,
- TokenDelimiterMatch.ANY, MatchTokenCountType.IGNORE_TOKEN_COUNT);
+ builder.and(CoreAttributeTypes.Name, "REQUIREMENTS", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_COUNT__IGNORE);
ResultSet<HasLocalId<Integer>> results = builder.getResultsAsLocalIds();
assertEquals(7, results.size());
@@ -259,7 +254,7 @@ public class OrcsQueryTest {
@Test
public void testQueryAttributeKeyword() throws OseeCoreException {
QueryBuilder builder = factory.fromBranch(TestBranches.SAW_Bld_1);
- builder.and(CoreAttributeTypes.Name, "REQUIREMENTS", TokenDelimiterMatch.ANY);
+ builder.and(CoreAttributeTypes.Name, "REQUIREMENTS", QueryOption.TOKEN_DELIMITER__ANY);
assertEquals(7, builder.getCount());
ResultSet<ArtifactReadable> requirements = builder.getResults();
@@ -290,14 +285,14 @@ public class OrcsQueryTest {
// @formatter:on
QueryBuilder builder1 = factory.fromBranch(TestBranches.SAW_Bld_1);
- builder1.and(CoreAttributeTypes.Name, "REQUIREMENTS", TokenDelimiterMatch.ANY, CaseType.MATCH_CASE);
+ builder1.and(CoreAttributeTypes.Name, "REQUIREMENTS", QueryOption.TOKEN_DELIMITER__ANY, QueryOption.CASE__MATCH);
assertEquals(0, builder1.getCount());
}
@Test
public void testRelatedToTest() throws OseeCoreException {
QueryBuilder builder1 = factory.fromBranch(TestBranches.SAW_Bld_1);
- builder1.and(CoreAttributeTypes.Name, Operator.EQUAL, "Frame Synchronization");
+ builder1.and(CoreAttributeTypes.Name, "Frame Synchronization");
assertEquals("Frame Synchronization", builder1.getResults().getExactlyOne().getName());
QueryBuilder builder2 = factory.fromBranch(TestBranches.SAW_Bld_1);
@@ -327,7 +322,7 @@ public class OrcsQueryTest {
private BranchReadable setupNameEqualsArtifacts() throws Exception {
author = factory.fromBranch(CoreBranches.COMMON).andIds(SystemUser.OseeSystem).getResults().getExactlyOne();
- IOseeBranch branchToken = TokenFactory.createBranch( "TestAndNameEquals");
+ IOseeBranch branchToken = TokenFactory.createBranch("TestAndNameEquals");
BranchReadable branch = branchApi.createTopLevelBranch(branchToken, author).call();
TransactionBuilder tx = txFactory.createTransaction(branch, author, "add folders");
tx.createArtifact(CoreArtifactTypes.Folder, "First Folder");
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java
index 1c19d94a05..a3294db751 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java
@@ -19,7 +19,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.Operator;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.orcs.ApplicationContext;
@@ -93,8 +92,7 @@ public class OrcsRelationLoadingTest {
private void checkRelationsForSawBranch(OrcsApi oseeApi, QueryFactory queryFactory, ApplicationContext context) throws OseeCoreException {
QueryBuilder builder =
- queryFactory.fromBranch(TestBranches.SAW_Bld_1).and(CoreAttributeTypes.Name, Operator.EQUAL,
- "Design Constraints");
+ queryFactory.fromBranch(TestBranches.SAW_Bld_1).and(CoreAttributeTypes.Name, "Design Constraints");
ResultSet<ArtifactReadable> resultSet = builder.getResults();
assertEquals(1, resultSet.size());
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 f78b995730..43be1e6d52 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
@@ -17,7 +17,6 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.jdk.core.type.Identifiable;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -157,17 +156,11 @@ public interface QueryBuilder {
QueryBuilder andNameEquals(String artifactName) throws OseeCoreException;
/**
- * Search criteria that finds an attribute of the given type with its current value relative to the given value based
- * on the operator provided.
- */
- QueryBuilder and(IAttributeType attributeType, Operator operator, String value) throws OseeCoreException;
-
- /**
* Search criteria that finds an attribute of the given type with its current value exactly equal (or not equal) to
* any one of the given literal values. If the list only contains one value, then the search is conducted exactly as
* if the single value constructor was called. This search does not support the (* wildcard) for multiple values.
*/
- QueryBuilder and(IAttributeType attributeType, Operator operator, Collection<String> values) throws OseeCoreException;
+ QueryBuilder and(IAttributeType attributeType, Collection<String> values, QueryOption... options) throws OseeCoreException;
/**
* Search criteria that finds an attribute of the given type with its current value relative to the given value based
@@ -180,7 +173,7 @@ public interface QueryBuilder {
* any one of the given literal values. If the list only contains one value, then the search is conducted exactly as
* if the single value constructor was called. This search does not support the (* wildcard) for multiple values.
*/
- QueryBuilder and(Collection<? extends IAttributeType> attributeTypes, String value, QueryOption... options) throws OseeCoreException;
+ QueryBuilder and(Collection<IAttributeType> attributeTypes, String value, QueryOption... options) throws OseeCoreException;
/**
* Search for related artifacts
diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java
index bbb3003650..83a5cb6a92 100644
--- a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java
+++ b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java
@@ -21,12 +21,9 @@ import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
import static org.junit.Assert.assertEquals;
import org.databene.contiperf.PerfTest;
import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.enums.CaseType;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.MatchTokenCountType;
+import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.enums.SystemUser;
-import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
-import org.eclipse.osee.framework.core.enums.TokenOrderType;
import org.eclipse.osee.framework.jdk.core.type.Identity;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.rest.client.OseeClient;
@@ -137,8 +134,8 @@ public class OseeClientQueryTest {
public void searchForArtifactWithActionInName() throws OseeCoreException {
final int EXPECTED_RESULTS = 43;
SearchResult results =
- createClient.createQueryBuilder(COMMON).and(CoreAttributeTypes.Name, "SAW", CaseType.IGNORE_CASE,
- TokenOrderType.MATCH_ORDER, TokenDelimiterMatch.ANY, MatchTokenCountType.IGNORE_TOKEN_COUNT).getSearchResult(
+ createClient.createQueryBuilder(COMMON).and(CoreAttributeTypes.Name, "SAW", QueryOption.CASE__IGNORE,
+ QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_DELIMITER__ANY, QueryOption.TOKEN_COUNT__IGNORE).getSearchResult(
RequestType.IDS);
assertEquals(EXPECTED_RESULTS, results.getTotal());
}

Back to the top