diff options
author | mpotterc0k | 2013-10-18 19:46:09 +0000 |
---|---|---|
committer | mpotterc0k | 2013-10-30 22:12:43 +0000 |
commit | a55a843eeeb81547698dbb2244bdf4b3d3e8798d (patch) | |
tree | 78452eb145f9004370153540d0c5af442a1f5178 | |
parent | 7de00e4c399f029c76fd6d996e0d148429f6fe66 (diff) | |
download | org.eclipse.osee-a55a843eeeb81547698dbb2244bdf4b3d3e8798d.tar.gz org.eclipse.osee-a55a843eeeb81547698dbb2244bdf4b3d3e8798d.tar.xz org.eclipse.osee-a55a843eeeb81547698dbb2244bdf4b3d3e8798d.zip |
refactor[ats_37M02]: Move functionality from DataloaderFactory to DataLoader0.15.0.v201310311538_RC
Change-Id: If3d3f604598f995c0284ef5d3a67ed3d4b8eee74
Signed-off-by: mpotterc0k <marc.a.potter@boeing.com>
40 files changed, 719 insertions, 381 deletions
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 dfdf9bef8a9..2536b1cdf20 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 @@ -202,7 +202,7 @@ public class ArtifactLoaderTest { List<Artifact> artifacts; try { artifacts = - ArtifactLoader.loadArtifacts(artIds, CoreBranches.COMMON, LoadLevel.FULL, LoadType.RELOAD_CACHE, + ArtifactLoader.loadArtifacts(artIds, CoreBranches.COMMON, LoadLevel.ALL, LoadType.RELOAD_CACHE, DeletionFlag.EXCLUDE_DELETED); Assert.assertTrue(artifacts.isEmpty()); } catch (OseeCoreException ex) { @@ -230,7 +230,7 @@ public class ArtifactLoaderTest { List<Artifact> artifacts; try { artifacts = - ArtifactLoader.loadArtifacts(artIds, CoreBranches.COMMON, LoadLevel.FULL, LoadType.RELOAD_CACHE, + ArtifactLoader.loadArtifacts(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.define/src/org/eclipse/osee/define/blam/operation/FixAttributeOperation.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/FixAttributeOperation.java index 82246bee830..ad515397940 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/FixAttributeOperation.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/FixAttributeOperation.java @@ -130,7 +130,7 @@ public class FixAttributeOperation extends AbstractOperation { new HashCollection<Artifact, IAttributeType>(false, HashSet.class); List<Artifact> artifacts = - ArtifactQuery.getArtifactListFromBranch(branch, LoadLevel.FULL, DeletionFlag.EXCLUDE_DELETED); + ArtifactQuery.getArtifactListFromBranch(branch, LoadLevel.ALL, DeletionFlag.EXCLUDE_DELETED); checkForCancelledStatus(monitor); monitor.subTask("Mapping Enumerated Attributes"); diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/LoadLevel.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/LoadLevel.java index ea44b2d191f..b2b47d0f150 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/LoadLevel.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/LoadLevel.java @@ -17,25 +17,20 @@ package org.eclipse.osee.framework.core.enums; * @author Ryan D. Brooks */ public enum LoadLevel { - SHALLOW, - FULL, - RELATION, - ATTRIBUTE, - ALL_CURRENT; + ARTIFACT_DATA, + ALL, + RELATION_DATA, + ARTIFACT_AND_ATTRIBUTE_DATA; public boolean isShallow() { - return this == SHALLOW; + return this == ARTIFACT_DATA; } public boolean isRelationsOnly() { - return this == RELATION; - } - - public boolean isHead() { - return this == ALL_CURRENT; + return this == RELATION_DATA; } public boolean isAttributesOnly() { - return this == ATTRIBUTE; + return this == ARTIFACT_AND_ATTRIBUTE_DATA; } } 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 bbc29f402a3..e1f7f973483 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 @@ -585,7 +585,7 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, I private void ensureAttributesLoaded() throws OseeCoreException { if (!isAttributesLoaded() && isInDb()) { - ArtifactLoader.loadArtifactData(this, LoadLevel.ATTRIBUTE); + ArtifactLoader.loadArtifactData(this, LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA); } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactPersistenceManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactPersistenceManager.java index a239736ac87..e9f3a0c84c1 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactPersistenceManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactPersistenceManager.java @@ -124,7 +124,7 @@ public class ArtifactPersistenceManager { LinkedList<Object> queryParameters = new LinkedList<Object>(); queryParameters.add(BranchManager.getBranchId(branch)); return ArtifactLoader.getArtifacts(getSql(searchCriteria, all, ARTIFACT_SELECT, queryParameters, branch), - queryParameters.toArray(), 100, LoadLevel.FULL, INCLUDE_CACHE, confirmer, null, EXCLUDE_DELETED); + queryParameters.toArray(), 100, LoadLevel.ALL, INCLUDE_CACHE, confirmer, null, EXCLUDE_DELETED); } /** diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java index a38bda662e8..5430f54bc63 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java @@ -11,8 +11,8 @@ package org.eclipse.osee.framework.skynet.core.artifact; import static org.eclipse.osee.framework.core.enums.DeletionFlag.INCLUDE_DELETED; -import static org.eclipse.osee.framework.core.enums.LoadLevel.RELATION; -import static org.eclipse.osee.framework.core.enums.LoadLevel.SHALLOW; +import static org.eclipse.osee.framework.core.enums.LoadLevel.ARTIFACT_DATA; +import static org.eclipse.osee.framework.core.enums.LoadLevel.RELATION_DATA; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; @@ -38,7 +38,7 @@ import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute; public class AttributeLoader { static void loadAttributeData(int queryId, CompositeKeyHashMap<Integer, Integer, Artifact> tempCache, boolean historical, DeletionFlag allowDeletedArtifacts, LoadLevel loadLevel) throws OseeCoreException { - if (loadLevel == SHALLOW || loadLevel == RELATION) { + if (loadLevel == ARTIFACT_DATA || loadLevel == RELATION_DATA) { return; } @@ -192,8 +192,6 @@ public class AttributeLoader { OseeSql sqlKey; if (historical) { sqlKey = OseeSql.LOAD_HISTORICAL_ATTRIBUTES; - } else if (loadLevel == LoadLevel.ALL_CURRENT) { - sqlKey = OseeSql.LOAD_ALL_CURRENT_ATTRIBUTES; } else if (allowDeletedArtifacts == INCLUDE_DELETED) { sqlKey = OseeSql.LOAD_CURRENT_ATTRIBUTES_WITH_DELETED; } else { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java index 1e225e2d97c..9e8fe90e298 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.artifact; -import static org.eclipse.osee.framework.core.enums.LoadLevel.ATTRIBUTE; -import static org.eclipse.osee.framework.core.enums.LoadLevel.SHALLOW; +import static org.eclipse.osee.framework.core.enums.LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; +import static org.eclipse.osee.framework.core.enums.LoadLevel.ARTIFACT_DATA; import java.util.Collection; import org.eclipse.osee.framework.core.client.ClientSessionManager; import org.eclipse.osee.framework.core.enums.LoadLevel; @@ -31,7 +31,7 @@ import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; class RelationLoader { public static void loadRelationData(int joinQueryId, Collection<Artifact> artifacts, boolean historical, LoadLevel loadLevel) throws OseeCoreException { - if (loadLevel == SHALLOW || loadLevel == ATTRIBUTE) { + if (loadLevel == ARTIFACT_DATA || loadLevel == ARTIFACT_AND_ATTRIBUTE_DATA) { return; } 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 91ae901fe12..6cb3074c48f 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 @@ -12,7 +12,7 @@ package org.eclipse.osee.framework.skynet.core.artifact.search; import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED; import static org.eclipse.osee.framework.core.enums.DeletionFlag.INCLUDE_DELETED; -import static org.eclipse.osee.framework.core.enums.LoadLevel.FULL; +import static org.eclipse.osee.framework.core.enums.LoadLevel.ALL; import static org.eclipse.osee.framework.skynet.core.artifact.LoadType.INCLUDE_CACHE; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; @@ -113,7 +113,7 @@ public class ArtifactQuery { } } } else { - artifact = new ArtifactQueryBuilder(artId, branch, allowDeleted, FULL).getOrCheckArtifact(queryType); + artifact = new ArtifactQueryBuilder(artId, branch, allowDeleted, ALL).getOrCheckArtifact(queryType); } return artifact; } @@ -187,7 +187,7 @@ public class ArtifactQuery { } return artifact; } - return new ArtifactQueryBuilder(guid, branch, allowDeleted, FULL).getOrCheckArtifact(queryType); + return new ArtifactQueryBuilder(guid, branch, allowDeleted, ALL).getOrCheckArtifact(queryType); } /** @@ -244,7 +244,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, IOseeBranch branch) throws OseeCoreException { - return ArtifactLoader.loadArtifacts(artifactIds, branch, LoadLevel.FULL, INCLUDE_CACHE, INCLUDE_DELETED); + return ArtifactLoader.loadArtifacts(artifactIds, branch, LoadLevel.ALL, INCLUDE_CACHE, INCLUDE_DELETED); } /** @@ -253,7 +253,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, IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return ArtifactLoader.loadArtifacts(artifactIds, branch, LoadLevel.FULL, INCLUDE_CACHE, allowDeleted); + return ArtifactLoader.loadArtifacts(artifactIds, branch, LoadLevel.ALL, INCLUDE_CACHE, allowDeleted); } /** @@ -262,39 +262,39 @@ public class ArtifactQuery { * @return a collection of the artifacts found or an empty collection if none are found */ public static List<Artifact> getArtifactListFromIds(List<String> guids, IOseeBranch branch) throws OseeCoreException { - return new ArtifactQueryBuilder(guids, branch, FULL).getArtifacts(30, null); + return new ArtifactQueryBuilder(guids, branch, ALL).getArtifacts(30, null); } public static List<Artifact> getArtifactListFromIds(List<String> guids, IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(guids, branch, allowDeleted, FULL).getArtifacts(30, null); + return new ArtifactQueryBuilder(guids, branch, allowDeleted, ALL).getArtifacts(30, null); } public static List<Artifact> getHistoricalArtifactListFromIds(List<String> guids, TransactionRecord transactionId, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(guids, transactionId, allowDeleted, FULL).getArtifacts(30, null); + return new ArtifactQueryBuilder(guids, transactionId, allowDeleted, ALL).getArtifacts(30, null); } public static List<Artifact> getHistoricalArtifactListFromIds(Collection<Integer> artifactIds, TransactionRecord transactionId, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactIds, transactionId, allowDeleted, FULL).getArtifacts(30, null); + return new ArtifactQueryBuilder(artifactIds, transactionId, allowDeleted, ALL).getArtifacts(30, null); } public static Artifact getHistoricalArtifactFromId(int artifactId, TransactionRecord transactionId, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, FULL).getOrCheckArtifact(QueryType.GET); + return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, ALL).getOrCheckArtifact(QueryType.GET); } public static Artifact getHistoricalArtifactFromId(String guid, TransactionRecord transactionId, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(Arrays.asList(guid), transactionId, allowDeleted, FULL).getOrCheckArtifact(QueryType.GET); + return new ArtifactQueryBuilder(Arrays.asList(guid), transactionId, allowDeleted, ALL).getOrCheckArtifact(QueryType.GET); } public static Artifact checkHistoricalArtifactFromId(int artifactId, TransactionRecord transactionId, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, FULL).getOrCheckArtifact(QueryType.CHECK); + return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, ALL).getOrCheckArtifact(QueryType.CHECK); } public static Artifact checkHistoricalArtifactFromId(String guid, TransactionRecord transactionId, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(Arrays.asList(guid), transactionId, allowDeleted, FULL).getOrCheckArtifact(QueryType.CHECK); + return new ArtifactQueryBuilder(Arrays.asList(guid), transactionId, allowDeleted, ALL).getOrCheckArtifact(QueryType.CHECK); } public static List<Artifact> getArtifactListFromName(String artifactName, IOseeBranch branch, DeletionFlag allowDeleted, QueryOption... options) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, allowDeleted, new AttributeCriteria(CoreAttributeTypes.Name, + return new ArtifactQueryBuilder(branch, ALL, allowDeleted, new AttributeCriteria(CoreAttributeTypes.Name, artifactName, options)).getArtifacts(30, null); } @@ -324,7 +324,7 @@ public class ArtifactQuery { * @throws MultipleArtifactsExist if more than one artifact is found */ public static Artifact getArtifactFromAttribute(IAttributeType attributeType, String attributeValue, IOseeBranch branch) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, EXCLUDE_DELETED, new AttributeCriteria(attributeType, + return new ArtifactQueryBuilder(branch, ALL, EXCLUDE_DELETED, new AttributeCriteria(attributeType, attributeValue)).getOrCheckArtifact(QueryType.GET); } @@ -338,11 +338,11 @@ public class ArtifactQuery { * @throws OseeCoreException */ public static List<Artifact> getArtifactListFromType(IArtifactType artifactTypeToken, IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactTypeToken, branch, FULL, allowDeleted).getArtifacts(1000, null); + return new ArtifactQueryBuilder(artifactTypeToken, branch, ALL, allowDeleted).getArtifacts(1000, null); } public static List<Artifact> getArtifactListFromType(List<IArtifactType> artifactTypeTokens, IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactTypeTokens, branch, FULL, allowDeleted).getArtifacts(1000, null); + return new ArtifactQueryBuilder(artifactTypeTokens, branch, ALL, allowDeleted).getArtifacts(1000, null); } public static List<Artifact> getArtifactListFromType(IArtifactType artifactTypeToken, IOseeBranch branch) throws OseeCoreException { @@ -350,15 +350,15 @@ public class ArtifactQuery { } public static List<Artifact> getArtifactListFromBranch(IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, allowDeleted).getArtifacts(10000, null); + return new ArtifactQueryBuilder(branch, ALL, allowDeleted).getArtifacts(10000, null); } public static List<Integer> selectArtifactListFromType(IArtifactType artifactTypeToken, IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactTypeToken, branch, FULL, allowDeleted).selectArtifacts(10000); + return new ArtifactQueryBuilder(artifactTypeToken, branch, ALL, allowDeleted).selectArtifacts(10000); } public static List<Integer> selectArtifactListFromBranch(IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, allowDeleted).selectArtifacts(10000); + return new ArtifactQueryBuilder(branch, ALL, allowDeleted).selectArtifacts(10000); } public static List<Artifact> getArtifactListFromBranch(IOseeBranch branch, LoadLevel loadLevel, DeletionFlag allowDeleted) throws OseeCoreException { @@ -366,14 +366,14 @@ public class ArtifactQuery { } public static List<Artifact> reloadArtifactListFromBranch(IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, allowDeleted).reloadArtifacts(10000); + return new ArtifactQueryBuilder(branch, ALL, allowDeleted).reloadArtifacts(10000); } /** * do not use this method if searching for a super type and its descendants, instead use getArtifactListFromTypeAnd */ public static List<Artifact> getArtifactListFromTypes(Collection<? extends IArtifactType> artifactTypes, IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactTypes, branch, FULL, allowDeleted).getArtifacts(1000, null); + return new ArtifactQueryBuilder(artifactTypes, branch, ALL, allowDeleted).getArtifacts(1000, null); } public static List<Artifact> getArtifactListFromTypeWithInheritence(IArtifactType artifactType, IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { @@ -391,7 +391,7 @@ public class ArtifactQuery { } public static int getArtifactCountFromTypes(Collection<? extends IArtifactType> artifactTypes, IOseeBranch branch, DeletionFlag allowDeleted) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactTypes, branch, FULL, allowDeleted).countArtifacts(); + return new ArtifactQueryBuilder(artifactTypes, branch, ALL, allowDeleted).countArtifacts(); } /** @@ -400,7 +400,7 @@ public class ArtifactQuery { * @return a collection of the artifacts found or an empty collection if none are found */ public static List<Artifact> getArtifactListFromTypeAnd(IArtifactType artifactType, IOseeBranch branch, int artifactCountEstimate, List<ArtifactSearchCriteria> criteria) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactType, branch, FULL, criteria).getArtifacts(artifactCountEstimate, null); + return new ArtifactQueryBuilder(artifactType, branch, ALL, criteria).getArtifacts(artifactCountEstimate, null); } /** @@ -409,7 +409,7 @@ public class ArtifactQuery { * @return a collection of the artifacts found or an empty collection if none are found */ public static List<Artifact> getArtifactListFromCriteria(IOseeBranch branch, int artifactCountEstimate, List<ArtifactSearchCriteria> criteria) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, criteria).getArtifacts(artifactCountEstimate, null); + return new ArtifactQueryBuilder(branch, ALL, criteria).getArtifacts(artifactCountEstimate, null); } /** @@ -418,7 +418,7 @@ public class ArtifactQuery { * @return a collection of the artifacts found or an empty collection if none are found */ public static List<Artifact> getArtifactListFromCriteria(IOseeBranch branch, int artifactCountEstimate, ArtifactSearchCriteria... criteria) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, EXCLUDE_DELETED, criteria).getArtifacts(artifactCountEstimate, null); + return new ArtifactQueryBuilder(branch, ALL, EXCLUDE_DELETED, criteria).getArtifacts(artifactCountEstimate, null); } /** @@ -427,7 +427,7 @@ public class ArtifactQuery { * @return a collection of the artifacts found or an empty collection if none are found */ public static List<Artifact> getRelatedArtifactList(Artifact artifact, IRelationType relationType, RelationSide relationSide) throws OseeCoreException { - return new ArtifactQueryBuilder(artifact.getBranch(), FULL, EXCLUDE_DELETED, new RelationCriteria( + return new ArtifactQueryBuilder(artifact.getBranch(), ALL, EXCLUDE_DELETED, new RelationCriteria( artifact.getArtId(), relationType, relationSide)).getArtifacts(1000, null); } @@ -437,7 +437,7 @@ public class ArtifactQuery { * @return a collection of the artifacts found or an empty collection if none are found */ public static List<Artifact> getArtifactListFromRelation(IRelationType relationType, RelationSide relationSide, IOseeBranch branch) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, EXCLUDE_DELETED, new RelationCriteria(relationType, relationSide)).getArtifacts( + return new ArtifactQueryBuilder(branch, ALL, EXCLUDE_DELETED, new RelationCriteria(relationType, relationSide)).getArtifacts( 1000, null); } @@ -447,12 +447,12 @@ public class ArtifactQuery { * @return a collection of the artifacts found or an empty collection if none are found */ public static List<Artifact> getArtifactListFromTypeAndAttribute(IArtifactType artifactType, IAttributeType attributeType, String attributeValue, IOseeBranch branch, QueryOption... options) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactType, branch, FULL, new AttributeCriteria(attributeType, attributeValue, + return new ArtifactQueryBuilder(artifactType, branch, ALL, new AttributeCriteria(attributeType, attributeValue, options)).getArtifacts(100, null); } public static List<Artifact> getArtifactListFromAttribute(IAttributeType attributeType, String attributeValue, IOseeBranch branch, QueryOption... options) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, EXCLUDE_DELETED, new AttributeCriteria(attributeType, + return new ArtifactQueryBuilder(branch, ALL, EXCLUDE_DELETED, new AttributeCriteria(attributeType, attributeValue, options)).getArtifacts(300, null); } @@ -460,22 +460,22 @@ public class ArtifactQuery { * Return all artifacts that have one or more attributes of given type regardless of the value */ public static List<Artifact> getArtifactListFromAttributeType(IAttributeType attributeType, IOseeBranch branch) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, EXCLUDE_DELETED, new AttributeCriteria(attributeType)).getArtifacts( + return new ArtifactQueryBuilder(branch, ALL, EXCLUDE_DELETED, new AttributeCriteria(attributeType)).getArtifacts( 300, null); } private static ArtifactQueryBuilder queryFromTypeAndAttribute(IArtifactType artifactType, IAttributeType attributeType, String attributeValue, IOseeBranch branch, QueryOption... options) { - return new ArtifactQueryBuilder(artifactType, branch, FULL, new AttributeCriteria(attributeType, attributeValue, + return new ArtifactQueryBuilder(artifactType, branch, ALL, new AttributeCriteria(attributeType, attributeValue, options)); } public static List<Artifact> getArtifactListFromTypeAndAttribute(IArtifactType artifactType, IAttributeType attributeType, Collection<String> attributeValues, IOseeBranch branch, int artifactCountEstimate) throws OseeCoreException { - return new ArtifactQueryBuilder(artifactType, branch, FULL, new AttributeCriteria(attributeType, attributeValues)).getArtifacts( + return new ArtifactQueryBuilder(artifactType, branch, ALL, new AttributeCriteria(attributeType, attributeValues)).getArtifacts( artifactCountEstimate, null); } public static List<Artifact> getArtifactListFromAttributeValues(IAttributeType attributeType, Collection<String> attributeValues, IOseeBranch branch, int artifactCountEstimate) throws OseeCoreException { - return new ArtifactQueryBuilder(branch, FULL, EXCLUDE_DELETED, new AttributeCriteria(attributeType, + return new ArtifactQueryBuilder(branch, ALL, EXCLUDE_DELETED, new AttributeCriteria(attributeType, attributeValues)).getArtifacts(artifactCountEstimate, null); } @@ -513,7 +513,7 @@ public class ArtifactQuery { SearchRequest searchRequest = new SearchRequest(branch, queryString, options); determineSearchAll(searchRequest); - return new HttpArtifactQuery(searchRequest).getArtifacts(FULL, INCLUDE_CACHE); + return new HttpArtifactQuery(searchRequest).getArtifacts(ALL, INCLUDE_CACHE); } /** @@ -526,7 +526,7 @@ public class ArtifactQuery { */ public static List<ArtifactMatch> getArtifactMatchesFromAttributeKeywords(SearchRequest searchRequest) throws OseeCoreException { determineSearchAll(searchRequest); - return new HttpArtifactQuery(searchRequest).getArtifactsWithMatches(FULL, INCLUDE_CACHE); + return new HttpArtifactQuery(searchRequest).getArtifactsWithMatches(ALL, INCLUDE_CACHE); } /** @@ -541,7 +541,7 @@ public class ArtifactQuery { } public static Artifact reloadArtifactFromId(int artId, IOseeBranch branch) throws OseeCoreException { - ArtifactQueryBuilder query = new ArtifactQueryBuilder(artId, branch, INCLUDE_DELETED, FULL); + ArtifactQueryBuilder query = new ArtifactQueryBuilder(artId, branch, INCLUDE_DELETED, ALL); Artifact artifact = query.reloadArtifact(); OseeEventManager.kickLocalArtifactReloadEvent(query, Collections.singleton(artifact)); return artifact; @@ -564,7 +564,7 @@ public class ArtifactQuery { artIds.add(artifact.getArtId()); } - ArtifactQueryBuilder query = new ArtifactQueryBuilder(artIds, entrySet.getKey(), INCLUDE_DELETED, FULL); + ArtifactQueryBuilder query = new ArtifactQueryBuilder(artIds, entrySet.getKey(), INCLUDE_DELETED, ALL); reloadedArts.addAll(query.reloadArtifacts(artIds.size())); OseeEventManager.kickLocalArtifactReloadEvent(query, reloadedArts); @@ -654,7 +654,7 @@ public class ArtifactQuery { searchParameters.isIncludeDeleted() ? DeletionFlag.INCLUDE_DELETED : DeletionFlag.EXCLUDE_DELETED; List<Artifact> loadedArtifacts = - ArtifactLoader.loadArtifacts(result.getIds(), branch, LoadLevel.FULL, INCLUDE_CACHE, deletionFlag, tx); + ArtifactLoader.loadArtifacts(result.getIds(), branch, LoadLevel.ALL, INCLUDE_CACHE, deletionFlag, tx); return new ResultSetList<Artifact>(loadedArtifacts); } } 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 161526c8924..99ec91f087b 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 @@ -417,7 +417,7 @@ public class ArtifactQueryBuilder { tx = TransactionManager.getTransactionId(txId); } List<Artifact> results = - ArtifactLoader.loadArtifacts(localIds, branch, LoadLevel.SHALLOW, LoadType.INCLUDE_CACHE, allowDeleted, tx); + ArtifactLoader.loadArtifacts(localIds, branch, LoadLevel.ARTIFACT_DATA, LoadType.INCLUDE_CACHE, allowDeleted, tx); return results.size(); } diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/ds/OptionsUtilTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/ds/OptionsUtilTest.java index ac9a2096824..da925acfca3 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/ds/OptionsUtilTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/ds/OptionsUtilTest.java @@ -35,21 +35,22 @@ public class OptionsUtilTest { Options defaults = OptionsUtil.createOptions(); assertEquals(-1, OptionsUtil.getFromTransaction(defaults)); - assertEquals(DeletionFlag.EXCLUDE_DELETED, OptionsUtil.getIncludeDeleted(defaults)); - assertEquals(LoadLevel.SHALLOW, OptionsUtil.getLoadLevel(defaults)); - assertEquals(false, OptionsUtil.areDeletedIncluded(defaults)); + assertEquals(DeletionFlag.EXCLUDE_DELETED, OptionsUtil.getIncludeDeletedArtifacts(defaults)); + assertEquals(LoadLevel.ALL, OptionsUtil.getLoadLevel(defaults)); + assertEquals(false, OptionsUtil.areDeletedArtifactsIncluded(defaults)); + assertEquals(false, OptionsUtil.isCacheIncluded(defaults)); assertEquals(true, OptionsUtil.isHeadTransaction(defaults)); assertEquals(false, OptionsUtil.isHistorical(defaults)); } @Test public void testSetGetLoadLevel() { - assertEquals(LoadLevel.SHALLOW, OptionsUtil.getLoadLevel(options)); + assertEquals(LoadLevel.ARTIFACT_DATA, OptionsUtil.getLoadLevel(options)); - OptionsUtil.setLoadLevel(options, LoadLevel.ATTRIBUTE); + OptionsUtil.setLoadLevel(options, LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA); - assertEquals(LoadLevel.ATTRIBUTE, OptionsUtil.getLoadLevel(options)); + assertEquals(LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA, OptionsUtil.getLoadLevel(options)); } @Test @@ -73,34 +74,46 @@ public class OptionsUtilTest { @Test public void testSetGetIncludeDeleted() { - assertEquals(DeletionFlag.EXCLUDE_DELETED, OptionsUtil.getIncludeDeleted(options)); - assertEquals(false, OptionsUtil.areDeletedIncluded(options)); + assertEquals(DeletionFlag.EXCLUDE_DELETED, OptionsUtil.getIncludeDeletedArtifacts(options)); + assertEquals(false, OptionsUtil.areDeletedArtifactsIncluded(options)); - OptionsUtil.setIncludeDeleted(options, true); + OptionsUtil.setIncludeDeletedArtifacts(options, true); - assertEquals(DeletionFlag.INCLUDE_DELETED, OptionsUtil.getIncludeDeleted(options)); - assertEquals(true, OptionsUtil.areDeletedIncluded(options)); + assertEquals(DeletionFlag.INCLUDE_DELETED, OptionsUtil.getIncludeDeletedArtifacts(options)); + assertEquals(true, OptionsUtil.areDeletedArtifactsIncluded(options)); + } + + @Test + public void testSetGetIncludeCache() { + assertEquals(false, OptionsUtil.isCacheIncluded(options)); + + OptionsUtil.setIncludeCache(options, true); + + assertEquals(true, OptionsUtil.isCacheIncluded(options)); } @Test public void testReset() { OptionsUtil.setFromTransaction(options, 1231); - OptionsUtil.setLoadLevel(options, LoadLevel.ATTRIBUTE); - OptionsUtil.setIncludeDeleted(options, true); + OptionsUtil.setLoadLevel(options, LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA); + OptionsUtil.setIncludeDeletedArtifacts(options, true); + OptionsUtil.setIncludeCache(options, true); assertEquals(1231, OptionsUtil.getFromTransaction(options)); - assertEquals(DeletionFlag.INCLUDE_DELETED, OptionsUtil.getIncludeDeleted(options)); - assertEquals(LoadLevel.ATTRIBUTE, OptionsUtil.getLoadLevel(options)); - assertEquals(true, OptionsUtil.areDeletedIncluded(options)); + assertEquals(DeletionFlag.INCLUDE_DELETED, OptionsUtil.getIncludeDeletedArtifacts(options)); + assertEquals(LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA, OptionsUtil.getLoadLevel(options)); + assertEquals(true, OptionsUtil.areDeletedArtifactsIncluded(options)); + assertEquals(true, OptionsUtil.isCacheIncluded(options)); assertEquals(false, OptionsUtil.isHeadTransaction(options)); assertEquals(true, OptionsUtil.isHistorical(options)); OptionsUtil.reset(options); assertEquals(-1, OptionsUtil.getFromTransaction(options)); - assertEquals(DeletionFlag.EXCLUDE_DELETED, OptionsUtil.getIncludeDeleted(options)); - assertEquals(LoadLevel.SHALLOW, OptionsUtil.getLoadLevel(options)); - assertEquals(false, OptionsUtil.areDeletedIncluded(options)); + assertEquals(DeletionFlag.EXCLUDE_DELETED, OptionsUtil.getIncludeDeletedArtifacts(options)); + assertEquals(LoadLevel.ALL, OptionsUtil.getLoadLevel(options)); + assertEquals(false, OptionsUtil.areDeletedArtifactsIncluded(options)); + assertEquals(false, OptionsUtil.isCacheIncluded(options)); assertEquals(true, OptionsUtil.isHeadTransaction(options)); assertEquals(false, OptionsUtil.isHistorical(options)); } diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationManagerTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationManagerTest.java index d9b9a4454d8..fdf78fb23cf 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationManagerTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationManagerTest.java @@ -98,7 +98,7 @@ public class RelationManagerTest { manager = RelationManagerFactory.createRelationManager(logger, types, relationFactory, loader); - when(loader.loadNodes(eq(session), eq(graph), anyCollectionOf(Integer.class), eq(LoadLevel.FULL))).thenAnswer( + when(loader.loadNodes(eq(session), eq(graph), anyCollectionOf(Integer.class), eq(LoadLevel.ALL))).thenAnswer( new LoaderAnswer()); when(node1.getLocalId()).thenReturn(11); @@ -175,7 +175,7 @@ public class RelationManagerTest { public void testGetRelatedOnSideA() throws OseeCoreException { ResultSet<RelationNode> nodes = manager.getRelated(session, graph, DEFAULT_HIERARCHY, node1, IS_PARENT); - verify(loader).loadNodes(eq(session), eq(graph), captor.capture(), eq(LoadLevel.FULL)); + verify(loader).loadNodes(eq(session), eq(graph), captor.capture(), eq(LoadLevel.ALL)); Collection<Integer> toLoad = captor.getValue(); assertEquals(3, toLoad.size()); @@ -195,7 +195,7 @@ public class RelationManagerTest { public void testGetRelatedOnSideB() throws OseeCoreException { ResultSet<RelationNode> readables = manager.getRelated(session, graph, DEFAULT_HIERARCHY, node1, IS_CHILD); - verify(loader).loadNodes(eq(session), eq(graph), captor.capture(), eq(LoadLevel.FULL)); + verify(loader).loadNodes(eq(session), eq(graph), captor.capture(), eq(LoadLevel.ALL)); Collection<Integer> toLoad = captor.getValue(); assertEquals(1, toLoad.size()); diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationNodeLoaderImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationNodeLoaderImplTest.java index c009739fd63..16d03c9cff2 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationNodeLoaderImplTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationNodeLoaderImplTest.java @@ -74,16 +74,16 @@ public class RelationNodeLoaderImplTest { public void testLoadNodes() throws OseeCoreException { Iterable<Artifact> artifacts = Arrays.asList(artifact); - when(dataLoaderFactory.fromBranchAndArtifactIds(session, BRANCH, ids)).thenReturn(loader); + when(dataLoaderFactory.newDataLoaderFromIds(session, BRANCH, ids)).thenReturn(loader); when(graphBuilderFactory.createBuilderForGraph(graph)).thenReturn(builder); when(builder.getArtifacts()).thenReturn(artifacts); - Iterable<RelationNode> actual = relationNode.loadNodes(session, graph, ids, LoadLevel.FULL); + Iterable<RelationNode> actual = relationNode.loadNodes(session, graph, ids, LoadLevel.ALL); - verify(dataLoaderFactory).fromBranchAndArtifactIds(session, BRANCH, ids); + verify(dataLoaderFactory).newDataLoaderFromIds(session, BRANCH, ids); verify(graphBuilderFactory).createBuilderForGraph(graph); - verify(loader).setLoadLevel(LoadLevel.FULL); + verify(loader).withLoadLevel(LoadLevel.ALL); verify(loader).fromTransaction(TRANSACTION_ID); verify(loader).load(null, builder); verify(builder).getArtifacts(); diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationResolverTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationResolverTest.java index 02a22fae959..0bfcd83fcd2 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationResolverTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationResolverTest.java @@ -99,7 +99,7 @@ public class RelationResolverTest { when(relation4.getLocalIdForSide(RelationSide.SIDE_A)).thenReturn(11); when(relation4.getLocalIdForSide(RelationSide.SIDE_B)).thenReturn(66); - when(loader.loadNodes(eq(session), eq(graphData), anyCollectionOf(Integer.class), eq(LoadLevel.FULL))).thenReturn( + when(loader.loadNodes(eq(session), eq(graphData), anyCollectionOf(Integer.class), eq(LoadLevel.ALL))).thenReturn( resultSet); } @@ -111,7 +111,7 @@ public class RelationResolverTest { List<RelationNode> arts = resolver.resolve(session, graphData, links, RelationSide.SIDE_A, RelationSide.SIDE_B); - verify(loader).loadNodes(eq(session), eq(graphData), captor.capture(), eq(LoadLevel.FULL)); + verify(loader).loadNodes(eq(session), eq(graphData), captor.capture(), eq(LoadLevel.ALL)); assertCollection(captor.getValue(), 11, 22, 33, 44, 55, 66); assertCollection(arts, node1, node2, node3, node4, node5, node6); } @@ -124,7 +124,7 @@ public class RelationResolverTest { List<RelationNode> arts = resolver.resolve(session, graphData, links, RelationSide.SIDE_A); - verify(loader).loadNodes(eq(session), eq(graphData), captor.capture(), eq(LoadLevel.FULL)); + verify(loader).loadNodes(eq(session), eq(graphData), captor.capture(), eq(LoadLevel.ALL)); assertCollection(captor.getValue(), 11, 33, 55); assertCollection(arts, node1, node3, node5); @@ -138,7 +138,7 @@ public class RelationResolverTest { List<RelationNode> arts = resolver.resolve(session, graphData, links, RelationSide.SIDE_B); - verify(loader).loadNodes(eq(session), eq(graphData), captor.capture(), eq(LoadLevel.FULL)); + verify(loader).loadNodes(eq(session), eq(graphData), captor.capture(), eq(LoadLevel.ALL)); assertCollection(captor.getValue(), 22, 44, 66); assertCollection(arts, node2, node4, node6); @@ -160,7 +160,7 @@ public class RelationResolverTest { verify(graphData).getNode(33); verify(graphData).getNode(55); - verify(loader).loadNodes(eq(session), eq(graphData), captor.capture(), eq(LoadLevel.FULL)); + verify(loader).loadNodes(eq(session), eq(graphData), captor.capture(), eq(LoadLevel.ALL)); assertCollection(captor.getValue(), 22, 44, 66); assertCollection(arts, node1, node2, node3, node4, node5, node6); diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataLoader.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataLoader.java index aca01c7e55e..4eb61b289af 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataLoader.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataLoader.java @@ -11,7 +11,6 @@ package org.eclipse.osee.orcs.core.ds; import java.util.Collection; -import org.eclipse.osee.executor.admin.HasCancellation; import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.LoadLevel; @@ -22,44 +21,59 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; */ public interface DataLoader extends Loader { + ////////// OPTIONS @Override - DataLoader includeDeleted(); + DataLoader setOptions(Options sourceOptions); - @Override - DataLoader includeDeleted(boolean enabled); - - @Override DataLoader fromTransaction(int transactionId); - @Override - DataLoader headTransaction(); + DataLoader fromHeadTransaction(); - @Override - DataLoader setLoadLevel(LoadLevel loadLevel); + DataLoader withLoadLevel(LoadLevel loadLevel); - @Override - DataLoader resetToDefaults(); + LoadLevel getLoadLevel(); - @Override - DataLoader loadAttributeType(IAttributeType... attributeType) throws OseeCoreException; + int getFromTransaction(); - @Override - DataLoader loadAttributeTypes(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException; + boolean isHeadTransaction(); - @Override - DataLoader loadRelationType(IRelationType... relationType) throws OseeCoreException; + //////////////// Deletion Options + DataLoader includeDeletedArtifacts(); - @Override - DataLoader loadRelationTypes(Collection<? extends IRelationType> relationType) throws OseeCoreException; + DataLoader includeDeletedAttributes(); + + DataLoader includeDeletedRelations(); + + DataLoader includeDeletedArtifacts(boolean enabled); + + DataLoader includeDeletedAttributes(boolean enabled); + + DataLoader includeDeletedRelations(boolean enabled); + + boolean areDeletedArtifactsIncluded(); + + boolean areDeletedAttributesIncluded(); + + boolean areDeletedRelationsIncluded(); + + //////////// IDS + + DataLoader withAttributeIds(int... attributeIds) throws OseeCoreException; + + DataLoader withAttributeIds(Collection<Integer> attributeIds) throws OseeCoreException; + + DataLoader withRelationIds(int... relationIds) throws OseeCoreException; + + DataLoader withRelationIds(Collection<Integer> relationIds) throws OseeCoreException; - DataLoader loadAttributeLocalId(int... attributeIds) throws OseeCoreException; + ///////// TYPES - DataLoader loadAttributeLocalIds(Collection<Integer> attributeIds) throws OseeCoreException; + DataLoader withAttributeTypes(IAttributeType... attributeType) throws OseeCoreException; - DataLoader loadRelationLocalId(int... relationIds) throws OseeCoreException; + DataLoader withAttributeTypes(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException; - DataLoader loadRelationLocalIds(Collection<Integer> relationIds) throws OseeCoreException; + DataLoader withRelationTypes(IRelationType... relationType) throws OseeCoreException; - void load(HasCancellation cancellation, LoadDataHandler handler) throws OseeCoreException; + DataLoader withRelationTypes(Collection<? extends IRelationType> relationType) throws OseeCoreException; } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataLoaderFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataLoaderFactory.java index f3c80a346d5..ce9107d5835 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataLoaderFactory.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataLoaderFactory.java @@ -23,14 +23,14 @@ public interface DataLoaderFactory { int getCount(HasCancellation cancellation, QueryContext queryContext) throws OseeCoreException; - DataLoader fromQueryContext(QueryContext queryContext) throws OseeCoreException; + DataLoader newDataLoader(QueryContext queryContext) throws OseeCoreException; - DataLoader fromBranchAndArtifactIds(OrcsSession session, IOseeBranch branch, Collection<Integer> artifactIds) throws OseeCoreException; + DataLoader newDataLoaderFromIds(OrcsSession session, IOseeBranch branch, Integer... artifactIds) throws OseeCoreException; - DataLoader fromBranchAndArtifactIds(OrcsSession session, IOseeBranch branch, int... artifactIds) throws OseeCoreException; + DataLoader newDataLoaderFromIds(OrcsSession session, IOseeBranch branch, Collection<Integer> artifactIds) throws OseeCoreException; - DataLoader fromBranchAndIds(OrcsSession session, IOseeBranch branch, Collection<String> ids) throws OseeCoreException; + DataLoader newDataLoaderFromGuids(OrcsSession session, IOseeBranch branch, String... artifactGuids) throws OseeCoreException; - DataLoader fromBranchAndIds(OrcsSession session, IOseeBranch branch, String... ids) throws OseeCoreException; + DataLoader newDataLoaderFromGuids(OrcsSession session, IOseeBranch branch, Collection<String> artifactGuids) throws OseeCoreException; } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/Loader.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/Loader.java index 21b7ea49d11..2320eb582f0 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/Loader.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/Loader.java @@ -10,10 +10,7 @@ *******************************************************************************/ package org.eclipse.osee.orcs.core.ds; -import java.util.Collection; -import org.eclipse.osee.framework.core.data.IAttributeType; -import org.eclipse.osee.framework.core.data.IRelationType; -import org.eclipse.osee.framework.core.enums.LoadLevel; +import org.eclipse.osee.executor.admin.HasCancellation; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; /** @@ -23,32 +20,8 @@ public interface Loader { Loader setOptions(Options sourceOptions); - Loader includeDeleted(); + void load(HasCancellation cancellation, LoadDataHandler handler) throws OseeCoreException; - Loader includeDeleted(boolean enabled); - - boolean areDeletedIncluded(); - - Loader fromTransaction(int transactionId); - - int getFromTransaction(); - - Loader headTransaction(); - - boolean isHeadTransaction(); - - LoadLevel getLoadLevel(); - - Loader setLoadLevel(LoadLevel loadLevel); - - Loader resetToDefaults(); - - Loader loadAttributeType(IAttributeType... attributeType) throws OseeCoreException; - - Loader loadAttributeTypes(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException; - - Loader loadRelationType(IRelationType... relationType) throws OseeCoreException; - - Loader loadRelationTypes(Collection<? extends IRelationType> relationType) throws OseeCoreException; + void load(LoadDataHandler handler) throws OseeCoreException; } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/OptionsUtil.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/OptionsUtil.java index e8a7ce5ddd1..7a401c2db9d 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/OptionsUtil.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/OptionsUtil.java @@ -22,46 +22,92 @@ public final class OptionsUtil { private static final int TRANSACTION_SENTINEL = -1; private static final String FROM_TRANSACTION = "from.transaction"; - private static final String INCLUDE_DELETED = "include.deleted"; + private static final String INCLUDE_DELETED_ARTIFACTS = "include.deleted.artifacts"; + private static final String INCLUDE_DELETED_ATTRIBUTES = "include.deleted.attributes"; + private static final String INCLUDE_DELETED_RELATIONS = "include.deleted.relations"; + private static final String INCLUDE_CACHE = "include.cache"; private static final String LOAD_LEVEL = "load.level"; public static Options createBranchOptions() { Options options = new Options(); - setIncludeDeleted(options, false); - setLoadLevel(options, LoadLevel.SHALLOW); + setIncludeCache(options, false); + setIncludeDeletedArtifacts(options, false); + setIncludeDeletedAttributes(options, false); + setIncludeDeletedRelations(options, false); + setLoadLevel(options, LoadLevel.ARTIFACT_DATA); return options; } public static Options createOptions() { Options options = new Options(); - setIncludeDeleted(options, false); + setIncludeCache(options, false); + setIncludeDeletedArtifacts(options, false); + setIncludeDeletedAttributes(options, false); + setIncludeDeletedRelations(options, false); setHeadTransaction(options); - setLoadLevel(options, LoadLevel.SHALLOW); + setLoadLevel(options, LoadLevel.ALL); return options; } public static void reset(Options options) { - setIncludeDeleted(options, false); + setIncludeCache(options, false); + setIncludeDeletedArtifacts(options, false); + setIncludeDeletedAttributes(options, false); + setIncludeDeletedRelations(options, false); setHeadTransaction(options); - setLoadLevel(options, LoadLevel.SHALLOW); + setLoadLevel(options, LoadLevel.ALL); } - public static boolean areDeletedIncluded(Options options) { - return options.getBoolean(INCLUDE_DELETED); + public static boolean isCacheIncluded(Options options) { + return options.getBoolean(INCLUDE_CACHE); } - public static void setIncludeDeleted(Options options, boolean enabled) { - options.put(INCLUDE_DELETED, enabled); + public static void setIncludeCache(Options options, boolean enabled) { + options.put(INCLUDE_CACHE, enabled); } - public static DeletionFlag getIncludeDeleted(Options options) { - boolean includeDeleted = areDeletedIncluded(options); + public static boolean areDeletedArtifactsIncluded(Options options) { + return options.getBoolean(INCLUDE_DELETED_ARTIFACTS); + } + + public static void setIncludeDeletedArtifacts(Options options, boolean enabled) { + options.put(INCLUDE_DELETED_ARTIFACTS, enabled); + } + + public static DeletionFlag getIncludeDeletedArtifacts(Options options) { + boolean includeDeleted = areDeletedArtifactsIncluded(options); + return DeletionFlag.allowDeleted(includeDeleted); + } + + public static boolean areDeletedAttributesIncluded(Options options) { + return options.getBoolean(INCLUDE_DELETED_ATTRIBUTES); + } + + public static void setIncludeDeletedAttributes(Options options, boolean enabled) { + options.put(INCLUDE_DELETED_ATTRIBUTES, enabled); + } + + public static DeletionFlag getIncludeDeletedAttributes(Options options) { + boolean includeDeleted = areDeletedAttributesIncluded(options); + return DeletionFlag.allowDeleted(includeDeleted); + } + + public static boolean areDeletedRelationsIncluded(Options options) { + return options.getBoolean(INCLUDE_DELETED_RELATIONS); + } + + public static void setIncludeDeletedRelations(Options options, boolean enabled) { + options.put(INCLUDE_DELETED_RELATIONS, enabled); + } + + public static DeletionFlag getIncludeDeletedRelations(Options options) { + boolean includeDeleted = areDeletedRelationsIncluded(options); return DeletionFlag.allowDeleted(includeDeleted); } public static LoadLevel getLoadLevel(Options options) { String level = options.get(LOAD_LEVEL); - LoadLevel loadLevel = LoadLevel.SHALLOW; + LoadLevel loadLevel = LoadLevel.ARTIFACT_DATA; if (Strings.isValid(level)) { loadLevel = LoadLevel.valueOf(level); } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationNodeLoaderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationNodeLoaderImpl.java index 6203d856b0a..4600d577af4 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationNodeLoaderImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationNodeLoaderImpl.java @@ -40,10 +40,10 @@ public class RelationNodeLoaderImpl implements RelationNodeLoader { public <T extends RelationNode> Iterable<T> loadNodes(OrcsSession session, final GraphData graph, Collection<Integer> ids, LoadLevel level) throws OseeCoreException { GraphBuilder builder = graphBuilderFactory.createBuilderForGraph(graph); - DataLoader loader = dataLoaderFactory.fromBranchAndArtifactIds(session, graph.getBranch(), ids); - loader.setLoadLevel(level); + DataLoader loader = dataLoaderFactory.newDataLoaderFromIds(session, graph.getBranch(), ids); + loader.withLoadLevel(level); loader.fromTransaction(graph.getTransaction()); - loader.includeDeleted(); + loader.includeDeletedArtifacts(); loader.load(null, builder); return getResults(builder); diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationResolverImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationResolverImpl.java index 0eb8164a4c9..28f56c52464 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationResolverImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationResolverImpl.java @@ -62,7 +62,7 @@ public class RelationResolverImpl implements RelationResolver { } } if (toLoad != null && !toLoad.isEmpty()) { - Iterable<T> result = loader.loadNodes(session, graph, toLoad, LoadLevel.FULL); + Iterable<T> result = loader.loadNodes(session, graph, toLoad, LoadLevel.ALL); for (T item : result) { items.put(item.getLocalId(), item); } @@ -88,7 +88,7 @@ public class RelationResolverImpl implements RelationResolver { @Override public void resolve(OrcsSession session, GraphData graph, RelationNode node) throws OseeCoreException { - loader.loadNodes(session, graph, Collections.singleton(node.getLocalId()), LoadLevel.RELATION); + loader.loadNodes(session, graph, Collections.singleton(node.getLocalId()), LoadLevel.RELATION_DATA); } } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/BranchCallableQueryFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/BranchCallableQueryFactory.java index ed19f531e21..659eef30bcc 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/BranchCallableQueryFactory.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/BranchCallableQueryFactory.java @@ -72,7 +72,7 @@ public class BranchCallableQueryFactory { return (BranchReadable) data; } }; - OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.FULL); + OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.ALL); queryEngine.createBranchQuery(getSession(), getQueryData(), handler).call(); List<BranchReadable> results = handler.getBranches(); setItemsFound(results.size()); @@ -94,7 +94,7 @@ public class BranchCallableQueryFactory { } }; - OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.FULL); + OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.ALL); queryEngine.createBranchQuery(getSession(), getQueryData(), handler).call(); List<IOseeBranch> results = handler.getBranches(); setItemsFound(results.size()); diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/BranchQueryImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/BranchQueryImpl.java index 41115e6897d..3075bd7ed98 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/BranchQueryImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/BranchQueryImpl.java @@ -15,11 +15,13 @@ import static org.eclipse.osee.framework.core.enums.BranchState.DELETED; import static org.eclipse.osee.framework.core.enums.BranchState.DELETE_IN_PROGRESS; import static org.eclipse.osee.framework.core.enums.BranchState.PURGED; import static org.eclipse.osee.framework.core.enums.BranchState.PURGE_IN_PROGRESS; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; + import org.eclipse.osee.executor.admin.CancellableCallable; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.data.ResultSet; @@ -77,13 +79,13 @@ public class BranchQueryImpl implements BranchQuery { @Override public BranchQuery includeDeleted(boolean enabled) { - OptionsUtil.setIncludeDeleted(getOptions(), enabled); + OptionsUtil.setIncludeDeletedArtifacts(getOptions(), enabled); return this; } @Override public boolean areDeletedIncluded() { - return OptionsUtil.areDeletedIncluded(getOptions()); + return OptionsUtil.areDeletedArtifactsIncluded(getOptions()); } @Override 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 8f1ecc8da7a..46b7522ac86 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 @@ -81,7 +81,7 @@ public class CallableQueryFactory { results.add(data); } }; - OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.ATTRIBUTE); + OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA); queryEngine.createArtifactQuery(getSession(), getQueryData(), handler).call(); setItemsFound(results.size()); return ResultSets.newResultSet(results); @@ -95,7 +95,7 @@ public class CallableQueryFactory { @Override protected ResultSet<ArtifactReadable> innerCall() throws Exception { GraphBuilder handler = builderFactory.createGraphBuilder(provider); - OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.FULL); + OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.ALL); queryEngine.createArtifactQuery(getSession(), getQueryData(), handler).call(); Iterable<Artifact> results = handler.getArtifacts(); setItemsFound(Iterables.size(results)); @@ -111,7 +111,7 @@ public class CallableQueryFactory { protected ResultSet<Match<ArtifactReadable, AttributeReadable<?>>> innerCall() throws Exception { GraphBuilder handler = builderFactory.createGraphBuilder(provider); ArtifactMatchDataHandler matchHandler = new ArtifactMatchDataHandler(getSession(), handler, proxyManager); - OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.FULL); + OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.ALL); queryEngine.createArtifactQuery(getSession(), getQueryData(), matchHandler).call(); List<Match<ArtifactReadable, AttributeReadable<?>>> results = matchHandler.getResults(); setItemsFound(Iterables.size(results)); 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 3bfc4134ae1..a7900a42c5a 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 @@ -77,13 +77,13 @@ public class QueryBuilderImpl implements QueryBuilder { @Override public QueryBuilder includeDeleted(boolean enabled) { - OptionsUtil.setIncludeDeleted(getOptions(), enabled); + OptionsUtil.setIncludeDeletedArtifacts(getOptions(), enabled); return this; } @Override public boolean areDeletedIncluded() { - return OptionsUtil.areDeletedIncluded(getOptions()); + return OptionsUtil.areDeletedArtifactsIncluded(getOptions()); } @Override diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/TransactionCallableQueryFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/TransactionCallableQueryFactory.java index f845c8a523e..1799b1f42ab 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/TransactionCallableQueryFactory.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/TransactionCallableQueryFactory.java @@ -73,7 +73,7 @@ public class TransactionCallableQueryFactory { return data; } }; - OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.FULL); + OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.ALL); queryEngine.createTxQuery(getSession(), getQueryData(), handler).call(); ResultSet<TransactionReadable> results = handler.getTransactions(); setItemsFound(results.size()); @@ -94,7 +94,7 @@ public class TransactionCallableQueryFactory { txs.add(data.getLocalId()); } }; - OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.FULL); + OptionsUtil.setLoadLevel(getQueryData().getOptions(), LoadLevel.ALL); queryEngine.createTxQuery(getSession(), getQueryData(), handler).call(); setItemsFound(txs.size()); return ResultSets.newResultSet(txs); diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataLoaderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataLoaderImpl.java index b3729428e53..0d3560feaa6 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataLoaderImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataLoaderImpl.java @@ -54,8 +54,8 @@ public class TxDataLoaderImpl implements TxDataLoader { for (ArtifactId artifactId : artifactIds) { ids.add(artifactId.getGuid()); } - DataLoader loader = dataLoaderFactory.fromBranchAndIds(session, branch, ids); - loader.setLoadLevel(LoadLevel.FULL); + DataLoader loader = dataLoaderFactory.newDataLoaderFromGuids(session, branch, ids); + loader.withLoadLevel(LoadLevel.ALL); return loader; } diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java index 14f91e3d075..facc35ac358 100644 --- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java +++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java @@ -24,7 +24,9 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; + import java.util.Iterator; + import org.eclipse.osee.executor.admin.HasCancellation; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.enums.LoadLevel; @@ -100,8 +102,8 @@ public class LoaderTest { @org.junit.Test public void testLoad() throws OseeCoreException { - DataLoader loader = loaderFactory.fromBranchAndArtifactIds(session, CoreBranches.COMMON, 5, 6, 7); - loader.setLoadLevel(LoadLevel.FULL); + DataLoader loader = loaderFactory.newDataLoaderFromIds(session, CoreBranches.COMMON, 5, 6, 7); + loader.withLoadLevel(LoadLevel.ALL); loader.load(cancellation, builder); @@ -151,11 +153,11 @@ public class LoaderTest { @org.junit.Test public void testLoadByTypes() throws OseeCoreException { - DataLoader loader = loaderFactory.fromBranchAndArtifactIds(session, CoreBranches.COMMON, 5, 6, 7); - loader.setLoadLevel(LoadLevel.FULL); + DataLoader loader = loaderFactory.newDataLoaderFromIds(session, CoreBranches.COMMON, 5, 6, 7); + loader.withLoadLevel(LoadLevel.ALL); - loader.loadAttributeType(Name); - loader.loadRelationType(Default_Hierarchical__Parent); + loader.withAttributeTypes(Name); + loader.withRelationTypes(Default_Hierarchical__Parent); loader.load(cancellation, builder); @@ -200,11 +202,11 @@ public class LoaderTest { @org.junit.Test public void testLoadByIds() throws OseeCoreException { - DataLoader loader = loaderFactory.fromBranchAndArtifactIds(session, CoreBranches.COMMON, 5, 6, 7); - loader.setLoadLevel(LoadLevel.FULL); + DataLoader loader = loaderFactory.newDataLoaderFromIds(session, CoreBranches.COMMON, 5, 6, 7); + loader.withLoadLevel(LoadLevel.ALL); - loader.loadAttributeLocalId(11, 14); - loader.loadRelationLocalId(2, 3); + loader.withAttributeIds(11, 14); + loader.withRelationIds(2, 3); loader.load(cancellation, builder); @@ -248,8 +250,8 @@ public class LoaderTest { @org.junit.Test public void testLoadByGuids() throws OseeCoreException { String[] ids = new String[] {"AkA10I4aUSDLuFNIaegA", "AkA10LiAPEZLR4+jdFQA", "AkA2AcT6AXe6ivMFRhAA"}; - DataLoader loader = loaderFactory.fromBranchAndIds(session, CoreBranches.COMMON, ids); - loader.setLoadLevel(LoadLevel.FULL); + DataLoader loader = loaderFactory.newDataLoaderFromGuids(session, CoreBranches.COMMON, ids); + loader.withLoadLevel(LoadLevel.ALL); loader.load(cancellation, builder); diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java index d2b9b3dfc3f..fb0cfad8eb1 100644 --- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java +++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java @@ -15,9 +15,11 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import java.util.Collection; import java.util.LinkedList; import java.util.List; + import org.eclipse.osee.executor.admin.HasCancellation; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.model.Branch; @@ -104,9 +106,9 @@ public class MissingChangeItemFactoryTest { String sessionGuid = GUID.create(); when(session.getGuid()).thenReturn(sessionGuid); - when(dataLoaderFactory.fromBranchAndArtifactIds(any(OrcsSession.class), eq(sourceBranch), any(Collection.class))).thenReturn( + when(dataLoaderFactory.newDataLoaderFromIds(any(OrcsSession.class), eq(sourceBranch), any(Collection.class))).thenReturn( sourceDataLoader); - when(dataLoaderFactory.fromBranchAndArtifactIds(any(OrcsSession.class), eq(destBranch), any(Collection.class))).thenReturn( + when(dataLoaderFactory.newDataLoaderFromIds(any(OrcsSession.class), eq(destBranch), any(Collection.class))).thenReturn( destDataLoader); when(sourceTx.getBranch()).thenReturn(sourceBranch); when(destTx.getBranch()).thenReturn(destBranch); diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java index e11c0d705e9..6b30ca0df00 100644 --- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java +++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java @@ -132,10 +132,10 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadFull() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.FULL; + LoadLevel expectedLoadLevel = LoadLevel.ALL; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); dataLoader.fromTransaction(EXPECTED_TX_ID); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -152,7 +152,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadArtifactIds() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.SHALLOW; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // " jart1.art_id, art1.art_type_id, art1.guid\n" + // " FROM \n" + // @@ -162,8 +162,8 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -174,7 +174,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadArtifactIncludeDeleted() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.SHALLOW; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // " jart1.art_id, art1.art_type_id, art1.guid\n" + // " FROM \n" + // @@ -184,9 +184,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current IN (1, 2, 3) AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.includeDeleted(); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.includeDeletedArtifacts(); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -197,7 +197,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadArtifactHistorical() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.SHALLOW; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id, txs1.transaction_id as stripe_transaction_id,\n" + // " jart1.art_id, art1.art_type_id, art1.guid\n" + // @@ -205,11 +205,11 @@ public class DataLoaderFactoryImplTest { "osee_join_artifact jart1, osee_artifact art1, osee_txs txs1\n" + // " WHERE \n" + // "art1.art_id = jart1.art_id AND jart1.query_id = ? AND art1.gamma_id = txs1.gamma_id\n" + // - " AND txs1.transaction_id <= jart1.transaction_id AND txs1.tx_current IN (1, 0) AND txs1.branch_id = jart1.branch_id\n" + // + " AND txs1.transaction_id <= jart1.transaction_id AND txs1.mod_type != 3 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); dataLoader.fromTransaction(EXPECTED_TX_ID); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -221,7 +221,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadArtifactHistoricalIncludeDeleted() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.SHALLOW; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id, txs1.transaction_id as stripe_transaction_id,\n" + // " jart1.art_id, art1.art_type_id, art1.guid\n" + // @@ -232,10 +232,10 @@ public class DataLoaderFactoryImplTest { " AND txs1.transaction_id <= jart1.transaction_id AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); dataLoader.fromTransaction(EXPECTED_TX_ID); - dataLoader.includeDeleted(); + dataLoader.includeDeletedArtifacts(); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -247,7 +247,7 @@ public class DataLoaderFactoryImplTest { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @Test public void testLoadAttributes() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // " jart1.art_id, att1.attr_id, att1.attr_type_id, att1.value, att1.uri\n" + // @@ -258,8 +258,8 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -270,7 +270,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadAttributesWithType() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -282,9 +282,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadAttributeType(CoreAttributeTypes.Annotation); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withAttributeTypes(CoreAttributeTypes.Annotation); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -296,7 +296,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadAttributesWithTypes() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -308,9 +308,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadAttributeType(CoreAttributeTypes.Annotation, CoreAttributeTypes.Category); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withAttributeTypes(CoreAttributeTypes.Annotation, CoreAttributeTypes.Category); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -327,7 +327,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadAttributesWithId() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // " jart1.art_id, att1.attr_id, att1.attr_type_id, att1.value, att1.uri\n" + // @@ -338,9 +338,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadAttributeLocalId(45); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withAttributeIds(45); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -351,7 +351,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadAttributesWithIds() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -363,9 +363,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadAttributeLocalId(45, 55); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withAttributeIds(45, 55); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -376,7 +376,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadAttributesWithIdsAndTypes() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -388,10 +388,10 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadAttributeLocalId(45, 55); - dataLoader.loadAttributeType(CoreAttributeTypes.Annotation, CoreAttributeTypes.Category); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withAttributeIds(45, 55); + dataLoader.withAttributeTypes(CoreAttributeTypes.Annotation, CoreAttributeTypes.Category); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -409,7 +409,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadAttributesWithIdAndType() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -421,10 +421,10 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadAttributeLocalId(45); - dataLoader.loadAttributeType(CoreAttributeTypes.Annotation); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withAttributeIds(45); + dataLoader.withAttributeTypes(CoreAttributeTypes.Annotation); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -436,7 +436,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadAttributesIncludeDeleted() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // " jart1.art_id, att1.attr_id, att1.attr_type_id, att1.value, att1.uri\n" + // @@ -447,9 +447,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current IN (1, 2, 3) AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.includeDeleted(); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.includeDeletedArtifacts(); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -460,7 +460,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadAttributesHistorical() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id, txs1.transaction_id as stripe_transaction_id,\n" + // @@ -469,11 +469,11 @@ public class DataLoaderFactoryImplTest { "osee_join_artifact jart1, osee_attribute att1, osee_txs txs1\n" + // " WHERE \n" + // "att1.art_id = jart1.art_id AND jart1.query_id = ? AND att1.gamma_id = txs1.gamma_id\n" + // - " AND txs1.transaction_id <= jart1.transaction_id AND txs1.tx_current IN (1, 0) AND txs1.branch_id = jart1.branch_id\n" + // + " AND txs1.transaction_id <= jart1.transaction_id AND txs1.mod_type != 3 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); dataLoader.fromTransaction(EXPECTED_TX_ID); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -485,7 +485,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadAttributesHistoricalIncludeDeleted() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.ATTRIBUTE; + LoadLevel expectedLoadLevel = LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id, txs1.transaction_id as stripe_transaction_id,\n" + // @@ -497,10 +497,10 @@ public class DataLoaderFactoryImplTest { " AND txs1.transaction_id <= jart1.transaction_id AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, att1.attr_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); dataLoader.fromTransaction(EXPECTED_TX_ID); - dataLoader.includeDeleted(); + dataLoader.includeDeletedArtifacts(); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -513,7 +513,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadRelations() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.RELATION; + LoadLevel expectedLoadLevel = LoadLevel.RELATION_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -525,8 +525,8 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -537,7 +537,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadRelationsIncludeDeleted() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.RELATION; + LoadLevel expectedLoadLevel = LoadLevel.RELATION_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -549,9 +549,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current IN (1, 2, 3) AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.includeDeleted(); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.includeDeletedArtifacts(); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -562,7 +562,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadRelationsWithType() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.RELATION; + LoadLevel expectedLoadLevel = LoadLevel.RELATION_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -574,9 +574,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadRelationType(CoreRelationTypes.Default_Hierarchical__Child); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withRelationTypes(CoreRelationTypes.Default_Hierarchical__Child); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -588,7 +588,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadRelationsWithTypes() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.RELATION; + LoadLevel expectedLoadLevel = LoadLevel.RELATION_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -600,9 +600,10 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadRelationType(CoreRelationTypes.Default_Hierarchical__Child, CoreRelationTypes.Dependency__Artifact); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withRelationTypes(CoreRelationTypes.Default_Hierarchical__Child, + CoreRelationTypes.Dependency__Artifact); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -620,7 +621,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadRelationsWithId() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.RELATION; + LoadLevel expectedLoadLevel = LoadLevel.RELATION_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -632,9 +633,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadRelationLocalId(45); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withRelationIds(45); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -645,7 +646,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadRelationsWithIds() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.RELATION; + LoadLevel expectedLoadLevel = LoadLevel.RELATION_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -657,9 +658,9 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadRelationLocalId(45, 55); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withRelationIds(45, 55); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -670,7 +671,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadRelationsWithIdsAndTypes() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.RELATION; + LoadLevel expectedLoadLevel = LoadLevel.RELATION_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -682,10 +683,11 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadRelationLocalId(45, 55); - dataLoader.loadRelationType(CoreRelationTypes.Default_Hierarchical__Child, CoreRelationTypes.Dependency__Artifact); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withRelationIds(45, 55); + dataLoader.withRelationTypes(CoreRelationTypes.Default_Hierarchical__Child, + CoreRelationTypes.Dependency__Artifact); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -705,7 +707,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadRelationsWithIdAndType() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.RELATION; + LoadLevel expectedLoadLevel = LoadLevel.RELATION_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // @@ -717,10 +719,10 @@ public class DataLoaderFactoryImplTest { " AND txs1.tx_current = 1 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); - dataLoader.loadRelationLocalId(45); - dataLoader.loadRelationType(CoreRelationTypes.Default_Hierarchical__Child); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.withRelationIds(45); + dataLoader.withRelationTypes(CoreRelationTypes.Default_Hierarchical__Child); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -732,7 +734,7 @@ public class DataLoaderFactoryImplTest { @Test public void testLoadRelationsHistorical() throws OseeCoreException { - LoadLevel expectedLoadLevel = LoadLevel.RELATION; + LoadLevel expectedLoadLevel = LoadLevel.RELATION_DATA; String expected = "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id, txs1.transaction_id as stripe_transaction_id,\n" + // @@ -741,11 +743,11 @@ public class DataLoaderFactoryImplTest { "osee_join_artifact jart1, osee_relation_link rel1, osee_txs txs1\n" + // " WHERE \n" + // "(rel1.a_art_id = jart1.art_id OR rel1.b_art_id = jart1.art_id) AND jart1.query_id = ? AND rel1.gamma_id = txs1.gamma_id\n" + // - " AND txs1.transaction_id <= jart1.transaction_id AND txs1.tx_current IN (1, 0) AND txs1.branch_id = jart1.branch_id\n" + // + " AND txs1.transaction_id <= jart1.transaction_id AND txs1.mod_type != 3 AND txs1.branch_id = jart1.branch_id\n" + // " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; - DataLoader dataLoader = factory.fromBranchAndArtifactIds(session, BRANCH, Arrays.asList(1, 2, 3)); - dataLoader.setLoadLevel(expectedLoadLevel); + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); dataLoader.fromTransaction(EXPECTED_TX_ID); assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); @@ -755,6 +757,58 @@ public class DataLoaderFactoryImplTest { verifyCommon(EXPECTED_TX_ID, expectedLoadLevel, EXCLUDE_DELETED, expected); } + @Test + public void testLoadArtifactIncludeDeletedAttributes() throws OseeCoreException { + LoadLevel expectedLoadLevel = LoadLevel.ALL; + String expected = + "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // + " jart1.art_id, rel1.rel_link_id, rel1.rel_link_type_id, rel1.a_art_id, rel1.b_art_id, rel1.rationale\n" + // + " FROM \n" + // + "osee_join_artifact jart1, osee_relation_link rel1, osee_txs txs1\n" + // + " WHERE \n" + // + "(rel1.a_art_id = jart1.art_id OR rel1.b_art_id = jart1.art_id) AND jart1.query_id = ? AND rel1.gamma_id = txs1.gamma_id\n" + // + " AND txs1.tx_current IN (1, 2, 3) AND txs1.branch_id = jart1.branch_id\n" + // + " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; + + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.includeDeletedAttributes(); + dataLoader.withAttributeIds(45, 55); + dataLoader.withAttributeTypes(CoreAttributeTypes.Annotation, CoreAttributeTypes.Category); + + assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); + + dataLoader.load(cancellation, builder); + + verifyCommon(EXPECTED_HEAD_TX_ID, expectedLoadLevel, EXCLUDE_DELETED, expected); + } + + @Test + public void testLoadArtifactIncludeDeletedRelations() throws OseeCoreException { + LoadLevel expectedLoadLevel = LoadLevel.ALL; + String expected = + "SELECT/*+ ordered */ txs1.gamma_id, txs1.mod_type, txs1.branch_id, txs1.transaction_id,\n" + // + " jart1.art_id, rel1.rel_link_id, rel1.rel_link_type_id, rel1.a_art_id, rel1.b_art_id, rel1.rationale\n" + // + " FROM \n" + // + "osee_join_artifact jart1, osee_relation_link rel1, osee_txs txs1\n" + // + " WHERE \n" + // + "(rel1.a_art_id = jart1.art_id OR rel1.b_art_id = jart1.art_id) AND jart1.query_id = ? AND rel1.rel_link_type_id = ? AND rel1.gamma_id = txs1.gamma_id\n" + // + " AND txs1.tx_current IN (1, 2, 3) AND txs1.branch_id = jart1.branch_id\n" + // + " ORDER BY txs1.branch_id, jart1.art_id, rel1.rel_link_id, txs1.transaction_id desc"; + + DataLoader dataLoader = factory.newDataLoaderFromIds(session, BRANCH, Arrays.asList(1, 2, 3)); + dataLoader.withLoadLevel(expectedLoadLevel); + dataLoader.includeDeletedRelations(); + dataLoader.withRelationTypes(CoreRelationTypes.Default_Hierarchical__Child); + + assertEquals(expectedLoadLevel, dataLoader.getLoadLevel()); + + dataLoader.load(cancellation, builder); + + verifyCommon(EXPECTED_HEAD_TX_ID, expectedLoadLevel, EXCLUDE_DELETED, expected, + CoreRelationTypes.Default_Hierarchical__Child.getGuid().intValue()); + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private static final Long JQID = Long.MAX_VALUE; @@ -789,7 +843,7 @@ public class DataLoaderFactoryImplTest { assertEquals(isHeadTx, OptionsUtil.isHeadTransaction(options)); assertEquals(!isHeadTx, OptionsUtil.isHistorical(options)); assertEquals(level, OptionsUtil.getLoadLevel(options)); - assertEquals(includeDeleted, OptionsUtil.getIncludeDeleted(options)); + assertEquals(includeDeleted, OptionsUtil.getIncludeDeletedArtifacts(options)); assertTrue(joinCaptor.getValue().wasStored()); assertEquals(3, joinCaptor.getValue().size()); diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java index b5fa13b4760..3ed2b346490 100644 --- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java +++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java @@ -17,8 +17,10 @@ import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.when; + import java.util.Iterator; import java.util.List; + import org.eclipse.osee.executor.admin.ExecutorAdmin; import org.eclipse.osee.framework.core.enums.CaseType; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; @@ -276,7 +278,7 @@ public class ArtifactQuerySqlContextFactoryImplTest { " ORDER BY art1.art_id, txs1.branch_id"; queryData.addCriteria(GUIDS, IDS, TYPES); - OptionsUtil.setIncludeDeleted(queryData.getOptions(), true); + OptionsUtil.setIncludeDeletedArtifacts(queryData.getOptions(), true); QuerySqlContext context = queryEngine.createQueryContext(session, queryData); Assert.assertEquals(expected, context.getSql()); diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java index e2db5d86070..0d2645246f3 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java @@ -16,6 +16,7 @@ import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; + import org.eclipse.osee.executor.admin.HasCancellation; import org.eclipse.osee.framework.core.enums.LoadLevel; import org.eclipse.osee.framework.core.enums.ModificationType; @@ -34,6 +35,7 @@ import org.eclipse.osee.orcs.core.ds.LoadDataHandlerAdapter; import org.eclipse.osee.orcs.core.ds.OrcsData; import org.eclipse.osee.orcs.core.ds.RelationData; import org.eclipse.osee.orcs.db.internal.IdentityLocator; + import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; @@ -86,9 +88,9 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory { } private Set<Integer> determineWhichArtifactsNotOnDestination(HasCancellation cancellation, OrcsSession session, Set<Integer> artIds, TransactionRecord destTx) throws OseeCoreException { - DataLoader loader = dataLoaderFactory.fromBranchAndArtifactIds(session, destTx.getBranch(), artIds); + DataLoader loader = dataLoaderFactory.newDataLoaderFromIds(session, destTx.getBranch(), artIds); final Set<Integer> missingArtIds = new LinkedHashSet<Integer>(artIds); - loader.includeDeleted(); + loader.includeDeletedArtifacts(); loader.fromTransaction(destTx.getId()); loader.load(cancellation, new LoadDataHandlerAdapter() { @@ -105,9 +107,9 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory { final Set<ChangeItem> toReturn = new LinkedHashSet<ChangeItem>(); final Set<RelationData> relations = new LinkedHashSet<RelationData>(); - DataLoader loader = dataLoaderFactory.fromBranchAndArtifactIds(session, sourceTx.getBranch(), missingArtIds); - loader.setLoadLevel(LoadLevel.FULL); - loader.includeDeleted(); + DataLoader loader = dataLoaderFactory.newDataLoaderFromIds(session, sourceTx.getBranch(), missingArtIds); + loader.withLoadLevel(LoadLevel.ALL); + loader.includeDeletedArtifacts(); loader.fromTransaction(sourceTx.getId()); loader.load(cancellation, new LoadDataHandlerAdapter() { @@ -163,7 +165,7 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory { final Set<RelationChangeItem> toReturn = new LinkedHashSet<RelationChangeItem>(); DataLoader loader = - dataLoaderFactory.fromBranchAndArtifactIds(session, destTx.getBranch(), relationChangesToAdd.keySet()); + dataLoaderFactory.newDataLoaderFromIds(session, destTx.getBranch(), relationChangesToAdd.keySet()); loader.fromTransaction(destTx.getId()); loader.load(cancellation, new LoadDataHandlerAdapter() { diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImpl.java index a2413fe51ea..49c5404026d 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImpl.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImpl.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.osee.orcs.db.internal.loader; +import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -30,9 +31,7 @@ import org.eclipse.osee.orcs.core.ds.OptionsUtil; import org.eclipse.osee.orcs.core.ds.QueryContext; import org.eclipse.osee.orcs.db.internal.loader.executors.AbstractLoadExecutor; import org.eclipse.osee.orcs.db.internal.loader.executors.ArtifactQueryContextLoadExecutor; -import org.eclipse.osee.orcs.db.internal.loader.executors.LoadExecutor; import org.eclipse.osee.orcs.db.internal.loader.executors.QueryContextLoadExecutor; -import org.eclipse.osee.orcs.db.internal.loader.executors.UuidsLoadExecutor; import org.eclipse.osee.orcs.db.internal.search.QuerySqlContext; import org.eclipse.osee.orcs.db.internal.search.engines.ArtifactQuerySqlContext; @@ -91,7 +90,7 @@ public class DataLoaderFactoryImpl implements DataLoaderFactory { } @Override - public DataLoader fromQueryContext(QueryContext queryContext) throws OseeCoreException { + public DataLoader newDataLoader(QueryContext queryContext) throws OseeCoreException { AbstractLoadExecutor executor; if (queryContext instanceof ArtifactQuerySqlContext) { ArtifactQuerySqlContext sqlQueryContext = adapt(ArtifactQuerySqlContext.class, queryContext); @@ -101,37 +100,31 @@ public class DataLoaderFactoryImpl implements DataLoaderFactory { executor = new QueryContextLoadExecutor(loader, dbService, sqlQueryContext); } Options options = OptionsUtil.createOptions(); - return new DataLoaderImpl(logger, executor, options); + return new DataLoaderImpl(logger, executor, options, null, null, branchCache, loader); } @Override - public DataLoader fromBranchAndArtifactIds(OrcsSession session, IOseeBranch branch, Collection<Integer> artifactIds) throws OseeCoreException { - Conditions.checkNotNull(branch, "branch"); - Conditions.checkNotNullOrEmpty(artifactIds, "artifactIds"); + public DataLoader newDataLoaderFromIds(OrcsSession session, IOseeBranch branch, Integer... ids) throws OseeCoreException { + return newDataLoaderFromIds(session, branch, Arrays.asList(ids)); + } - AbstractLoadExecutor executor = new LoadExecutor(loader, dbService, branchCache, session, branch, artifactIds); + @Override + public DataLoader newDataLoaderFromIds(OrcsSession session, IOseeBranch branch, Collection<Integer> ids) throws OseeCoreException { + Conditions.checkNotNull(branch, "branch"); Options options = OptionsUtil.createOptions(); - return new DataLoaderImpl(logger, executor, options); + return new DataLoaderImpl(logger, ids, options, session, branch, branchCache, loader); } @Override - public DataLoader fromBranchAndArtifactIds(OrcsSession session, IOseeBranch branch, int... artifactIds) throws OseeCoreException { - return fromBranchAndArtifactIds(session, branch, toCollection(artifactIds)); + public DataLoader newDataLoaderFromGuids(OrcsSession session, IOseeBranch branch, String... guids) throws OseeCoreException { + return newDataLoaderFromGuids(session, branch, Arrays.asList(guids)); } @Override - public DataLoader fromBranchAndIds(OrcsSession session, IOseeBranch branch, Collection<String> guids) throws OseeCoreException { + public DataLoader newDataLoaderFromGuids(OrcsSession session, IOseeBranch branch, Collection<String> guids) throws OseeCoreException { Conditions.checkNotNull(branch, "branch"); - Conditions.checkNotNullOrEmpty(guids, "artifactGuids"); - - AbstractLoadExecutor executor = new UuidsLoadExecutor(loader, dbService, branchCache, session, branch, guids); Options options = OptionsUtil.createOptions(); - return new DataLoaderImpl(logger, executor, options); - } - - @Override - public DataLoader fromBranchAndIds(OrcsSession session, IOseeBranch branch, String... ids) throws OseeCoreException { - return fromBranchAndIds(session, branch, toCollection(ids)); + return new DataLoaderImpl(logger, options, session, branch, branchCache, loader, guids); } @SuppressWarnings("unchecked") diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderImpl.java index 68632e1b931..844f3408319 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderImpl.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderImpl.java @@ -14,14 +14,19 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; + import org.eclipse.osee.executor.admin.HasCancellation; import org.eclipse.osee.framework.core.data.IAttributeType; +import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.LoadLevel; import org.eclipse.osee.framework.core.exception.OseeExceptions; +import org.eclipse.osee.framework.core.model.cache.BranchCache; +import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.logger.Log; +import org.eclipse.osee.orcs.OrcsSession; import org.eclipse.osee.orcs.core.ds.DataLoader; import org.eclipse.osee.orcs.core.ds.LoadDataHandler; import org.eclipse.osee.orcs.core.ds.Options; @@ -31,6 +36,8 @@ import org.eclipse.osee.orcs.db.internal.loader.criteria.CriteriaAttribute; import org.eclipse.osee.orcs.db.internal.loader.criteria.CriteriaOrcsLoad; import org.eclipse.osee.orcs.db.internal.loader.criteria.CriteriaRelation; import org.eclipse.osee.orcs.db.internal.loader.executors.AbstractLoadExecutor; +import org.eclipse.osee.orcs.db.internal.loader.executors.LoadExecutor; +import org.eclipse.osee.orcs.db.internal.loader.executors.UuidsLoadExecutor; public class DataLoaderImpl implements DataLoader { @@ -41,16 +48,46 @@ public class DataLoaderImpl implements DataLoader { private final Collection<IRelationType> relationTypes = new HashSet<IRelationType>(); private final Log logger; - private final AbstractLoadExecutor loadExecutor; + private AbstractLoadExecutor loadExecutor; private final Options options; - public DataLoaderImpl(Log logger, AbstractLoadExecutor loadExecutor, Options options) { + private final OrcsSession session; + private final IOseeBranch branch; + private final BranchCache branchCache; + private final SqlObjectLoader sqlLoader; + + public DataLoaderImpl(Log logger, AbstractLoadExecutor loadExecutor, Options options, OrcsSession session, IOseeBranch branch, BranchCache branchCache, SqlObjectLoader sqlLoader) { this.logger = logger; this.loadExecutor = loadExecutor; this.options = options; + this.session = session; + this.branch = branch; + this.branchCache = branchCache; + this.sqlLoader = sqlLoader; + } + + public DataLoaderImpl(Log logger, Collection<Integer> artifactIds, Options options, OrcsSession session, IOseeBranch branch, BranchCache branchCache, SqlObjectLoader sqlLoader) { + this.logger = logger; + this.options = options; + this.session = session; + this.branch = branch; + this.branchCache = branchCache; + this.sqlLoader = sqlLoader; + + withArtifactIds(artifactIds); + } + + public DataLoaderImpl(Log logger, Options options, OrcsSession session, IOseeBranch branch, BranchCache branchCache, SqlObjectLoader sqlLoader, Collection<String> artifactIds) { + this.logger = logger; + this.options = options; + this.session = session; + this.branch = branch; + this.branchCache = branchCache; + this.sqlLoader = sqlLoader; + + withArtifactGuids(artifactIds); } - @Override public DataLoader resetToDefaults() { OptionsUtil.reset(getOptions()); @@ -73,20 +110,52 @@ public class DataLoaderImpl implements DataLoader { } @Override - public DataLoader includeDeleted() { - includeDeleted(true); + public DataLoader includeDeletedArtifacts() { + includeDeletedArtifacts(true); + return this; + } + + @Override + public DataLoader includeDeletedArtifacts(boolean enabled) { + OptionsUtil.setIncludeDeletedArtifacts(getOptions(), enabled); + return this; + } + + @Override + public DataLoader includeDeletedAttributes() { + return includeDeletedAttributes(true); + } + + @Override + public DataLoader includeDeletedAttributes(boolean enabled) { + OptionsUtil.setIncludeDeletedAttributes(getOptions(), enabled); return this; } @Override - public DataLoader includeDeleted(boolean enabled) { - OptionsUtil.setIncludeDeleted(getOptions(), enabled); + public DataLoader includeDeletedRelations() { + return includeDeletedRelations(true); + } + + @Override + public DataLoader includeDeletedRelations(boolean enabled) { + OptionsUtil.setIncludeDeletedRelations(getOptions(), enabled); return this; } @Override - public boolean areDeletedIncluded() { - return OptionsUtil.areDeletedIncluded(getOptions()); + public boolean areDeletedArtifactsIncluded() { + return OptionsUtil.areDeletedArtifactsIncluded(getOptions()); + } + + @Override + public boolean areDeletedAttributesIncluded() { + return OptionsUtil.areDeletedAttributesIncluded(getOptions()); + } + + @Override + public boolean areDeletedRelationsIncluded() { + return OptionsUtil.areDeletedRelationsIncluded(getOptions()); } @Override @@ -101,7 +170,7 @@ public class DataLoaderImpl implements DataLoader { } @Override - public DataLoader headTransaction() { + public DataLoader fromHeadTransaction() { OptionsUtil.setHeadTransaction(getOptions()); return this; } @@ -117,55 +186,67 @@ public class DataLoaderImpl implements DataLoader { } @Override - public DataLoader setLoadLevel(LoadLevel loadLevel) { + public DataLoader withLoadLevel(LoadLevel loadLevel) { OptionsUtil.setLoadLevel(getOptions(), loadLevel); return this; } + private DataLoader withArtifactIds(Collection<Integer> artifactIds) { + loadExecutor = + new LoadExecutor(sqlLoader, sqlLoader.getDatabaseService(), branchCache, session, branch, artifactIds); + return this; + } + + private DataLoader withArtifactGuids(Collection<String> artifactGuids) { + loadExecutor = + new UuidsLoadExecutor(sqlLoader, sqlLoader.getDatabaseService(), branchCache, session, branch, artifactGuids); + return this; + } + @Override - public DataLoader loadAttributeType(IAttributeType... attributeType) throws OseeCoreException { - return loadAttributeTypes(Arrays.asList(attributeType)); + public DataLoader withAttributeTypes(IAttributeType... attributeType) throws OseeCoreException { + return withAttributeTypes(Arrays.asList(attributeType)); } @SuppressWarnings("unused") @Override - public DataLoader loadAttributeTypes(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException { + public DataLoader withAttributeTypes(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException { this.attributeTypes.addAll(attributeTypes); return this; } @Override - public DataLoader loadRelationType(IRelationType... relationType) throws OseeCoreException { - return loadRelationTypes(Arrays.asList(relationType)); + public DataLoader withRelationTypes(IRelationType... relationType) throws OseeCoreException { + return withRelationTypes(Arrays.asList(relationType)); } @SuppressWarnings("unused") @Override - public DataLoader loadRelationTypes(Collection<? extends IRelationType> relationTypes) throws OseeCoreException { + public DataLoader withRelationTypes(Collection<? extends IRelationType> relationTypes) throws OseeCoreException { this.relationTypes.addAll(relationTypes); return this; } @Override - public DataLoader loadAttributeLocalId(int... attributeIds) throws OseeCoreException { - return loadAttributeLocalIds(toCollection(attributeIds)); + public DataLoader withAttributeIds(int... attributeIds) throws OseeCoreException { + return withAttributeIds(toCollection(attributeIds)); } @SuppressWarnings("unused") @Override - public DataLoader loadAttributeLocalIds(Collection<Integer> attributeIds) throws OseeCoreException { + public DataLoader withAttributeIds(Collection<Integer> attributeIds) throws OseeCoreException { this.attributeIds.addAll(attributeIds); return this; } @Override - public DataLoader loadRelationLocalId(int... relationIds) throws OseeCoreException { - return loadRelationLocalIds(toCollection(relationIds)); + public DataLoader withRelationIds(int... relationIds) throws OseeCoreException { + return withRelationIds(toCollection(relationIds)); } @SuppressWarnings("unused") @Override - public DataLoader loadRelationLocalIds(Collection<Integer> relationIds) throws OseeCoreException { + public DataLoader withRelationIds(Collection<Integer> relationIds) throws OseeCoreException { this.relationIds.addAll(relationIds); return this; } @@ -188,6 +269,11 @@ public class DataLoaderImpl implements DataLoader { ////////////////////// EXECUTE METHODS @Override + public void load(LoadDataHandler handler) throws OseeCoreException { + load(null, handler); + } + + @Override public void load(HasCancellation cancellation, LoadDataHandler handler) throws OseeCoreException { long startTime = 0; @@ -197,6 +283,7 @@ public class DataLoaderImpl implements DataLoader { startTime = System.currentTimeMillis(); logger.trace("%s [start] - [%s] [%s]", getClass().getSimpleName(), criteria, options); } + determineLoadExecutor(); Exception saveException = null; try { handler.onLoadStart(); @@ -228,4 +315,11 @@ public class DataLoaderImpl implements DataLoader { CriteriaRelation relationCriteria = new CriteriaRelation(copy(relationIds), copy(relationTypes)); return new CriteriaOrcsLoad(artifactCriteria, attributeCriteria, relationCriteria); } + + private void determineLoadExecutor() throws OseeCoreException { + if (loadExecutor == null) { + throw new OseeArgumentException("Either artifacts ID or Query Context must be specified"); + } + } + } diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/LoadSqlWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/LoadSqlWriter.java index 49383f4d0fe..f2906761c42 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/LoadSqlWriter.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/LoadSqlWriter.java @@ -10,7 +10,9 @@ *******************************************************************************/ package org.eclipse.osee.orcs.db.internal.loader; +import java.util.Iterator; import java.util.List; +import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -80,34 +82,79 @@ public class LoadSqlWriter extends AbstractSqlWriter { } private void writeTxFilter(String txsAlias, String artJoinAlias, StringBuilder sb) { + //@formatter:off + /********************************************************************* + * The clause handling the inclusion of deleted items changes based on case + * note this applies to the 3 tables ARTIFACT_TABLE, ATTRIBUTE_TABLE, RELATION_TABLE + * case 1: No items allow deleted + * case 2: One table in query + * case 3: All tables that are in the query allow deleted + * case 4: More than one table with differing deletion flags + */ + //@formatter:on + boolean hasTable[] = + { + getAliasManager().hasAlias(TableEnum.ARTIFACT_TABLE), + getAliasManager().hasAlias(TableEnum.ATTRIBUTE_TABLE), + getAliasManager().hasAlias(TableEnum.RELATION_TABLE)}; + + /********************************************************************** + * Allow deleted artifacts applies even if the artifact table is not in the query. The other two only make sense + * when the table is also used + */ + boolean allowDeletedAtrifacts = OptionsUtil.areDeletedArtifactsIncluded(getOptions()); + boolean allowDeletedAttributes = OptionsUtil.areDeletedAttributesIncluded(getOptions()); + boolean allowDeletedRelations = OptionsUtil.areDeletedRelationsIncluded(getOptions()); + boolean areDeletedIncluded = allowDeletedAtrifacts || allowDeletedAttributes || allowDeletedRelations; + boolean areDeletedSame = true; + if (areDeletedIncluded) { + /******************************** + * there must be at least 2 table in the query for a difference + */ + int count = 0; + for (boolean add : hasTable) { + if (add) { + count++; + } + } + if (count > 1) { + areDeletedSame = + !((hasTable[0] && !allowDeletedAtrifacts) || (hasTable[1] && !allowDeletedAttributes) || (hasTable[2] && !allowDeletedRelations)); + } + } if (OptionsUtil.isHistorical(getOptions())) { sb.append(txsAlias); sb.append(".transaction_id <= "); sb.append(artJoinAlias); sb.append(".transaction_id"); - if (!OptionsUtil.areDeletedIncluded(getOptions())) { + if (!areDeletedIncluded) { sb.append(" AND "); sb.append(txsAlias); - sb.append(".tx_current"); - sb.append(" IN ("); - sb.append(String.valueOf(TxChange.CURRENT.getValue())); - sb.append(", "); - sb.append(String.valueOf(TxChange.NOT_CURRENT.getValue())); - sb.append(")"); + sb.append(".mod_type"); + sb.append(" != "); + sb.append(String.valueOf(ModificationType.DELETED.getValue())); + } else if (!areDeletedSame) { + sb.append(" AND "); + buildDeletedClause(sb, txsAlias); } } else { - sb.append(txsAlias); - sb.append(".tx_current"); - if (OptionsUtil.areDeletedIncluded(getOptions())) { - sb.append(" IN ("); - sb.append(String.valueOf(TxChange.CURRENT.getValue())); - sb.append(", "); - sb.append(String.valueOf(TxChange.DELETED.getValue())); - sb.append(", "); - sb.append(String.valueOf(TxChange.ARTIFACT_DELETED.getValue())); - sb.append(")"); + if (areDeletedIncluded) { + if (areDeletedSame) { + sb.append(txsAlias); + sb.append(".tx_current"); + sb.append(" IN ("); + sb.append(String.valueOf(TxChange.CURRENT.getValue())); + sb.append(", "); + sb.append(String.valueOf(TxChange.DELETED.getValue())); + sb.append(", "); + sb.append(String.valueOf(TxChange.ARTIFACT_DELETED.getValue())); + sb.append(")"); + } else { + buildDeletedClause(sb, txsAlias); + } } else { - sb.append(" = "); + sb.append(txsAlias); + sb.append(".tx_current = "); sb.append(String.valueOf(TxChange.CURRENT.getValue())); } } @@ -117,4 +164,96 @@ public class LoadSqlWriter extends AbstractSqlWriter { public Options getOptions() { return getContext().getOptions(); } + + private void buildDeletedClause(StringBuilder sb, String txsAlias) { + /***************************************************************** + * It is assumed this is called only if at least one type of deleted is allowed and they differ. These checks are + * not made + */ + int count = 0; + if (getAliasManager().hasAlias(TableEnum.ARTIFACT_TABLE)) { + List<String> artTables = getAliasManager().getAliases(TableEnum.ARTIFACT_TABLE); + if (OptionsUtil.areDeletedArtifactsIncluded(getOptions())) { + sb.append("("); + buildTableGamma(sb, artTables, txsAlias); + sb.append(" AND "); + buildTxClause(sb, txsAlias); + sb.append(")"); + count++; + } + } + if (getAliasManager().hasAlias(TableEnum.ATTRIBUTE_TABLE)) { + List<String> attrTables = getAliasManager().getAliases(TableEnum.ATTRIBUTE_TABLE); + if (OptionsUtil.areDeletedAttributesIncluded(getOptions())) { + if (count > 1) { + sb.append(" AND "); + } + sb.append("("); + buildTableGamma(sb, attrTables, txsAlias); + sb.append(" AND "); + buildTxClause(sb, txsAlias); + sb.append(")"); + count++; + } + } + if (getAliasManager().hasAlias(TableEnum.RELATION_TABLE)) { + List<String> relationTables = getAliasManager().getAliases(TableEnum.RELATION_TABLE); + if (OptionsUtil.areDeletedAttributesIncluded(getOptions())) { + if (count > 1) { + sb.append(" AND "); + } + sb.append("("); + buildTableGamma(sb, relationTables, txsAlias); + sb.append(" AND "); + buildTxClause(sb, txsAlias); + sb.append(")"); + count++; + } + } + } + + private void buildTableGamma(StringBuilder sb, List<String> tableAliases, String txsAlias) { + if (tableAliases.size() == 1) { + sb.append(tableAliases.get(0)); + sb.append(".gamma_id = "); + sb.append(txsAlias); + sb.append(".gamma_id"); + } else { + Iterator<String> iter = tableAliases.iterator(); + iter.next(); + sb.append("("); + sb.append(iter); + sb.append(".gamma_id = "); + sb.append(txsAlias); + sb.append(".gamma_id"); + while (iter.hasNext()) { + iter.next(); + sb.append(" OR "); + sb.append(iter); + sb.append(".gamma_id = "); + sb.append(txsAlias); + sb.append(".gamma_id"); + } + sb.append(")"); + } + } + + private void buildTxClause(StringBuilder sb, String txsAlias) { + + sb.append(txsAlias); + sb.append(".tx_current"); + if (OptionsUtil.isHistorical(getOptions())) { + sb.append(" IN ("); + sb.append(String.valueOf(TxChange.CURRENT.getValue())); + sb.append(", "); + sb.append(String.valueOf(TxChange.DELETED.getValue())); + sb.append(", "); + sb.append(String.valueOf(TxChange.ARTIFACT_DELETED.getValue())); + sb.append(")"); + } else { + sb.append(" = "); + sb.append(String.valueOf(TxChange.CURRENT.getValue())); + } + } + } diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/SqlObjectLoader.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/SqlObjectLoader.java index 1d210fd3cc7..2190444db0d 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/SqlObjectLoader.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/SqlObjectLoader.java @@ -82,7 +82,15 @@ public class SqlObjectLoader { txProcessor = new TransactionLoadProcessor(objectFactory); } - private IOseeDatabaseService getDatabaseService() { + public SqlHandlerFactory getFactory() { + return handlerFactory; + } + + public SqlProvider getProvider() { + return sqlProvider; + } + + public IOseeDatabaseService getDatabaseService() { return dbService; } @@ -93,11 +101,11 @@ public class SqlObjectLoader { } private boolean isAttributeLoadingAllowed(LoadLevel level) { - return level != LoadLevel.SHALLOW && level != LoadLevel.RELATION; + return level != LoadLevel.ARTIFACT_DATA && level != LoadLevel.RELATION_DATA; } private boolean isRelationLoadingAllowed(LoadLevel level) { - return level != LoadLevel.SHALLOW && level != LoadLevel.ATTRIBUTE; + return level != LoadLevel.ARTIFACT_DATA && level != LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA; } private void writeSql(Criteria criteria, LoadSqlContext context) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/ArtifactLoadProcessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/ArtifactLoadProcessor.java index d1b99c79cf5..bf1ed742e57 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/ArtifactLoadProcessor.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/ArtifactLoadProcessor.java @@ -41,7 +41,7 @@ public class ArtifactLoadProcessor extends LoadProcessor<ArtifactData, ArtifactO ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type")); // assumption: SQL is returning unwanted deleted artifacts only in the historical case boolean historical = OptionsUtil.isHistorical(options); - if (!historical || OptionsUtil.areDeletedIncluded(options) || modType != ModificationType.DELETED) { + if (!historical || OptionsUtil.areDeletedArtifactsIncluded(options) || modType != ModificationType.DELETED) { long gamma = chStmt.getInt("gamma_id"); int txId = chStmt.getInt("transaction_id"); diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/AbstractSimpleQueryCallableFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/AbstractSimpleQueryCallableFactory.java index b57ab6a4daf..e41d44d62ec 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/AbstractSimpleQueryCallableFactory.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/AbstractSimpleQueryCallableFactory.java @@ -61,7 +61,7 @@ public abstract class AbstractSimpleQueryCallableFactory implements QueryCallabl QuerySqlContext queryContext = queryContextFactory.createQueryContext(getSession(), getQueryData()); checkForCancelled(); - DataLoader loader = objectLoader.fromQueryContext(queryContext); + DataLoader loader = objectLoader.newDataLoader(queryContext); loader.setOptions(getQueryData().getOptions()); final AtomicInteger counter = new AtomicInteger(); diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQueryCallableFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQueryCallableFactory.java index d05c4b6d339..6b73c7f3d4f 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQueryCallableFactory.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQueryCallableFactory.java @@ -87,7 +87,7 @@ public class ArtifactQueryCallableFactory implements QueryCallableFactory { } private boolean isLoadLevelTooLow(LoadLevel level) { - return LoadLevel.SHALLOW == level; + return LoadLevel.ARTIFACT_DATA == level; } protected boolean isPostProcessRequired() { @@ -98,14 +98,14 @@ public class ArtifactQueryCallableFactory implements QueryCallableFactory { QuerySqlContext queryContext = queryContextFactory.createQueryContext(getSession(), getQueryData()); checkForCancelled(); - DataLoader loader = objectLoader.fromQueryContext(queryContext); + DataLoader loader = objectLoader.newDataLoader(queryContext); loader.setOptions(getQueryData().getOptions()); if (enableFilter) { // Ensure we will receive attribute data for post-process LoadLevel level = loader.getLoadLevel(); if (isLoadLevelTooLow(level)) { - loader.setLoadLevel(LoadLevel.ATTRIBUTE); + loader.withLoadLevel(LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA); } } ArtifactDataCountHandler countingHandler = factory.createHandler(this, getQueryData(), queryContext, handler); diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlWriter.java index 6fd71369e1e..744d6fd945b 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlWriter.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlWriter.java @@ -102,7 +102,7 @@ public class ArtifactQuerySqlWriter extends AbstractSqlWriter { sb.append(txsAlias); sb.append(".transaction_id <= ?"); addParameter(OptionsUtil.getFromTransaction(getOptions())); - if (!OptionsUtil.areDeletedIncluded(getOptions())) { + if (!OptionsUtil.areDeletedArtifactsIncluded(getOptions())) { sb.append(AND_WITH_NEWLINES); sb.append(txsAlias); sb.append(".tx_current"); @@ -115,7 +115,7 @@ public class ArtifactQuerySqlWriter extends AbstractSqlWriter { } else { sb.append(txsAlias); sb.append(".tx_current"); - if (OptionsUtil.areDeletedIncluded(getOptions())) { + if (OptionsUtil.areDeletedArtifactsIncluded(getOptions())) { sb.append(" IN ("); sb.append(String.valueOf(TxChange.CURRENT.getValue())); sb.append(", "); diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/ComodificationCheck.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/ComodificationCheck.java index f0d4c1324ce..4a5238f7c4a 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/ComodificationCheck.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/ComodificationCheck.java @@ -46,9 +46,9 @@ public class ComodificationCheck implements TransactionProcessor { txData.getChangeSet().accept(checker); if (!checker.getArtifactIds().isEmpty()) { - DataLoader loader = dataLoader.fromBranchAndArtifactIds(session, txData.getBranch(), checker.getArtifactIds()); - loader.loadAttributeLocalIds(checker.getAttributeIds()); - loader.loadRelationLocalIds(checker.getRelationIds()); + DataLoader loader = dataLoader.newDataLoaderFromIds(session, txData.getBranch(), checker.getArtifactIds()); + loader.withAttributeIds(checker.getAttributeIds()); + loader.withRelationIds(checker.getRelationIds()); loader.load(cancellation, checker); } diff --git a/plugins/org.eclipse.osee.orcs.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.test/META-INF/MANIFEST.MF index 9a6f1037762..32524c483a2 100644 --- a/plugins/org.eclipse.osee.orcs.test/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.orcs.test/META-INF/MANIFEST.MF @@ -18,6 +18,7 @@ Import-Package: org.eclipse.osee.event, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.orcs, + org.eclipse.osee.orcs.core.ds, org.eclipse.osee.orcs.data, org.eclipse.osee.orcs.db.mock, org.eclipse.osee.orcs.search, |