From f5b562cfcc469ea61f060b3ada7b8640c48e69b4 Mon Sep 17 00:00:00 2001 From: Ryan D. Brooks Date: Thu, 24 Aug 2017 14:55:56 -0700 Subject: refactor: Extend TxChange from Id Change-Id: I17cb6fb86a7e29940eeab1b5d37e5faedc01c0da --- .../skynet/core/ConflictDeletionTest.java | 12 ++-- .../osee/framework/core/enums/TxChange.java | 74 ++++++++++++++-------- .../eclipse/osee/framework/core/sql/OseeSql.java | 12 ++-- .../framework/server/ide/data/ArtifactUtil.java | 2 +- .../skynet/core/artifact/ChangeArtifactType.java | 2 +- .../skynet/core/artifact/UpdateMergeBranch.java | 14 ++-- .../core/transaction/BaseTransactionData.java | 4 +- .../StoreSkynetTransactionOperation.java | 2 +- .../core/utility/InvalidTxCurrentsAndModTypes.java | 4 +- .../ItemsDeletedWithNoOtherModification.java | 2 +- .../ui/skynet/dbHealth/RelationIntegrityCheck.java | 8 +-- .../dbHealth/RepeatEnumerationAttributeValues.java | 2 +- .../db/internal/transaction/TxSqlBuilderTest.java | 12 ++-- .../internal/accessor/UpdatePreviousTxCurrent.java | 6 +- .../db/internal/callable/BranchCopyTxCallable.java | 8 +-- .../callable/CommitBranchDatabaseTxCallable.java | 2 +- .../ConsolidateRelationsDatabaseTxCallable.java | 8 +-- .../callable/CreateBranchDatabaseTxCallable.java | 6 +- .../InvalidTxCurrentsAndModTypesCallable.java | 6 +- .../internal/callable/OrcsTypeLoaderCallable.java | 4 +- .../callable/PurgeTransactionTxCallable.java | 7 +- .../internal/change/LoadDeltasBetweenBranches.java | 12 ++-- .../console/FixDuplicateAttributesCommand.java | 3 +- .../exchange/transform/V0_9_2Transformer.java | 2 +- .../transform/V0_9_2TxsConsolidateParser.java | 2 +- .../orcs/db/internal/loader/LoadSqlWriter.java | 10 +-- .../loader/processor/DynamicLoadProcessor.java | 2 +- .../search/engines/ApplicabilityDsQueryImpl.java | 5 +- .../search/engines/ArtifactQuerySqlWriter.java | 4 +- .../search/engines/ObjectQuerySqlWriter.java | 8 +-- .../db/internal/transaction/TransactionWriter.java | 8 +-- .../db/internal/transaction/TxSqlBuilderImpl.java | 2 +- .../osee/orcs/rest/internal/TypesEndpointImpl.java | 4 +- 33 files changed, 133 insertions(+), 126 deletions(-) diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java index 37572fde3a8..3f838fa851f 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java @@ -158,7 +158,7 @@ public class ConflictDeletionTest { if (DEBUG) { dumpAttribute(attribute); } else { - checkAttribute(artifact, attribute, TxChange.ARTIFACT_DELETED.getValue()); + checkAttribute(artifact, attribute, TxChange.ARTIFACT_DELETED); } } //Check that relations are deleted. @@ -166,7 +166,7 @@ public class ConflictDeletionTest { if (DEBUG) { dumpRelation(relation, artifact); } else { - checkRelation(artifact, relation, TxChange.ARTIFACT_DELETED.getValue()); + checkRelation(artifact, relation, TxChange.ARTIFACT_DELETED); } } } @@ -286,8 +286,8 @@ public class ConflictDeletionTest { assertTrue("Attribute " + attribute.getId() + " should be deleted but isn't", attribute.isDeleted()); assertTrue("Relation " + relation.getId() + " should be deleted but isn't", relation.isDeleted()); - checkAttribute(artifactForDeletionCheck, attribute, TxChange.DELETED.getValue()); - checkRelation(artifactForDeletionCheck, relation, TxChange.DELETED.getValue()); + checkAttribute(artifactForDeletionCheck, attribute, TxChange.DELETED); + checkRelation(artifactForDeletionCheck, relation, TxChange.DELETED); } } @@ -307,7 +307,7 @@ public class ConflictDeletionTest { } } - private void checkAttribute(Artifact artifact, Attribute attribute, int value) throws OseeCoreException { + private void checkAttribute(Artifact artifact, Attribute attribute, TxChange value) throws OseeCoreException { JdbcStatement chStmt = ConnectionHandler.getStatement(); try { chStmt.runPreparedQuery(CHECK_FOR_ZERO_TX_CURRENT_ATTRIBUTE, artifact.getBranch(), artifact.getTransaction(), @@ -336,7 +336,7 @@ public class ConflictDeletionTest { } } - public void checkRelation(Artifact artifact, RelationLink relation, int value) throws OseeCoreException { + public void checkRelation(Artifact artifact, RelationLink relation, TxChange value) throws OseeCoreException { JdbcStatement chStmt = ConnectionHandler.getStatement(); assertTrue( "Relation should be deleted between Parent: " + relation.getArtifactIdA() + " and child " + relation.getArtifactIdB(), diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TxChange.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TxChange.java index 202e7791e2e..f16fceeda2b 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TxChange.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TxChange.java @@ -11,46 +11,58 @@ package org.eclipse.osee.framework.core.enums; -import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.eclipse.osee.framework.jdk.core.type.BaseId; +import org.eclipse.osee.framework.jdk.core.type.Id; +import org.eclipse.osee.framework.jdk.core.type.IdSerializer; /** * @author Ryan D. Brooks */ -public enum TxChange { - NOT_CURRENT(0), - CURRENT(1), - DELETED(2), - ARTIFACT_DELETED(3); +@JsonSerialize(using = IdSerializer.class) +public interface TxChange extends Id { - private int value; + public static final TxChange SENTINEL = internalCreate(Id.SENTINEL); + public static final TxChange NOT_CURRENT = internalCreate(0L); + public static final TxChange CURRENT = internalCreate(1L); + public static final TxChange DELETED = internalCreate(2L); + public static final TxChange ARTIFACT_DELETED = internalCreate(3L); - private TxChange(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - - public boolean isDeleted() { - return this == DELETED || this == ARTIFACT_DELETED; + public static TxChange valueOf(int id) { + switch (id) { + case 0: + return NOT_CURRENT; + case 1: + return CURRENT; + case 2: + return DELETED; + case 3: + return ARTIFACT_DELETED; + default: + return SENTINEL; + } } - public boolean isCurrent() { - return this != TxChange.NOT_CURRENT; - } + /** + * This method is only public because all methods in an interface are and it should never be called outside of this + * interface + */ + public static TxChange internalCreate(Long id) { + final class TxChangeImpl extends BaseId implements TxChange, Comparable { + public TxChangeImpl(Long id) { + super(id); + } - public static TxChange getChangeType(int value) throws OseeArgumentException { - for (TxChange change : values()) { - if (change.getValue() == value) { - return change; + @Override + public int compareTo(TxChange o) { + return getId().compareTo(o.getId()); } } - throw new OseeArgumentException("[%s] does not correspond to any defined ModificationType enumerations", value); + return new TxChangeImpl(id); } public static TxChange getCurrent(ModificationType type) { - TxChange txChange = null; + TxChange txChange; if (type == ModificationType.DELETED) { txChange = TxChange.DELETED; @@ -61,4 +73,12 @@ public enum TxChange { } return txChange; } -} + + default boolean isDeleted() { + return this == DELETED || this == ARTIFACT_DELETED; + } + + default boolean isCurrent() { + return this != TxChange.NOT_CURRENT; + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java index 97f2b522100..943d4f34ddd 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java @@ -21,9 +21,9 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; */ public enum OseeSql { - TX_GET_PREVIOUS_TX_NOT_CURRENT_ARTIFACTS("SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_artifact art, osee_txs txs WHERE art.art_id = ? AND art.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue()), - TX_GET_PREVIOUS_TX_NOT_CURRENT_ATTRIBUTES("SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_attribute atr, osee_txs txs WHERE atr.attr_id = ? AND atr.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue()), - TX_GET_PREVIOUS_TX_NOT_CURRENT_RELATIONS("SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_relation_link rel, osee_txs txs WHERE rel.rel_link_id = ? AND rel.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue()), + TX_GET_PREVIOUS_TX_NOT_CURRENT_ARTIFACTS("SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_artifact art, osee_txs txs WHERE art.art_id = ? AND art.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT), + TX_GET_PREVIOUS_TX_NOT_CURRENT_ATTRIBUTES("SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_attribute atr, osee_txs txs WHERE atr.attr_id = ? AND atr.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT), + TX_GET_PREVIOUS_TX_NOT_CURRENT_RELATIONS("SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_relation_link rel, osee_txs txs WHERE rel.rel_link_id = ? AND rel.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT), MERGE_GET_ARTIFACTS_FOR_BRANCH("SELECT art.art_id FROM osee_txs txs, osee_artifact art WHERE txs.branch_id = ? and txs.gamma_id = art.gamma_id"), MERGE_GET_ATTRIBUTES_FOR_BRANCH("SELECT atr.art_id, atr.attr_id FROM osee_txs txs, osee_attribute atr WHERE txs.branch_id = ? and txs.gamma_id = atr.gamma_id"), @@ -47,7 +47,7 @@ public enum OseeSql { LOAD_CURRENT_ARCHIVED_ATTRIBUTES_WITH_DELETED(Strings.SELECT_CURRENT_ARCHIVED_ATTRIBUTES_PREFIX + "IN (1, 3) order by al1.id2, al1.id1, att1.attr_id, txs.transaction_id desc", Strings.HintsOrdered), LOAD_ALL_CURRENT_ARCHIVED_ATTRIBUTES(Strings.SELECT_CURRENT_ARCHIVED_ATTRIBUTES_PREFIX + "IN (1, 2, 3) order by al1.id2, al1.id1, att1.attr_id, txs.transaction_id desc", Strings.HintsOrdered), - LOAD_RELATIONS("SELECT%s txs.mod_type, rel_link_id, a_art_id, b_art_id, rel_link_type_id, rel.gamma_id, rationale, txs.branch_id, aj.id4, txs.app_id FROM osee_join_id4 aj, osee_relation_link rel, osee_txs txs WHERE aj.query_id = ? AND (aj.id2 = rel.a_art_id OR aj.id2 = rel.b_art_id) AND rel.gamma_id = txs.gamma_id AND txs.tx_current = " + TxChange.CURRENT.getValue() + " AND aj.id1 = txs.branch_id", Strings.HintsOrdered), + LOAD_RELATIONS("SELECT%s txs.mod_type, rel_link_id, a_art_id, b_art_id, rel_link_type_id, rel.gamma_id, rationale, txs.branch_id, aj.id4, txs.app_id FROM osee_join_id4 aj, osee_relation_link rel, osee_txs txs WHERE aj.query_id = ? AND (aj.id2 = rel.a_art_id OR aj.id2 = rel.b_art_id) AND rel.gamma_id = txs.gamma_id AND txs.tx_current = " + TxChange.CURRENT + " AND aj.id1 = txs.branch_id", Strings.HintsOrdered), LOAD_CURRENT_ARTIFACTS(Strings.SELECT_CURRENT_ARTIFACTS_PREFIX + "= 1", Strings.HintsOrdered), LOAD_CURRENT_ARTIFACTS_WITH_DELETED(Strings.SELECT_CURRENT_ARTIFACTS_PREFIX + "in (1, 2)", Strings.HintsOrdered), LOAD_CURRENT_ARCHIVED_ARTIFACTS(Strings.SELECT_CURRENT_ARCHIVED_ARTIFACTS_PREFIX + "= 1", Strings.HintsOrdered), @@ -60,10 +60,10 @@ public enum OseeSql { CHANGE_BRANCH_ATTRIBUTE_WAS("SELECT%s attxs1.attr_id, attxs1.value as was_value, txs1.mod_type FROM osee_join_id4 ja1, osee_attribute attxs1, osee_txs txs1, WHERE txs1.branch_id = ? AND txs1.tx_type = 1 AND attxs1.gamma_id = txs1.gamma_id AND attxs1.art_id = ja1.id2 AND txs1.branch_id = ja1.id1 AND ja1.query_id = ?", Strings.HintsOrdered), CHANGE_TX_ATTRIBUTE_WAS("SELECT%s att1.attr_id, att1.value as was_value, txs1.mod_type FROM osee_join_id4 al1, osee_attribute att1, osee_txs txs1 WHERE al1.id2 = att1.art_id AND att1.gamma_id = txs1.gamma_id AND txs1.transaction_id < ? AND al1.query_id = ? AND txs1.branch_id = al1.id1 order by txs1.branch_id, att1.art_id, att1.attr_id, txs1.transaction_id desc", Strings.HintsOrdered), - CHANGE_BRANCH_ATTRIBUTE_IS("SELECT%s art1.art_type_id, attr1.art_id, attr1.attr_id, attr1.gamma_id, attr1.attr_type_id, attr1.value as is_value, txs1.mod_type FROM osee_txs txs1, osee_attribute attr1, osee_artifact art1 WHERE txs1.branch_id = ? AND txs1.transaction_id <> = ? AND txs1.tx_current in (" + TxChange.DELETED.getValue() + ", " + TxChange.CURRENT.getValue() + ", " + TxChange.ARTIFACT_DELETED.getValue() + ") AND art1.art_id = attr1.art_id AND attr1.gamma_id = txs1.gamma_id", Strings.HintsOrdered), + CHANGE_BRANCH_ATTRIBUTE_IS("SELECT%s art1.art_type_id, attr1.art_id, attr1.attr_id, attr1.gamma_id, attr1.attr_type_id, attr1.value as is_value, txs1.mod_type FROM osee_txs txs1, osee_attribute attr1, osee_artifact art1 WHERE txs1.branch_id = ? AND txs1.transaction_id <> = ? AND txs1.tx_current in (" + TxChange.DELETED + ", " + TxChange.CURRENT + ", " + TxChange.ARTIFACT_DELETED + ") AND art1.art_id = attr1.art_id AND attr1.gamma_id = txs1.gamma_id", Strings.HintsOrdered), CHANGE_TX_ATTRIBUTE_IS("SELECT art.art_type_id, att.art_id, att.attr_id, att.gamma_id, att.attr_type_id, att.value as is_value, txs.mod_type FROM osee_txs txs, osee_attribute att, osee_artifact art WHERE txs.branch_id = ? and txs.transaction_id = ? AND txs.gamma_id = att.gamma_id AND att.art_id = art.art_id"), CHANGE_TX_ATTRIBUTE_IS_FOR_SPECIFIC_ARTIFACT(CHANGE_TX_ATTRIBUTE_IS.sql + " and att.art_id =?"), - CHANGE_BRANCH_RELATION("SELECT%s txs1.mod_type, rel1.gamma_id, rel1.b_art_id, rel1.a_art_id, rel1.rationale, rel1.rel_link_id, rel1.rel_link_type_id, art.art_type_id from osee_txs txs1, osee_relation_link rel1, osee_artifact art where txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (" + TxChange.DELETED.getValue() + ", " + TxChange.CURRENT.getValue() + ", " + TxChange.ARTIFACT_DELETED.getValue() + ") AND txs1.gamma_id = rel1.gamma_id AND rel1.a_art_id = art.art_id", Strings.HintsOrdered), + CHANGE_BRANCH_RELATION("SELECT%s txs1.mod_type, rel1.gamma_id, rel1.b_art_id, rel1.a_art_id, rel1.rationale, rel1.rel_link_id, rel1.rel_link_type_id, art.art_type_id from osee_txs txs1, osee_relation_link rel1, osee_artifact art where txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (" + TxChange.DELETED + ", " + TxChange.CURRENT + ", " + TxChange.ARTIFACT_DELETED + ") AND txs1.gamma_id = rel1.gamma_id AND rel1.a_art_id = art.art_id", Strings.HintsOrdered), CHANGE_TX_RELATION("SELECT txs.mod_type, rel.gamma_id, rel.b_art_id, rel.a_art_id, rel.rationale, rel.rel_link_id, rel.rel_link_type_id, art.art_type_id from osee_txs txs, osee_relation_link rel, osee_artifact art where txs.branch_id = ? AND txs.transaction_id = ? AND txs.gamma_id = rel.gamma_id AND rel.a_art_id = art.art_id"), CHANGE_TX_RELATION_FOR_SPECIFIC_ARTIFACT(CHANGE_TX_RELATION.sql + " and (rel.a_art_id = ? or rel.b_art_id = ?)"), CHANGE_BRANCH_ARTIFACT("select%s art1.art_id, art1.art_type_id, art1.gamma_id, txs1.mod_type FROM osee_txs txs1, osee_artifact art1 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.gamma_id = art1.gamma_id AND txs1.mod_type in (" + ModificationType.DELETED.getValue() + ", " + ModificationType.NEW.getValue() + ", " + ModificationType.INTRODUCED.getValue() + ") ", Strings.HintsOrdered), diff --git a/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/ArtifactUtil.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/ArtifactUtil.java index 6e3f7c1a2b5..324d852856f 100644 --- a/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/ArtifactUtil.java +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/ArtifactUtil.java @@ -24,7 +24,7 @@ public class ArtifactUtil { public static String getUri(JdbcClient jdbcClient, String artifactGuid, BranchReadable branch) throws OseeCoreException { String sql = String.format(URI_BY_GUID, getTransactionTable(branch)); - return jdbcClient.fetch("", sql, artifactGuid, branch, TxChange.CURRENT.getValue()); + return jdbcClient.fetch("", sql, artifactGuid, branch, TxChange.CURRENT); } private static String getTransactionTable(BranchReadable branch) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java index 2dad2c94855..d13a5b3de45 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java @@ -136,7 +136,7 @@ public class ChangeArtifactType { try (JdbcStatement chStmt = ConnectionHandler.getStatement()) { chStmt.runPreparedQuery( "select branch_id, gamma_id from osee_join_id jid1, osee_join_id jid2, osee_txs txs where jid1.query_id = ? and jid2.query_id = ? and jid1.id = txs.gamma_id and jid2.id = txs.branch_id and txs.tx_current = ?", - gammaJoin.getQueryId(), branchJoin.getQueryId(), TxChange.CURRENT.getValue()); + gammaJoin.getQueryId(), branchJoin.getQueryId(), TxChange.CURRENT); while (chStmt.next()) { GammaId gammaId = GammaId.valueOf(chStmt.getLong("gamma_id")); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java index 663aa2aecfb..1d0a87d8525 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java @@ -40,9 +40,9 @@ import org.eclipse.osee.jdbc.JdbcConnection; public class UpdateMergeBranch extends AbstractDbTxOperation { private static final String TX_CURRENT_SETTINGS = "CASE" + // - " WHEN txs1.mod_type = " + ModificationType.DELETED.getValue() + " THEN " + TxChange.DELETED.getValue() + // - " WHEN txs1.mod_type = " + ModificationType.ARTIFACT_DELETED.getValue() + " THEN " + TxChange.ARTIFACT_DELETED.getValue() + // - " ELSE " + TxChange.CURRENT.getValue() + // + " WHEN txs1.mod_type = " + ModificationType.DELETED.getValue() + " THEN " + TxChange.DELETED + // + " WHEN txs1.mod_type = " + ModificationType.ARTIFACT_DELETED.getValue() + " THEN " + TxChange.ARTIFACT_DELETED + // + " ELSE " + TxChange.CURRENT + // " END"; private static final String UPDATE_ARTIFACTS = @@ -116,9 +116,8 @@ public class UpdateMergeBranch extends AbstractDbTxOperation { //Copy over any missing attributes TransactionId baselineTransaction = BranchManager.getBaseTransaction(mergeBranch); for (Artifact artifact : goodMergeBranchArtifacts) { - numberAttrUpdated += - getJdbcClient().runPreparedUpdate(connection, UPDATE_ARTIFACTS, baselineTransaction, mergeBranch, - artifact.getArtId(), sourceBranch, TxChange.NOT_CURRENT.getValue(), mergeBranch, baselineTransaction); + numberAttrUpdated += getJdbcClient().runPreparedUpdate(connection, UPDATE_ARTIFACTS, baselineTransaction, + mergeBranch, artifact.getArtId(), sourceBranch, TxChange.NOT_CURRENT, mergeBranch, baselineTransaction); } if (DEBUG) { System.out.println(String.format(" Adding %d Attributes to Existing Artifacts took %s", @@ -166,8 +165,7 @@ public class UpdateMergeBranch extends AbstractDbTxOperation { } private void insertGammas(JdbcConnection connection, String sql, TransactionId baseTx, int queryId, BranchId sourceBranch, BranchId mergeBranch) throws OseeCoreException { - getJdbcClient().runPreparedUpdate(connection, sql, baseTx, TxChange.CURRENT.getValue(), mergeBranch, sourceBranch, - queryId); + getJdbcClient().runPreparedUpdate(connection, sql, baseTx, TxChange.CURRENT, mergeBranch, sourceBranch, queryId); } private Collection getAllMergeArtifacts(BranchId branch) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java index 9775c1e32af..4eff50aedd2 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java @@ -68,8 +68,8 @@ public abstract class BaseTransactionData { ModificationType modTypeToStore = getAdjustedModificationType(); internalAddInsertToBatch(collector, Integer.MAX_VALUE, INSERT_INTO_TRANSACTION_TABLE, collector.getTransaction(), - getGammaId(), modTypeToStore.getValue(), TxChange.getCurrent(modTypeToStore).getValue(), - collector.getBranch(), getApplicId()); + getGammaId(), modTypeToStore.getValue(), TxChange.getCurrent(modTypeToStore), collector.getBranch(), + getApplicId()); //TODO: remove hack defaulting to 1 } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java index 525a275b2ca..d755d416e45 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java @@ -52,7 +52,7 @@ import org.eclipse.osee.jdbc.JdbcStatement; public final class StoreSkynetTransactionOperation extends AbstractDbTxOperation implements InsertDataCollector { private static final String UPDATE_TXS_NOT_CURRENT = - "UPDATE osee_txs SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " WHERE branch_id = ? AND transaction_id = ? AND gamma_id = ?"; + "UPDATE osee_txs SET tx_current = " + TxChange.NOT_CURRENT + " WHERE branch_id = ? AND transaction_id = ? AND gamma_id = ?"; private final HashCollection dataItemInserts = new HashCollection<>(); private final Map dataInsertOrder = new HashMap<>(); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/InvalidTxCurrentsAndModTypes.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/InvalidTxCurrentsAndModTypes.java index 9a82437f888..43140cb6812 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/InvalidTxCurrentsAndModTypes.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/InvalidTxCurrentsAndModTypes.java @@ -93,7 +93,7 @@ public class InvalidTxCurrentsAndModTypes extends AbstractOperation { } else if (address.getCorrectedTxCurrent() != null) { logIssue("corrected txCurrent: " + address.getCorrectedTxCurrent(), address); currentData.add(new Object[] { - address.getCorrectedTxCurrent().getValue(), + address.getCorrectedTxCurrent(), address.getTransactionId(), address.getGammaId(), address.getBranchId()}); @@ -182,7 +182,7 @@ public class InvalidTxCurrentsAndModTypes extends AbstractOperation { Consumer consumer = stmt -> { checkForCancelledStatus(monitor); ModificationType modType = ModificationType.getMod(stmt.getInt("mod_type")); - TxChange txCurrent = TxChange.getChangeType(stmt.getInt("tx_current")); + TxChange txCurrent = TxChange.valueOf(stmt.getInt("tx_current")); TransactionDetailsType type = TransactionDetailsType.toEnum(stmt.getInt("tx_type")); ApplicabilityId appId = ApplicabilityId.valueOf(stmt.getLong("app_id")); Address address = new Address(type.isBaseline(), stmt.getLong("branch_id"), stmt.getInt(columnName), diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java index 9017bfa6af7..b994f2f76e7 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java @@ -71,7 +71,7 @@ public class ItemsDeletedWithNoOtherModification extends DatabaseHealthOperation private void loadData(String sql, TxChange txChange, ModificationType modificationType) throws OseeCoreException { JdbcStatement chStmt = ConnectionHandler.getStatement(); try { - chStmt.runPreparedQuery(sql, txChange.getValue(), modificationType.getValue(), modificationType.getValue()); + chStmt.runPreparedQuery(sql, txChange, modificationType.getValue(), modificationType.getValue()); while (chStmt.next()) { addressing.add( new LocalValues(chStmt.getInt("art_id"), chStmt.getInt("attr_id"), chStmt.getLong("branch_id"), diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java index 34838448d65..958da1b5c9f 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java @@ -53,8 +53,8 @@ public class RelationIntegrityCheck extends DatabaseHealthOperation { " osee_tx_details txd " + " WHERE " + " tx1.branch_id = tx2.branch_id AND " + - " tx1.tx_current = " + TxChange.CURRENT.getValue() + " AND " + - " tx2.tx_current = " + TxChange.DELETED.getValue() + " AND " + + " tx1.tx_current = " + TxChange.CURRENT + " AND " + + " tx2.tx_current = " + TxChange.DELETED + " AND " + " tx1.gamma_id = rel1.gamma_id AND " + " tx2.gamma_id = av1.gamma_id AND " + " av1.art_id = rel1.%s AND " + @@ -102,10 +102,10 @@ public class RelationIntegrityCheck extends DatabaseHealthOperation { private static final String UPDATE_TXS_PREVIOUS = "UPDATE osee_txs SET tx_current = 0 WHERE gamma_id = ? AND transaction_id = ?"; private static final String UPDATE_TXS_CURRENT = - "UPDATE osee_txs SET tx_current = " + TxChange.ARTIFACT_DELETED.getValue() + ", mod_type = " + ModificationType.ARTIFACT_DELETED.getValue() + " WHERE gamma_id = ? AND transaction_id = ?"; + "UPDATE osee_txs SET tx_current = " + TxChange.ARTIFACT_DELETED + ", mod_type = " + ModificationType.ARTIFACT_DELETED.getValue() + " WHERE gamma_id = ? AND transaction_id = ?"; private static final String INSERT_TXS = - "INSERT INTO osee_txs (gamma_id, transaction_id, tx_current, mod_type, branch_id) VALUES (?, ?, " + TxChange.ARTIFACT_DELETED.getValue() + ", " + ModificationType.ARTIFACT_DELETED.getValue() + ", ?)"; + "INSERT INTO osee_txs (gamma_id, transaction_id, tx_current, mod_type, branch_id) VALUES (?, ?, " + TxChange.ARTIFACT_DELETED + ", " + ModificationType.ARTIFACT_DELETED.getValue() + ", ?)"; private static final String[] COLUMN_HEADERS = { "Rel Link ID", diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java index 0bac39af01c..c04ae91bad7 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java @@ -41,7 +41,7 @@ import org.eclipse.osee.jdbc.JdbcStatement; public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation { private final static String FIND_REPEAT_ENUMS = - "select DISTINCT(art1.guid), att1.art_id, att1.value, att1.attr_type_id from osee_attribute att1, osee_attribute att2, osee_txs txs1, osee_txs txs2, osee_artifact art1 where att1.gamma_id = txs1.gamma_id and txs1.branch_id = ? and att2.gamma_id = txs2.gamma_id and txs2.branch_id = ? and att1.art_id = att2.art_id and att1.attr_id <> att2.attr_id and att1.value = att2.value and txs1.tx_current = " + TxChange.CURRENT.getValue() + " and txs2.tx_current = " + TxChange.CURRENT.getValue() + " and att1.attr_type_id = att2.attr_type_id and art1.art_id = att1.art_id order by att1.art_id, att1.attr_type_id, att1.value"; + "select DISTINCT(art1.guid), att1.art_id, att1.value, att1.attr_type_id from osee_attribute att1, osee_attribute att2, osee_txs txs1, osee_txs txs2, osee_artifact art1 where att1.gamma_id = txs1.gamma_id and txs1.branch_id = ? and att2.gamma_id = txs2.gamma_id and txs2.branch_id = ? and att1.art_id = att2.art_id and att1.attr_id <> att2.attr_id and att1.value = att2.value and txs1.tx_current = " + TxChange.CURRENT + " and txs2.tx_current = " + TxChange.CURRENT + " and att1.attr_type_id = att2.attr_type_id and art1.art_id = att1.art_id order by att1.art_id, att1.attr_type_id, att1.value"; public RepeatEnumerationAttributeValues() { super("Repeat Enumeration Attribute Values"); 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 75ff8db9ff1..9ee7e623cba 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 @@ -193,7 +193,7 @@ public class TxSqlBuilderTest { // @formatter:off verifyRow(SqlOrderEnum.ARTIFACTS, ITEM_ID, TYPE_UUID, NEXT_GAMMA_ID, EXP_GUID); - verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, NEXT_GAMMA_ID, modType.getValue(), TxChange.CURRENT.getValue(), COMMON); + verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, NEXT_GAMMA_ID, modType.getValue(), TxChange.CURRENT, COMMON); verifyQuery(SqlOrderEnum.ARTIFACTS); // @formatter:on @@ -215,7 +215,7 @@ public class TxSqlBuilderTest { ModificationType expectedType = modType != REPLACED_WITH_VERSION ? modType : MODIFIED; // @formatter:off - verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, GammaId.SENTINEL, expectedType.getValue(), TxChange.getCurrent(expectedType).getValue(), COMMON); + verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, GammaId.SENTINEL, expectedType.getValue(), TxChange.getCurrent(expectedType), COMMON); verifyQuery(SqlOrderEnum.ARTIFACTS); // @formatter:on @@ -263,7 +263,7 @@ public class TxSqlBuilderTest { // @formatter:off verifyRow(SqlOrderEnum.RELATIONS, ITEM_ID, TYPE_UUID, NEXT_GAMMA_ID, A_ART_ID.getId().intValue(), B_ART_ID.getId().intValue(), RATIONALE); - verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, NEXT_GAMMA_ID, modType.getValue(), TxChange.CURRENT.getValue(), COMMON); + verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, NEXT_GAMMA_ID, modType.getValue(), TxChange.CURRENT, COMMON); verifyQuery(SqlOrderEnum.RELATIONS); // @formatter:on @@ -285,7 +285,7 @@ public class TxSqlBuilderTest { ModificationType expectedType = modType != REPLACED_WITH_VERSION ? modType : MODIFIED; // @formatter:off - verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, GammaId.SENTINEL, expectedType.getValue(), TxChange.getCurrent(expectedType).getValue(), COMMON); + verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, GammaId.SENTINEL, expectedType.getValue(), TxChange.getCurrent(expectedType), COMMON); verifyQuery(SqlOrderEnum.RELATIONS); // @formatter:on @@ -307,7 +307,7 @@ public class TxSqlBuilderTest { // @formatter:off verifyRow(SqlOrderEnum.ATTRIBUTES, ITEM_ID, TYPE_UUID, NEXT_GAMMA_ID, ATTR_ARTIFACT_ID, ATTR_VALUE, ATTR_URI); - verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, NEXT_GAMMA_ID, modType.getValue(), TxChange.CURRENT.getValue(), COMMON); + verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, NEXT_GAMMA_ID, modType.getValue(), TxChange.CURRENT, COMMON); verifyQuery(SqlOrderEnum.ATTRIBUTES); // @formatter:on @@ -341,7 +341,7 @@ public class TxSqlBuilderTest { ModificationType expectedType = modType != REPLACED_WITH_VERSION ? modType : MODIFIED; // @formatter:off - verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, GammaId.SENTINEL, expectedType.getValue(), TxChange.getCurrent(expectedType).getValue(), COMMON); + verifyRow(SqlOrderEnum.TXS, EXPECTED_TX, GammaId.SENTINEL, expectedType.getValue(), TxChange.getCurrent(expectedType), COMMON); verifyQuery(SqlOrderEnum.ATTRIBUTES); // @formatter:on diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java index 0764314f4f3..648d4b7612a 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java @@ -25,9 +25,9 @@ import org.eclipse.osee.jdbc.OseePreparedStatement; */ public class UpdatePreviousTxCurrent { private static final String UPDATE_TXS_NOT_CURRENT = - "update osee_txs SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " where branch_id = ? AND gamma_id = ? and transaction_id = ?"; + "update osee_txs SET tx_current = " + TxChange.NOT_CURRENT + " where branch_id = ? AND gamma_id = ? and transaction_id = ?"; private static final String UPDATE_TXS_NOT_CURRENT_NO_TX = - "update osee_txs SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " where branch_id = ? AND gamma_id = ?"; + "update osee_txs SET tx_current = " + TxChange.NOT_CURRENT + " where branch_id = ? AND gamma_id = ?"; // @formatter:off private static final String SELECT_TXS_AND_GAMMAS_FROM_TXS ="with\n"+ "txs as (select gamma_id from osee_txs where branch_id = ? and transaction_id = ?),\n"+ @@ -37,7 +37,7 @@ public class UpdatePreviousTxCurrent { " SELECT item2.gamma_id FROM osee_artifact item1, txs, osee_artifact item2 where txs.gamma_id = item1.gamma_id and item1.art_id = item2.art_id\n"+ "UNION ALL\n"+ " SELECT item2.gamma_id FROM osee_relation_link item1, txs, osee_relation_link item2 where txs.gamma_id = item1.gamma_id and item1.rel_link_id = item2.rel_link_id)\n"+ - "select txsb.transaction_id, txsb.gamma_id FROM item, osee_txs txsb where item.gamma_id = txsb.gamma_id AND txsb.branch_id = ? AND transaction_id <> ? AND txsb.tx_current <> " + TxChange.NOT_CURRENT.getValue(); + "select txsb.transaction_id, txsb.gamma_id FROM item, osee_txs txsb where item.gamma_id = txsb.gamma_id AND txsb.branch_id = ? AND transaction_id <> ? AND txsb.tx_current <> " + TxChange.NOT_CURRENT; // @formatter:on private final JdbcClient jdbcClient; diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/BranchCopyTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/BranchCopyTxCallable.java index 2f7860c7acc..008b60f238f 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/BranchCopyTxCallable.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/BranchCopyTxCallable.java @@ -102,13 +102,7 @@ public final class BranchCopyTxCallable extends JdbcTransaction { ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type")); Long app_id = chStmt.getLong("app_id"); TxChange txCurrent = TxChange.getCurrent(modType); - data.add(new Object[] { - baseTxId, - gamma, - modType.getValue(), - txCurrent.getValue(), - branchData.getBranch(), - app_id}); + data.add(new Object[] {baseTxId, gamma, modType.getValue(), txCurrent, branchData.getBranch(), app_id}); gammas.add(gamma); } } diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java index 2c0debe5392..9beb0fd8908 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java @@ -153,7 +153,7 @@ public class CommitBranchDatabaseTxCallable extends AbstractDatastoreTxCallable< destinationBranch, change.getNetChange().getGammaId(), modType.getValue(), - TxChange.getCurrent(modType).getValue(), + TxChange.getCurrent(modType), appToken}); } getJdbcClient().runBatchUpdate(connection, INSERT_COMMIT_ADDRESSING, insertData); diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ConsolidateRelationsDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ConsolidateRelationsDatabaseTxCallable.java index ca674f560f3..bb06dbe1794 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ConsolidateRelationsDatabaseTxCallable.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ConsolidateRelationsDatabaseTxCallable.java @@ -163,13 +163,13 @@ public class ConsolidateRelationsDatabaseTxCallable extends AbstractDatastoreTxC long transactionId = stmt.getLong("transaction_id"); long netGammaId = stmt.getLong("net_gamma_id"); int modType = stmt.getInt("mod_type"); - TxChange txCurrent = TxChange.getChangeType(stmt.getInt("tx_current")); + TxChange txCurrent = TxChange.valueOf(stmt.getInt("tx_current")); long branchId = stmt.getLong("branch_id"); if (isNextAddressing(netGammaId, transactionId)) { if (updatedAddressing) { - updateAddressing.addToBatch(previousNetGammaId, netModType.getValue(), netTxCurrent.getValue(), - previousBranchId, previousTransactionId, previousObsoleteGammaId); + updateAddressing.addToBatch(previousNetGammaId, netModType.getValue(), netTxCurrent, previousBranchId, + previousTransactionId, previousObsoleteGammaId); } updatedAddressing = obsoleteGammaId != netGammaId; previousNetGammaId = netGammaId; @@ -244,7 +244,7 @@ public class ConsolidateRelationsDatabaseTxCallable extends AbstractDatastoreTxC strB.append(","); strB.append(modType); strB.append(","); - strB.append(txCurrent.getValue()); + strB.append(txCurrent); strB.append("\n"); console.writeln(strB.toString()); } diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java index f188164c048..80e1acdd9eb 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java @@ -226,9 +226,9 @@ public class CreateBranchDatabaseTxCallable extends JdbcTransaction { OseePreparedStatement addressing = jdbcClient.getBatchStatement(connection, INSERT_ADDRESSING); if (newBranchData.getBranchType().isMergeBranch()) { populateAddressingToCopy(connection, addressing, baseTxId, gammas, SELECT_ATTRIBUTE_ADDRESSING_FROM_JOIN, - parentBranch, TxChange.NOT_CURRENT.getValue(), newBranchData.getMergeAddressingQueryId()); + parentBranch, TxChange.NOT_CURRENT, newBranchData.getMergeAddressingQueryId()); populateAddressingToCopy(connection, addressing, baseTxId, gammas, SELECT_ARTIFACT_ADDRESSING_FROM_JOIN, - parentBranch, TxChange.NOT_CURRENT.getValue(), newBranchData.getMergeAddressingQueryId()); + parentBranch, TxChange.NOT_CURRENT, newBranchData.getMergeAddressingQueryId()); } else { populateAddressingToCopy(connection, addressing, baseTxId, gammas, SELECT_ADDRESSING, parentBranch, sourceTxId); @@ -249,7 +249,7 @@ public class CreateBranchDatabaseTxCallable extends JdbcTransaction { ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type")); Long appId = chStmt.getLong("app_id"); TxChange txCurrent = TxChange.getCurrent(modType); - addressing.addToBatch(baseTxId, gamma, modType.getValue(), txCurrent.getValue(), branchId, appId); + addressing.addToBatch(baseTxId, gamma, modType.getValue(), txCurrent, branchId, appId); gammas.add(gamma); } } diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InvalidTxCurrentsAndModTypesCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InvalidTxCurrentsAndModTypesCallable.java index 4b732ba9703..af028189b29 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InvalidTxCurrentsAndModTypesCallable.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InvalidTxCurrentsAndModTypesCallable.java @@ -79,7 +79,7 @@ public class InvalidTxCurrentsAndModTypesCallable extends AbstractDatastoreTxCal logIssue("corrected txCurrent: " + address.getCorrectedTxCurrent(), address); currentData.add(new Object[] { - address.getCorrectedTxCurrent().getValue(), + address.getCorrectedTxCurrent(), address.getTransactionId(), address.getGammaId(), address.getBranchId()}); @@ -166,9 +166,9 @@ public class InvalidTxCurrentsAndModTypesCallable extends AbstractDatastoreTxCal Consumer consumer = stmt -> { checkForCancelled(); ModificationType modType = ModificationType.getMod(stmt.getInt("mod_type")); - TxChange txCurrent = TxChange.getChangeType(stmt.getInt("tx_current")); + TxChange txCurrent = TxChange.valueOf(stmt.getInt("tx_current")); TransactionDetailsType type = TransactionDetailsType.toEnum(stmt.getInt("tx_type")); - ApplicabilityId appId = ApplicabilityId.valueOf(stmt.getLong("app_id")); + ApplicabilityId appId = ApplicabilityId.valueOf(stmt.getLong("app_id")); Address address = new Address(type.isBaseline(), stmt.getLong("branch_id"), stmt.getInt(columnName), stmt.getLong("transaction_id"), stmt.getLong("gamma_id"), modType, appId, txCurrent); diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java index f6e707f2ab0..55543468368 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java @@ -62,8 +62,8 @@ public class OrcsTypeLoaderCallable extends AbstractDatastoreCallable getJdbcClient().runQuery(stmt -> { String uri = stmt.getString("uri"); paths.add(uri); - }, OrcsTypes.LOAD_OSEE_TYPE_DEF_URIS, CoreTupleTypes.OseeTypeDef, CoreBranches.COMMON, - TxChange.CURRENT.getValue(), OrcsTypesData.OSEE_TYPE_VERSION, TxChange.CURRENT.getValue()); + }, OrcsTypes.LOAD_OSEE_TYPE_DEF_URIS, CoreTupleTypes.OseeTypeDef, CoreBranches.COMMON, TxChange.CURRENT, + OrcsTypesData.OSEE_TYPE_VERSION, TxChange.CURRENT); return paths; } diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeTransactionTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeTransactionTxCallable.java index 913108bd119..afec58ba552 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeTransactionTxCallable.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeTransactionTxCallable.java @@ -152,11 +152,8 @@ public class PurgeTransactionTxCallable extends AbstractDatastoreTxCallable ? and txs.branch_id = ? and txs.transaction_id <= ?"; getJdbcClient().runQuery(consumer, JdbcConstants.JDBC__MAX_FETCH_SIZE, query, idJoin.getQueryId(), - TxChange.NOT_CURRENT.getValue(), txBranchId, txId, idJoin.getQueryId(), TxChange.NOT_CURRENT.getValue(), - txBranchId, txId, idJoin.getQueryId(), TxChange.NOT_CURRENT.getValue(), txBranchId, txId); + TxChange.NOT_CURRENT, txBranchId, txId, idJoin.getQueryId(), TxChange.NOT_CURRENT, txBranchId, txId, + idJoin.getQueryId(), TxChange.NOT_CURRENT, txBranchId, txId); } @@ -254,9 +254,9 @@ public class LoadDeltasBetweenBranches extends AbstractDatastoreCallable result.add(new Pair(ArtifactId.valueOf(stmt.getLong("art_id")), ApplicabilityToken.create(stmt.getLong("key"), stmt.getString("value")))), - SELECT_APPLIC_FOR_ARTS, idJoin.getQueryId(), branch, TxChange.NOT_CURRENT.getValue()); + SELECT_APPLIC_FOR_ARTS, idJoin.getQueryId(), branch, NOT_CURRENT); } return result; } 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 56dc9aa6c14..53894a757ad 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 @@ -126,10 +126,10 @@ public class ArtifactQuerySqlWriter extends AbstractSqlWriter { sb.append(".tx_current"); if (allowDeleted) { sb.append(" <> "); - sb.append(String.valueOf(TxChange.NOT_CURRENT.getValue())); + sb.append(String.valueOf(TxChange.NOT_CURRENT)); } else { sb.append(" = "); - sb.append(String.valueOf(TxChange.CURRENT.getValue())); + sb.append(String.valueOf(TxChange.CURRENT)); } } } diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ObjectQuerySqlWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ObjectQuerySqlWriter.java index d2de975a766..fdd4ba22f2e 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ObjectQuerySqlWriter.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ObjectQuerySqlWriter.java @@ -265,15 +265,15 @@ public class ObjectQuerySqlWriter extends AbstractSqlWriter { sb.append(".tx_current"); if (allowDeleted) { sb.append(" IN ("); - sb.append(String.valueOf(TxChange.CURRENT.getValue())); + sb.append(String.valueOf(TxChange.CURRENT)); sb.append(", "); - sb.append(String.valueOf(TxChange.DELETED.getValue())); + sb.append(String.valueOf(TxChange.DELETED)); sb.append(", "); - sb.append(String.valueOf(TxChange.ARTIFACT_DELETED.getValue())); + sb.append(String.valueOf(TxChange.ARTIFACT_DELETED)); sb.append(")"); } else { sb.append(" = "); - sb.append(String.valueOf(TxChange.CURRENT.getValue())); + sb.append(String.valueOf(TxChange.CURRENT)); } } } diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java index d964d9fd0e6..5ed713d6bd6 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java @@ -30,7 +30,7 @@ import org.eclipse.osee.orcs.db.internal.sql.join.AbstractJoinQuery; public class TransactionWriter { protected static final String UPDATE_TXS_NOT_CURRENT = - "UPDATE osee_txs SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " WHERE branch_id = ? AND transaction_id = ? AND gamma_id = ?"; + "UPDATE osee_txs SET tx_current = " + TxChange.NOT_CURRENT + " WHERE branch_id = ? AND transaction_id = ? AND gamma_id = ?"; private static final String INSERT_ARTIFACT = "INSERT INTO osee_artifact (art_id, art_type_id, gamma_id, guid) VALUES (?,?,?,?)"; @@ -57,13 +57,13 @@ public class TransactionWriter { "INSERT INTO osee_tx_details (transaction_id, osee_comment, time, author, branch_id, tx_type) VALUES (?, ?, ?, ?, ?, ?)"; private static final String TX_GET_PREVIOUS_TX_NOT_CURRENT_ARTIFACTS = - "SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_join_id jid, osee_artifact art, osee_txs txs WHERE jid.query_id = ? AND art.art_id = jid.id AND art.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue(); + "SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_join_id jid, osee_artifact art, osee_txs txs WHERE jid.query_id = ? AND art.art_id = jid.id AND art.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT; private static final String TX_GET_PREVIOUS_TX_NOT_CURRENT_ATTRIBUTES = - "SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_join_id jid, osee_attribute attr, osee_txs txs WHERE jid.query_id = ? AND attr.attr_id = jid.id AND attr.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue(); + "SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_join_id jid, osee_attribute attr, osee_txs txs WHERE jid.query_id = ? AND attr.attr_id = jid.id AND attr.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT; private static final String TX_GET_PREVIOUS_TX_NOT_CURRENT_RELATIONS = - "SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_join_id jid, osee_relation_link rel, osee_txs txs WHERE jid.query_id = ? AND rel.rel_link_id = jid.id AND rel.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue(); + "SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_join_id jid, osee_relation_link rel, osee_txs txs WHERE jid.query_id = ? AND rel.rel_link_id = jid.id AND rel.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT; public static enum SqlOrderEnum { ARTIFACTS(INSERT_ARTIFACT, TX_GET_PREVIOUS_TX_NOT_CURRENT_ARTIFACTS), 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 2da021ea2b8..aec1131d6b2 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 @@ -195,7 +195,7 @@ public class TxSqlBuilderImpl implements OrcsVisitor, TxSqlBuilder { ModificationType modType = orcsData.getModType(); addRow(SqlOrderEnum.TXS, data.getTransactionId(), data.getGammaId(), modType.getValue(), - TxChange.getCurrent(modType).getValue(), data.getBranch(), orcsData.getApplicabilityId()); + TxChange.getCurrent(modType), data.getBranch(), orcsData.getApplicabilityId()); if (key.hasTxNotCurrentQuery()) { IdJoinQuery join = txNotCurrentsJoin.get(key); diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java index 322bc7435d0..53e019a917b 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java @@ -281,8 +281,8 @@ public class TypesEndpointImpl implements TypesEndpoint { sheet.setAttrId(stmt2.getInt("attr_id")); attrIds.add(new Long(sheet.getAttrId()).intValue()); typeVersion.getSheets().add(sheet); - }, OrcsTypes.LOAD_OSEE_TYPE_DEF_URIS, CoreTupleTypes.OseeTypeDef, CoreBranches.COMMON, - TxChange.CURRENT.getValue(), typeVersion.getVersionNum(), TxChange.CURRENT.getValue()); + }, OrcsTypes.LOAD_OSEE_TYPE_DEF_URIS, CoreTupleTypes.OseeTypeDef, CoreBranches.COMMON, TxChange.CURRENT, + typeVersion.getVersionNum(), TxChange.CURRENT); }, OrcsTypes.LOAD_OSEE_TYPE_VERSIONS, CoreTupleTypes.OseeTypeDef.getId()); -- cgit v1.2.3