Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Minks2018-05-10 20:49:12 -0400
committerRyan Brooks2018-05-31 18:33:37 -0400
commit84b8de6bdc2e4fefec4311d8ab2e45a33abfa3c9 (patch)
tree0f4cf6f8177717451a72758b28550dae820b1689
parent8ae01e17a140c69224d32e771d42014c84582791 (diff)
downloadorg.eclipse.osee-84b8de6bdc2e4fefec4311d8ab2e45a33abfa3c9.tar.gz
org.eclipse.osee-84b8de6bdc2e4fefec4311d8ab2e45a33abfa3c9.tar.xz
org.eclipse.osee-84b8de6bdc2e4fefec4311d8ab2e45a33abfa3c9.zip
refactor: Use GammaId primitive where appropriate
Change-Id: Ic1f073078ca8bbc19a78bbbc726df78f6cb7fd4c Signed-off-by: Mark Minks <mark.minks@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/VersionData.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/primitives/AttributeImpl.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java38
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityManager.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/VersionDataImpl.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java5
11 files changed, 45 insertions, 39 deletions
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/VersionData.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/VersionData.java
index 7f910e9968..256830df22 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/VersionData.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/VersionData.java
@@ -21,7 +21,7 @@ public interface VersionData extends Cloneable {
GammaId getGammaId();
- void setGammaId(long gamma);
+ void setGammaId(GammaId gamma);
TransactionId getTransactionId();
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 1c796f7ee2..65207ddc2f 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
@@ -268,7 +268,7 @@ public abstract class AttributeImpl<T> implements Comparable<AttributeImpl<T>>,
return getOrcsData().getVersion().getGammaId();
}
- public void internalSetGammaId(int gammaId) {
+ public void internalSetGammaId(GammaId gammaId) {
getOrcsData().getVersion().setGammaId(gammaId);
}
@@ -280,7 +280,7 @@ public abstract class AttributeImpl<T> implements Comparable<AttributeImpl<T>>,
* artifact.persist(); artifact.reloadAttributesAndRelations(); Will need to be called afterwards to see replaced
* data in memory
*/
- public void replaceWithVersion(int gammaId) {
+ public void replaceWithVersion(GammaId gammaId) {
internalSetModificationType(ModificationType.REPLACED_WITH_VERSION);
getOrcsData().getVersion().setGammaId(gammaId);
setDirtyFlag(true);
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 eea86da892..a717de452b 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
@@ -197,13 +197,14 @@ public class MissingChangeItemFactoryTest {
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<>();
- AttributeData attrData1 = createAttributeData(artId, ci1AttrId, 1L, ModificationType.MODIFIED);
- AttributeData attrData2 = createAttributeData(artId, ci1AttrId + 1, missingGamma, ModificationType.INTRODUCED);
+ AttributeData attrData1 = createAttributeData(artId, ci1AttrId, GammaId.valueOf(1L), ModificationType.MODIFIED);
+ AttributeData attrData2 =
+ createAttributeData(artId, ci1AttrId + 1, GammaId.valueOf(missingGamma), ModificationType.INTRODUCED);
attrDatas.add(attrData1);
attrDatas.add(attrData2);
List<ArtifactData> artData = new LinkedList<>();
- ArtifactData artData1 = createArtifactData(artId, artGamma, ModificationType.NEW);
+ ArtifactData artData1 = createArtifactData(artId, GammaId.valueOf(artGamma), ModificationType.NEW);
artData.add(artData1);
List<ChangeItem> expected = new LinkedList<>();
@@ -232,21 +233,23 @@ public class MissingChangeItemFactoryTest {
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<>();
- AttributeData attrData1 = createAttributeData(artA, ci1AttrId, 1L, ModificationType.MODIFIED);
- AttributeData attrData2 = createAttributeData(artA, ci1AttrId + 1, missingGamma, ModificationType.INTRODUCED);
+ AttributeData attrData1 = createAttributeData(artA, ci1AttrId, GammaId.valueOf(1L), ModificationType.MODIFIED);
+ AttributeData attrData2 =
+ createAttributeData(artA, ci1AttrId + 1, GammaId.valueOf(missingGamma), ModificationType.INTRODUCED);
attrDatas.add(attrData1);
attrDatas.add(attrData2);
List<ArtifactData> artData = new LinkedList<>();
- ArtifactData artData1 = createArtifactData(artA, artGamma, ModificationType.NEW);
+ ArtifactData artData1 = createArtifactData(artA, GammaId.valueOf(artGamma), ModificationType.NEW);
artData.add(artData1);
List<RelationData> relDatas = new LinkedList<>();
- RelationData relData1 = createRelationData(RelationId.valueOf(11), artA, artC, 88, ModificationType.NEW);
+ RelationData relData1 =
+ createRelationData(RelationId.valueOf(11), artA, artC, GammaId.valueOf(88), ModificationType.NEW);
relDatas.add(relData1);
List<ArtifactData> destArtData = new LinkedList<>();
- ArtifactData destArt = createArtifactData(artC, 99, ModificationType.NEW);
+ ArtifactData destArt = createArtifactData(artC, GammaId.valueOf(99), ModificationType.NEW);
destArtData.add(destArt);
List<ChangeItem> expected = new LinkedList<>();
@@ -270,13 +273,13 @@ public class MissingChangeItemFactoryTest {
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<>();
- AttributeData attrData1 = createAttributeData(artId, 33, 1L, ModificationType.MODIFIED);
- AttributeData attrData2 = createAttributeData(artId, 44 + 1, 67L, ModificationType.NEW);
+ AttributeData attrData1 = createAttributeData(artId, 33, GammaId.valueOf(1L), ModificationType.MODIFIED);
+ AttributeData attrData2 = createAttributeData(artId, 44 + 1, GammaId.valueOf(67L), ModificationType.NEW);
attrDatas.add(attrData1);
attrDatas.add(attrData2);
List<ArtifactData> artData = new LinkedList<>();
- ArtifactData artData1 = createArtifactData(artId, 89L, ModificationType.NEW);
+ ArtifactData artData1 = createArtifactData(artId, GammaId.valueOf(89L), ModificationType.NEW);
artData.add(artData1);
List<ChangeItem> expected = new LinkedList<>();
@@ -298,13 +301,14 @@ public class MissingChangeItemFactoryTest {
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<>();
- AttributeData attrData1 = createAttributeData(artId, 33, 1L, ModificationType.ARTIFACT_DELETED);
- AttributeData attrData2 = createAttributeData(artId, 44 + 1, 67L, ModificationType.ARTIFACT_DELETED);
+ AttributeData attrData1 = createAttributeData(artId, 33, GammaId.valueOf(1L), ModificationType.ARTIFACT_DELETED);
+ AttributeData attrData2 =
+ createAttributeData(artId, 44 + 1, GammaId.valueOf(67L), ModificationType.ARTIFACT_DELETED);
attrDatas.add(attrData1);
attrDatas.add(attrData2);
List<ArtifactData> artData = new LinkedList<>();
- ArtifactData artData1 = createArtifactData(artId, 89L, ModificationType.DELETED);
+ ArtifactData artData1 = createArtifactData(artId, GammaId.valueOf(89L), ModificationType.DELETED);
artData.add(artData1);
List<ChangeItem> expected = new LinkedList<>();
@@ -350,7 +354,7 @@ public class MissingChangeItemFactoryTest {
return null;
}
- private static AttributeData createAttributeData(ArtifactId artId, int attrId, long gamma, ModificationType modType) {
+ private static AttributeData createAttributeData(ArtifactId artId, int attrId, GammaId gamma, ModificationType modType) {
VersionData version = new VersionDataImpl();
version.setGammaId(gamma);
DataProxy<?> proxy = mock(DataProxy.class);
@@ -364,7 +368,7 @@ public class MissingChangeItemFactoryTest {
return data;
}
- private static ArtifactData createArtifactData(ArtifactId artId, long gamma, ModificationType modType) {
+ private static ArtifactData createArtifactData(ArtifactId artId, GammaId gamma, ModificationType modType) {
VersionData version = new VersionDataImpl();
version.setGammaId(gamma);
@@ -375,7 +379,7 @@ public class MissingChangeItemFactoryTest {
return data;
}
- private static RelationData createRelationData(RelationId relId, ArtifactId artA, ArtifactId artB, long gamma, ModificationType modType) {
+ private static RelationData createRelationData(RelationId relId, ArtifactId artA, ArtifactId artB, GammaId gamma, ModificationType modType) {
VersionData version = new VersionDataImpl();
version.setGammaId(gamma);
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java
index 6489ac7992..8ecd81fc26 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java
@@ -146,7 +146,7 @@ public class TxSqlBuilderTest {
tx.setDate(EXPECTED_TX_TIME);
tx.setTxType(EXPECTED_TX_TYPE);
- when(idManager.getNextGammaId()).thenReturn(NEXT_GAMMA_ID.getId());
+ when(idManager.getNextGammaId()).thenReturn(NEXT_GAMMA_ID);
}
@Test
@@ -349,7 +349,7 @@ public class TxSqlBuilderTest {
private void reset(OrcsData data) {
data.getVersion().setTransactionId(LOADED_TX_ID);
- data.getVersion().setGammaId(GammaId.SENTINEL.getId());
+ data.getVersion().setGammaId(GammaId.SENTINEL);
}
private void verifyQuery(SqlOrderEnum key) {
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityManager.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityManager.java
index 8b121b3aac..82c2ff7b6e 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityManager.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityManager.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal;
+import org.eclipse.osee.framework.core.data.GammaId;
import org.eclipse.osee.framework.core.data.TransactionId;
/**
@@ -25,7 +26,7 @@ public interface IdentityManager extends IdentityLocator {
int getNextRelationId();
- long getNextGammaId();
+ GammaId getNextGammaId();
void invalidateIds();
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java
index d819c4d260..ebc5d6b390 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.orcs.db.internal.exchange;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+import org.eclipse.osee.framework.core.data.GammaId;
import org.eclipse.osee.framework.core.data.OseeData;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -100,7 +101,7 @@ public class ExportItemFactory {
processTxOptions(options);
- int gammaJoinId = createGammaJoin(getDbService(), branchJoinId, options);
+ GammaId gammaJoinId = createGammaJoin(getDbService(), branchJoinId, options);
items.add(new ManifestExportItem(logger, preferences, items, options));
items.add(new MetadataExportItem(logger, items, getDbService()));
@@ -120,7 +121,7 @@ public class ExportItemFactory {
return items;
}
- private void addItem(List<AbstractExportItem> items, Long branchJoinId, PropertyStore options, int gammaJoinId, ExportItem exportItem, String query) {
+ private void addItem(List<AbstractExportItem> items, Long branchJoinId, PropertyStore options, GammaId gammaJoinId, ExportItem exportItem, String query) {
StringBuilder modifiedQuery = new StringBuilder(query);
Object[] bindData = prepareQuery(exportItem, modifiedQuery, options, branchJoinId, gammaJoinId);
items.add(new DbTableExportItem(getLogger(), getDbService(), getResourceManager(), exportItem,
@@ -135,9 +136,9 @@ public class ExportItemFactory {
}
}
- private int createGammaJoin(JdbcClient jdbcClient, Long branchJoinId, PropertyStore options) {
+ private GammaId createGammaJoin(JdbcClient jdbcClient, Long branchJoinId, PropertyStore options) {
List<Object> bindList = new ArrayList<>();
- int gammaJoinId = new Random().nextInt();
+ GammaId gammaJoinId = GammaId.valueOf(new Random().nextInt());
StringBuilder sql = new StringBuilder(
"INSERT INTO osee_join_id (id, query_id) SELECT DISTINCT(gamma_id), %s FROM osee_join_id, osee_txs txs WHERE query_id=? AND id = txs.branch_id");
bindList.add(branchJoinId);
@@ -157,7 +158,7 @@ public class ExportItemFactory {
return gammaJoinId;
}
- private static Object[] prepareQuery(ExportItem exportItem, StringBuilder query, PropertyStore options, Long branchJoinId, int gammaJionId) {
+ private static Object[] prepareQuery(ExportItem exportItem, StringBuilder query, PropertyStore options, Long branchJoinId, GammaId gammaJionId) {
List<Object> bindData = new ArrayList<>();
if (exportItem.matches(ExportItem.OSEE_ARTIFACT_DATA, ExportItem.OSEE_ATTRIBUTE_DATA,
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java
index 6afa0150b6..4a312f275d 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java
@@ -184,7 +184,7 @@ public class DataFactoryImpl implements DataFactory {
version.setTransactionId(TransactionId.SENTINEL);
version.setStripeId(TransactionId.SENTINEL);
version.setHistorical(false);
- version.setGammaId(GammaId.SENTINEL.getId());
+ version.setGammaId(GammaId.SENTINEL);
data.setModType(ModificationType.NEW);
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java
index ecbfe77d60..5c0c79c327 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java
@@ -80,7 +80,7 @@ public class OrcsObjectFactoryImpl implements OrcsObjectFactory {
VersionData version = new VersionDataImpl();
version.setBranch(branchId);
version.setTransactionId(txId);
- version.setGammaId(gamma.getId());
+ version.setGammaId(gamma);
version.setHistorical(historical);
version.setStripeId(stripeId);
return version;
@@ -190,7 +190,7 @@ public class OrcsObjectFactoryImpl implements OrcsObjectFactory {
data.setModType(ModificationType.NEW);
data.setApplicabilityId(ApplicabilityId.BASE);
data.setTupleType(tupleType);
- data.getVersion().setGammaId(Lib.generateUuid());
+ data.getVersion().setGammaId(GammaId.valueOf(Lib.generateUuid()));
data.getVersion().setBranch(branch);
data.setElement1(e1);
data.setElement2(e2);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/VersionDataImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/VersionDataImpl.java
index fad69b453f..1f4a7487c0 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/VersionDataImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/VersionDataImpl.java
@@ -37,8 +37,8 @@ public class VersionDataImpl implements VersionData {
}
@Override
- public void setGammaId(long gamma) {
- this.gamma = GammaId.valueOf(gamma);
+ public void setGammaId(GammaId gamma) {
+ this.gamma = gamma;
}
@Override
@@ -137,7 +137,7 @@ public class VersionDataImpl implements VersionData {
public VersionData clone() {
VersionData copy = new VersionDataImpl();
copy.setBranch(getBranch());
- copy.setGammaId(getGammaId().getId());
+ copy.setGammaId(getGammaId());
copy.setHistorical(isHistorical());
copy.setStripeId(getStripeId());
copy.setTransactionId(getTransactionId());
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java
index 9eb4523e4c..33350f6c28 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java
@@ -67,7 +67,7 @@ public class TxSqlBuilderImpl implements OrcsVisitor, TxSqlBuilder {
public List<Object[]> getInsertData(SqlOrderEnum key) {
List<Object[]> toReturn = null;
if (dataItemInserts != null) {
- toReturn = (List<Object[]>) dataItemInserts.getValues(key);
+ toReturn = dataItemInserts.getValues(key);
}
return toReturn != null ? toReturn : Collections.<Object[]> emptyList();
}
@@ -218,8 +218,7 @@ public class TxSqlBuilderImpl implements OrcsVisitor, TxSqlBuilder {
private void updateGamma(OrcsData data) {
VersionData version = data.getVersion();
- long newGamma = idManager.getNextGammaId();
- version.setGammaId(newGamma);
+ version.setGammaId(idManager.getNextGammaId());
}
private ModificationType computeModType(ModificationType original) {
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java
index eac174af05..c8e18b61d8 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.util;
+import org.eclipse.osee.framework.core.data.GammaId;
import org.eclipse.osee.framework.core.data.OseeData;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
@@ -51,8 +52,8 @@ public class IdentityManagerImpl implements IdentityManager {
}
@Override
- public long getNextGammaId() {
- return client.getNextSequence(OseeData.GAMMA_ID_SEQ, true);
+ public GammaId getNextGammaId() {
+ return GammaId.valueOf(client.getNextSequence(OseeData.GAMMA_ID_SEQ, true));
}
@Override

Back to the top