Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2016-08-25 15:07:24 -0400
committerdonald.g.dunne2016-08-25 15:07:24 -0400
commitc64919986d2b209a9269a5dc28cb69ed3ff452b7 (patch)
tree30734dc17591a33cfc88d38fd02035248d66e2bf
parent853de90d88a3d88a93cecb51633099d2f6a4b2e4 (diff)
downloadorg.eclipse.osee-c64919986d2b209a9269a5dc28cb69ed3ff452b7.tar.gz
org.eclipse.osee-c64919986d2b209a9269a5dc28cb69ed3ff452b7.tar.xz
org.eclipse.osee-c64919986d2b209a9269a5dc28cb69ed3ff452b7.zip
refactor: Use ArtifactId with ArtifactQueryBuilder
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/commit/ICommitConfigItem.java5
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsConfigQuery.java2
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsQuery.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsConfigQueryImpl.java7
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsQueryImpl.java19
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java11
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java30
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java9
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsConfigQueryImpl.java15
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsQueryImpl.java24
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/CreateTasksOperation.java5
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenOrphanedTasks.java5
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactLoaderTest.java4
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java4
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/MockIArtifact.java4
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifact.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifactProxy.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/ArtifactDataProviderImpl.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockArtifact.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/DefaultBasicArtifact.java12
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java9
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java15
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Named.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteriaTest.java11
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/mocks/MockIArtifact.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java62
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java52
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java81
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java14
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java11
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactIds.java30
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaRelatedTo.java24
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/script/impl/OrcsScriptInterpreterImpl.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ArtifactQueryBuilderImpl.java110
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CallableQueryFactory.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/handlers/SqlHandlerFactoryUtilTest.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/ArtifactIdsSqlHandler.java19
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/RelatedToSqlHandler.java42
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java19
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/QueryBuilder.java23
-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.java15
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryBuilderImpl.java30
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchMatch.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResponse.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResult.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/search/predicate/RelatedToPredicateHandlerTest.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/ArtifactSearch_V1.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/RelatedToPredicateHandler.java17
-rw-r--r--plugins/org.eclipse.osee.orcs.script.dsl/src/org/eclipse/osee/orcs/script/dsl/typesystem/NumberConverter.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java27
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java6
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ArtifactQueryBuilder.java80
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java18
-rw-r--r--plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java12
71 files changed, 493 insertions, 559 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/commit/ICommitConfigItem.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/commit/ICommitConfigItem.java
index 6599b5b2381..fcefbb61294 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/commit/ICommitConfigItem.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/commit/ICommitConfigItem.java
@@ -11,14 +11,13 @@
package org.eclipse.osee.ats.api.commit;
import org.eclipse.osee.framework.core.util.Result;
+import org.eclipse.osee.framework.jdk.core.type.Named;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
/**
* @author Donald G. Dunne
*/
-public interface ICommitConfigItem {
-
- public String getName() throws OseeCoreException;
+public interface ICommitConfigItem extends Named {
public long getBaselineBranchUuid() throws OseeCoreException;
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsConfigQuery.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsConfigQuery.java
index 0f940638fcd..6cbd782fde9 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsConfigQuery.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsConfigQuery.java
@@ -30,7 +30,7 @@ public interface IAtsConfigQuery {
<T extends IAtsConfigObject> ResultSet<T> getResults();
- Collection<Integer> getItemIds() throws OseeCoreException;
+ Collection<ArtifactId> getItemIds() throws OseeCoreException;
<T extends IAtsConfigObject> Collection<T> getItems();
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsQuery.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsQuery.java
index a37a617dfeb..c253d71fde9 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsQuery.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsQuery.java
@@ -92,7 +92,7 @@ public interface IAtsQuery {
IAtsQuery andActionableItem(IAtsActionableItem actionableItem);
- Collection<Integer> getItemIds() throws OseeCoreException;
+ Collection<ArtifactId> getItemIds() throws OseeCoreException;
IAtsQuery andAssigneeWas(IAtsUser... assignees);
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsConfigQueryImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsConfigQueryImpl.java
index aa416e3d32c..2aaf67aeeee 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsConfigQueryImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsConfigQueryImpl.java
@@ -69,7 +69,7 @@ public class AtsConfigQueryImpl extends AbstractAtsConfigQueryImpl {
}
@Override
- public List<Integer> queryGetIds() {
+ public List<? extends ArtifactId> queryGetIds() {
return getQuery().getIds();
}
@@ -84,11 +84,6 @@ public class AtsConfigQueryImpl extends AbstractAtsConfigQueryImpl {
}
@Override
- public void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, int artId) {
- getQuery().andRelatedToLocalIds(relationTypeSide, artId);
- }
-
- @Override
public void queryAnd(IAttributeType attrType, Collection<String> values, QueryOption[] queryOption) {
getQuery().and(attrType, values, queryOption);
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsQueryImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsQueryImpl.java
index 6a0897704cf..9d2cb400ee0 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsQueryImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsQueryImpl.java
@@ -68,7 +68,7 @@ public class AtsQueryImpl extends AbstractAtsQueryImpl {
}
@Override
- public List<Integer> queryGetIds() {
+ public List<ArtifactId> queryGetIds() {
return query.getIds();
}
@@ -83,18 +83,18 @@ public class AtsQueryImpl extends AbstractAtsQueryImpl {
}
@Override
- public void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, int artId) {
- query.andRelatedToLocalIds(relationTypeSide, artId);
+ public void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, ArtifactId artId) {
+ query.andRelatedTo(relationTypeSide, artId);
}
@Override
- public void queryAnd(IAttributeType attrType, Collection<String> values, QueryOption[] queryOption) {
- query.and(attrType, values, queryOption);
+ public void queryAndRelatedTo(IRelationTypeSide relationTypeSide, List<ArtifactId> artIds) {
+ query.andRelatedTo(relationTypeSide, artIds);
}
@Override
- public void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, List<Integer> artIds) {
- query.andRelatedToLocalIds(relationTypeSide, artIds);
+ public void queryAnd(IAttributeType attrType, Collection<String> values, QueryOption[] queryOption) {
+ query.and(attrType, values, queryOption);
}
@Override
@@ -128,7 +128,7 @@ public class AtsQueryImpl extends AbstractAtsQueryImpl {
}
@Override
- public List<Integer> getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(List<AtsAttributeQuery> teamWorkflowAttr) {
+ public List<ArtifactId> getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(List<AtsAttributeQuery> teamWorkflowAttr) {
AtsQueryImpl search = new AtsQueryImpl(services);
search.isOfType(AtsArtifactTypes.TeamWorkflow);
if (teamDefUuids != null && !teamDefUuids.isEmpty()) {
@@ -153,5 +153,4 @@ public class AtsQueryImpl extends AbstractAtsQueryImpl {
query.andNotExists(attributeType);
return this;
}
-
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java
index 4893168d35d..eff4607f57a 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.core.query;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -47,7 +48,7 @@ public abstract class AbstractAtsConfigQueryImpl implements IAtsConfigQuery {
protected Collection<Long> uuids;
protected final IAtsServices services;
protected Collection<Long> aiUuids;
- protected List<Integer> onlyIds = null;
+ protected List<ArtifactId> onlyIds = null;
protected final List<IAtsQueryFilter> queryFilters;
public AbstractAtsConfigQueryImpl(IAtsServices services) {
@@ -59,7 +60,7 @@ public abstract class AbstractAtsConfigQueryImpl implements IAtsConfigQuery {
}
@Override
- public Collection<Integer> getItemIds() throws OseeCoreException {
+ public Collection<ArtifactId> getItemIds() throws OseeCoreException {
onlyIds = new LinkedList<>();
getItems();
return onlyIds;
@@ -142,7 +143,7 @@ public abstract class AbstractAtsConfigQueryImpl implements IAtsConfigQuery {
return onlyIds != null;
}
- public abstract List<Integer> queryGetIds();
+ public abstract List<? extends ArtifactId> queryGetIds();
@Override
public IAtsConfigQuery isOfType(IArtifactType artifactType) {
@@ -161,7 +162,7 @@ public abstract class AbstractAtsConfigQueryImpl implements IAtsConfigQuery {
@Override
public IAtsConfigQuery andUuids(Long... uuids) {
- this.uuids = org.eclipse.osee.framework.jdk.core.util.Collections.getAggregate(uuids);
+ this.uuids = Arrays.asList(uuids);
return this;
}
@@ -202,8 +203,6 @@ public abstract class AbstractAtsConfigQueryImpl implements IAtsConfigQuery {
public abstract void queryAnd(IAttributeType attrType, String value);
- public abstract void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, int artId);
-
private void addAttributeCriteria() {
if (!andAttr.isEmpty()) {
for (AtsAttributeQuery attrQuery : andAttr) {
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java
index 86363be8961..31d54b96f24 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java
@@ -74,7 +74,7 @@ public abstract class AbstractAtsQueryImpl implements IAtsQuery {
protected Long insertionUuid;
protected Long insertionActivityUuid;
protected Long workPackageUuid;
- protected List<Integer> onlyIds = null;
+ protected List<ArtifactId> onlyIds = null;
private ReleasedOption releasedOption;
protected final List<IAtsQueryFilter> queryFilters;
@@ -93,7 +93,7 @@ public abstract class AbstractAtsQueryImpl implements IAtsQuery {
}
@Override
- public Collection<Integer> getItemIds() throws OseeCoreException {
+ public Collection<ArtifactId> getItemIds() throws OseeCoreException {
onlyIds = new LinkedList<>();
getItems();
return onlyIds;
@@ -178,7 +178,7 @@ public abstract class AbstractAtsQueryImpl implements IAtsQuery {
}
}
- private Collection<? extends Integer> handleReleaseOption(List<Integer> queryGetIds) {
+ private Collection<ArtifactId> handleReleaseOption(List<ArtifactId> queryGetIds) {
if (releasedOption != null && releasedOption != ReleasedOption.Both) {
throw new UnsupportedOperationException("This option not supported");
}
@@ -231,8 +231,8 @@ public abstract class AbstractAtsQueryImpl implements IAtsQuery {
// teamDef, ai and version
if (isTeamTypeDefAisOrVersionSearched(allArtTypes)) {
- List<Integer> teamWfUuids = getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(teamWorkflowAttr);
- queryAndRelatedToLocalIds(AtsRelationTypes.TeamWfToTask_TeamWf, teamWfUuids);
+ List<ArtifactId> teamWfUuids = getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(teamWorkflowAttr);
+ queryAndRelatedTo(AtsRelationTypes.TeamWfToTask_TeamWf, teamWfUuids);
}
addEvConfigCriteria();
@@ -251,8 +251,8 @@ public abstract class AbstractAtsQueryImpl implements IAtsQuery {
// teamDef, ai and version
if (isTeamTypeDefAisOrVersionSearched(allArtTypes)) {
- List<Integer> teamWfUuids = getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(teamWorkflowAttr);
- queryAndRelatedToLocalIds(AtsRelationTypes.TeamWorkflowToReview_Team, teamWfUuids);
+ List<ArtifactId> teamWfUuids = getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(teamWorkflowAttr);
+ queryAndRelatedTo(AtsRelationTypes.TeamWorkflowToReview_Team, teamWfUuids);
}
collectResults(allResults, allArtTypes);
@@ -431,12 +431,12 @@ public abstract class AbstractAtsQueryImpl implements IAtsQuery {
return onlyIds != null;
}
- public abstract List<Integer> queryGetIds();
+ public abstract List<ArtifactId> queryGetIds();
/**
* Return team workflow ids based on teamdef, ai and version criteria to use in relatedTo criteria.
*/
- public abstract List<Integer> getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(List<AtsAttributeQuery> teamWorkflowAttr);
+ public abstract List<ArtifactId> getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(List<AtsAttributeQuery> teamWorkflowAttr);
private Set<IArtifactType> getAllArtTypes() {
Set<IArtifactType> allArtTypes = new HashSet<>();
@@ -788,11 +788,11 @@ public abstract class AbstractAtsQueryImpl implements IAtsQuery {
private void addVersionCriteria() {
if (versionUuid != null && versionUuid > 0) {
queryAndRelatedToLocalIds(AtsRelationTypes.TeamWorkflowTargetedForVersion_Version,
- Long.valueOf(versionUuid).intValue());
+ ArtifactId.valueOf(versionUuid));
}
}
- public abstract void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, int artId);
+ public abstract void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, ArtifactId artId);
private void addAiCriteria() {
if (isActionableItemSpecified()) {
@@ -829,16 +829,16 @@ public abstract class AbstractAtsQueryImpl implements IAtsQuery {
private void addRelationCriteria() {
if (!andRels.isEmpty()) {
for (Entry<IRelationTypeSide, List<IAtsObject>> entry : andRels.entrySet()) {
- List<Integer> artIds = new LinkedList<>();
+ List<ArtifactId> artIds = new LinkedList<>();
for (IAtsObject object : entry.getValue()) {
- artIds.add(new Long(object.getId()).intValue());
+ artIds.add(ArtifactId.valueOf(object.getId()));
}
- queryAndRelatedToLocalIds(entry.getKey(), artIds);
+ queryAndRelatedTo(entry.getKey(), artIds);
}
}
}
- public abstract void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, List<Integer> artIds);
+ public abstract void queryAndRelatedTo(IRelationTypeSide relationTypeSide, List<ArtifactId> artIds);
private void addStateNameCriteria() {
if (stateName != null) {
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
index 3ac4dc8b7ea..c8ddbbf23e2 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
@@ -37,7 +37,6 @@ import org.eclipse.osee.ats.core.users.AtsCoreUsers;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.rest.IAtsServer;
import org.eclipse.osee.framework.core.data.ArtifactId;
-import org.eclipse.osee.framework.core.data.HasLocalId;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
@@ -115,10 +114,10 @@ public final class AtsConfigEndpointImpl implements AtsConfigEndpointApi {
}
}
// load ats config object ids
- for (HasLocalId<Integer> configArtId : orcsApi.getQueryFactory().fromBranch(
- AtsUtilCore.getAtsBranch()).andIsOfType(AtsArtifactTypes.TeamDefinition, AtsArtifactTypes.Version,
- AtsArtifactTypes.ActionableItem).getResultsAsLocalIds()) {
- configs.getAtsConfigIds().add(Long.valueOf(configArtId.getLocalId()));
+ for (ArtifactId configArtId : orcsApi.getQueryFactory().fromBranch(AtsUtilCore.getAtsBranch()).andIsOfType(
+ AtsArtifactTypes.TeamDefinition, AtsArtifactTypes.Version,
+ AtsArtifactTypes.ActionableItem).getResultsAsLocalIds()) {
+ configs.getAtsConfigIds().add(configArtId.getId());
}
// load work definitions
for (ArtifactId workDefArt : orcsApi.getQueryFactory().fromBranch(AtsUtilCore.getAtsBranch()).andIsOfType(
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsConfigQueryImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsConfigQueryImpl.java
index 11120685277..1a7eb023bc8 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsConfigQueryImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsConfigQueryImpl.java
@@ -19,7 +19,6 @@ import org.eclipse.osee.ats.core.query.AbstractAtsConfigQueryImpl;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.rest.IAtsServer;
import org.eclipse.osee.framework.core.data.ArtifactId;
-import org.eclipse.osee.framework.core.data.HasLocalId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
@@ -72,13 +71,8 @@ public class AtsConfigQueryImpl extends AbstractAtsConfigQueryImpl {
}
@Override
- public List<Integer> queryGetIds() {
- List<Integer> results = new LinkedList<>();
- Iterator<HasLocalId<Integer>> iterator = getQuery().getResultsAsLocalIds().iterator();
- while (iterator.hasNext()) {
- results.add(iterator.next().getLocalId());
- }
- return results;
+ public List<? extends ArtifactId> queryGetIds() {
+ return getQuery().getResultsAsLocalIds().getList();
}
@Override
@@ -92,11 +86,6 @@ public class AtsConfigQueryImpl extends AbstractAtsConfigQueryImpl {
}
@Override
- public void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, int artId) {
- getQuery().andRelatedToLocalIds(relationTypeSide, artId);
- }
-
- @Override
public void queryAnd(IAttributeType attrType, Collection<String> values, QueryOption[] queryOption) {
getQuery().and(attrType, values, queryOption);
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsQueryImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsQueryImpl.java
index 5a9c8bcbe75..2deae710799 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsQueryImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsQueryImpl.java
@@ -23,7 +23,6 @@ import org.eclipse.osee.ats.core.query.AtsAttributeQuery;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.rest.IAtsServer;
import org.eclipse.osee.framework.core.data.ArtifactId;
-import org.eclipse.osee.framework.core.data.HasLocalId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
@@ -70,11 +69,11 @@ public class AtsQueryImpl extends AbstractAtsQueryImpl {
}
@Override
- public List<Integer> queryGetIds() {
- List<Integer> results = new LinkedList<>();
- Iterator<HasLocalId<Integer>> iterator = query.getResultsAsLocalIds().iterator();
+ public List<ArtifactId> queryGetIds() {
+ List<ArtifactId> results = new LinkedList<>();
+ Iterator<? extends ArtifactId> iterator = query.getResultsAsLocalIds().iterator();
while (iterator.hasNext()) {
- results.add(iterator.next().getLocalId());
+ results.add(iterator.next());
}
return results;
}
@@ -90,18 +89,18 @@ public class AtsQueryImpl extends AbstractAtsQueryImpl {
}
@Override
- public void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, int artId) {
- query.andRelatedToLocalIds(relationTypeSide, artId);
+ public void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, ArtifactId artId) {
+ query.andRelatedTo(relationTypeSide, artId);
}
@Override
- public void queryAnd(IAttributeType attrType, Collection<String> values, QueryOption[] queryOption) {
- query.and(attrType, values, queryOption);
+ public void queryAndRelatedTo(IRelationTypeSide relationTypeSide, List<ArtifactId> artifacts) {
+ query.andRelatedTo(relationTypeSide, artifacts);
}
@Override
- public void queryAndRelatedToLocalIds(IRelationTypeSide relationTypeSide, List<Integer> artIds) {
- query.andRelatedToLocalIds(relationTypeSide, artIds);
+ public void queryAnd(IAttributeType attrType, Collection<String> values, QueryOption[] queryOption) {
+ query.and(attrType, values, queryOption);
}
@Override
@@ -140,7 +139,7 @@ public class AtsQueryImpl extends AbstractAtsQueryImpl {
}
@Override
- public List<Integer> getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(List<AtsAttributeQuery> teamWorkflowAttr) {
+ public List<ArtifactId> getRelatedTeamWorkflowUuidsBasedOnTeamDefsAisAndVersions(List<AtsAttributeQuery> teamWorkflowAttr) {
AtsQueryImpl search = new AtsQueryImpl(atsServer);
search.isOfType(AtsArtifactTypes.TeamWorkflow);
if (teamDefUuids != null && !teamDefUuids.isEmpty()) {
@@ -160,5 +159,4 @@ public class AtsQueryImpl extends AbstractAtsQueryImpl {
query.andNotExists(attributeType);
return this;
}
-
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/CreateTasksOperation.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/CreateTasksOperation.java
index b2288f49e0a..dff3537f7d9 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/CreateTasksOperation.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/CreateTasksOperation.java
@@ -179,8 +179,9 @@ public class CreateTasksOperation {
resultData.errorf("Relation [%s] Uuids must be suplied Task creation in %s",
relation.getRelationTypeName(), task);
}
- Collection<Integer> foundUuids = atsServer.getQueryService().createQuery(WorkItemType.WorkItem).andUuids(
- relation.getRelatedUuids().toArray(new Long[relation.getRelatedUuids().size()])).getItemIds();
+ Collection<ArtifactId> foundUuids =
+ atsServer.getQueryService().createQuery(WorkItemType.WorkItem).andUuids(
+ relation.getRelatedUuids().toArray(new Long[relation.getRelatedUuids().size()])).getItemIds();
List<Long> notFoundUuids = relation.getRelatedUuids();
notFoundUuids.removeAll(foundUuids);
if (foundUuids.size() != relation.getRelatedUuids().size()) {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenOrphanedTasks.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenOrphanedTasks.java
index 83fee2d30b1..abe27f5bcca 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenOrphanedTasks.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenOrphanedTasks.java
@@ -36,6 +36,7 @@ import org.eclipse.osee.ats.internal.AtsClientService;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.ats.util.widgets.dialog.ActionableItemListDialog;
import org.eclipse.osee.ats.world.WorldXViewerFactory;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.enums.Active;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.core.operation.Operations;
@@ -84,12 +85,12 @@ public class OpenOrphanedTasks extends Action {
@Override
protected void doWork(IProgressMonitor monitor) throws Exception {
- List<Integer> ids = ArtifactQuery.createQueryBuilder(AtsUtilCore.getAtsBranch()).andIsOfType(
+ List<ArtifactId> ids = ArtifactQuery.createQueryBuilder(AtsUtilCore.getAtsBranch()).andIsOfType(
AtsArtifactTypes.Task).andNotExists(AtsRelationTypes.TeamWfToTask_Task).getIds();
if (ids.isEmpty()) {
AWorkbench.popup("No Orphaned Tasks Found");
} else {
- List<Artifact> artifacts = ArtifactQuery.getArtifactListFromIds(ids, AtsUtilCore.getAtsBranch());
+ List<Artifact> artifacts = ArtifactQuery.getArtifactListFrom(ids, AtsUtilCore.getAtsBranch());
CustomizeData data = new CustomizeData();
data.setGuid(GUID.create());
data.setName("Orphaned Task View");
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactLoaderTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactLoaderTest.java
index 7e5afa58e8f..a51ae561602 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactLoaderTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactLoaderTest.java
@@ -194,7 +194,7 @@ public class ArtifactLoaderTest {
public IStatus run(SubMonitor subMonitor) {
List<Artifact> artifacts;
try {
- artifacts = ArtifactLoader.loadArtifacts(artIds, CoreBranches.COMMON, LoadLevel.ALL,
+ artifacts = ArtifactLoader.loadArtifactIds(artIds, CoreBranches.COMMON, LoadLevel.ALL,
LoadType.RELOAD_CACHE, DeletionFlag.EXCLUDE_DELETED);
Assert.assertTrue(artifacts.isEmpty());
} catch (OseeCoreException ex) {
@@ -221,7 +221,7 @@ public class ArtifactLoaderTest {
public IStatus run(SubMonitor subMonitor) {
List<Artifact> artifacts;
try {
- artifacts = ArtifactLoader.loadArtifacts(artIds, CoreBranches.COMMON, LoadLevel.ALL,
+ artifacts = ArtifactLoader.loadArtifactIds(artIds, CoreBranches.COMMON, LoadLevel.ALL,
LoadType.RELOAD_CACHE, DeletionFlag.EXCLUDE_DELETED);
Assert.assertTrue(artifacts.isEmpty());
} catch (OseeCoreException ex) {
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 5b685f7142b..d0bd7d8ec14 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
@@ -242,8 +242,8 @@ public class ArtifactQueryTest {
ArtifactCache.deCache(toCheck);
TransactionToken beforeDelete = idToTxId.get(newIdsInOrder.get(1));
- Assert.assertNotNull(ArtifactQuery.checkHistoricalArtifactFromId(firstCreated.getArtId(), beforeDelete,
- DeletionFlag.EXCLUDE_DELETED));
+ Assert.assertNotNull(
+ ArtifactQuery.checkHistoricalArtifactFromId(firstCreated, beforeDelete, DeletionFlag.EXCLUDE_DELETED));
}
@Test
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/MockIArtifact.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/MockIArtifact.java
index 911f3194fa2..06b5f0cb8a4 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/MockIArtifact.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/MockIArtifact.java
@@ -22,7 +22,7 @@ import org.eclipse.osee.framework.skynet.core.types.IArtifact;
/**
* @author Roberto E. Escobar
*/
-public class MockIArtifact extends NamedIdentity<String>implements IArtifact {
+public class MockIArtifact extends NamedIdentity<String> implements IArtifact {
private boolean wasGetFullArtifactCalled;
private final int uniqueId;
@@ -78,7 +78,7 @@ public class MockIArtifact extends NamedIdentity<String>implements IArtifact {
}
@Override
- public Long getUuid() {
+ public Long getId() {
return new Long(uniqueId);
}
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
index 09f2f25a01e..8d8b0a55667 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
@@ -528,8 +528,8 @@ public class OrcsStorageImpl implements Storage {
TransactionReadable commit = tx.commit();
if (commit != null) {
- ArtifactReadable newRerpotArt = getQuery().fromBranch(program.getUuid()).fromTransaction(commit).andGuid(
- reportArt.getGuid()).getResults().getExactlyOne();
+ ArtifactReadable newRerpotArt = getQuery().fromBranch(program.getUuid()).fromTransaction(commit).andId(
+ reportArt).getResults().getExactlyOne();
AttributeReadable<Object> contentsAsAttribute =
newRerpotArt.getAttributes(CoreAttributeTypes.GeneralStringData).getExactlyOne();
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java
index 86b2661d2f6..307e9cfa418 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java
@@ -306,7 +306,7 @@ public class ArtifactMatchInterpreterTest {
}
@Override
- public Long getUuid() {
+ public Long getId() {
return 0L;
}
};
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifact.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifact.java
index cece3e6dc47..f9730106fe4 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifact.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifact.java
@@ -57,7 +57,7 @@ public class MockArtifact extends NamedIdentity<String> implements IBasicArtifac
}
@Override
- public Long getUuid() {
+ public Long getId() {
return Long.valueOf(artId);
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifactProxy.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifactProxy.java
index d545b1d5266..1f0adb27986 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifactProxy.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifactProxy.java
@@ -95,7 +95,7 @@ public class MockArtifactProxy implements ArtifactProxy {
}
@Override
- public Long getUuid() {
+ public Long getId() {
return Long.valueOf(artifactObject.getArtId());
}
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/ArtifactDataProviderImpl.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/ArtifactDataProviderImpl.java
index 3e1a265b6fd..f9a756fcce0 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/ArtifactDataProviderImpl.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/ArtifactDataProviderImpl.java
@@ -141,7 +141,7 @@ public final class ArtifactDataProviderImpl implements ArtifactDataProvider {
}
@Override
- public Long getUuid() {
+ public Long getId() {
return Long.valueOf(self.getArtId());
}
}
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockArtifact.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockArtifact.java
index 383c5293d50..d6ce7da87d8 100644
--- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockArtifact.java
+++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockArtifact.java
@@ -57,7 +57,7 @@ public class MockArtifact extends NamedIdentity<String> implements IBasicArtifac
}
@Override
- public Long getUuid() {
+ public Long getId() {
return Long.valueOf(artId);
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/DefaultBasicArtifact.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/DefaultBasicArtifact.java
index e82114dceba..5cafb644a7a 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/DefaultBasicArtifact.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/DefaultBasicArtifact.java
@@ -16,18 +16,18 @@ import org.eclipse.osee.framework.jdk.core.type.NamedIdentity;
/**
* @author Roberto E. Escobar
*/
-public final class DefaultBasicArtifact extends NamedIdentity<String>implements IBasicArtifact<Object> {
+public final class DefaultBasicArtifact extends NamedIdentity<String> implements IBasicArtifact<Object> {
- private final int artId;
+ private final Long artId;
- public DefaultBasicArtifact(int artId, String guid, String name) {
+ public DefaultBasicArtifact(long artId, String guid, String name) {
super(guid, name);
this.artId = artId;
}
@Override
public int getArtId() {
- return artId;
+ return artId.intValue();
}
@Override
@@ -46,7 +46,7 @@ public final class DefaultBasicArtifact extends NamedIdentity<String>implements
}
@Override
- public Long getUuid() {
- return 0L;
+ public Long getId() {
+ return artId;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
index 092060347bc..3c39127bd59 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
@@ -25,7 +25,9 @@ public interface ArtifactId extends Identifiable<String>, Id {
public static final ArtifactId SENTINEL = ArtifactId.valueOf(Id.SENTINEL);
- public Long getUuid();
+ default Long getUuid() {
+ return getId();
+ }
public static ArtifactId valueOf(String id) {
@@ -45,11 +47,6 @@ public interface ArtifactId extends Identifiable<String>, Id {
}
@Override
- public Long getUuid() {
- return getId();
- }
-
- @Override
public String getName() {
return null;
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java
index 3f141e87e63..48061141618 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java
@@ -151,11 +151,11 @@ public final class TokenFactory {
private static class ArtifactToken extends NamedIdentity<String> implements IArtifactToken {
private final IArtifactType artifactType;
- private final long uuid;
+ private final long id;
- public ArtifactToken(long uuid, String guid, String name, IArtifactType artifactType) {
+ public ArtifactToken(long id, String guid, String name, IArtifactType artifactType) {
super(guid, name);
- this.uuid = uuid;
+ this.id = id;
this.artifactType = artifactType;
}
@@ -170,8 +170,8 @@ public final class TokenFactory {
}
@Override
- public Long getUuid() {
- return uuid;
+ public Long getId() {
+ return id;
}
}
@@ -230,11 +230,6 @@ public final class TokenFactory {
}
@Override
- public Long getUuid() {
- return getId();
- }
-
- @Override
public String getGuid() {
return guid;
}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Named.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Named.java
index 1345a1a0659..afa3c978b5c 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Named.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Named.java
@@ -15,7 +15,11 @@ package org.eclipse.osee.framework.jdk.core.type;
* @author Andrew M. Finkbeiner
*/
public interface Named extends Comparable<Named> {
- String getName();
+ public static final String SENTINEL = "Sentinel";
+
+ default String getName() {
+ return toString();
+ }
@Override
default int compareTo(Named other) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteriaTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteriaTest.java
index e203cd47d68..3b8b49017f1 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteriaTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteriaTest.java
@@ -14,6 +14,7 @@ import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
@@ -37,10 +38,11 @@ public class RelationCriteriaTest {
verify(builder).andExists(CoreRelationTypes.Allocation__Component);
reset(builder);
- criteria = new RelationCriteria(4, CoreRelationTypes.Allocation__Component, RelationSide.SIDE_A);
+ ArtifactId artifact = ArtifactId.valueOf(4);
+ criteria = new RelationCriteria(artifact, CoreRelationTypes.Allocation__Component, RelationSide.SIDE_A);
criteria.addToQueryBuilder(builder);
ArgumentCaptor<IRelationTypeSide> rtsCaptor = ArgumentCaptor.forClass(IRelationTypeSide.class);
- verify(builder).andRelatedToLocalIds(rtsCaptor.capture(), eq(4));
+ verify(builder).andRelatedTo(rtsCaptor.capture(), eq(artifact));
Assert.assertEquals(CoreRelationTypes.Allocation__Component.getGuid(), rtsCaptor.getValue().getGuid());
Assert.assertEquals(RelationSide.SIDE_A, rtsCaptor.getValue().getSide());
}
@@ -53,10 +55,11 @@ public class RelationCriteriaTest {
verify(builder).andExists((IRelationType) CoreRelationTypes.Allocation__Component);
reset(builder);
- criteria = new RelationCriteria(4, CoreRelationTypes.Allocation__Component, RelationSide.SIDE_A);
+ ArtifactId artifact = ArtifactId.valueOf(4);
+ criteria = new RelationCriteria(artifact, CoreRelationTypes.Allocation__Component, RelationSide.SIDE_A);
criteria.addToQueryBuilder(builder);
ArgumentCaptor<IRelationTypeSide> rtsCaptor = ArgumentCaptor.forClass(IRelationTypeSide.class);
- verify(builder).andRelatedToLocalIds(rtsCaptor.capture(), eq(4));
+ verify(builder).andRelatedTo(rtsCaptor.capture(), eq(artifact));
Assert.assertEquals(CoreRelationTypes.Allocation__Component.getGuid(), rtsCaptor.getValue().getGuid());
Assert.assertEquals(RelationSide.SIDE_A, rtsCaptor.getValue().getSide());
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/mocks/MockIArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/mocks/MockIArtifact.java
index 7e68a058364..f24ee1345a0 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/mocks/MockIArtifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/mocks/MockIArtifact.java
@@ -84,8 +84,7 @@ public class MockIArtifact extends NamedIdentity<String> implements IArtifact {
}
@Override
- public Long getUuid() {
+ public Long getId() {
return new Long(uniqueId);
}
-
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
index de19873f92d..4adf09a1269 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
@@ -1160,7 +1160,7 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
return;
}
- ArtifactQuery.reloadArtifactFromId(getArtId(), getBranch());
+ ArtifactQuery.reloadArtifactFromId(this, getBranch());
}
void prepareForReload() {
@@ -1736,11 +1736,6 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
}
@Override
- public Long getUuid() {
- return getId();
- }
-
- @Override
public Long getId() {
return Long.valueOf(getArtId());
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java
index 2512a3c3ad8..965368fd6b4 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java
@@ -16,6 +16,7 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
@@ -155,6 +156,10 @@ public final class ArtifactCache {
return getActive(artId, branch.getUuid());
}
+ public static Artifact getActive(ArtifactId artId, BranchId branch) {
+ return getActive(artId.getId(), branch.getUuid());
+ }
+
public static Artifact getActive(Integer artId, Long branchUuid) {
return ID_CACHE.getById(artId, branchUuid);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java
index 5316b6aabf0..190c29bc01b 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java
@@ -22,6 +22,7 @@ import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.TokenFactory;
@@ -57,7 +58,7 @@ public final class ArtifactLoader {
* (re)loads the artifacts selected by sql and then returns them in a list
*/
public static List<Artifact> getArtifacts(String sql, Object[] queryParameters, int artifactCountEstimate, LoadLevel loadLevel, LoadType reload, ISearchConfirmer confirmer, TransactionRecord transactionId, DeletionFlag allowDeleted, boolean isArchived) throws OseeCoreException {
- List<Pair<Integer, Long>> toLoad = selectArtifacts(sql, queryParameters, artifactCountEstimate);
+ List<Pair<ArtifactId, BranchId>> toLoad = selectArtifacts(sql, queryParameters, artifactCountEstimate);
List<Artifact> artifacts =
loadSelectedArtifacts(toLoad, loadLevel, reload, allowDeleted, transactionId, isArchived);
@@ -67,23 +68,32 @@ public final class ArtifactLoader {
return new LinkedList<Artifact>(artifacts);
}
- public static List<Artifact> loadArtifacts(Collection<Integer> artIds, BranchId branch, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted, TransactionId transactionId) throws OseeCoreException {
- List<Pair<Integer, Long>> toLoad = new LinkedList<>();
- Long branchUuid = branch.getUuid();
- for (Integer artId : new HashSet<Integer>(artIds)) {
- toLoad.add(new Pair<Integer, Long>(artId, branchUuid));
- }
+ public static List<Artifact> loadArtifactIds(Collection<Integer> artIds, BranchId branch, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted) {
+ return loadArtifactIds(artIds, branch, loadLevel, reload, allowDeleted, TransactionId.SENTINEL);
+ }
- List<Artifact> artifacts = loadSelectedArtifacts(toLoad, loadLevel, reload, allowDeleted, transactionId,
- BranchManager.isArchived(branch));
- return artifacts;
+ public static List<Artifact> loadArtifactIds(Collection<Integer> artIds, BranchId branch, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted, TransactionId transactionId) {
+ List<ArtifactId> artifacts = new ArrayList<>();
+ for (Integer artId : artIds) {
+ artifacts.add(ArtifactId.valueOf(artId));
+ }
+ return loadArtifacts(artifacts, branch, loadLevel, reload, allowDeleted, transactionId);
}
- public static List<Artifact> loadArtifacts(Collection<Integer> artIds, BranchId branch, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted) throws OseeCoreException {
+ public static List<Artifact> loadArtifacts(Collection<ArtifactId> artIds, BranchId branch, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted) {
return loadArtifacts(artIds, branch, loadLevel, reload, allowDeleted, TransactionId.SENTINEL);
}
- private static List<Artifact> loadSelectedArtifacts(List<Pair<Integer, Long>> toLoad, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted, TransactionId transactionId, boolean isArchived) throws OseeCoreException {
+ public static List<Artifact> loadArtifacts(Collection<ArtifactId> artIds, BranchId branch, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted, TransactionId transactionId) {
+ List<Pair<ArtifactId, BranchId>> toLoad = new LinkedList<>();
+ for (ArtifactId artId : new HashSet<>(artIds)) {
+ toLoad.add(new Pair<ArtifactId, BranchId>(artId, branch));
+ }
+ return loadSelectedArtifacts(toLoad, loadLevel, reload, allowDeleted, transactionId,
+ BranchManager.isArchived(branch));
+ }
+
+ private static List<Artifact> loadSelectedArtifacts(List<Pair<ArtifactId, BranchId>> toLoad, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted, TransactionId transactionId, boolean isArchived) throws OseeCoreException {
Set<Artifact> artifacts = new LinkedHashSet<>();
if (transactionId.isValid()) {
loadArtifacts(toLoad, loadLevel, transactionId, reload, allowDeleted, artifacts, isArchived);
@@ -93,17 +103,17 @@ public final class ArtifactLoader {
return new LinkedList<Artifact>(artifacts);
}
- private static void loadActiveArtifacts(List<Pair<Integer, Long>> toLoad, Set<Artifact> artifacts, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted, boolean isArchived) throws OseeCoreException {
+ private static void loadActiveArtifacts(List<Pair<ArtifactId, BranchId>> toLoad, Set<Artifact> artifacts, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted, boolean isArchived) throws OseeCoreException {
if (!toLoad.isEmpty()) {
int numRequested = toLoad.size();
- Iterator<Pair<Integer, Long>> iterator = toLoad.iterator();
+ Iterator<Pair<ArtifactId, BranchId>> iterator = toLoad.iterator();
CompositeKeyHashMap<Integer, Long, ReentrantLock> locks =
new CompositeKeyHashMap<Integer, Long, ReentrantLock>();
while (iterator.hasNext()) {
- Pair<Integer, Long> next = iterator.next();
- Integer artId = next.getFirst();
- Long branchUuid = next.getSecond();
+ Pair<ArtifactId, BranchId> next = iterator.next();
+ Integer artId = next.getFirst().getId().intValue();
+ Long branchUuid = next.getSecond().getId();
Artifact active = null;
@@ -126,9 +136,9 @@ public final class ArtifactLoader {
} finally {
// remove and unlock locks this thread created but didn't load
if (artifacts.size() != numRequested) {
- for (Pair<Integer, Long> loadPair : toLoad) {
- Integer artId = loadPair.getFirst();
- Long branchUuid = loadPair.getSecond();
+ for (Pair<ArtifactId, BranchId> loadPair : toLoad) {
+ Integer artId = loadPair.getFirst().getId().intValue();
+ Long branchUuid = loadPair.getSecond().getId();
removeAndUnlock(artId, branchUuid);
locks.removeAndGet(artId, branchUuid);
}
@@ -247,12 +257,12 @@ public final class ArtifactLoader {
* @param artifacts
* @param locks
*/
- private static void loadArtifacts(List<Pair<Integer, Long>> toLoad, LoadLevel loadLevel, TransactionId transactionId, LoadType reload, DeletionFlag allowDeleted, Set<Artifact> artifacts, boolean isArchived) throws OseeCoreException {
+ private static void loadArtifacts(List<Pair<ArtifactId, BranchId>> toLoad, LoadLevel loadLevel, TransactionId transactionId, LoadType reload, DeletionFlag allowDeleted, Set<Artifact> artifacts, boolean isArchived) throws OseeCoreException {
if (toLoad != null && !toLoad.isEmpty()) {
ArtifactJoinQuery joinQuery = JoinUtility.createArtifactJoinQuery();
- for (Pair<Integer, Long> pair : toLoad) {
- joinQuery.add(pair.getFirst(), pair.getSecond(), transactionId);
+ for (Pair<ArtifactId, BranchId> pair : toLoad) {
+ joinQuery.add(pair.getFirst().getId().intValue(), pair.getSecond().getId(), transactionId);
}
loadArtifacts(artifacts, joinQuery, loadLevel, null, reload, transactionId, allowDeleted, isArchived);
}
@@ -289,18 +299,18 @@ public final class ArtifactLoader {
/**
* Determines the artIds and branchUuids of artifacts to load based on sql and queryParameters
*/
- private static List<Pair<Integer, Long>> selectArtifacts(String sql, Object[] queryParameters, int artifactCountEstimate) throws OseeCoreException {
+ private static List<Pair<ArtifactId, BranchId>> selectArtifacts(String sql, Object[] queryParameters, int artifactCountEstimate) throws OseeCoreException {
JdbcStatement chStmt = ConnectionHandler.getStatement();
long time = System.currentTimeMillis();
- List<Pair<Integer, Long>> toLoad = new LinkedList<>();
+ List<Pair<ArtifactId, BranchId>> toLoad = new LinkedList<>();
try {
chStmt.runPreparedQuery(artifactCountEstimate, sql, queryParameters);
while (chStmt.next()) {
int artId = chStmt.getInt("art_id");
long branchUuid = chStmt.getLong("branch_id");
- toLoad.add(new Pair<Integer, Long>(artId, branchUuid));
+ toLoad.add(new Pair<>(ArtifactId.valueOf(artId), BranchId.valueOf(branchUuid)));
}
} finally {
chStmt.close();
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 13cde7f144b..610e2cdcf44 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
@@ -140,7 +140,8 @@ public class ArtifactQuery {
}
}
} else {
- artifact = new ArtifactQueryBuilder(artId, branch, allowDeleted, ALL).getOrCheckArtifact(queryType);
+ artifact = new ArtifactQueryBuilder(ArtifactId.valueOf(artId), branch, allowDeleted, ALL).getOrCheckArtifact(
+ queryType);
}
return artifact;
}
@@ -245,16 +246,11 @@ public class ArtifactQuery {
return null;
}
- public static List<Integer> selectArtifactIdsFromTypeAndName(IArtifactType artifactType, String artifactName, BranchId branch, QueryOption... options) throws OseeCoreException {
+ public static List<ArtifactId> selectArtifactIdsFromTypeAndName(IArtifactType artifactType, String artifactName, BranchId branch, QueryOption... options) throws OseeCoreException {
return queryFromTypeAndAttribute(artifactType, CoreAttributeTypes.Name, artifactName, branch,
options).selectArtifacts(2);
}
- public static List<Integer> selectArtifactIdsFromTypeAndAttribute(IArtifactType artifactType, IAttributeType attributeType, String attributeValue, BranchId branch, QueryOption... options) throws OseeCoreException {
- return queryFromTypeAndAttribute(artifactType, attributeType, attributeValue, branch, options).selectArtifacts(
- 10000);
- }
-
/**
* Checks for existence of an artifact based on its type and name
*
@@ -279,6 +275,15 @@ public class ArtifactQuery {
* @return a collection of the artifacts found or an empty collection if none are found
*/
public static List<Artifact> getArtifactListFromIds(Collection<Integer> artifactIds, BranchId branch) throws OseeCoreException {
+ return ArtifactLoader.loadArtifactIds(artifactIds, branch, LoadLevel.ALL, INCLUDE_CACHE, INCLUDE_DELETED);
+ }
+
+ /**
+ * search for un-deleted artifacts with any of the given artifact ids
+ *
+ * @return a collection of the artifacts found or an empty collection if none are found
+ */
+ public static List<Artifact> getArtifactListFrom(Collection<ArtifactId> artifactIds, BranchId branch) throws OseeCoreException {
return ArtifactLoader.loadArtifacts(artifactIds, branch, LoadLevel.ALL, INCLUDE_CACHE, INCLUDE_DELETED);
}
@@ -288,7 +293,7 @@ public class ArtifactQuery {
* @return a collection of the artifacts found or an empty collection if none are found
*/
public static List<Artifact> getArtifactListFromIds(Collection<Integer> artifactIds, BranchId branch, DeletionFlag allowDeleted) throws OseeCoreException {
- return ArtifactLoader.loadArtifacts(artifactIds, branch, LoadLevel.ALL, INCLUDE_CACHE, allowDeleted);
+ return ArtifactLoader.loadArtifactIds(artifactIds, branch, LoadLevel.ALL, INCLUDE_CACHE, allowDeleted);
}
/**
@@ -313,13 +318,14 @@ public class ArtifactQuery {
}
public static Artifact getHistoricalArtifactFromId(int artifactId, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
- return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, ALL).getOrCheckArtifact(QueryType.GET);
+ return new ArtifactQueryBuilder(ArtifactId.valueOf(artifactId), transactionId, allowDeleted,
+ ALL).getOrCheckArtifact(QueryType.GET);
}
public static Artifact getHistoricalArtifactFromIdOrNull(int artifactId, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
try {
- return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, ALL).getOrCheckArtifact(
- QueryType.GET);
+ return new ArtifactQueryBuilder(ArtifactId.valueOf(artifactId), transactionId, allowDeleted,
+ ALL).getOrCheckArtifact(QueryType.GET);
} catch (ArtifactDoesNotExist ex) {
// do nothing
}
@@ -331,7 +337,7 @@ public class ArtifactQuery {
QueryType.GET);
}
- public static Artifact checkHistoricalArtifactFromId(int artifactId, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
+ public static Artifact checkHistoricalArtifactFromId(Artifact artifactId, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, ALL).getOrCheckArtifact(QueryType.CHECK);
}
@@ -394,14 +400,6 @@ public class ArtifactQuery {
return new ArtifactQueryBuilder(branch, ALL, allowDeleted).getArtifacts(10000, null);
}
- public static List<Integer> selectArtifactListFromType(IArtifactType artifactTypeToken, BranchId branch, DeletionFlag allowDeleted) throws OseeCoreException {
- return new ArtifactQueryBuilder(artifactTypeToken, branch, ALL, allowDeleted).selectArtifacts(10000);
- }
-
- public static List<Integer> selectArtifactListFromBranch(BranchId branch, DeletionFlag allowDeleted) throws OseeCoreException {
- return new ArtifactQueryBuilder(branch, ALL, allowDeleted).selectArtifacts(10000);
- }
-
public static List<Artifact> getArtifactListFromBranch(BranchId branch, LoadLevel loadLevel, DeletionFlag allowDeleted) throws OseeCoreException {
return new ArtifactQueryBuilder(branch, loadLevel, allowDeleted).getArtifacts(10000, null);
}
@@ -469,7 +467,7 @@ public class ArtifactQuery {
*/
public static List<Artifact> getRelatedArtifactList(Artifact artifact, IRelationType relationType, RelationSide relationSide) throws OseeCoreException {
return new ArtifactQueryBuilder(artifact.getBranch(), ALL, EXCLUDE_DELETED,
- new RelationCriteria(artifact.getArtId(), relationType, relationSide)).getArtifacts(1000, null);
+ new RelationCriteria(artifact, relationType, relationSide)).getArtifacts(1000, null);
}
/**
@@ -593,7 +591,7 @@ public class ArtifactQuery {
return queryBuilder.getMatches();
}
- public static Artifact reloadArtifactFromId(int artId, BranchId branch) throws OseeCoreException {
+ public static Artifact reloadArtifactFromId(ArtifactId artId, BranchId branch) throws OseeCoreException {
ArtifactQueryBuilder query = new ArtifactQueryBuilder(artId, branch, INCLUDE_DELETED, ALL);
Artifact artifact = query.reloadArtifact();
OseeEventManager.kickLocalArtifactReloadEvent(query, Collections.singleton(artifact));
@@ -705,7 +703,7 @@ public class ArtifactQuery {
DeletionFlag deletionFlag =
searchParameters.isIncludeDeleted() ? DeletionFlag.INCLUDE_DELETED : DeletionFlag.EXCLUDE_DELETED;
- List<Integer> ids = result.getIds();
+ List<ArtifactId> ids = result.getIds();
ResultSet<Artifact> toReturn;
if (ids != null && !ids.isEmpty()) {
List<Artifact> loadedArtifacts =
@@ -732,20 +730,20 @@ public class ArtifactQuery {
DeletionFlag deletionFlag =
searchParameters.isIncludeDeleted() ? DeletionFlag.INCLUDE_DELETED : DeletionFlag.EXCLUDE_DELETED;
- Map<Integer, Artifact> artIdToArtifact = new HashMap<>();
+ Map<Long, Artifact> artIdToArtifact = new HashMap<>();
List<Artifact> loadedArtifacts =
ArtifactLoader.loadArtifacts(result.getIds(), branch, LoadLevel.ALL, INCLUDE_CACHE, deletionFlag, tx);
for (Artifact art : loadedArtifacts) {
- artIdToArtifact.put(art.getArtId(), art);
+ artIdToArtifact.put(art.getId(), art);
}
Map<Artifact, ArtifactMatch> matches = new HashMap<>();
for (SearchMatch match : result.getSearchMatches()) {
- int artId = match.getArtId();
+ ArtifactId artId = match.getArtId();
int attrId = match.getAttrId();
- Artifact art = artIdToArtifact.get(artId);
+ Artifact art = artIdToArtifact.get(artId.getId());
if (art != null) {
ArtifactMatch toAddTo = matches.get(art);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java
index c97ddc4ecd4..79ed29c0cdd 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java
@@ -22,10 +22,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
-import java.util.Set;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.TransactionId;
@@ -57,7 +56,7 @@ public class ArtifactQueryBuilder {
private String guid;
private final ArtifactSearchCriteria[] criteria;
private final BranchId branch;
- private int artifactId;
+ private ArtifactId artifactId;
private Collection<Integer> artifactIds;
private final Collection<? extends IArtifactType> artifactTypes;
private final DeletionFlag allowDeleted;
@@ -68,7 +67,7 @@ public class ArtifactQueryBuilder {
/**
* @param allowDeleted set whether deleted artifacts should be included in the resulting artifact list
*/
- public ArtifactQueryBuilder(int artId, BranchId branch, DeletionFlag allowDeleted, LoadLevel loadLevel) {
+ public ArtifactQueryBuilder(ArtifactId artId, BranchId branch, DeletionFlag allowDeleted, LoadLevel loadLevel) {
this(null, artId, null, null, null, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel);
}
@@ -79,75 +78,82 @@ public class ArtifactQueryBuilder {
* @param allowDeleted set whether deleted artifacts should be included in the resulting artifact list
*/
public ArtifactQueryBuilder(Collection<Integer> artifactIds, BranchId branch, DeletionFlag allowDeleted, LoadLevel loadLevel) {
- this(artifactIds, 0, null, null, null, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel);
+ this(artifactIds, ArtifactId.SENTINEL, null, null, null, branch, TransactionToken.SENTINEL, allowDeleted,
+ loadLevel);
emptyCriteria = artifactIds.isEmpty();
}
public ArtifactQueryBuilder(List<String> guids, BranchId branch, LoadLevel loadLevel) {
- this(null, 0, guids, null, null, branch, TransactionToken.SENTINEL, EXCLUDE_DELETED, loadLevel);
+ this(null, ArtifactId.SENTINEL, guids, null, null, branch, TransactionToken.SENTINEL, EXCLUDE_DELETED, loadLevel);
emptyCriteria = guids.isEmpty();
}
public ArtifactQueryBuilder(List<String> guids, BranchId branch, DeletionFlag allowDeleted, LoadLevel loadLevel) {
- this(null, 0, guids, null, null, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel);
+ this(null, ArtifactId.SENTINEL, guids, null, null, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel);
emptyCriteria = guids.isEmpty();
}
public ArtifactQueryBuilder(List<String> guids, TransactionToken transactionId, DeletionFlag allowDeleted, LoadLevel loadLevel) throws OseeCoreException {
- this(null, 0, guids, null, null, transactionId.getBranch(), transactionId, allowDeleted, loadLevel);
+ this(null, ArtifactId.SENTINEL, guids, null, null, transactionId.getBranch(), transactionId, allowDeleted,
+ loadLevel);
emptyCriteria = guids.isEmpty();
}
public ArtifactQueryBuilder(Collection<Integer> artifactIds, TransactionToken transactionId, DeletionFlag allowDeleted, LoadLevel loadLevel) throws OseeCoreException {
- this(artifactIds, 0, null, null, null, transactionId.getBranch(), transactionId, allowDeleted, loadLevel);
+ this(artifactIds, ArtifactId.SENTINEL, null, null, null, transactionId.getBranch(), transactionId, allowDeleted,
+ loadLevel);
emptyCriteria = artifactIds.isEmpty();
}
- public ArtifactQueryBuilder(int artifactId, TransactionToken transactionId, DeletionFlag allowDeleted, LoadLevel loadLevel) throws OseeCoreException {
+ public ArtifactQueryBuilder(ArtifactId artifactId, TransactionToken transactionId, DeletionFlag allowDeleted, LoadLevel loadLevel) throws OseeCoreException {
this(null, artifactId, null, null, null, transactionId.getBranch(), transactionId, allowDeleted, loadLevel);
}
public ArtifactQueryBuilder(String guid, BranchId branch, DeletionFlag allowDeleted, LoadLevel loadLevel) throws OseeCoreException {
- this(null, 0, null, ensureValid(guid), null, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel);
+ this(null, ArtifactId.SENTINEL, null, ensureValid(guid), null, branch, TransactionToken.SENTINEL, allowDeleted,
+ loadLevel);
}
public ArtifactQueryBuilder(IArtifactType artifactType, BranchId branch, LoadLevel loadLevel, DeletionFlag allowDeleted) {
- this(null, 0, null, null, Arrays.asList(artifactType), branch, TransactionToken.SENTINEL, allowDeleted,
- loadLevel);
+ this(null, ArtifactId.SENTINEL, null, null, Arrays.asList(artifactType), branch, TransactionToken.SENTINEL,
+ allowDeleted, loadLevel);
}
public ArtifactQueryBuilder(Collection<? extends IArtifactType> artifactTypes, BranchId branch, LoadLevel loadLevel, DeletionFlag allowDeleted) {
- this(null, 0, null, null, artifactTypes, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel);
+ this(null, ArtifactId.SENTINEL, null, null, artifactTypes, branch, TransactionToken.SENTINEL, allowDeleted,
+ loadLevel);
emptyCriteria = artifactTypes.isEmpty();
}
public ArtifactQueryBuilder(BranchId branch, LoadLevel loadLevel, DeletionFlag allowDeleted) {
- this(null, 0, null, null, null, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel);
+ this(null, ArtifactId.SENTINEL, null, null, null, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel);
}
public ArtifactQueryBuilder(BranchId branch, LoadLevel loadLevel, DeletionFlag allowDeleted, ArtifactSearchCriteria... criteria) {
- this(null, 0, null, null, null, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel, criteria);
+ this(null, ArtifactId.SENTINEL, null, null, null, branch, TransactionToken.SENTINEL, allowDeleted, loadLevel,
+ criteria);
emptyCriteria = criteria.length == 0;
}
public ArtifactQueryBuilder(BranchId branch, LoadLevel loadLevel, List<ArtifactSearchCriteria> criteria) {
- this(null, 0, null, null, null, branch, TransactionToken.SENTINEL, EXCLUDE_DELETED, loadLevel, toArray(criteria));
+ this(null, ArtifactId.SENTINEL, null, null, null, branch, TransactionToken.SENTINEL, EXCLUDE_DELETED, loadLevel,
+ toArray(criteria));
emptyCriteria = criteria.isEmpty();
}
public ArtifactQueryBuilder(IArtifactType artifactType, BranchId branch, LoadLevel loadLevel, ArtifactSearchCriteria... criteria) {
- this(null, 0, null, null, Arrays.asList(artifactType), branch, TransactionToken.SENTINEL, EXCLUDE_DELETED,
- loadLevel, criteria);
+ this(null, ArtifactId.SENTINEL, null, null, Arrays.asList(artifactType), branch, TransactionToken.SENTINEL,
+ EXCLUDE_DELETED, loadLevel, criteria);
emptyCriteria = criteria.length == 0;
}
public ArtifactQueryBuilder(IArtifactType artifactType, BranchId branch, LoadLevel loadLevel, List<ArtifactSearchCriteria> criteria) {
- this(null, 0, null, null, Arrays.asList(artifactType), branch, TransactionToken.SENTINEL, EXCLUDE_DELETED,
- loadLevel, toArray(criteria));
+ this(null, ArtifactId.SENTINEL, null, null, Arrays.asList(artifactType), branch, TransactionToken.SENTINEL,
+ EXCLUDE_DELETED, loadLevel, toArray(criteria));
emptyCriteria = criteria.isEmpty();
}
- private ArtifactQueryBuilder(Collection<Integer> artifactIds, int artifactId, List<String> guids, String guid, Collection<? extends IArtifactType> artifactTypes, BranchId branch, TransactionToken transactionId, DeletionFlag allowDeleted, LoadLevel loadLevel, ArtifactSearchCriteria... criteria) {
+ private ArtifactQueryBuilder(Collection<Integer> artifactIds, ArtifactId artifactId, List<String> guids, String guid, Collection<? extends IArtifactType> artifactTypes, BranchId branch, TransactionToken transactionId, DeletionFlag allowDeleted, LoadLevel loadLevel, ArtifactSearchCriteria... criteria) {
this.artifactTypes = artifactTypes;
this.branch = branch;
this.criteria = criteria;
@@ -158,7 +164,7 @@ public class ArtifactQueryBuilder {
this.transactionId = transactionId;
if (artifactIds != null && !artifactIds.isEmpty()) {
if (artifactIds.size() == 1) {
- this.artifactId = artifactIds.iterator().next();
+ this.artifactId = ArtifactId.valueOf(artifactIds.iterator().next());
} else {
this.artifactIds = artifactIds;
}
@@ -193,7 +199,7 @@ public class ArtifactQueryBuilder {
private boolean useServerSearch() {
return Conditions.hasValues(artifactTypes) || guid != null || Conditions.hasValues(
- guids) || criteria.length > 0 || artifactId == 0 && !Conditions.hasValues(artifactIds);
+ guids) || criteria.length > 0 || artifactId.isInvalid() && !Conditions.hasValues(artifactIds);
}
private QueryBuilder getQueryBuilder() throws OseeCoreException {
@@ -218,10 +224,10 @@ public class ArtifactQueryBuilder {
builder.includeDeleted();
}
- if (artifactId != 0 || Conditions.hasValues(artifactIds)) {
+ if (artifactId.isValid() || Conditions.hasValues(artifactIds)) {
if (Conditions.hasValues(artifactIds)) {
builder.andLocalIds(artifactIds);
- } else if (artifactId != 0) {
+ } else if (artifactId.isValid()) {
builder.andLocalId(artifactId);
}
}
@@ -275,7 +281,7 @@ public class ArtifactQueryBuilder {
}
private List<Artifact> loadArtifactsFromServerIds(LoadType reload) throws OseeCoreException {
- List<Integer> ids = createOrcsQuery().getIds();
+ List<ArtifactId> ids = createOrcsQuery().getIds();
List<Artifact> artifacts;
if (ids != null && !ids.isEmpty()) {
artifacts = ArtifactLoader.loadArtifacts(ids, branch, loadLevel, reload, allowDeleted, transactionId);
@@ -294,7 +300,7 @@ public class ArtifactQueryBuilder {
return artifactsFromServerIds;
}
- public List<Integer> selectArtifacts(int artifactCountEstimate) throws OseeCoreException {
+ public List<ArtifactId> selectArtifacts(int artifactCountEstimate) throws OseeCoreException {
return createOrcsQuery().getIds();
}
@@ -336,7 +342,7 @@ public class ArtifactQueryBuilder {
message.append(" with type(s): ");
message.append(artifactTypes);
}
- if (artifactId != 0) {
+ if (artifactId.isValid()) {
message.append(" with id \"");
message.append(artifactId);
message.append("\"");
@@ -359,7 +365,7 @@ public class ArtifactQueryBuilder {
private static final class LocalIdQueryBuilder implements InvocationHandler {
- private final Set<Integer> localIds = new LinkedHashSet<>();
+ private final List<ArtifactId> localIds = new ArrayList<>();
private DeletionFlag allowDeleted = EXCLUDE_DELETED;
private TransactionId txId = TransactionId.SENTINEL;
private final BranchId branch;
@@ -416,7 +422,7 @@ public class ArtifactQueryBuilder {
@SuppressWarnings("unused")
public SearchResult getSearchResult() throws OseeCoreException {
SearchResponse response = new SearchResponse();
- List<Integer> ids = new LinkedList<>(localIds);
+ List<ArtifactId> ids = new LinkedList<>(localIds);
response.setIds(ids);
return response;
}
@@ -432,21 +438,18 @@ public class ArtifactQueryBuilder {
}
@SuppressWarnings("unused")
- public void andLocalId(int... artifactId) {
- for (int id : artifactId) {
- localIds.add(id);
- }
+ public void andLocalId(ArtifactId artifactId) {
+ localIds.add(artifactId);
}
@SuppressWarnings("unused")
public void andLocalIds(Collection<Integer> artifactIds) {
- localIds.addAll(artifactIds);
+ artifactIds.stream().map(id -> ArtifactId.valueOf(id)).forEachOrdered(localIds::add);
}
@SuppressWarnings("unused")
- public List<Integer> getIds() {
- return new LinkedList<Integer>(localIds);
+ public List<ArtifactId> getIds() {
+ return localIds;
}
-
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java
index c3d2e960de6..9db2fb49429 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact.search;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.data.TokenFactory;
@@ -24,11 +25,11 @@ import org.eclipse.osee.orcs.rest.client.QueryBuilder;
public class RelationCriteria implements ArtifactSearchCriteria {
private final IRelationType relationType;
private final RelationSide relationSide;
- private final int artifactId;
+ private final ArtifactId artifactId;
/**
* Constructor for search criteria that follows the relation link ending on the given side
- *
+ *
* @param relationEnum the side to start following the link from
*/
public RelationCriteria(IRelationTypeSide relationEnum) {
@@ -40,10 +41,10 @@ public class RelationCriteria implements ArtifactSearchCriteria {
}
public RelationCriteria(IRelationType relationType, RelationSide relationSide) {
- this(0, relationType, relationSide);
+ this(ArtifactId.SENTINEL, relationType, relationSide);
}
- public RelationCriteria(int artifactId, IRelationType relationType, RelationSide relationSide) {
+ public RelationCriteria(ArtifactId artifactId, IRelationType relationType, RelationSide relationSide) {
this.artifactId = artifactId;
this.relationType = relationType;
this.relationSide = relationSide;
@@ -51,10 +52,10 @@ public class RelationCriteria implements ArtifactSearchCriteria {
@Override
public void addToQueryBuilder(QueryBuilder builder) throws OseeCoreException {
- if (artifactId > 0) {
+ if (artifactId.isValid()) {
IRelationTypeSide rts =
TokenFactory.createRelationTypeSide(relationSide, relationType.getGuid(), Strings.EMPTY_STRING);
- builder.andRelatedToLocalIds(rts, artifactId);
+ builder.andRelatedTo(rts, artifactId);
} else if (relationSide == null) {
builder.andExists(relationType);
} else {
@@ -63,5 +64,4 @@ public class RelationCriteria implements ArtifactSearchCriteria {
builder.andExists(rts);
}
}
-
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java
index 83e520d5775..7d0c52ebe67 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java
@@ -19,6 +19,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
@@ -217,10 +218,10 @@ public class ConflictManagerInternal {
BranchManager.getBaseTransaction(source).getId(), joinQuery.getQueryId(), dest.getUuid());
while (chStmt.next()) {
- int artId = chStmt.getInt("art_id");
- int sAttrId = chStmt.getInt("source_attr_id");
- int dAttrId = chStmt.getInt("dest_attr_id");
- artIdSet.add(artId);
+ Long artId = chStmt.getLong("art_id");
+ Long sAttrId = chStmt.getLong("source_attr_id");
+ Long dAttrId = chStmt.getLong("dest_attr_id");
+ artIdSet.add(artId.intValue());
batchParams.add(new Object[] {dAttrId, sAttrId, artId});
}
@@ -234,7 +235,7 @@ public class ConflictManagerInternal {
ConnectionHandler.runBatchUpdate(updateSql, batchParams);
// update cached source artifacts
for (Object[] params : batchParams) {
- ArtifactQuery.reloadArtifactFromId((int) params[2], source);
+ ArtifactQuery.reloadArtifactFromId(ArtifactId.valueOf((Long) params[2]), source);
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
index 28f20b8e1af..e5818282095 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
@@ -60,8 +60,8 @@ public class ReplaceArtifactWithBaselineOperation extends AbstractOperation {
for (Artifact artifact : artifacts) {
monitor.subTask("Reverting: " + artifact.getName());
monitor.worked(1);
- Artifact sourceArtifact = ArtifactQuery.checkHistoricalArtifactFromId(artifact.getArtId(), txRecord,
- DeletionFlag.INCLUDE_DELETED);
+ Artifact sourceArtifact =
+ ArtifactQuery.checkHistoricalArtifactFromId(artifact, txRecord, DeletionFlag.INCLUDE_DELETED);
try {
if (sourceArtifact != null) {
String userId = ClientSessionManager.getCurrentUserToken().getUserId();
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java
index b9761d6d428..f8a29eacf04 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java
@@ -143,10 +143,10 @@ public class OrcsSubscriptionStorage extends AbstractOrcsStorage implements Subs
@Override
public ResultSet<Account> getSubscriptionMembersById(SubscriptionGroupId groupId) {
- int intGroupId = Long.valueOf(groupId.getId()).intValue();
+ ArtifactId groupArtId = ArtifactId.valueOf(groupId.getId());
ResultSet<ArtifactReadable> results =
- newQuery().andIsOfType(CoreArtifactTypes.User).andRelatedToLocalIds(CoreRelationTypes.Users_Artifact,
- intGroupId).getResults();
+ newQuery().andIsOfType(CoreArtifactTypes.User).andRelatedTo(CoreRelationTypes.Users_Artifact,
+ groupArtId).getResults();
return getFactory().newAccountResultSet(results);
}
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java
index c8d977a6fee..fd405c7e544 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java
@@ -28,7 +28,6 @@ import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.DEFAULT_
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -194,7 +193,7 @@ public class TransactionBuilderImplTest {
when(queryFactory.fromBranch(branch)).thenReturn(builder);
when(builder.includeDeletedArtifacts()).thenReturn(builder);
- when(builder.andGuid(anyString())).thenReturn(builder);
+ when(builder.andId(any())).thenReturn(builder);
ResultSet<ArtifactReadable> source = ResultSets.singleton(expectedAuthor);
when(builder.getResults()).thenReturn(source);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java
index d7b7ea1a842..b96e1ccd072 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java
@@ -10,13 +10,12 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.ds;
+import org.eclipse.osee.framework.core.data.ArtifactId;
+
/**
* @author Roberto E. Escobar
*/
-public interface ArtifactData extends OrcsData {
-
- String getGuid();
+public interface ArtifactData extends OrcsData, ArtifactId {
void setGuid(String guid);
-
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactIds.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactIds.java
index 74542fc6709..553aef9313d 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactIds.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactIds.java
@@ -11,29 +11,37 @@
package org.eclipse.osee.orcs.core.ds.criteria;
import java.util.Collection;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.orcs.core.ds.Criteria;
-import org.eclipse.osee.orcs.core.ds.Options;
/**
* @author Roberto E. Escobar
*/
public class CriteriaArtifactIds extends Criteria {
- private final Collection<Long> ids;
+ private final Collection<? extends ArtifactId> ids;
- public CriteriaArtifactIds(Collection<Long> ids) {
- super();
+ private final ArtifactId id;
+
+ public CriteriaArtifactIds(Collection<? extends ArtifactId> ids) {
this.ids = ids;
+ id = null;
}
- @Override
- public void checkValid(Options options) throws OseeCoreException {
- Conditions.checkNotNullOrEmpty(ids, "artifact ids");
+ public CriteriaArtifactIds(ArtifactId id) {
+ this.id = id;
+ ids = null;
+ }
+
+ public boolean hasMultipleIds() {
+ return id == null;
+ }
+
+ public ArtifactId getId() {
+ return id;
}
- public Collection<Long> getIds() {
+ public Collection<? extends ArtifactId> getIds() {
return ids;
}
@@ -41,4 +49,4 @@ public class CriteriaArtifactIds extends Criteria {
public String toString() {
return "CriteriaArtifactIds [ids=" + ids + "]";
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaRelatedTo.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaRelatedTo.java
index e100035671b..a060fc86685 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaRelatedTo.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaRelatedTo.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.orcs.core.ds.criteria;
import java.util.Collection;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -22,11 +23,18 @@ import org.eclipse.osee.orcs.core.ds.Options;
*/
public class CriteriaRelatedTo extends Criteria {
private final IRelationTypeSide relationTypeSide;
- private final Collection<Integer> artifactIds;
+ private final Collection<? extends ArtifactId> artifactIds;
+ private final ArtifactId artifactId;
- public CriteriaRelatedTo(IRelationTypeSide relationTypeSide, Collection<Integer> artifactIds) {
- super();
+ public CriteriaRelatedTo(IRelationTypeSide relationTypeSide, ArtifactId artifactId) {
this.relationTypeSide = relationTypeSide;
+ this.artifactId = artifactId;
+ this.artifactIds = null;
+ }
+
+ public CriteriaRelatedTo(IRelationTypeSide relationTypeSide, Collection<? extends ArtifactId> artifactIds) {
+ this.relationTypeSide = relationTypeSide;
+ this.artifactId = null;
this.artifactIds = artifactIds;
}
@@ -34,10 +42,18 @@ public class CriteriaRelatedTo extends Criteria {
return relationTypeSide;
}
- public Collection<Integer> getIds() {
+ public Collection<? extends ArtifactId> getIds() {
return artifactIds;
}
+ public ArtifactId getId() {
+ return artifactId;
+ }
+
+ public boolean hasMultipleIds() {
+ return artifactId == null;
+ }
+
@Override
public void checkValid(Options options) throws OseeCoreException {
Conditions.checkNotNull(getType(), "relation type side");
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java
index 37d03c1fa6a..5d928e66dbf 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java
@@ -221,7 +221,7 @@ public class ArtifactImpl extends AttributeManagerImpl implements Artifact {
}
@Override
- public Long getUuid() {
+ public Long getId() {
return Long.valueOf(getLocalId());
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java
index 600688d11a0..c43900c5c34 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java
@@ -285,7 +285,7 @@ public class ArtifactReadOnlyImpl extends AbstractProxied<Artifact> implements A
}
@Override
- public Long getUuid() {
+ public Long getId() {
return Long.valueOf(getLocalId());
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/script/impl/OrcsScriptInterpreterImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/script/impl/OrcsScriptInterpreterImpl.java
index 2b85902afbe..651ebe016d5 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/script/impl/OrcsScriptInterpreterImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/script/impl/OrcsScriptInterpreterImpl.java
@@ -18,8 +18,10 @@ import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
+import java.util.stream.Collectors;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
@@ -624,8 +626,9 @@ public class OrcsScriptInterpreterImpl implements OrcsScriptInterpreter {
@Override
public Void caseOsRelatedToClause(OsRelatedToClause object) {
IRelationTypeSide typeSide = asRelationTypeSide(object.getType(), object.getSide());
- Collection<Integer> ids = resolver.resolve(Integer.class, object.getIds());
- getArtifactQuery().andRelatedToLocalIds(typeSide, ids);
+ Collection<Long> ids = resolver.resolve(Long.class, object.getIds());
+ getArtifactQuery().andRelatedTo(typeSide,
+ ids.stream().map(id -> ArtifactId.valueOf(id)).collect(Collectors.toList()));
return null;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ArtifactQueryBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ArtifactQueryBuilderImpl.java
index 80cb59cc42b..640d1660269 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ArtifactQueryBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ArtifactQueryBuilderImpl.java
@@ -10,14 +10,13 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.search;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
-import org.eclipse.osee.framework.core.data.HasLocalId;
+import java.util.stream.Collectors;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
@@ -26,8 +25,6 @@ import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
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.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.GUID;
@@ -36,6 +33,8 @@ import org.eclipse.osee.orcs.core.ds.Options;
import org.eclipse.osee.orcs.core.ds.OptionsUtil;
import org.eclipse.osee.orcs.core.ds.QueryData;
import org.eclipse.osee.orcs.core.ds.criteria.BranchCriteria;
+import org.eclipse.osee.orcs.core.ds.criteria.CriteriaArtifactIds;
+import org.eclipse.osee.orcs.core.ds.criteria.CriteriaRelatedTo;
import org.eclipse.osee.orcs.core.ds.criteria.TxCriteria;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.search.ArtifactQueryBuilder;
@@ -144,18 +143,28 @@ public class ArtifactQueryBuilderImpl<T> implements ArtifactQueryBuilder<T> {
}
@Override
- public T andUuid(long... uuids) throws OseeCoreException {
- List<Long> ids = new ArrayList<>(uuids.length);
- for (long id : uuids) {
- ids.add(id);
- }
- return andUuids(ids);
+ public T andUuid(long id) {
+ return andId(ArtifactId.valueOf(id));
+ }
+
+ @Override
+ public T andId(ArtifactId id) {
+ return addAndCheck(queryData, new CriteriaArtifactIds(id));
+ }
+
+ @Override
+ public T andIds(ArtifactId id) {
+ return andId(id);
+ }
+
+ @Override
+ public T andIds(Collection<? extends ArtifactId> ids) {
+ return addAndCheck(queryData, new CriteriaArtifactIds(ids));
}
@Override
public T andUuids(Collection<Long> artifactIds) throws OseeCoreException {
- Criteria criteria = criteriaFactory.createArtifactIdCriteria(artifactIds);
- return addAndCheck(getQueryData(), criteria);
+ return andIds(artifactIds.stream().map(id -> ArtifactId.valueOf(id)).collect(Collectors.toList()));
}
@Override
@@ -165,7 +174,7 @@ public class ArtifactQueryBuilderImpl<T> implements ArtifactQueryBuilder<T> {
@SuppressWarnings("unchecked")
@Override
- public T andGuids(Collection<String> ids) throws OseeCoreException {
+ public T andGuids(Collection<String> ids) {
Set<String> guids = new HashSet<>();
Set<String> invalids = new HashSet<>();
for (String id : ids) {
@@ -185,141 +194,118 @@ public class ArtifactQueryBuilderImpl<T> implements ArtifactQueryBuilder<T> {
}
@Override
- public T andIsOfType(IArtifactType... artifactType) throws OseeCoreException {
+ public T andIsOfType(IArtifactType... artifactType) {
return andIsOfType(Arrays.asList(artifactType));
}
@Override
- public T andIsOfType(Collection<? extends IArtifactType> artifactType) throws OseeCoreException {
+ public T andIsOfType(Collection<? extends IArtifactType> artifactType) {
Criteria criteria = criteriaFactory.createArtifactTypeCriteriaWithInheritance(artifactType);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T andTypeEquals(IArtifactType... artifactType) throws OseeCoreException {
+ public T andTypeEquals(IArtifactType... artifactType) {
return andTypeEquals(Arrays.asList(artifactType));
}
@Override
- public T andTypeEquals(Collection<? extends IArtifactType> artifactType) throws OseeCoreException {
+ public T andTypeEquals(Collection<? extends IArtifactType> artifactType) {
Criteria criteria = criteriaFactory.createArtifactTypeCriteria(artifactType);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T andExists(IAttributeType... attributeType) throws OseeCoreException {
+ public T andExists(IAttributeType... attributeType) {
return andExists(Arrays.asList(attributeType));
}
@Override
- public T andExists(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException {
+ public T andExists(Collection<? extends IAttributeType> attributeTypes) {
Criteria criteria = criteriaFactory.createExistsCriteria(attributeTypes);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T andNotExists(IAttributeType attributeType) throws OseeCoreException {
+ public T andNotExists(IAttributeType attributeType) {
Criteria criteria = criteriaFactory.createNotExistsCriteria(attributeType);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T andNotExists(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException {
+ public T andNotExists(Collection<? extends IAttributeType> attributeTypes) {
Criteria criteria = criteriaFactory.createNotExistsCriteria(attributeTypes);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T andExists(IRelationType relationType) throws OseeCoreException {
+ public T andExists(IRelationType relationType) {
Criteria criteria = criteriaFactory.createExistsCriteria(relationType);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T andNotExists(IRelationType relationType) throws OseeCoreException {
+ public T andNotExists(IRelationType relationType) {
Criteria criteria = criteriaFactory.createNotExistsCriteria(relationType);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T andNotExists(IRelationTypeSide relationTypeSide) throws OseeCoreException {
+ public T andNotExists(IRelationTypeSide relationTypeSide) {
Criteria criteria = criteriaFactory.createNotExistsCriteria(relationTypeSide);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T andExists(IRelationTypeSide relationTypeSide) throws OseeCoreException {
+ public T andExists(IRelationTypeSide relationTypeSide) {
Criteria criteria = criteriaFactory.createExistsCriteria(relationTypeSide);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T and(IAttributeType attributeType, Collection<String> values, QueryOption... options) throws OseeCoreException {
+ public T and(IAttributeType attributeType, Collection<String> values, QueryOption... options) {
return and(Collections.singleton(attributeType), values, options);
}
@Override
- public T and(IAttributeType attributeType, String value, QueryOption... options) throws OseeCoreException {
+ public T and(IAttributeType attributeType, String value, QueryOption... options) {
return and(Collections.singleton(attributeType), Collections.singleton(value), options);
}
@Override
- public T and(Collection<IAttributeType> attributeTypes, String value, QueryOption... options) throws OseeCoreException {
+ public T and(Collection<IAttributeType> attributeTypes, String value, QueryOption... options) {
return and(attributeTypes, Collections.singleton(value), options);
}
@Override
- public T and(Collection<IAttributeType> attributeTypes, Collection<String> value, QueryOption... options) throws OseeCoreException {
+ public T and(Collection<IAttributeType> attributeTypes, Collection<String> value, QueryOption... options) {
Criteria criteria = criteriaFactory.createAttributeCriteria(attributeTypes, value, options);
return addAndCheck(getQueryData(), criteria);
}
@Override
- public T andNameEquals(String artifactName) throws OseeCoreException {
+ public T andNameEquals(String artifactName) {
return and(CoreAttributeTypes.Name, artifactName);
}
@Override
- public T andIds(Identifiable<String>... ids) throws OseeCoreException {
+ public T andIds(ArtifactId... ids) {
return andIds(Arrays.asList(ids));
}
@Override
- public T andIds(Collection<? extends Identifiable<String>> ids) throws OseeCoreException {
- Set<String> guids = new HashSet<>();
- for (Identity<String> id : ids) {
- guids.add(id.getGuid());
- }
- return andGuids(guids);
- }
-
- @Override
- public T andRelatedTo(IRelationTypeSide relationTypeSide, ArtifactReadable... artifacts) throws OseeCoreException {
+ public T andRelatedTo(IRelationTypeSide relationTypeSide, ArtifactReadable... artifacts) {
return andRelatedTo(relationTypeSide, Arrays.asList(artifacts));
}
@Override
- public T andRelatedTo(IRelationTypeSide relationTypeSide, Collection<? extends ArtifactReadable> artifacts) throws OseeCoreException {
- Set<Integer> ids = new HashSet<>();
- for (HasLocalId<Integer> token : artifacts) {
- ids.add(token.getLocalId());
- }
- return andRelatedToLocalIds(relationTypeSide, ids);
+ public T andRelatedTo(IRelationTypeSide relationTypeSide, Collection<? extends ArtifactId> artifacts) {
+ return addAndCheck(getQueryData(), new CriteriaRelatedTo(relationTypeSide, artifacts));
}
@Override
- public T andRelatedToLocalIds(IRelationTypeSide relationTypeSide, int... artifactIds) throws OseeCoreException {
- Set<Integer> ids = new HashSet<>();
- for (Integer id : artifactIds) {
- ids.add(id);
- }
- return andRelatedToLocalIds(relationTypeSide, ids);
- }
-
- @Override
- public T andRelatedToLocalIds(IRelationTypeSide relationTypeSide, Collection<Integer> artifactIds) throws OseeCoreException {
- Criteria criteria = criteriaFactory.createRelatedToCriteria(relationTypeSide, artifactIds);
- return addAndCheck(getQueryData(), criteria);
+ public T andRelatedTo(IRelationTypeSide relationTypeSide, ArtifactId artifactId) {
+ return addAndCheck(getQueryData(), new CriteriaRelatedTo(relationTypeSide, artifactId));
}
@SuppressWarnings("unchecked")
@@ -332,7 +318,7 @@ public class ArtifactQueryBuilderImpl<T> implements ArtifactQueryBuilder<T> {
}
@SuppressWarnings("unchecked")
- private T addAndCheck(QueryData queryData, Criteria criteria) throws OseeCoreException {
+ private T addAndCheck(QueryData queryData, Criteria criteria) {
criteria.checkValid(getOptions());
queryData.addCriteria(criteria);
return (T) this;
@@ -372,4 +358,4 @@ public class ArtifactQueryBuilderImpl<T> implements ArtifactQueryBuilder<T> {
andIds(CoreArtifactTokens.DefaultHierarchyRoot);
return (T) this;
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CallableQueryFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CallableQueryFactory.java
index 424dbe3e6bb..ba75488d7e4 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CallableQueryFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CallableQueryFactory.java
@@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.search;
+import com.google.common.collect.Iterables;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.osee.executor.admin.CancellableCallable;
-import org.eclipse.osee.framework.core.data.HasLocalId;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.type.ResultSets;
@@ -34,7 +35,6 @@ import org.eclipse.osee.orcs.core.internal.proxy.ExternalArtifactManager;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
import org.eclipse.osee.orcs.search.Match;
-import com.google.common.collect.Iterables;
/**
* @author Roberto E. Escobar
@@ -69,12 +69,12 @@ public class CallableQueryFactory {
};
}
- public CancellableCallable<ResultSet<HasLocalId<Integer>>> createLocalIdSearch(OrcsSession session, QueryData queryData) {
- return new AbstractSearchCallable<ResultSet<HasLocalId<Integer>>>(session, queryData) {
+ public CancellableCallable<ResultSet<? extends ArtifactId>> createLocalIdSearch(OrcsSession session, QueryData queryData) {
+ return new AbstractSearchCallable<ResultSet<? extends ArtifactId>>(session, queryData) {
@Override
- protected ResultSet<HasLocalId<Integer>> innerCall() throws Exception {
- final List<HasLocalId<Integer>> results = new LinkedList<>();
+ protected ResultSet<? extends ArtifactId> innerCall() throws Exception {
+ final List<ArtifactId> results = new LinkedList<>();
LoadDataHandlerAdapter handler = new LoadDataHandlerAdapter() {
@Override
public void onData(ArtifactData data) {
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 b2172422149..b0a94948751 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
@@ -23,12 +23,10 @@ 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;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaArtifactGuids;
-import org.eclipse.osee.orcs.core.ds.criteria.CriteriaArtifactIds;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaArtifactType;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeKeywords;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeTypeExists;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeTypeNotExists;
-import org.eclipse.osee.orcs.core.ds.criteria.CriteriaRelatedTo;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaRelationTypeExists;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaRelationTypeFollow;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaRelationTypeNotExists;
@@ -106,18 +104,10 @@ public class CriteriaFactory {
return new CriteriaArtifactType(artifactTypeCache, artifactTypes, true);
}
- public Criteria createArtifactIdCriteria(Collection<Long> artifactIds) throws OseeCoreException {
- return new CriteriaArtifactIds(artifactIds);
- }
-
public Criteria createArtifactGuidCriteria(Set<String> guids) throws OseeCoreException {
return new CriteriaArtifactGuids(guids);
}
- public Criteria createRelatedToCriteria(IRelationTypeSide relationType, Collection<Integer> artifactIds) throws OseeCoreException {
- return new CriteriaRelatedTo(relationType, artifactIds);
- }
-
public Criteria createAllArtifactsCriteria() {
return new CriteriaAllArtifacts();
}
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 f624e79bf35..b900e9af3db 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
@@ -11,7 +11,7 @@
package org.eclipse.osee.orcs.core.internal.search;
import org.eclipse.osee.executor.admin.CancellableCallable;
-import org.eclipse.osee.framework.core.data.HasLocalId;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.orcs.OrcsSession;
@@ -24,7 +24,7 @@ import org.eclipse.osee.orcs.search.QueryBuilder;
/**
* @author Roberto E. Escobar
*/
-public class QueryBuilderImpl extends ArtifactQueryBuilderImpl<QueryBuilder>implements QueryBuilder {
+public class QueryBuilderImpl extends ArtifactQueryBuilderImpl<QueryBuilder> implements QueryBuilder {
private final CallableQueryFactory queryFactory;
private final OrcsSession session;
@@ -63,7 +63,7 @@ public class QueryBuilderImpl extends ArtifactQueryBuilderImpl<QueryBuilder>impl
}
@Override
- public ResultSet<HasLocalId<Integer>> getResultsAsLocalIds() throws OseeCoreException {
+ public ResultSet<? extends ArtifactId> getResultsAsLocalIds() throws OseeCoreException {
try {
return createSearchResultsAsLocalIds().call();
} catch (Exception ex) {
@@ -82,7 +82,7 @@ public class QueryBuilderImpl extends ArtifactQueryBuilderImpl<QueryBuilder>impl
}
@Override
- public CancellableCallable<ResultSet<HasLocalId<Integer>>> createSearchResultsAsLocalIds() throws OseeCoreException {
+ public CancellableCallable<ResultSet<? extends ArtifactId>> createSearchResultsAsLocalIds() throws OseeCoreException {
return queryFactory.createLocalIdSearch(session, buildAndCopy());
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java
index 2fc42fe8b1a..ec2fffda441 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryFactoryImpl.java
@@ -98,7 +98,7 @@ public class QueryFactoryImpl implements QueryFactory {
for (ArtifactReadable art : artifacts) {
guids.add(art.getGuid());
}
- return fromBranch(artifact.getBranchId()).andGuids(guids);
+ return fromBranch(artifact.getBranch()).andGuids(guids);
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
index 202cb57500f..507a35d01c9 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
@@ -354,8 +354,8 @@ public class TransactionBuilderImpl implements TransactionBuilder {
}
protected ArtifactReadable getArtifactReadable(OrcsSession session, QueryModule query, Long branch, ArtifactId id) {
- return query.createQueryFactory(session).fromBranch(branch).includeDeletedArtifacts().andGuid(
- id.getGuid()).getResults().getOneOrNull();
+ return query.createQueryFactory(session).fromBranch(branch).includeDeletedArtifacts().andId(
+ id).getResults().getOneOrNull();
}
@Override
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 e2412681a6f..36f244e6c19 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
@@ -17,6 +17,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.core.ds.Criteria;
import org.eclipse.osee.orcs.core.ds.CriteriaSet;
@@ -43,7 +44,7 @@ import org.mockito.Mock;
/**
* Test Case for {@link SqlHandlerFactoryUtil}
- *
+ *
* @author Roberto E. Escobar
*/
public class SqlHandlerFactoryUtilTest {
@@ -67,7 +68,7 @@ public class SqlHandlerFactoryUtilTest {
public void testQueryModuleFactory() throws Exception {
List<Criteria> criteria = new ArrayList<>();
criteria.add(new CriteriaArtifactGuids(null));
- criteria.add(new CriteriaArtifactIds(null));
+ criteria.add(new CriteriaArtifactIds((Collection<? extends ArtifactId>) null));
criteria.add(new CriteriaRelationTypeFollow(null));
criteria.add(new CriteriaArtifactType(null, null, true));
criteria.add(new CriteriaRelationTypeExists(null));
@@ -76,7 +77,7 @@ public class SqlHandlerFactoryUtilTest {
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 CriteriaRelatedTo(null, (Collection<? extends ArtifactId>) null));
criteria.add(new CriteriaAllArtifacts());
Collections.shuffle(criteria);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java
index d9e185ca3ec..df96ae07f51 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java
@@ -81,4 +81,8 @@ public class ArtifactDataImpl extends OrcsVersionedObjectImpl implements Artifac
this.useBackingData = useBackingData;
}
-}
+ @Override
+ public Long getId() {
+ return getLocalId().longValue();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/ArtifactIdsSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/ArtifactIdsSqlHandler.java
index 14a58dbbaa9..68c09905391 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/ArtifactIdsSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/ArtifactIdsSqlHandler.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.search.handlers;
-import java.util.Collection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.OptionsUtil;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaArtifactIds;
@@ -43,18 +42,17 @@ public class ArtifactIdsSqlHandler extends SqlHandler<CriteriaArtifactIds> {
StringBuilder sb = new StringBuilder();
sb.append(
"SELECT max(txs.transaction_id) as transaction_id, art.art_id\n FROM osee_txs txs, osee_artifact art");
- Collection<Long> ids = criteria.getIds();
- if (ids.size() > 1) {
+ if (criteria.hasMultipleIds()) {
sb.append(", osee_join_id id");
}
sb.append("\n WHERE txs.gamma_id = art.gamma_id\n");
- if (ids.size() > 1) {
- AbstractJoinQuery joinQuery = writer.writeIdJoin(ids);
+ if (criteria.hasMultipleIds()) {
+ AbstractJoinQuery joinQuery = writer.writeJoin(criteria.getIds());
sb.append(" AND art.art_id = id.id AND id.query_id = ?");
writer.addParameter(joinQuery.getQueryId());
} else {
sb.append(" AND art.art_id = ?");
- writer.addParameter(ids.iterator().next());
+ writer.addParameter(criteria.getId());
}
sb.append(" AND ");
sb.append(writer.getWithClauseTxBranchFilter("txs", false));
@@ -75,7 +73,7 @@ public class ArtifactIdsSqlHandler extends SqlHandler<CriteriaArtifactIds> {
@Override
public void addTables(AbstractSqlWriter writer) {
- if (criteria.getIds().size() > 1 && !OptionsUtil.isHistorical(writer.getOptions())) {
+ if (criteria.hasMultipleIds() && !OptionsUtil.isHistorical(writer.getOptions())) {
jIdAlias = writer.addTable(TableEnum.ID_JOIN_TABLE);
}
artAlias = writer.addTable(TableEnum.ARTIFACT_TABLE);
@@ -84,7 +82,6 @@ public class ArtifactIdsSqlHandler extends SqlHandler<CriteriaArtifactIds> {
@Override
public boolean addPredicates(AbstractSqlWriter writer) throws OseeCoreException {
- Collection<Long> ids = criteria.getIds();
if (OptionsUtil.isHistorical(writer.getOptions())) {
writer.write(withClauseName);
@@ -97,8 +94,8 @@ public class ArtifactIdsSqlHandler extends SqlHandler<CriteriaArtifactIds> {
writer.write(".art_id");
} else {
writer.write(artAlias);
- if (ids.size() > 1) {
- AbstractJoinQuery joinQuery = writer.writeIdJoin(ids);
+ if (criteria.hasMultipleIds()) {
+ AbstractJoinQuery joinQuery = writer.writeJoin(criteria.getIds());
writer.write(".art_id = ");
writer.write(jIdAlias);
writer.write(".id AND ");
@@ -107,7 +104,7 @@ public class ArtifactIdsSqlHandler extends SqlHandler<CriteriaArtifactIds> {
writer.addParameter(joinQuery.getQueryId());
} else {
writer.write(".art_id = ?");
- writer.addParameter(ids.iterator().next());
+ writer.addParameter(criteria.getId());
}
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/RelatedToSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/RelatedToSqlHandler.java
index e5cb6434162..0874e18649b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/RelatedToSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/RelatedToSqlHandler.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.search.handlers;
-import java.util.Collection;
import java.util.List;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -49,7 +48,7 @@ public class RelatedToSqlHandler extends SqlHandler<CriteriaRelatedTo> {
StringBuilder sb = new StringBuilder();
sb.append("SELECT max(txs.transaction_id) as transaction_id, rel.a_art_id as art_id\n");
sb.append(" FROM osee_txs txs, osee_relation_link rel");
- if (criteria.getIds().size() > 1) {
+ if (criteria.hasMultipleIds()) {
sb.append(", ");
sb.append(TableEnum.ID_JOIN_TABLE.getName());
sb.append(" ");
@@ -87,7 +86,7 @@ public class RelatedToSqlHandler extends SqlHandler<CriteriaRelatedTo> {
@Override
public void addTables(AbstractSqlWriter writer) {
- if (criteria.getIds().size() > 1) {
+ if (criteria.hasMultipleIds()) {
jIdAlias = writer.addTable(TableEnum.ID_JOIN_TABLE);
}
@@ -107,26 +106,23 @@ public class RelatedToSqlHandler extends SqlHandler<CriteriaRelatedTo> {
sb.append(".rel_link_type_id = ?");
writer.addParameter(typeSide.getGuid());
- Collection<Integer> ids = criteria.getIds();
- if (!ids.isEmpty()) {
- sb.append(" AND ");
- String aOrbArtId = typeSide.getSide().isSideA() ? ".a_art_id" : ".b_art_id";
- if (ids.size() > 1) {
- AbstractJoinQuery joinQuery = writer.writeIdJoin(ids);
- sb.append(relAliasName);
- sb.append(aOrbArtId);
- sb.append(" = ");
- sb.append(jIdAlias);
- sb.append(".id AND ");
- sb.append(jIdAlias);
- sb.append(".query_id = ?");
- writer.addParameter(joinQuery.getQueryId());
- } else {
- sb.append(relAliasName);
- sb.append(aOrbArtId);
- sb.append(" = ?");
- writer.addParameter(ids.iterator().next());
- }
+ sb.append(" AND ");
+ String aOrbArtId = typeSide.getSide().isSideA() ? ".a_art_id" : ".b_art_id";
+ if (criteria.hasMultipleIds()) {
+ AbstractJoinQuery joinQuery = writer.writeJoin(criteria.getIds());
+ sb.append(relAliasName);
+ sb.append(aOrbArtId);
+ sb.append(" = ");
+ sb.append(jIdAlias);
+ sb.append(".id AND ");
+ sb.append(jIdAlias);
+ sb.append(".query_id = ?");
+ writer.addParameter(joinQuery.getQueryId());
+ } else {
+ sb.append(relAliasName);
+ sb.append(aOrbArtId);
+ sb.append(" = ?");
+ writer.addParameter(criteria.getId());
}
List<String> aliases = writer.getAliases(TableEnum.ARTIFACT_TABLE);
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 318f0eb0b2b..f7a5b283f3f 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
@@ -328,27 +328,21 @@ public abstract class AbstractSqlWriter implements HasOptions {
public CharJoinQuery writeCharJoin(Collection<String> ids) {
CharJoinQuery joinQuery = joinFactory.createCharJoinQuery();
- for (String id : ids) {
- joinQuery.add(id);
- }
+ ids.forEach(id -> joinQuery.add(id));
addJoin(joinQuery);
return joinQuery;
}
- public IdJoinQuery writeIdJoin(Collection<? extends Number> ids) {
+ public IdJoinQuery writeJoin(Collection<? extends Id> ids) {
IdJoinQuery joinQuery = joinFactory.createIdJoinQuery();
- for (Number id : ids) {
- joinQuery.add(id.longValue());
- }
+ ids.forEach(id -> joinQuery.add(id.getId()));
addJoin(joinQuery);
return joinQuery;
}
- public IdJoinQuery writeJoin(Collection<? extends Id> ids) {
+ public IdJoinQuery writeIdJoin(Collection<? extends Number> ids) {
IdJoinQuery joinQuery = joinFactory.createIdJoinQuery();
- for (Id id : ids) {
- joinQuery.add(id.getId());
- }
+ ids.forEach(id -> joinQuery.add(id));
addJoin(joinQuery);
return joinQuery;
}
@@ -384,5 +378,4 @@ public abstract class AbstractSqlWriter implements HasOptions {
String pattern = jdbcClient.getDbType().getRegularExpMatchSql();
write(pattern, field, expression);
}
-
-}
+} \ No newline at end of file
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 c9573c4fcf8..8f1893ba745 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
@@ -12,6 +12,7 @@ package org.eclipse.osee.orcs.rest.client;
import java.util.Collection;
import java.util.List;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
@@ -52,7 +53,7 @@ public interface QueryBuilder {
/**
* Search criteria that finds a given artifact id
*/
- QueryBuilder andLocalId(int... artifactId) throws OseeCoreException;
+ QueryBuilder andLocalId(ArtifactId artifactId);
/**
* Search criteria that finds a given artifact ids
@@ -177,28 +178,14 @@ public interface QueryBuilder {
*
* @param relationTypeSide the type-side to search on
*/
- QueryBuilder andRelatedTo(IRelationTypeSide relationTypeSide, IArtifactToken... artifacts) throws OseeCoreException;
+ QueryBuilder andRelatedTo(IRelationTypeSide relationTypeSide, ArtifactId... artifacts) throws OseeCoreException;
/**
* Search for related artifacts
*
* @param relationTypeSide the type-side to search on
*/
- QueryBuilder andRelatedTo(IRelationTypeSide relationTypeSide, Collection<? extends IArtifactToken> artifacts) throws OseeCoreException;
-
- /**
- * Search for related artifacts
- *
- * @param relationTypeSide the type-side to search on
- */
- QueryBuilder andRelatedToLocalIds(IRelationTypeSide relationTypeSide, int... artifactIds) throws OseeCoreException;
-
- /**
- * Search for related artifacts
- *
- * @param relationTypeSide the type-side to search on
- */
- QueryBuilder andRelatedToLocalIds(IRelationTypeSide relationTypeSide, Collection<Integer> artifactIds) throws OseeCoreException;
+ QueryBuilder andRelatedTo(IRelationTypeSide relationTypeSide, Collection<ArtifactId> artifactIds) throws OseeCoreException;
/**
* Executes query
@@ -217,7 +204,7 @@ public interface QueryBuilder {
*
* @return artifact search ids
*/
- List<Integer> getIds();
+ List<ArtifactId> getIds();
QueryBuilder getQueryBuilder();
}
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 35731a14c07..f9f2bf14d06 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
@@ -11,6 +11,7 @@
package org.eclipse.osee.orcs.rest.client.internal.search;
import java.util.Collection;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
@@ -50,6 +51,6 @@ public interface PredicateFactory {
Predicate createRelationTypeSideExistsSearch(IRelationTypeSide relationTypeSide);
- Predicate createRelatedToSearch(IRelationTypeSide relationTypeSide, Collection<?> ids);
+ Predicate createRelatedToSearch(IRelationTypeSide relationTypeSide, Collection<ArtifactId> ids);
} \ 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/PredicateFactoryImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/PredicateFactoryImpl.java
index b1eff99a263..3a5a92fca52 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
@@ -15,7 +15,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.osee.framework.core.data.IArtifactToken;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
@@ -128,18 +128,13 @@ public class PredicateFactoryImpl implements PredicateFactory {
}
@Override
- public Predicate createRelatedToSearch(IRelationTypeSide relationTypeSide, Collection<?> ids) {
+ public Predicate createRelatedToSearch(IRelationTypeSide relationTypeSide, Collection<ArtifactId> ids) {
List<String> values = new LinkedList<>();
String side = relationTypeSide.getSide().isSideA() ? "A" : "B";
- for (Object id : ids) {
- if (id instanceof IArtifactToken) {
- values.add(((IArtifactToken) id).getGuid());
- } else if (id instanceof Integer) {
- values.add(id.toString());
- }
+ for (ArtifactId id : ids) {
+ values.add(id.getId().toString());
}
- return new Predicate(SearchMethod.RELATED_TO, Arrays.asList(side + relationTypeSide.getGuid().toString()),
- values);
+ return new Predicate(SearchMethod.RELATED_TO, Arrays.asList(side + relationTypeSide.getId().toString()), values);
}
private List<String> getLongIds(Collection<? extends Id> types) {
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 028616c52ad..c2d90471c3d 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
@@ -13,8 +13,8 @@ package org.eclipse.osee.orcs.rest.client.internal.search;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
@@ -93,12 +93,8 @@ public class QueryBuilderImpl implements QueryBuilder {
}
@Override
- public QueryBuilder andLocalId(int... artifactId) {
- Collection<Integer> ids = new LinkedList<>();
- for (int id : artifactId) {
- ids.add(id);
- }
- return andLocalIds(ids);
+ public QueryBuilder andLocalId(ArtifactId artifactId) {
+ return andLocalIds(Collections.singletonList(artifactId.getId().intValue()));
}
@Override
@@ -221,26 +217,12 @@ public class QueryBuilderImpl implements QueryBuilder {
}
@Override
- public QueryBuilder andRelatedTo(IRelationTypeSide relationTypeSide, IArtifactToken... artifacts) {
+ public QueryBuilder andRelatedTo(IRelationTypeSide relationTypeSide, ArtifactId... artifacts) {
return andRelatedTo(relationTypeSide, Arrays.asList(artifacts));
}
@Override
- public QueryBuilder andRelatedTo(IRelationTypeSide relationTypeSide, Collection<? extends IArtifactToken> artifacts) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public QueryBuilder andRelatedToLocalIds(IRelationTypeSide relationTypeSide, int... artifactIds) {
- Collection<Integer> ids = new LinkedList<>();
- for (int id : artifactIds) {
- ids.add(id);
- }
- return andRelatedToLocalIds(relationTypeSide, ids);
- }
-
- @Override
- public QueryBuilder andRelatedToLocalIds(IRelationTypeSide relationTypeSide, Collection<Integer> artifactIds) {
+ public QueryBuilder andRelatedTo(IRelationTypeSide relationTypeSide, Collection<ArtifactId> artifactIds) {
predicates.add(predicateFactory.createRelatedToSearch(relationTypeSide, artifactIds));
return this;
}
@@ -258,7 +240,7 @@ public class QueryBuilderImpl implements QueryBuilder {
}
@Override
- public List<Integer> getIds() {
+ public List<ArtifactId> getIds() {
return getSearchResult(RequestType.IDS).getIds();
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchMatch.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchMatch.java
index 49d8344bfdb..f4ab1d4a3c7 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchMatch.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchMatch.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.orcs.rest.model.search.artifact;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
/**
@@ -21,7 +22,7 @@ import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
@XmlRootElement(name = "SearchMatch")
public class SearchMatch {
- private int artId;
+ private ArtifactId artId;
private int attrId;
@XmlTransient
@@ -31,17 +32,17 @@ public class SearchMatch {
// default constructor
}
- public SearchMatch(int artId, int attrId, List<MatchLocation> locations) {
+ public SearchMatch(ArtifactId artId, int attrId, List<MatchLocation> locations) {
this.artId = artId;
this.attrId = attrId;
this.locations = locations;
}
- public int getArtId() {
+ public ArtifactId getArtId() {
return artId;
}
- public void setArtId(int artId) {
+ public void setArtId(ArtifactId artId) {
this.artId = artId;
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResponse.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResponse.java
index a4e668c5b20..e82945e1133 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResponse.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResponse.java
@@ -16,6 +16,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
+import org.eclipse.osee.framework.core.data.ArtifactId;
/**
* @author John R. Misinco
@@ -30,7 +31,7 @@ public class SearchResponse implements SearchResult {
private SearchRequest searchRequest;
@XmlTransient
- private List<Integer> ids = new LinkedList<>();
+ private List<ArtifactId> ids = new LinkedList<>();
@XmlTransient
private List<SearchMatch> searchMatches = new LinkedList<>();
@@ -73,14 +74,14 @@ public class SearchResponse implements SearchResult {
@Override
@XmlElementWrapper(name = "ids")
@XmlElement(name = "id")
- public List<Integer> getIds() {
+ public List<ArtifactId> getIds() {
if (ids == null) {
ids = new LinkedList<>();
}
return ids;
}
- public void setIds(List<Integer> ids) {
+ public void setIds(List<ArtifactId> ids) {
this.ids = ids;
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResult.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResult.java
index 9980a840570..9f226387edf 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResult.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/artifact/SearchResult.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.orcs.rest.model.search.artifact;
import java.util.List;
+import org.eclipse.osee.framework.core.data.ArtifactId;
/**
* @author John R. Misinco
@@ -26,7 +27,7 @@ public interface SearchResult {
SearchParameters getSearchParameters();
- List<Integer> getIds();
+ List<ArtifactId> getIds();
List<SearchMatch> getSearchMatches();
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 6c961e493db..90fec4bb2be 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
@@ -15,6 +15,7 @@ import static org.mockito.Mockito.verify;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.enums.RelationSide;
@@ -40,7 +41,7 @@ public class RelatedToPredicateHandlerTest {
@Mock
private QueryBuilder builder;
@Captor
- private ArgumentCaptor<Collection<Integer>> idsCaptor;
+ private ArgumentCaptor<Collection<ArtifactId>> idsCaptor;
@Captor
private ArgumentCaptor<IRelationTypeSide> rtsCaptor;
@@ -55,15 +56,15 @@ public class RelatedToPredicateHandlerTest {
Predicate testPredicate = 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());
+ verify(builder, times(2)).andRelatedTo(rtsCaptor.capture(), idsCaptor.capture());
List<IRelationTypeSide> rts = rtsCaptor.getAllValues();
Assert.assertEquals(2, rts.size());
verifyRelationTypeSide(rts.get(0), "A1");
verifyRelationTypeSide(rts.get(1), "B2");
- List<Collection<Integer>> ids = idsCaptor.getAllValues();
+ List<Collection<ArtifactId>> ids = idsCaptor.getAllValues();
Assert.assertEquals(2, ids.size());
- ids.containsAll(Arrays.asList(4, 5));
+ ids.containsAll(Arrays.asList(ArtifactId.valueOf(4), ArtifactId.valueOf(5)));
}
@Test(expected = UnsupportedOperationException.class)
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 fc5cbad2b0f..403f45edc68 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
@@ -18,7 +18,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriInfo;
-import org.eclipse.osee.framework.core.data.HasLocalId;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -74,15 +74,15 @@ public class ArtifactSearch_V1 extends ArtifactSearch {
SearchResponse result = new SearchResponse();
RequestType request = params.getRequestType();
if (request != null) {
- List<Integer> localIds = new LinkedList<>();
+ List<ArtifactId> localIds = new LinkedList<>();
switch (request) {
case COUNT:
int total = builder.getCount();
result.setTotal(total);
break;
case IDS:
- for (HasLocalId<Integer> art : builder.getResultsAsLocalIds()) {
- localIds.add(art.getLocalId());
+ for (ArtifactId art : builder.getResultsAsLocalIds()) {
+ localIds.add(art);
}
result.setIds(localIds);
result.setTotal(localIds.size());
@@ -91,7 +91,7 @@ public class ArtifactSearch_V1 extends ArtifactSearch {
ResultSet<Match<ArtifactReadable, AttributeReadable<?>>> matches = builder.getMatches();
List<SearchMatch> searchMatches = new LinkedList<>();
for (Match<ArtifactReadable, AttributeReadable<?>> match : matches) {
- int artId = match.getItem().getLocalId();
+ ArtifactId artId = match.getItem();
localIds.add(artId);
for (AttributeReadable<?> attribute : match.getElements()) {
int attrId = attribute.getLocalId();
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/RelatedToPredicateHandler.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/RelatedToPredicateHandler.java
index b3aff3b2e01..00b735b08ee 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/RelatedToPredicateHandler.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/artifact/predicate/RelatedToPredicateHandler.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.orcs.rest.internal.search.artifact.predicate;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -40,19 +41,25 @@ public class RelatedToPredicateHandler implements PredicateHandler {
Conditions.checkNotNull(values, "values");
Collection<IRelationTypeSide> types = PredicateHandlerUtil.getIRelationTypeSides(typeParameters);
- Collection<Integer> localIds = new LinkedList<>();
+ Collection<ArtifactId> artIds = new LinkedList<>();
for (String value : values) {
if (GUID.isValid(value)) {
throw new UnsupportedOperationException();
} else {
- localIds.add(Integer.parseInt(value));
+ artIds.add(ArtifactId.valueOf(value));
}
}
- if (!localIds.isEmpty()) {
- for (IRelationTypeSide rts : types) {
- builder.andRelatedToLocalIds(rts, localIds);
+ if (!artIds.isEmpty()) {
+ if (artIds.size() == 1) {
+ for (IRelationTypeSide rts : types) {
+ builder.andRelatedTo(rts, artIds.iterator().next());
+ }
+ } else {
+ for (IRelationTypeSide rts : types) {
+ builder.andRelatedTo(rts, artIds);
+ }
}
}
return builder;
diff --git a/plugins/org.eclipse.osee.orcs.script.dsl/src/org/eclipse/osee/orcs/script/dsl/typesystem/NumberConverter.java b/plugins/org.eclipse.osee.orcs.script.dsl/src/org/eclipse/osee/orcs/script/dsl/typesystem/NumberConverter.java
index 076bcff198c..47d829119af 100644
--- a/plugins/org.eclipse.osee.orcs.script.dsl/src/org/eclipse/osee/orcs/script/dsl/typesystem/NumberConverter.java
+++ b/plugins/org.eclipse.osee.orcs.script.dsl/src/org/eclipse/osee/orcs/script/dsl/typesystem/NumberConverter.java
@@ -46,7 +46,7 @@ public class NumberConverter {
return "";
}
default:
- throw new IllegalArgumentException("Invalid number literal base " + getBase(literal));
+ throw new IllegalArgumentException("Invalid number literal base " + literal);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java
index 40421b6cce4..aaf7e4a90ee 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java
@@ -26,7 +26,6 @@ import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.SystemUser;
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.OrcsApi;
import org.eclipse.osee.orcs.OrcsBranch;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -59,6 +58,7 @@ public class OrcsPortingTest {
private TransactionFactory txFactory;
private final String branchString = "CopiedTxBranch";
private final ArtifactId author = SystemUser.OseeSystem;
+ private ArtifactId nextReq;
@Before
public void setUp() throws Exception {
@@ -69,13 +69,11 @@ public class OrcsPortingTest {
@Test
public void testCreateBranch() throws Exception {
- String artifactGuid = GUID.create();
-
ArtifactId assocaitedArt = setupAssociatedArtifact();
- TransactionToken mainBranchTx = createBaselineBranchAndArtifacts(artifactGuid);
+ TransactionToken mainBranchTx = createBaselineBranchAndArtifacts();
IOseeBranch branch = TokenFactory.createBranch(mainBranchTx.getBranchId(), "testCreateBranch");
- TransactionId transactionToCopy = createWorkingBranchChanges(branch, artifactGuid);
+ TransactionId transactionToCopy = createWorkingBranchChanges(branch, nextReq);
BranchId copyTxBranch = createCopyFromTransactionBranch(transactionToCopy, assocaitedArt);
TransactionToken finalTx = commitToDestinationBranch(copyTxBranch);
@@ -90,7 +88,7 @@ public class OrcsPortingTest {
if (art.isOfType(CoreArtifactTypes.SoftwareRequirement)) {
assertEquals(2, art.getAttributes().size());
- assertEquals(artifactGuid, art.getGuid());
+ assertEquals(nextReq, art);
assertEquals("SecondRequirement", art.getName());
String actual = art.getSoleAttributeAsString(CoreAttributeTypes.Subsystem);
@@ -108,13 +106,10 @@ public class OrcsPortingTest {
@Test
public void testForMultiplePortBranches() throws Exception {
- String artifactGuid = GUID.create();
- String differentGuid = GUID.create();
-
ArtifactId assocaitedArt = setupAssociatedArtifact();
- TransactionId mainBranchTx = createBaselineBranchAndArtifacts(artifactGuid);
- TransactionId differentBranchTx = createBaselineBranchAndArtifacts(differentGuid);
+ TransactionId mainBranchTx = createBaselineBranchAndArtifacts();
+ TransactionId differentBranchTx = createBaselineBranchAndArtifacts();
BranchId copyTxBranch = createCopyFromTransactionBranch(mainBranchTx, assocaitedArt);
assertNotNull(copyTxBranch);
@@ -126,7 +121,7 @@ public class OrcsPortingTest {
fail(); // should never get here due to thrown exception
}
- private TransactionToken createBaselineBranchAndArtifacts(String artifactGuid) throws Exception {
+ private TransactionToken createBaselineBranchAndArtifacts() throws Exception {
// set up the main branch
IOseeBranch branch = TokenFactory.createBranch("MainFromBranch");
branchApi.createTopLevelBranch(branch, author).call();
@@ -138,7 +133,7 @@ public class OrcsPortingTest {
tx.setSoleAttributeFromString(baseReq, CoreAttributeTypes.Subsystem, "Test");
TransactionBuilder tx2 = txFactory.createTransaction(branch, author, "add another requirement");
- ArtifactId nextReq = tx2.createArtifact(CoreArtifactTypes.SoftwareRequirement, "SecondRequirement", artifactGuid);
+ nextReq = tx2.createArtifact(CoreArtifactTypes.SoftwareRequirement, "SecondRequirement");
tx2.setSoleAttributeFromString(nextReq, CoreAttributeTypes.Subsystem, "Test2");
return tx2.commit();
@@ -153,7 +148,7 @@ public class OrcsPortingTest {
return assocaitedArt;
}
- private TransactionId createWorkingBranchChanges(IOseeBranch parentBranch, String artifactToModifyGuid) throws Exception {
+ private TransactionId createWorkingBranchChanges(IOseeBranch parentBranch, ArtifactId artifactToModify) throws Exception {
// set up the child branch to copy to
IOseeBranch childBranch = TokenFactory.createBranch("childBranch");
@@ -161,7 +156,7 @@ public class OrcsPortingTest {
TransactionBuilder tx3 = txFactory.createTransaction(childBranch, author, "update second requirement");
ArtifactReadable readableReq2 =
- query.fromBranch(childBranch).andGuid(artifactToModifyGuid).getResults().getExactlyOne();
+ query.fromBranch(childBranch).andId(artifactToModify).getResults().getExactlyOne();
// modifying this artifact should cause it to get introduced
tx3.setSoleAttributeFromString(readableReq2, CoreAttributeTypes.Subsystem, "test changed");
@@ -175,7 +170,7 @@ public class OrcsPortingTest {
// make an additional transaction to make sure it doesn't get copied also
TransactionBuilder tx4 = txFactory.createTransaction(childBranch, author, "after second requirement");
ArtifactReadable readableReq2verA =
- query.fromBranch(childBranch).andGuid(artifactToModifyGuid).getResults().getExactlyOne();
+ query.fromBranch(childBranch).andId(artifactToModify).getResults().getExactlyOne();
// modifying this artifact should cause it to get introduced
tx4.setSoleAttributeFromString(readableReq2verA, CoreAttributeTypes.Subsystem, "test changed again");
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 81c6d8283d5..077f6ada6f8 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
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.osee.framework.core.data.ArtifactId;
-import org.eclipse.osee.framework.core.data.HasLocalId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
@@ -119,7 +118,7 @@ public class OrcsQueryTest {
@Test
public void testQueryByIds() throws OseeCoreException {
- QueryBuilder builder = factory.fromBranch(COMMON_ID).andGuid(CoreArtifactTokens.UserGroups.getGuid());
+ QueryBuilder builder = factory.fromBranch(COMMON_ID).andId(CoreArtifactTokens.UserGroups);
assertEquals(1, builder.getCount());
ArtifactReadable artifact = builder.getResults().getExactlyOne();
@@ -330,7 +329,7 @@ public class OrcsQueryTest {
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();
+ ResultSet<? extends ArtifactId> results = builder.getResultsAsLocalIds();
assertEquals(7, results.size());
assertEquals(7, builder.getCount());
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java
index de2a0dd63b8..8df8f8d4e19 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java
@@ -560,10 +560,10 @@ public class OrcsTransactionTest {
public void testArtifactGetTransaction() throws OseeCoreException {
TransactionBuilder tx = createTx();
- String guid = tx.createArtifact(CoreArtifactTypes.Component, "A component").getGuid();
+ ArtifactId artId = tx.createArtifact(CoreArtifactTypes.Component, "A component");
TransactionId startingTx = tx.commit();
- ArtifactReadable artifact = query.fromBranch(COMMON).andGuid(guid).getResults().getExactlyOne();
+ ArtifactReadable artifact = query.fromBranch(COMMON).andId(artId).getResults().getExactlyOne();
assertEquals(startingTx, artifact.getTransaction());
TransactionBuilder tx2 = createTx();
@@ -572,7 +572,7 @@ public class OrcsTransactionTest {
assertFalse(startingTx.equals(lastTx));
- ArtifactReadable currentArtifact = query.fromBranch(COMMON).andGuid(guid).getResults().getExactlyOne();
+ ArtifactReadable currentArtifact = query.fromBranch(COMMON).andId(artId).getResults().getExactlyOne();
assertEquals(lastTx, currentArtifact.getTransaction());
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ArtifactQueryBuilder.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ArtifactQueryBuilder.java
index 891f1340eaf..dba7f0e10f7 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ArtifactQueryBuilder.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ArtifactQueryBuilder.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.orcs.search;
import java.util.Collection;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
@@ -18,8 +19,6 @@ import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.data.TransactionId;
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;
import org.eclipse.osee.orcs.data.ArtifactReadable;
/**
@@ -59,158 +58,149 @@ public interface ArtifactQueryBuilder<T> {
T excludeDeleted();
+ T andId(ArtifactId id);
+
+ T andIds(ArtifactId id);
+
+ T andIds(Collection<? extends ArtifactId> ids);
+
+ T andIds(ArtifactId... ids);
+
/**
- * Search criteria that finds the artifact with given uuid (artifact id)
+ * Search criteria that finds the artifact with given artifact id
*/
- T andUuid(long... uuid) throws OseeCoreException;
+ T andUuid(long id);
/**
* Search criteria that finds the artifacts of given uuids (artifact ids)
*/
- T andUuids(Collection<Long> uuids) throws OseeCoreException;
+ T andUuids(Collection<Long> uuids);
/**
* Search criteria that finds a given artifact with guid
*/
- T andGuid(String guid) throws OseeCoreException;
+ T andGuid(String guid);
/**
* Search criteria that finds a given artifact with guids
*/
- T andGuids(Collection<String> ids) throws OseeCoreException;
-
- /**
- * Artifacts id(s)
- */
- T andIds(Identifiable<String>... ids) throws OseeCoreException;
-
- /**
- * Artifacts matching token id(s)
- */
- T andIds(Collection<? extends Identifiable<String>> ids) throws OseeCoreException;
+ T andGuids(Collection<String> ids);
/**
* Search criteria that finds a given artifact type using type inheritance
*/
- T andIsOfType(IArtifactType... artifactType) throws OseeCoreException;
+ T andIsOfType(IArtifactType... artifactType);
/**
* Search criteria that finds a given artifact types using type inheritance
*/
- T andIsOfType(Collection<? extends IArtifactType> artifactType) throws OseeCoreException;
+ T andIsOfType(Collection<? extends IArtifactType> artifactType);
/**
* Search criteria that finds a given artifact types by matching type exactly
*/
- T andTypeEquals(IArtifactType... artifactType) throws OseeCoreException;
+ T andTypeEquals(IArtifactType... artifactType);
/**
* Search criteria that finds a given artifact types by matching type exactly
*/
- T andTypeEquals(Collection<? extends IArtifactType> artifactType) throws OseeCoreException;
+ T andTypeEquals(Collection<? extends IArtifactType> artifactType);
/**
* Search criteria that checks for the existence of an attribute type(s).
*/
- T andExists(IAttributeType... attributeType) throws OseeCoreException;
+ T andExists(IAttributeType... attributeType);
/**
* Search criteria that checks for the existence of an attribute types.
*/
- T andExists(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException;
+ T andExists(Collection<? extends IAttributeType> attributeTypes);
/**
* Search criteria that checks for the non-existence of an attribute type(s).
*/
- T andNotExists(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException;
+ T andNotExists(Collection<? extends IAttributeType> attributeTypes);
/**
* Search criteria that checks for the non-existence of an attribute type(s).
*/
- T andNotExists(IAttributeType attributeType) throws OseeCoreException;
+ T andNotExists(IAttributeType attributeType);
/**
* Search criteria that follows the relation link ending on the given side
*
* @param relationType the type to start following the link from
*/
- T andExists(IRelationType relationType) throws OseeCoreException;
+ T andExists(IRelationType relationType);
/**
* Search criteria that checks for non-existence of a relation type
*
* @param relationTypeSide the type to check for non-existence
*/
- T andNotExists(IRelationTypeSide relationTypeSide) throws OseeCoreException;
+ T andNotExists(IRelationTypeSide relationTypeSide);
/**
* Search criteria that follows the relation link ending on the given side
*
* @param relationTypeSide the type to start following the link from
*/
- T andExists(IRelationTypeSide relationTypeSide) throws OseeCoreException;
+ T andExists(IRelationTypeSide relationTypeSide);
/**
* Search criteria that checks for non-existence of a relation type
*
* @param relationType the type to check for non-existence
*/
- T andNotExists(IRelationType relationType) throws OseeCoreException;
+ T andNotExists(IRelationType relationType);
/**
* Artifact name equals value
*/
- T andNameEquals(String artifactName) throws OseeCoreException;
+ T andNameEquals(String artifactName);
/**
* 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.
*/
- T and(IAttributeType attributeType, Collection<String> values, QueryOption... options) throws OseeCoreException;
+ T and(IAttributeType attributeType, Collection<String> values, QueryOption... options);
/**
* Search criteria that finds an attribute of the given type with its current value relative to the given value based
* on the operator provided.
*/
- T and(IAttributeType attributeType, String value, QueryOption... options) throws OseeCoreException;
+ T and(IAttributeType attributeType, String value, QueryOption... options);
/**
* 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.
*/
- T and(Collection<IAttributeType> attributeTypes, String value, QueryOption... options) throws OseeCoreException;
+ T and(Collection<IAttributeType> attributeTypes, String value, QueryOption... options);
- T and(Collection<IAttributeType> attributeTypes, Collection<String> value, QueryOption... options) throws OseeCoreException;
-
- /**
- * Search for related artifacts
- *
- * @param relationTypeSide the type-side to search on
- */
- T andRelatedTo(IRelationTypeSide relationTypeSide, ArtifactReadable... artifacts) throws OseeCoreException;
+ T and(Collection<IAttributeType> attributeTypes, Collection<String> value, QueryOption... options);
/**
* Search for related artifacts
*
* @param relationTypeSide the type-side to search on
*/
- T andRelatedTo(IRelationTypeSide relationTypeSide, Collection<? extends ArtifactReadable> artifacts) throws OseeCoreException;
+ T andRelatedTo(IRelationTypeSide relationTypeSide, ArtifactReadable... artifacts);
/**
* Search for related artifacts
*
* @param relationTypeSide the type-side to search on
*/
- T andRelatedToLocalIds(IRelationTypeSide relationTypeSide, int... artifactIds) throws OseeCoreException;
+ T andRelatedTo(IRelationTypeSide relationTypeSide, Collection<? extends ArtifactId> artifacts);
/**
* Search for related artifacts
*
* @param relationTypeSide the type-side to search on
*/
- T andRelatedToLocalIds(IRelationTypeSide relationTypeSide, Collection<Integer> artifactIds) throws OseeCoreException;
+ T andRelatedTo(IRelationTypeSide relationTypeSide, ArtifactId artifactId);
/**
* Search related artifacts with specific criteria. Will only follow first level of relations
@@ -223,4 +213,4 @@ public interface ArtifactQueryBuilder<T> {
* @return DefaultHeirarchicalRootArtifact
*/
T andIsHeirarchicalRootArtifact();
-}
+} \ No newline at end of file
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 8c0a79d8304..01da4035e60 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java
@@ -11,7 +11,7 @@
package org.eclipse.osee.orcs.search;
import org.eclipse.osee.executor.admin.CancellableCallable;
-import org.eclipse.osee.framework.core.data.HasLocalId;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -25,24 +25,24 @@ public interface QueryBuilder extends ArtifactQueryBuilder<QueryBuilder>, Query
/**
* Executes query
- *
+ *
* @return artifact search results
*/
ResultSet<ArtifactReadable> getResults() throws OseeCoreException;
/**
* Executes query
- *
+ *
* @return artifact search results with match locations
*/
ResultSet<Match<ArtifactReadable, AttributeReadable<?>>> getMatches() throws OseeCoreException;
/**
* Executes query
- *
+ *
* @return localIds search results
*/
- ResultSet<HasLocalId<Integer>> getResultsAsLocalIds() throws OseeCoreException;
+ ResultSet<? extends ArtifactId> getResultsAsLocalIds() throws OseeCoreException;
/**
* Count search results
@@ -58,23 +58,23 @@ public interface QueryBuilder extends ArtifactQueryBuilder<QueryBuilder>, Query
/**
* Schedule query
- *
+ *
* @return artifact search results
*/
CancellableCallable<ResultSet<ArtifactReadable>> createSearch() throws OseeCoreException;
/**
* Schedule query and find matching locations
- *
+ *
* @return artifact search results with match locations
*/
CancellableCallable<ResultSet<Match<ArtifactReadable, AttributeReadable<?>>>> createSearchWithMatches() throws OseeCoreException;
/**
* Schedule query and find matching locations
- *
+ *
* @return localIds search results
*/
- CancellableCallable<ResultSet<HasLocalId<Integer>>> createSearchResultsAsLocalIds() throws OseeCoreException;
+ CancellableCallable<ResultSet<? extends ArtifactId>> createSearchResultsAsLocalIds() throws OseeCoreException;
}
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 1cb0b420970..4ffbcf96182 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
@@ -95,17 +95,9 @@ public class OseeClientQueryTest {
@Test
public void searchForArtifactByLocalId() throws OseeCoreException {
final int EXPECTED_RESULTS = 1;
- SearchResult results = createClient.createQueryBuilder(COMMON).andLocalId(
- CoreArtifactTokens.UserGroups.getId().intValue()).getSearchResult(RequestType.IDS);
- assertEquals(EXPECTED_RESULTS, results.getTotal());
- }
-
- @Test
- public void searchForArtifactByLocalIds() throws OseeCoreException {
- final int EXPECTED_RESULTS = 2;
SearchResult results =
- createClient.createQueryBuilder(COMMON).andLocalId(CoreArtifactTokens.UserGroups.getId().intValue(),
- CoreArtifactTokens.Everyone.getId().intValue()).getSearchResult(RequestType.IDS);
+ createClient.createQueryBuilder(COMMON).andLocalId(CoreArtifactTokens.UserGroups).getSearchResult(
+ RequestType.IDS);
assertEquals(EXPECTED_RESULTS, results.getTotal());
}

Back to the top