Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2017-07-26 12:06:33 -0400
committerRyan D. Brooks2017-08-01 12:33:33 -0400
commitf96f4d98b6386957cecac87098debdcbdc5fc153 (patch)
tree8f018a7a3d48a416248a8a30852a6f91e3730748
parentdf5c1eaf602d059cefb27d9bcb1f7c426cf8d2c4 (diff)
downloadorg.eclipse.osee-f96f4d98b6386957cecac87098debdcbdc5fc153.tar.gz
org.eclipse.osee-f96f4d98b6386957cecac87098debdcbdc5fc153.tar.xz
org.eclipse.osee-f96f4d98b6386957cecac87098debdcbdc5fc153.zip
refactor: Use ArtifactId in DataLoaderFactory.newDataLoader
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/DataLoaderFactory.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/primitives/AttributeImpl.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java117
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java139
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java64
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImpl.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/AttributeDataImpl.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsVersionedObjectImpl.java7
12 files changed, 191 insertions, 179 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java
index 508ee1f5f9..9491ee4383 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java
@@ -26,7 +26,7 @@ public interface RelationId extends Id {
return valueOf(Long.valueOf(id));
}
- public static RelationId valueOf(Long id) {
+ public static RelationId valueOf(long id) {
final class RelationIdImpl extends BaseId implements RelationId {
public RelationIdImpl(Long txId) {
super(txId);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java
index 07144dc2b0..046e8a39a0 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java
@@ -26,7 +26,7 @@ public interface RelationTypeId extends Id {
return valueOf(Long.valueOf(id));
}
- public static RelationTypeId valueOf(Long id) {
+ public static RelationTypeId valueOf(long id) {
final class RelationTypeIdImpl extends BaseId implements RelationTypeId {
public RelationTypeIdImpl(Long txId) {
super(txId);
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 c74b41a28d..d3fcc23a23 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
@@ -12,6 +12,7 @@ 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.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.OrcsSession;
@@ -25,7 +26,7 @@ public interface DataLoaderFactory {
DataLoader newDataLoader(QueryContext queryContext) throws OseeCoreException;
- DataLoader newDataLoaderFromIds(OrcsSession session, BranchId branch, Integer... artifactIds) throws OseeCoreException;
+ DataLoader newDataLoader(OrcsSession session, BranchId branch, Collection<ArtifactId> artifactIds);
DataLoader newDataLoaderFromIds(OrcsSession session, BranchId branch, Collection<Integer> artifactIds) throws OseeCoreException;
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/primitives/AttributeImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/primitives/AttributeImpl.java
index 8ce73ad898..b14863584e 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/primitives/AttributeImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/primitives/AttributeImpl.java
@@ -16,6 +16,7 @@ import java.lang.ref.Reference;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -321,4 +322,14 @@ public abstract class AttributeImpl<T> implements Comparable<AttributeImpl<T>>,
return getOrcsData().getId();
}
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Id) {
+ return getId().equals(((Id) obj).getId());
+ }
+ if (obj instanceof Long) {
+ return getId().equals(obj);
+ }
+ return false;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java
index 6548869460..fe3bf2a1da 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertEquals;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
@@ -43,7 +44,7 @@ public class IntegrationUtil {
public static void verifyData(ArtifactData data, Object... values) {
int index = 0;
- assertEquals(values[index++], data.getLocalId());
+ assertEquals(values[index++], data);
assertEquals(values[index++], data.getGuid());
verifyData(data, index, values);
@@ -51,8 +52,8 @@ public class IntegrationUtil {
public static void verifyData(AttributeData data, Object... values) throws OseeCoreException {
int index = 0;
- assertEquals(values[index++], data.getLocalId());
- assertEquals(values[index++], data.getArtifactId());
+ assertEquals(values[index++], data);
+ assertEquals(values[index++], ArtifactId.valueOf(data.getArtifactId()));
index = verifyData(data, index, values);
@@ -65,8 +66,8 @@ public class IntegrationUtil {
int index = 0;
assertEquals(values[index++], data.getLocalId());
- assertEquals(values[index++], data.getArtIdA());
- assertEquals(values[index++], data.getArtIdB());
+ assertEquals(values[index++], data.getArtifactIdA());
+ assertEquals(values[index++], data.getArtifactIdB());
assertEquals(values[index++], data.getRationale());
verifyData(data, index, values);
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 1b2a8a13b5..1d6588f614 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.intergration;
+import static org.eclipse.osee.framework.core.enums.CoreArtifactTokens.UserGroups;
import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Folder;
import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.OseeTypeDefinition;
import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.Active;
@@ -26,13 +27,16 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Arrays;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.eclipse.osee.executor.admin.HasCancellation;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.ArtifactToken;
+import org.eclipse.osee.framework.core.data.AttributeId;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
@@ -98,17 +102,20 @@ public class LoaderTest {
private HasCancellation cancellation;
private DataLoaderFactory loaderFactory;
private static ArtifactReadable OseeTypesFrameworkArt;
- private static int OseeTypesFrameworkId, OseeTypesFrameworkActiveAttrId, OseeTypesFrameworkNameAttrId;
+ private static AttributeId OseeTypesFrameworkNameAttrId;
+ private static AttributeId OseeTypesFrameworkActiveAttrId;
private static long OseeTypesFrameworkActiveGammaId, OseeTypesFrameworkNameGammaId;
private static String OseeTypesFrameworkGuid;
private static ArtifactReadable OseeTypesClientDemoArt;
- private static int OseeTypesClientDemoId, OseeTypesClientDemoActiveAttrId, OseeTypesClientDemoNameAttrId;
+ private static AttributeId OseeTypesClientDemoActiveAttrId;
+ private static AttributeId OseeTypesClientDemoActiveAttrIdPlus1;
+ private static AttributeId OseeTypesClientDemoActiveAttrIdPlus2;
+ private static AttributeId OseeTypesClientDemoNameAttrId;
private static long OseeTypesClientDemoActiveGammaId, OseeTypesClientDemoNameGammaId;
private static String OseeTypesClientDemoGuid;
private static final long UserGroupsArtifactGammaId = 43L, OseeTypesClientDemoGammaId = 11L,
OseeTypesFrameworkGammaId = 8L;
- private static final int UserGroupsId = CoreArtifactTokens.UserGroups.getUuid().intValue();
- private static int UserGroupsNameAttrId;
+ private static AttributeId UserGroupsNameAttrId;
private static long UserGroupsNameGammaId;
private static final Map<ArtifactToken, Integer> artTokenToRelationId = new HashMap<>();
private static final Map<ArtifactToken, Long> artTokenToRelationGammaId = new HashMap<>();
@@ -124,6 +131,9 @@ public class LoaderTest {
private final TransactionId tx7 = TransactionId.valueOf(7);
// Transaction that AtsAdmin, AtsTempAdmin and OseeAccessAdmin were created in and related to User Groups
private final TransactionId tx10 = TransactionId.valueOf(10);
+ private static ArtifactId OseeTypesClientDemoId;
+ private static ArtifactId OseeTypesFrameworkId;
+ private static Collection<ArtifactId> artifactIds;
public void setUp() throws OseeCoreException {
JdbcClient jdbcClient = jdbcService.getClient();
@@ -135,28 +145,32 @@ public class LoaderTest {
for (ArtifactReadable art : orcsApi.getQueryFactory().fromBranch(CoreBranches.COMMON).andIsOfType(
CoreArtifactTypes.OseeTypeDefinition).getResults()) {
if (art.getName().contains("Framework")) {
- OseeTypesFrameworkId = art.getId().intValue();
+ OseeTypesFrameworkId = art;
OseeTypesFrameworkGuid = art.getGuid();
OseeTypesFrameworkArt = art;
for (AttributeReadable<Object> attr : art.getAttributes()) {
if (attr.isOfType(CoreAttributeTypes.Active)) {
- OseeTypesFrameworkActiveAttrId = attr.getId().intValue();
+ OseeTypesFrameworkActiveAttrId = attr;
OseeTypesFrameworkActiveGammaId = Long.valueOf(attr.getGammaId());
} else if (attr.isOfType(CoreAttributeTypes.Name)) {
- OseeTypesFrameworkNameAttrId = attr.getId().intValue();
+ OseeTypesFrameworkNameAttrId = attr;
OseeTypesFrameworkNameGammaId = Long.valueOf(attr.getGammaId());
}
}
} else if (art.getName().contains("OseeTypes_ClientDemo")) {
- OseeTypesClientDemoId = art.getId().intValue();
+ OseeTypesClientDemoId = art;
OseeTypesClientDemoGuid = art.getGuid();
OseeTypesClientDemoArt = art;
for (AttributeReadable<Object> attr : art.getAttributes()) {
if (attr.isOfType(CoreAttributeTypes.Active)) {
- OseeTypesClientDemoActiveAttrId = attr.getId().intValue();
- OseeTypesClientDemoActiveGammaId = Long.valueOf(attr.getGammaId());
+ OseeTypesClientDemoActiveAttrId = attr;
+ OseeTypesClientDemoActiveAttrIdPlus1 =
+ AttributeId.valueOf(OseeTypesClientDemoActiveAttrId.getId() + 1);
+ OseeTypesClientDemoActiveAttrIdPlus2 =
+ AttributeId.valueOf(OseeTypesClientDemoActiveAttrId.getId() + 2);
+ OseeTypesClientDemoActiveGammaId = attr.getGammaId();
} else if (attr.isOfType(CoreAttributeTypes.Name)) {
- OseeTypesClientDemoNameAttrId = attr.getId().intValue();
+ OseeTypesClientDemoNameAttrId = attr;
OseeTypesClientDemoNameGammaId = Long.valueOf(attr.getGammaId());
}
}
@@ -167,8 +181,8 @@ public class LoaderTest {
CoreArtifactTokens.UserGroups).getResults().getExactlyOne();
for (AttributeReadable<Object> attr : userGroupFolder.getAttributes()) {
if (attr.isOfType(CoreAttributeTypes.Name)) {
- UserGroupsNameAttrId = attr.getId().intValue();
- UserGroupsNameGammaId = Long.valueOf(attr.getGammaId());
+ UserGroupsNameAttrId = attr;
+ UserGroupsNameGammaId = attr.getGammaId();
}
}
ArtifactReadable defaultHierRoot = orcsApi.getQueryFactory().fromBranch(CoreBranches.COMMON).andId(
@@ -193,6 +207,8 @@ public class LoaderTest {
Assert.assertEquals(6, relationsArts.size());
}
+ artifactIds = Arrays.asList(OseeTypesFrameworkId, OseeTypesClientDemoId, UserGroups);
+
MockitoAnnotations.initMocks(this);
loaderFactory = dataStore.createDataModule(orcsApi.getOrcsTypes()).getDataLoaderFactory();
@@ -216,8 +232,7 @@ public class LoaderTest {
}
public void testLoad() throws OseeCoreException {
- DataLoader loader =
- loaderFactory.newDataLoaderFromIds(session, COMMON, OseeTypesFrameworkId, OseeTypesClientDemoId, UserGroupsId);
+ DataLoader loader = loaderFactory.newDataLoader(session, COMMON, artifactIds);
loader.withLoadLevel(LoadLevel.ALL);
verifyArtsAttrAndRelData(loader);
}
@@ -247,22 +262,23 @@ public class LoaderTest {
verifyData(attrs.next(), OseeTypesFrameworkActiveAttrId, OseeTypesFrameworkId, NEW, Active.getId(), COMMON, tx5,
OseeTypesFrameworkActiveGammaId, true, "");
- verifyData(attrs.next(), OseeTypesFrameworkActiveAttrId + 1, OseeTypesFrameworkId, NEW, Name.getId(), COMMON, tx5,
- OseeTypesFrameworkActiveGammaId + 1, "org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", "");
- verifyData(attrs.next(), OseeTypesFrameworkActiveAttrId + 2, OseeTypesFrameworkId, NEW,
- UriGeneralStringData.getId(), COMMON, tx5, OseeTypesFrameworkActiveGammaId + 2, "",
+ verifyData(attrs.next(), AttributeId.valueOf(OseeTypesFrameworkActiveAttrId.getId() + 1), OseeTypesFrameworkId,
+ NEW, Name.getId(), COMMON, tx5, OseeTypesFrameworkActiveGammaId + 1,
+ "org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", "");
+ verifyData(attrs.next(), AttributeId.valueOf(OseeTypesFrameworkActiveAttrId.getId() + 2), OseeTypesFrameworkId,
+ NEW, UriGeneralStringData.getId(), COMMON, tx5, OseeTypesFrameworkActiveGammaId + 2, "",
"attr://" + (OseeTypesFrameworkActiveGammaId + 2) + "/" + OseeTypesFrameworkGuid + ".zip");
verifyData(attrs.next(), OseeTypesClientDemoActiveAttrId, OseeTypesClientDemoId, NEW, Active.getId(), COMMON, tx5,
OseeTypesClientDemoActiveGammaId, true, "");
- verifyData(attrs.next(), OseeTypesClientDemoActiveAttrId + 1, OseeTypesClientDemoId, NEW, Name.getId(), COMMON,
+ verifyData(attrs.next(), OseeTypesClientDemoActiveAttrIdPlus1, OseeTypesClientDemoId, NEW, Name.getId(), COMMON,
tx5, OseeTypesClientDemoActiveGammaId + 1, "org.eclipse.osee.client.demo.OseeTypes_ClientDemo", "");
- verifyData(attrs.next(), OseeTypesClientDemoActiveAttrId + 2, OseeTypesClientDemoId, NEW,
+ verifyData(attrs.next(), OseeTypesClientDemoActiveAttrIdPlus2, OseeTypesClientDemoId, NEW,
UriGeneralStringData.getId(), COMMON, tx5, OseeTypesClientDemoActiveGammaId + 2, "",
"attr://" + (OseeTypesClientDemoActiveGammaId + 2) + "/" + OseeTypesClientDemoGuid + ".zip");
- verifyData(attrs.next(), UserGroupsNameAttrId, UserGroupsId, NEW, Name.getId(), COMMON, tx7,
- UserGroupsNameGammaId, "User Groups", "");
+ verifyData(attrs.next(), UserGroupsNameAttrId, UserGroups, NEW, Name.getId(), COMMON, tx7, UserGroupsNameGammaId,
+ "User Groups", "");
sort(relationCaptor.getAllValues());
Iterator<RelationData> rels = relationCaptor.getAllValues().iterator();
@@ -271,29 +287,26 @@ public class LoaderTest {
}
private void verifyRels(Iterator<RelationData> rels) {
- verifyData(rels.next(), artTokenToRelationId.get(CoreArtifactTokens.Everyone), UserGroupsId,
- CoreArtifactTokens.Everyone.getId().intValue(), "", NEW, Default_Hierarchical__Parent.getGuid(), COMMON, tx7,
+ verifyData(rels.next(), artTokenToRelationId.get(CoreArtifactTokens.Everyone), UserGroups,
+ CoreArtifactTokens.Everyone, "", NEW, Default_Hierarchical__Parent.getGuid(), COMMON, tx7,
artTokenToRelationGammaId.get(CoreArtifactTokens.Everyone));
verifyData(rels.next(), artTokenToRelationId.get(CoreArtifactTokens.DefaultHierarchyRoot),
- CoreArtifactTokens.DefaultHierarchyRoot.getId().intValue(), UserGroupsId, "", NEW,
- Default_Hierarchical__Parent.getGuid(), COMMON, tx7,
- artTokenToRelationGammaId.get(CoreArtifactTokens.DefaultHierarchyRoot));
- verifyData(rels.next(), artTokenToRelationId.get(CoreArtifactTokens.OseeAdmin), UserGroupsId,
- CoreArtifactTokens.OseeAdmin.getId().intValue(), "", NEW, Default_Hierarchical__Parent.getGuid(), COMMON, tx7,
+ CoreArtifactTokens.DefaultHierarchyRoot, UserGroups, "", NEW, Default_Hierarchical__Parent.getGuid(), COMMON,
+ tx7, artTokenToRelationGammaId.get(CoreArtifactTokens.DefaultHierarchyRoot));
+ verifyData(rels.next(), artTokenToRelationId.get(CoreArtifactTokens.OseeAdmin), UserGroups,
+ CoreArtifactTokens.OseeAdmin, "", NEW, Default_Hierarchical__Parent.getGuid(), COMMON, tx7,
artTokenToRelationGammaId.get(CoreArtifactTokens.OseeAdmin));
- verifyData(rels.next(), artTokenToRelationId.get(CoreArtifactTokens.OseeAccessAdmin), UserGroupsId,
- CoreArtifactTokens.OseeAccessAdmin.getId().intValue(), "", NEW, Default_Hierarchical__Parent.getGuid(), COMMON,
- tx10, artTokenToRelationGammaId.get(CoreArtifactTokens.OseeAccessAdmin));
- verifyData(rels.next(), artTokenToRelationId.get(AtsAdminToken), UserGroupsId, AtsAdminToken.getId().intValue(),
- "", NEW, Default_Hierarchical__Parent.getGuid(), COMMON, tx10, artTokenToRelationGammaId.get(AtsAdminToken));
- verifyData(rels.next(), artTokenToRelationId.get(AtsTempAdminToken), UserGroupsId,
- AtsTempAdminToken.getId().intValue(), "", NEW, Default_Hierarchical__Parent.getGuid(), COMMON, tx10,
- artTokenToRelationGammaId.get(AtsTempAdminToken));
+ verifyData(rels.next(), artTokenToRelationId.get(CoreArtifactTokens.OseeAccessAdmin), UserGroups,
+ CoreArtifactTokens.OseeAccessAdmin, "", NEW, Default_Hierarchical__Parent.getGuid(), COMMON, tx10,
+ artTokenToRelationGammaId.get(CoreArtifactTokens.OseeAccessAdmin));
+ verifyData(rels.next(), artTokenToRelationId.get(AtsAdminToken), UserGroups, AtsAdminToken, "", NEW,
+ Default_Hierarchical__Parent.getGuid(), COMMON, tx10, artTokenToRelationGammaId.get(AtsAdminToken));
+ verifyData(rels.next(), artTokenToRelationId.get(AtsTempAdminToken), UserGroups, AtsTempAdminToken, "", NEW,
+ Default_Hierarchical__Parent.getGuid(), COMMON, tx10, artTokenToRelationGammaId.get(AtsTempAdminToken));
}
private void verifyArts(Iterator<ArtifactData> arts) {
- verifyData(arts.next(), UserGroupsId, UserGroupsGuid, NEW, Folder.getId(), COMMON, tx7,
- UserGroupsArtifactGammaId);
+ verifyData(arts.next(), UserGroups, UserGroupsGuid, NEW, Folder.getId(), COMMON, tx7, UserGroupsArtifactGammaId);
verifyData(arts.next(), OseeTypesClientDemoId, OseeTypesClientDemoGuid, NEW, OseeTypeDefinition.getId(), COMMON,
tx5, OseeTypesClientDemoGammaId);
verifyData(arts.next(), OseeTypesFrameworkId, OseeTypesFrameworkGuid, NEW, OseeTypeDefinition.getId(), COMMON,
@@ -301,8 +314,7 @@ public class LoaderTest {
}
public void testLoadByTypes() throws OseeCoreException {
- DataLoader loader =
- loaderFactory.newDataLoaderFromIds(session, COMMON, OseeTypesFrameworkId, OseeTypesClientDemoId, UserGroupsId);
+ DataLoader loader = loaderFactory.newDataLoader(session, COMMON, artifactIds);
loader.withLoadLevel(LoadLevel.ALL);
loader.withAttributeTypes(Name);
@@ -333,8 +345,8 @@ public class LoaderTest {
OseeTypesFrameworkNameGammaId, "org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", "");
verifyData(attrs.next(), OseeTypesClientDemoNameAttrId, OseeTypesClientDemoId, NEW, Name.getId(), COMMON, tx5,
OseeTypesClientDemoNameGammaId, "org.eclipse.osee.client.demo.OseeTypes_ClientDemo", "");
- verifyData(attrs.next(), UserGroupsNameAttrId, UserGroupsId, NEW, Name.getId(), COMMON, tx7,
- UserGroupsNameGammaId, "User Groups", "");
+ verifyData(attrs.next(), UserGroupsNameAttrId, UserGroups, NEW, Name.getId(), COMMON, tx7, UserGroupsNameGammaId,
+ "User Groups", "");
sort(relationCaptor.getAllValues());
Iterator<RelationData> rels = relationCaptor.getAllValues().iterator();
@@ -343,17 +355,14 @@ public class LoaderTest {
}
public void testLoadByIds() throws OseeCoreException {
- DataLoader loader =
- loaderFactory.newDataLoaderFromIds(session, COMMON, OseeTypesFrameworkId, OseeTypesClientDemoId, UserGroupsId);
+ DataLoader loader = loaderFactory.newDataLoader(session, COMMON, artifactIds);
loader.withLoadLevel(LoadLevel.ALL);
List<Integer> activeAttrIds = new LinkedList<>();
AttributeReadable<Object> frameworkActiveAttr = getActiveAttr(OseeTypesFrameworkArt);
- Integer frameworkActiveAttrId = frameworkActiveAttr.getId().intValue();
- activeAttrIds.add(frameworkActiveAttrId);
+ activeAttrIds.add(frameworkActiveAttr.getId().intValue());
AttributeReadable<Object> clientDemoActiveAttr = getActiveAttr(OseeTypesClientDemoArt);
- Integer clientDemoActiveAttrId = clientDemoActiveAttr.getId().intValue();
- activeAttrIds.add(clientDemoActiveAttrId);
+ activeAttrIds.add(clientDemoActiveAttr.getId().intValue());
loader.withAttributeIds(activeAttrIds);
loader.withRelationIds(2, 3);
@@ -379,17 +388,17 @@ public class LoaderTest {
sort(attributeCaptor.getAllValues());
Iterator<AttributeData> attrs = attributeCaptor.getAllValues().iterator();
- verifyData(attrs.next(), frameworkActiveAttrId, OseeTypesFrameworkId, NEW, Active.getId(), COMMON, tx5,
+ verifyData(attrs.next(), frameworkActiveAttr, OseeTypesFrameworkId, NEW, Active.getId(), COMMON, tx5,
frameworkActiveAttr.getGammaId(), true, "");
- verifyData(attrs.next(), clientDemoActiveAttrId, OseeTypesClientDemoId, NEW, Active.getId(), COMMON, tx5,
+ verifyData(attrs.next(), clientDemoActiveAttr, OseeTypesClientDemoId, NEW, Active.getId(), COMMON, tx5,
clientDemoActiveAttr.getGammaId(), true, "");
sort(relationCaptor.getAllValues());
Iterator<RelationData> rels = relationCaptor.getAllValues().iterator();
- verifyData(rels.next(), 2, CoreArtifactTokens.DefaultHierarchyRoot.getId().intValue(), UserGroupsId, "", NEW,
+ verifyData(rels.next(), 2, CoreArtifactTokens.DefaultHierarchyRoot, UserGroups, "", NEW,
Default_Hierarchical__Parent.getGuid(), COMMON, tx7, defaultHierRootToUserGroupsRelationGammaId);
- verifyData(rels.next(), 3, UserGroupsId, CoreArtifactTokens.OseeAdmin.getId().intValue(), "", NEW,
+ verifyData(rels.next(), 3, UserGroups, CoreArtifactTokens.OseeAdmin, "", NEW,
Default_Hierarchical__Parent.getGuid(), COMMON, tx7, userGroupsToOseeAdminRelationGammaId);
}
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 bc5ffaf385..53c7351f57 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
@@ -36,7 +36,6 @@ import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItemUtil;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
@@ -48,6 +47,10 @@ import org.eclipse.osee.orcs.core.ds.LoadDataHandler;
import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.RelationData;
import org.eclipse.osee.orcs.core.ds.VersionData;
+import org.eclipse.osee.orcs.db.internal.loader.data.ArtifactDataImpl;
+import org.eclipse.osee.orcs.db.internal.loader.data.AttributeDataImpl;
+import org.eclipse.osee.orcs.db.internal.loader.data.RelationDataImpl;
+import org.eclipse.osee.orcs.db.internal.loader.data.VersionDataImpl;
import org.eclipse.osee.orcs.search.ApplicabilityQuery;
import org.junit.Assert;
import org.junit.Before;
@@ -70,8 +73,6 @@ public class MissingChangeItemFactoryTest {
@Mock private DataLoaderFactory dataLoaderFactory;
@Mock private DataLoader sourceDataLoader;
@Mock private DataLoader destDataLoader;
- @Mock private OrcsSession session;
- @Mock private HasCancellation cancellation;
@Mock private ApplicabilityQuery applicQuery;
// @formatter:on
@@ -98,14 +99,15 @@ public class MissingChangeItemFactoryTest {
return params;
}
- public MissingChangeItemFactoryTest(List<ChangeItem> changes, List<ChangeItem> expectedMissingChanges, List<AttributeData> attributeData, List<ArtifactData> artifactData, List<RelationData> relationData, List<ArtifactData> destArtifactData, HashMap<Long, ApplicabilityToken> applicMap) {
+ public MissingChangeItemFactoryTest(List<ChangeItem> changes, List<ChangeItem> expectedMissingChanges, List<AttributeData> attributeData, List<ArtifactData> artifactData, List<RelationData> relationData, List<ArtifactData> destArtifactData) {
this.changes = changes;
this.expectedMissingChanges = expectedMissingChanges;
this.attributeData = attributeData;
this.artifactData = artifactData;
this.relationData = relationData;
this.destArtifactData = destArtifactData;
- this.applicMap = applicMap;
+ this.applicMap = new HashMap<>();
+ applicMap.put(ApplicabilityToken.BASE.getId(), ApplicabilityToken.BASE);
}
@SuppressWarnings("unchecked")
@@ -113,12 +115,10 @@ public class MissingChangeItemFactoryTest {
public void init() throws OseeCoreException {
MockitoAnnotations.initMocks(this);
- String sessionGuid = GUID.create();
- when(session.getGuid()).thenReturn(sessionGuid);
- when(dataLoaderFactory.newDataLoaderFromIds(any(OrcsSession.class), eq(sourceBranch),
- any(Collection.class))).thenReturn(sourceDataLoader);
- when(dataLoaderFactory.newDataLoaderFromIds(any(OrcsSession.class), eq(destBranch),
- any(Collection.class))).thenReturn(destDataLoader);
+ when(dataLoaderFactory.newDataLoader(any(OrcsSession.class), eq(sourceBranch), any(Collection.class))).thenReturn(
+ sourceDataLoader);
+ when(dataLoaderFactory.newDataLoader(any(OrcsSession.class), eq(destBranch), any(Collection.class))).thenReturn(
+ destDataLoader);
when(applicQuery.getApplicabilityTokens(any(BranchId.class), any(BranchId.class))).thenReturn(applicMap);
changeItemFactory = new MissingChangeItemFactoryImpl(dataLoaderFactory);
}
@@ -169,18 +169,17 @@ public class MissingChangeItemFactoryTest {
}).when(destDataLoader).load(any(HasCancellation.class), any(LoadDataHandler.class));
Collection<ChangeItem> results =
- changeItemFactory.createMissingChanges(cancellation, session, changes, sourceTx, destTx, applicQuery);
+ changeItemFactory.createMissingChanges(null, null, changes, sourceTx, destTx, applicQuery);
if (expectedMissingChanges == null) {
Assert.assertTrue(results.isEmpty());
} else {
- Assert.assertEquals(expectedMissingChanges.size(), results.size());
for (ChangeItem change : results) {
ChangeItem expected = getMatchingChangeItem(change);
Assert.assertNotNull(expected);
- Assert.assertEquals(expected.getClass().getSimpleName(), change.getClass().getSimpleName());
Assert.assertEquals(expected.getCurrentVersion().getGammaId(), change.getCurrentVersion().getGammaId());
- Assert.assertTrue(expected.getCurrentVersion().getModType() == change.getCurrentVersion().getModType());
+ Assert.assertEquals(expected.getCurrentVersion().getModType(), change.getCurrentVersion().getModType());
}
+ Assert.assertEquals(expectedMissingChanges.size(), results.size());
}
}
@@ -190,15 +189,12 @@ public class MissingChangeItemFactoryTest {
private static Object[] testCase_missingAttribute() {
List<ChangeItem> changes = new LinkedList<>();
final int ci1AttrId = 1;
- final int artId = 3;
+ ArtifactId artId = ArtifactId.valueOf(3);
final long missingGamma = 9L;
long artGamma = 7L;
- HashMap<Long, ApplicabilityToken> applicMap = new HashMap<>();
- applicMap.put(1L, ApplicabilityToken.BASE);
ChangeItem ci1 = ChangeItemUtil.newAttributeChange(AttributeId.valueOf(ci1AttrId), AttributeTypeId.valueOf(2L),
- ArtifactId.valueOf(artId), GammaId.valueOf(4L), ModificationType.MODIFIED, Strings.EMPTY_STRING,
- ApplicabilityToken.BASE);
+ artId, GammaId.valueOf(4L), ModificationType.MODIFIED, Strings.EMPTY_STRING, ApplicabilityToken.BASE);
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<>();
@@ -215,7 +211,7 @@ public class MissingChangeItemFactoryTest {
expected.add(createExpected(attrData2));
expected.add(createExpected(artData1));
- return new Object[] {changes, expected, attrDatas, artData, null, null, applicMap};
+ return new Object[] {changes, expected, attrDatas, artData, null, null};
}
/**
@@ -228,13 +224,12 @@ public class MissingChangeItemFactoryTest {
long artGamma = 7L;
RelationId relId = RelationId.valueOf(6L);
- int artA = 65;
- int artB = 2;
+ ArtifactId artA = ArtifactId.valueOf(65);
+ ArtifactId artB = ArtifactId.valueOf(2);
+ ArtifactId artC = ArtifactId.valueOf(artB.getId() + 1);
GammaId srcGamma = GammaId.valueOf(7L);
- HashMap<Long, ApplicabilityToken> applicMap = new HashMap<>();
- applicMap.put(1L, ApplicabilityToken.BASE);
ChangeItem ci1 = ChangeItemUtil.newRelationChange(relId, RelationTypeId.SENTINEL, srcGamma, ModificationType.NEW,
- ArtifactId.valueOf(artA), ArtifactId.valueOf(artB), "", ApplicabilityToken.BASE);
+ artA, artB, "", ApplicabilityToken.BASE);
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<>();
@@ -248,11 +243,11 @@ public class MissingChangeItemFactoryTest {
artData.add(artData1);
List<RelationData> relDatas = new LinkedList<>();
- RelationData relData1 = createRelationData(11, artA, artB + 1, 88, ModificationType.NEW);
+ RelationData relData1 = createRelationData(RelationId.valueOf(11), artA, artC, 88, ModificationType.NEW);
relDatas.add(relData1);
List<ArtifactData> destArtData = new LinkedList<>();
- ArtifactData destArt = createArtifactData(artB + 1, 99, ModificationType.NEW);
+ ArtifactData destArt = createArtifactData(artC, 99, ModificationType.NEW);
destArtData.add(destArt);
List<ChangeItem> expected = new LinkedList<>();
@@ -261,7 +256,7 @@ public class MissingChangeItemFactoryTest {
expected.add(createExpected(artData1));
expected.add(createExpected(relData1));
- return new Object[] {changes, expected, attrDatas, artData, relDatas, destArtData, applicMap};
+ return new Object[] {changes, expected, attrDatas, artData, relDatas, destArtData};
}
/**
@@ -269,12 +264,10 @@ public class MissingChangeItemFactoryTest {
*/
private static Object[] testCase_deletedAttribute() {
List<ChangeItem> changes = new LinkedList<>();
- final int artId = 3;
- HashMap<Long, ApplicabilityToken> applicMap = new HashMap<>();
- applicMap.put(1L, ApplicabilityToken.BASE);
- ChangeItem ci1 = ChangeItemUtil.newAttributeChange(AttributeId.valueOf(22), AttributeTypeId.valueOf(2L),
- ArtifactId.valueOf(artId), GammaId.valueOf(4L), ModificationType.DELETED, Strings.EMPTY_STRING,
- ApplicabilityToken.BASE);
+ ArtifactId artId = ArtifactId.valueOf(3);
+
+ ChangeItem ci1 = ChangeItemUtil.newAttributeChange(AttributeId.valueOf(22), AttributeTypeId.valueOf(2L), artId,
+ GammaId.valueOf(4L), ModificationType.DELETED, Strings.EMPTY_STRING, ApplicabilityToken.BASE);
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<>();
@@ -292,7 +285,7 @@ public class MissingChangeItemFactoryTest {
expected.add(createExpected(attrData2));
expected.add(createExpected(artData1));
- return new Object[] {changes, expected, attrDatas, artData, null, null, applicMap};
+ return new Object[] {changes, expected, attrDatas, artData, null, null};
}
/**
@@ -301,22 +294,18 @@ public class MissingChangeItemFactoryTest {
private static Object[] testCase_artifactDeletedAttribute() {
List<ChangeItem> changes = new LinkedList<>();
final ArtifactId artId = ArtifactId.valueOf(3);
- HashMap<Long, ApplicabilityToken> applicMap = new HashMap<>();
- applicMap.put(1L, ApplicabilityToken.BASE);
ChangeItem ci1 = ChangeItemUtil.newAttributeChange(AttributeId.valueOf(22), AttributeTypeId.valueOf(2L), artId,
GammaId.valueOf(4L), ModificationType.ARTIFACT_DELETED, Strings.EMPTY_STRING, ApplicabilityToken.BASE);
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<>();
- AttributeData attrData1 =
- createAttributeData(artId.getId().intValue(), 33, 1L, ModificationType.ARTIFACT_DELETED);
- AttributeData attrData2 =
- createAttributeData(artId.getId().intValue(), 44 + 1, 67L, ModificationType.ARTIFACT_DELETED);
+ AttributeData attrData1 = createAttributeData(artId, 33, 1L, ModificationType.ARTIFACT_DELETED);
+ AttributeData attrData2 = createAttributeData(artId, 44 + 1, 67L, ModificationType.ARTIFACT_DELETED);
attrDatas.add(attrData1);
attrDatas.add(attrData2);
List<ArtifactData> artData = new LinkedList<>();
- ArtifactData artData1 = createArtifactData(artId.getId().intValue(), 89L, ModificationType.DELETED);
+ ArtifactData artData1 = createArtifactData(artId, 89L, ModificationType.DELETED);
artData.add(artData1);
List<ChangeItem> expected = new LinkedList<>();
@@ -324,7 +313,7 @@ public class MissingChangeItemFactoryTest {
expected.add(createExpected(attrData2));
expected.add(createExpected(artData1));
- return new Object[] {changes, expected, attrDatas, artData, null, null, applicMap};
+ return new Object[] {changes, expected, attrDatas, artData, null, null};
}
private static ModificationType determineModType(OrcsData data) {
@@ -336,9 +325,9 @@ public class MissingChangeItemFactoryTest {
}
private static ChangeItem createExpected(RelationData data) {
- return ChangeItemUtil.newRelationChange(RelationId.valueOf(Long.valueOf(data.getLocalId())),
- RelationTypeId.SENTINEL, GammaId.valueOf(data.getVersion().getGammaId()), determineModType(data),
- ArtifactId.valueOf(data.getArtIdA()), ArtifactId.valueOf(data.getArtIdB()), "", ApplicabilityToken.BASE);
+ return ChangeItemUtil.newRelationChange(RelationId.valueOf(data.getLocalId()), RelationTypeId.SENTINEL,
+ GammaId.valueOf(data.getVersion().getGammaId()), determineModType(data), ArtifactId.valueOf(data.getArtIdA()),
+ ArtifactId.valueOf(data.getArtIdB()), "", ApplicabilityToken.BASE);
}
private static ChangeItem createExpected(AttributeData data) {
@@ -362,41 +351,41 @@ public class MissingChangeItemFactoryTest {
return null;
}
- private static AttributeData createAttributeData(int artId, int attrId, long gamma, ModificationType modType) {
- AttributeData data = mock(AttributeData.class);
- VersionData version = mock(VersionData.class);
+ private static AttributeData createAttributeData(ArtifactId artId, int attrId, long gamma, ModificationType modType) {
+ VersionData version = new VersionDataImpl();
+ version.setGammaId(gamma);
DataProxy proxy = mock(DataProxy.class);
- when(data.getModType()).thenReturn(modType);
- when(data.getVersion()).thenReturn(version);
- when(data.getArtifactId()).thenReturn(artId);
- when(data.getLocalId()).thenReturn(attrId);
- when(data.getDataProxy()).thenReturn(proxy);
- when(data.getVersion().getGammaId()).thenReturn(gamma);
- when(data.getApplicabilityId()).thenReturn(ApplicabilityId.BASE);
+
+ AttributeData data = new AttributeDataImpl(version);
+ data.setArtifactId(artId.getId().intValue());
+ data.setModType(modType);
+ data.setLocalId(attrId);
+ data.setDataProxy(proxy);
+ data.setApplicabilityId(ApplicabilityId.BASE);
return data;
}
- private static ArtifactData createArtifactData(int artId, long gamma, ModificationType modType) {
- ArtifactData data = mock(ArtifactData.class);
- VersionData version = mock(VersionData.class);
- when(data.getModType()).thenReturn(modType);
- when(data.getLocalId()).thenReturn(artId);
- when(version.getGammaId()).thenReturn(gamma);
- when(data.getVersion()).thenReturn(version);
- when(data.getApplicabilityId()).thenReturn(ApplicabilityId.BASE);
+ private static ArtifactData createArtifactData(ArtifactId artId, long gamma, ModificationType modType) {
+ VersionData version = new VersionDataImpl();
+ version.setGammaId(gamma);
+
+ ArtifactData data = new ArtifactDataImpl(version);
+ data.setModType(modType);
+ data.setLocalId(artId.getId().intValue());
+ data.setApplicabilityId(ApplicabilityId.BASE);
return data;
}
- private static RelationData createRelationData(int relId, int artA, int artB, long gamma, ModificationType modType) {
- RelationData data = mock(RelationData.class);
- VersionData version = mock(VersionData.class);
- when(data.getLocalId()).thenReturn(relId);
- when(data.getArtIdA()).thenReturn(artA);
- when(data.getArtIdB()).thenReturn(artB);
- when(version.getGammaId()).thenReturn(gamma);
- when(data.getVersion()).thenReturn(version);
- when(data.getModType()).thenReturn(modType);
- when(data.getApplicabilityId()).thenReturn(ApplicabilityId.BASE);
+ private static RelationData createRelationData(RelationId relId, ArtifactId artA, ArtifactId artB, long gamma, ModificationType modType) {
+ VersionData version = new VersionDataImpl();
+ version.setGammaId(gamma);
+
+ RelationData data = new RelationDataImpl(version);
+ data.setModType(modType);
+ data.setLocalId(relId.getId().intValue());
+ data.setApplicabilityId(ApplicabilityId.BASE);
+ data.setArtIdA(artA);
+ data.setArtIdB(artB);
return data;
}
}
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 5e8ecb0327..160ffc3199 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
@@ -33,6 +33,7 @@ import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItemUtil;
+import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -62,24 +63,24 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
@Override
public Collection<ChangeItem> createMissingChanges(HasCancellation cancellation, OrcsSession session, List<ChangeItem> changes, TransactionToken sourceTx, TransactionToken destTx, ApplicabilityQuery applicQuery) throws OseeCoreException {
if (changes != null && !changes.isEmpty()) {
- Set<Integer> modifiedArtIds = new HashSet<>();
- Multimap<Integer, Integer> modifiedAttrIds = LinkedListMultimap.create();
- Multimap<Integer, Integer> modifiedRels = LinkedListMultimap.create();
+ Set<ArtifactId> modifiedArtIds = new HashSet<>();
+ Multimap<ArtifactId, Id> modifiedAttrIds = LinkedListMultimap.create();
+ Multimap<ArtifactId, Id> modifiedRels = LinkedListMultimap.create();
Multimap<Long, Long> modifiedTuples = LinkedListMultimap.create();
for (ChangeItem change : changes) {
switch (change.getChangeType()) {
case ARTIFACT_CHANGE:
if (!change.isSynthetic()) {
- modifiedArtIds.add(change.getArtId().getId().intValue());
+ modifiedArtIds.add(change.getArtId());
}
break;
case ATTRIBUTE_CHANGE:
- modifiedAttrIds.put(change.getArtId().getId().intValue(), change.getItemId().getId().intValue());
+ modifiedAttrIds.put(change.getArtId(), change.getItemId());
break;
case RELATION_CHANGE:
- modifiedRels.put(change.getArtId().getId().intValue(), change.getItemId().getId().intValue());
- modifiedRels.put(change.getArtIdB().getId().intValue(), change.getItemId().getId().intValue());
+ modifiedRels.put(change.getArtId(), change.getItemId());
+ modifiedRels.put(change.getArtIdB(), change.getItemId());
break;
case TUPLE_CHANGE:
modifiedTuples.put(0L, 1L);
@@ -89,11 +90,12 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
}
}
- Set<Integer> allArtIds = new HashSet<>(modifiedArtIds);
+ Set<ArtifactId> allArtIds = new HashSet<>(modifiedArtIds);
allArtIds.addAll(modifiedAttrIds.keySet());
allArtIds.addAll(modifiedRels.keySet());
- Set<Integer> missingArtIds = determineWhichArtifactsNotOnDestination(cancellation, session, allArtIds, destTx);
+ Set<ArtifactId> missingArtIds =
+ determineWhichArtifactsNotOnDestination(cancellation, session, allArtIds, destTx);
if (!missingArtIds.isEmpty()) {
applicTokensForMissingArts = applicQuery.getApplicabilityTokens(sourceTx.getBranch(), destTx.getBranch());
@@ -117,9 +119,9 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
return toReturn;
}
- private Set<Integer> determineWhichArtifactsNotOnDestination(HasCancellation cancellation, OrcsSession session, Set<Integer> artIds, TransactionToken destTx) throws OseeCoreException {
- DataLoader loader = dataLoaderFactory.newDataLoaderFromIds(session, destTx.getBranch(), artIds);
- final Set<Integer> missingArtIds = new LinkedHashSet<>(artIds);
+ private Set<ArtifactId> determineWhichArtifactsNotOnDestination(HasCancellation cancellation, OrcsSession session, Set<ArtifactId> artIds, TransactionToken destTx) throws OseeCoreException {
+ DataLoader loader = dataLoaderFactory.newDataLoader(session, destTx.getBranch(), artIds);
+ final Set<ArtifactId> missingArtIds = new LinkedHashSet<>(artIds);
loader.includeDeletedArtifacts();
loader.fromTransaction(destTx);
loader.fromBranchView(destTx.getBranch().getViewId());
@@ -128,17 +130,17 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
@Override
public void onData(ArtifactData data) {
- missingArtIds.remove(data.getLocalId());
+ missingArtIds.remove(data);
}
});
return missingArtIds;
}
- private Collection<ChangeItem> createMissingChangeItems(HasCancellation cancellation, OrcsSession session, TransactionToken sourceTx, TransactionToken destTx, final Set<Integer> modifiedArtIds, final Multimap<Integer, Integer> modifiedAttrIds, final Multimap<Integer, Integer> modifiedRels, final Set<Integer> missingArtIds, final Set<Integer> allArtIds) throws OseeCoreException {
+ private Collection<ChangeItem> createMissingChangeItems(HasCancellation cancellation, OrcsSession session, TransactionToken sourceTx, TransactionToken destTx, final Set<ArtifactId> modifiedArtIds, final Multimap<ArtifactId, Id> modifiedAttrIds, final Multimap<ArtifactId, Id> modifiedRels, final Set<ArtifactId> missingArtIds, final Set<ArtifactId> allArtIds) throws OseeCoreException {
final Set<ChangeItem> toReturn = new LinkedHashSet<>();
final Set<RelationData> relations = new LinkedHashSet<>();
- DataLoader loader = dataLoaderFactory.newDataLoaderFromIds(session, sourceTx.getBranch(), missingArtIds);
+ DataLoader loader = dataLoaderFactory.newDataLoader(session, sourceTx.getBranch(), missingArtIds);
loader.withLoadLevel(LoadLevel.ALL);
loader.includeDeletedArtifacts();
loader.fromTransaction(sourceTx);
@@ -148,23 +150,22 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
@Override
public void onData(ArtifactData data) throws OseeCoreException {
- if (!modifiedArtIds.contains(data.getLocalId())) {
+ if (!modifiedArtIds.contains(data)) {
toReturn.add(createArtifactChangeItem(data));
}
}
@Override
public void onData(RelationData data) {
- int localId = data.getLocalId();
- if (!modifiedRels.get(data.getArtIdA()).contains(localId) && !modifiedRels.get(data.getArtIdB()).contains(
- localId)) {
+ if (!modifiedRels.get(data.getArtifactIdA()).contains(
+ data) && !modifiedRels.get(data.getArtifactIdB()).contains(data)) {
relations.add(data);
}
}
@Override
public void onData(AttributeData data) throws OseeCoreException {
- if (!modifiedAttrIds.get(data.getArtifactId()).contains(data.getLocalId())) {
+ if (!modifiedAttrIds.get(ArtifactId.valueOf(data.getArtifactId())).contains(data)) {
toReturn.add(createAttributeChangeItem(data));
}
}
@@ -172,18 +173,18 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
});
if (!relations.isEmpty()) {
- Multimap<Integer, RelationData> relationChangesToAdd = LinkedListMultimap.create();
+ Multimap<ArtifactId, RelationData> relationChangesToAdd = LinkedListMultimap.create();
for (RelationData data : relations) {
- if (allArtIds.contains(data.getArtIdA())) {
- if (allArtIds.contains(data.getArtIdB())) {
+ if (allArtIds.contains(data.getArtifactIdA())) {
+ if (allArtIds.contains(data.getArtifactIdB())) {
toReturn.add(createRelationChangeItem(data));
} else {
// check if artIdB exists on destination branch, addRelation if it does
- relationChangesToAdd.put(data.getArtIdB(), data);
+ relationChangesToAdd.put(data.getArtifactIdB(), data);
}
- } else if (allArtIds.contains(data.getArtIdB())) {
+ } else if (allArtIds.contains(data.getArtifactIdB())) {
// if artIdA exists on destination, addRelation
- relationChangesToAdd.put(data.getArtIdA(), data);
+ relationChangesToAdd.put(data.getArtifactIdA(), data);
}
}
if (!relationChangesToAdd.isEmpty()) {
@@ -193,18 +194,17 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
return toReturn;
}
- private Set<ChangeItem> createExistingRelations(HasCancellation cancellation, OrcsSession session, TransactionToken destTx, final Multimap<Integer, RelationData> relationChangesToAdd) throws OseeCoreException {
+ private Set<ChangeItem> createExistingRelations(HasCancellation cancellation, OrcsSession session, TransactionToken destTx, final Multimap<ArtifactId, RelationData> relationChangesToAdd) throws OseeCoreException {
final Set<ChangeItem> toReturn = new LinkedHashSet<>();
- DataLoader loader =
- dataLoaderFactory.newDataLoaderFromIds(session, destTx.getBranch(), relationChangesToAdd.keySet());
+ DataLoader loader = dataLoaderFactory.newDataLoader(session, destTx.getBranch(), relationChangesToAdd.keySet());
loader.fromTransaction(destTx);
loader.fromBranchView(destTx.getBranch().getViewId());
loader.load(cancellation, new LoadDataHandlerAdapter() {
@Override
public void onData(ArtifactData data) throws OseeCoreException {
- for (RelationData relData : relationChangesToAdd.get(data.getLocalId())) {
+ for (RelationData relData : relationChangesToAdd.get(data)) {
toReturn.add(createRelationChangeItem(relData));
}
}
@@ -241,8 +241,8 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
ApplicabilityId appId = data.getApplicabilityId();
return ChangeItemUtil.newRelationChange(RelationId.valueOf(Long.valueOf(data.getLocalId())),
RelationTypeId.valueOf(data.getTypeUuid()), GammaId.valueOf(data.getVersion().getGammaId()),
- determineModType(data), ArtifactId.valueOf(data.getArtIdA()), ArtifactId.valueOf(data.getArtIdB()),
- data.getRationale(), getApplicabilityToken(appId));
+ determineModType(data), data.getArtifactIdA(), data.getArtifactIdB(), data.getRationale(),
+ getApplicabilityToken(appId));
}
}
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 3da3251041..4cfe780c60 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,9 +10,11 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.loader;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import org.eclipse.osee.executor.admin.HasCancellation;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -102,8 +104,12 @@ public class DataLoaderFactoryImpl implements DataLoaderFactory {
}
@Override
- public DataLoader newDataLoaderFromIds(OrcsSession session, BranchId branch, Integer... ids) throws OseeCoreException {
- return newDataLoaderFromIds(session, branch, Arrays.asList(ids));
+ public DataLoader newDataLoader(OrcsSession session, BranchId branch, Collection<ArtifactId> ids) {
+ ArrayList<Integer> intIds = new ArrayList<>();
+ for (ArtifactId id : ids) {
+ intIds.add(id.getId().intValue());
+ }
+ return newDataLoaderFromIds(session, branch, intIds);
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java
index 28b031183e..8fa89089c3 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactDataImpl.java
@@ -44,7 +44,7 @@ public class ArtifactDataImpl extends OrcsVersionedObjectImpl implements Artifac
if (obj instanceof ArtifactDataImpl) {
return guid.equals(((ArtifactDataImpl) obj).guid);
}
- return false;
+ return true;
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/AttributeDataImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/AttributeDataImpl.java
index c0c729271b..418061535e 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/AttributeDataImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/AttributeDataImpl.java
@@ -58,7 +58,7 @@ public class AttributeDataImpl extends OrcsVersionedObjectImpl implements Attrib
AttributeDataImpl other = (AttributeDataImpl) obj;
return Integer.valueOf(other.artifactId).equals(artifactId) && proxy.equals(other.proxy);
}
- return false;
+ return true;
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsVersionedObjectImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsVersionedObjectImpl.java
index 5e0b12d846..9afb693f16 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsVersionedObjectImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsVersionedObjectImpl.java
@@ -145,12 +145,7 @@ public abstract class OrcsVersionedObjectImpl extends OrcsObjectImpl<Integer> im
@Override
public int hashCode() {
- final int prime = 31;
- int result = getLocalId().hashCode();
- result = prime * result + (baseModType == null ? 0 : baseModType.hashCode());
- result = prime * result + Long.hashCode(baseTypeUuid);
- result = prime * result + (version == null ? 0 : version.hashCode());
- return result;
+ return getLocalId().hashCode();
}
@Override

Back to the top