summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2011-05-11 17:51:24 (EDT)
committerRyan D. Brooks2011-05-11 17:51:24 (EDT)
commitb8211e5364f2f7fbd803ac44ddb3c533847f816a (patch)
treee89dea0a98c373221c378e01137b0ffff5ff9de6
parent0e3bc3f933ea0b0dbf4b60dc6b995df0e4eee2e9 (diff)
downloadorg.eclipse.osee-b8211e5364f2f7fbd803ac44ddb3c533847f816a.zip
org.eclipse.osee-b8211e5364f2f7fbd803ac44ddb3c533847f816a.tar.gz
org.eclipse.osee-b8211e5364f2f7fbd803ac44ddb3c533847f816a.tar.bz2
refactor[ats_7QN16]: Remove OSEE_REMOVED_TXS table
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java24
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml16
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/revert/Revert.java24
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ShowRevertTransactions.java70
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.java4
6 files changed, 16 insertions, 130 deletions
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
index 64761eb..cd7c163 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
@@ -33,16 +33,20 @@ import org.eclipse.osee.framework.database.core.OseeConnection;
* @author Ryan D. Brooks
*/
public class PurgeBranchOperation extends AbstractDbTxOperation {
+
+ //@formatter:off
private static final String SELECT_DELETABLE_GAMMAS =
- "select txs1.gamma_id from %s txs1 where txs1.branch_id = ? AND txs1.transaction_id <> ? AND NOT EXISTS (SELECT 1 FROM osee_txs txs2 WHERE txs1.gamma_id = txs2.gamma_id AND txs1.branch_id <> txs2.branch_id) AND NOT EXISTS (SELECT 1 FROM osee_txs_archived txs3 WHERE txs1.gamma_id = txs3.gamma_id AND txs1.branch_id <> txs3.branch_id)";
- private static final String SELECT_DELETABLE_TXS_REMOVED_GAMMAS =
- "select txs1.rem_gamma_id from osee_removed_txs txs1, osee_tx_details txd1 where txd1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.transaction_id = txd1.transaction_id AND NOT EXISTS (SELECT 1 FROM osee_txs txs2 WHERE txs1.rem_gamma_id = txs2.gamma_id AND txd1.branch_id <> txs2.branch_id) AND NOT EXISTS (SELECT 1 FROM osee_txs_archived txs3 WHERE txs1.rem_gamma_id = txs3.gamma_id AND txd1.branch_id <> txs3.branch_id)";
- private static final String PURGE_GAMMAS = "delete from %s where gamma_id = ?";
- private static final String DELETE_FROM_BRANCH_TABLE = "delete from osee_branch where branch_id = ?";
+ "SELECT txs1.gamma_id FROM %s txs1 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND NOT EXISTS " +
+ "(SELECT txs2.branch_id FROM osee_txs txs2 WHERE txs1.gamma_id = txs2.gamma_id AND txs1.branch_id <> txs2.branch_id) AND NOT EXISTS " +
+ "(SELECT txs3.branch_id FROM osee_txs_archived txs3 WHERE txs1.gamma_id = txs3.gamma_id AND txs1.branch_id <> txs3.branch_id)";
+ //@formatter:on
+
+ private static final String PURGE_GAMMAS = "DELETE FROM %s WHERE gamma_id = ?";
+ private static final String DELETE_FROM_BRANCH_TABLE = "DELETE FROM osee_branch WHERE branch_id = ?";
private static final String DELETE_FROM_MERGE =
- "delete from osee_merge where merge_branch_id = ? and source_branch_id=?";
- private static final String DELETE_FROM_CONFLICT = "delete from osee_conflict where merge_branch_id = ?";
- private static final String DELETE_FROM_TX_DETAILS = "delete from osee_tx_details where branch_id = ?";
+ "DELETE FROM osee_merge WHERE merge_branch_id = ? AND source_branch_id = ?";
+ private static final String DELETE_FROM_CONFLICT = "DELETE FROM osee_conflict WHERE merge_branch_id = ?";
+ private static final String DELETE_FROM_TX_DETAILS = "DELETE FROM osee_tx_details WHERE branch_id = ?";
private final Branch branch;
private final List<Object[]> deleteableGammas = new ArrayList<Object[]>();
@@ -72,14 +76,13 @@ public class PurgeBranchOperation extends AbstractDbTxOperation {
monitor.worked(calculateWork(0.05));
- findDeleteableGammas(SELECT_DELETABLE_TXS_REMOVED_GAMMAS, 0.10);
findDeleteableGammas(String.format(SELECT_DELETABLE_GAMMAS, sourceTableName), 0.10);
purgeGammas("osee_artifact", 0.10);
purgeGammas("osee_attribute", 0.10);
purgeGammas("osee_relation_link", 0.10);
- String sql = String.format("delete from %s where branch_id = ?", sourceTableName);
+ String sql = String.format("DELETE FROM %s WHERE branch_id = ?", sourceTableName);
purgeFromTable(sourceTableName, sql, 0.20, branch.getId());
purgeFromTable("Tx Details", DELETE_FROM_TX_DETAILS, 0.09, branch.getId());
purgeFromTable("Conflict", DELETE_FROM_CONFLICT, 0.01, branch.getId());
@@ -89,7 +92,6 @@ public class PurgeBranchOperation extends AbstractDbTxOperation {
BranchCache branchCache = cachingService.getBranchCache();
branch.setStorageState(StorageState.PURGED);
branchCache.storeItems(branch);
- branchCache.decache(branch);
branch.internalRemovePurgedBranchFromParent();
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml b/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml
index 31eb377..339b55e 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml
+++ b/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml
@@ -506,22 +506,6 @@
<!-- __________________________________________________________ -->
<!-- -->
- <!-- Reverted TXS -->
- <!-- -->
- <!-- __________________________________________________________ -->
-
- <Table name="OSEE_REMOVED_TXS" schema="OSEE" tablespace="osee_data">
- <Column id="TRANSACTION_ID" defaultValue="not null" type="INTEGER" />
- <Column id="REM_GAMMA_ID" defaultValue="not null" type="BIGINT" />
- <Column id="REM_MOD_TYPE" defaultValue="not null" type="smallint" />
- <Column id="REM_TX_CURRENT" defaultValue="not null" type="smallint" />
- <Column id="REM_TRANSACTION_ID" defaultValue="not null" type="INTEGER" />
- <Constraint schema="OSEE" id="OSEE_REM_TXS_RG_RTX_PK" type="PRIMARY KEY" appliesTo="REM_GAMMA_ID, REM_TRANSACTION_ID"/>
- </Table>
-
-
- <!-- __________________________________________________________ -->
- <!-- -->
<!-- IMPORT TABLES -->
<!-- __________________________________________________________ -->
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/revert/Revert.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/revert/Revert.java
index fbc6866..ebc8a69 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/revert/Revert.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/revert/Revert.java
@@ -31,9 +31,6 @@ public abstract class Revert {
private static final String UPDATE_DETAILS_TABLE =
"UPDATE osee_tx_details SET osee_comment = ?, tx_type = ? WHERE transaction_id = ?";
- private static final String UPDATE_REVERT_TABLE =
- "INSERT INTO osee_removed_txs (transaction_id, rem_mod_type, rem_tx_current, rem_transaction_id, rem_gamma_id) (SELECT ?, txs.mod_type, txs.tx_current, txs.transaction_id, txs.gamma_id FROM osee_txs txs WHERE txs.gamma_id = ? AND txs.transaction_id = ?)";
-
private static final String SET_TX_CURRENT_REVERT =
"UPDATE osee_txs SET tx_current = " + TxChange.CURRENT.getValue() + " WHERE gamma_id = ? and transaction_id = ?";
@@ -126,28 +123,9 @@ public abstract class Revert {
@SuppressWarnings("unchecked")
private void updateTransactionTables(OseeConnection connection, TransactionRecord transId) throws OseeDataStoreException, OseeCoreException {
- long time = System.currentTimeMillis();
ConnectionHandler.runPreparedUpdate(connection, UPDATE_DETAILS_TABLE, REVERT_COMMENT,
TxChange.DELETED.getValue(), transId.getId());
- int count1 = ConnectionHandler.runBatchUpdate(connection, UPDATE_REVERT_TABLE, gammaIdsToInsert);
- int count2 = ConnectionHandler.runBatchUpdate(connection, DELETE_TXS_GAMMAS_REVERT, gammaIdsModifications);
-
- if (count1 != count2) {
- throw new OseeCoreException("Revert Transaction moved %d transaction but should have moved %d", count1, count2);
- }
- if (DEBUG) {
- displayRevertResults(time, objectReverted, gammaIdsModifications, count2);
- }
- }
-
- private void displayRevertResults(long time, String objectReverted, List<Object[]> gammaIdsModifications, int count2) {
- System.out.println(String.format("Deleted %d txs for gamma revert in %s", count2, Lib.getElapseString(time)));
- time = System.currentTimeMillis();
- for (Object[] items : gammaIdsModifications) {
- System.out.println(String.format(" Revert %s: [gammaId, transactionId] = %s ", objectReverted,
- Arrays.deepToString(items)));
- }
- System.out.println(String.format(" Displayed all the data in %s", Lib.getElapseString(time)));
+ ConnectionHandler.runBatchUpdate(connection, DELETE_TXS_GAMMAS_REVERT, gammaIdsModifications);
}
private void setTxCurrentForRevertedObjects(OseeConnection connection) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 7b94638..fe655ee 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -1444,14 +1444,6 @@
</Operation>
</extension>
<extension
- id="ShowRevertTransactions"
- name="ShowRevertTransactions"
- point="org.eclipse.osee.framework.ui.skynet.BlamOperation">
- <Operation
- className="org.eclipse.osee.framework.ui.skynet.blam.operation.ShowRevertTransactions">
- </Operation>
- </extension>
- <extension
point="org.eclipse.osee.framework.skynet.core.ClientLoopbackCmd">
<ClientLoopbackCmd
className="org.eclipse.osee.framework.ui.skynet.artifact.OpenArtifactEditorLoopbackCmd">
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ShowRevertTransactions.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ShowRevertTransactions.java
deleted file mode 100644
index 1688655..0000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ShowRevertTransactions.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.blam.operation;
-
-import java.util.Arrays;
-import java.util.Collection;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
-
-/**
- * @author Theron Virgin
- */
-public class ShowRevertTransactions extends AbstractBlam {
- private static final String GET_REVERT_TRANSACTIONS =
- "Select DISTINCT det.branch_id, Value, txs.transaction_id, Time FROM osee_removed_txs txs, osee_tx_details det, osee_attribute attr, osee_txs txs1 WHERE txs.transaction_id = det.transaction_id AND det.author = attr.art_id AND attr.attr_type_id = 30 AND attr.gamma_id = txs1.gamma_id AND txs1.tx_current = 1 ORDER BY time";
-
- @Override
- public String getName() {
- return "Show Revert Transactions";
- }
-
- @Override
- public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception {
- StringBuffer sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
-
- sbFull.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Branch ID", "User", "Transaction_ID", "Date"}));
-
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(GET_REVERT_TRANSACTIONS);
- while (chStmt.next()) {
- sbFull.append(AHTML.addRowMultiColumnTable(new String[] {
- String.valueOf(chStmt.getInt("branch_id")),
- chStmt.getString("value"),
- String.valueOf(chStmt.getInt("transaction_id")),
- chStmt.getDate("time").toString()}));
- }
- sbFull.append(AHTML.endMultiColumnTable());
- XResultData rd = new XResultData();
- rd.addRaw(sbFull.toString());
- rd.report("Revert Transactions", Manipulations.RAW_HTML);
- } finally {
- chStmt.close();
- }
- }
-
- @Override
- public String getXWidgetsXml() {
- return "<xWidgets></xWidgets>";
- }
-
- @Override
- public Collection<String> getCategories() {
- return Arrays.asList("Admin");
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.java
index 35b81ca..e4a3cf2 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.java
@@ -28,9 +28,9 @@ import org.eclipse.swt.SWT;
*/
public class CleanUpBackingData extends DatabaseHealthOperation {
private static final String NOT_ADDRESSESED_GAMMAS =
- "select gamma_id from %s t1 where not exists (select 1 from osee_txs txs1 where t1.gamma_id = txs1.gamma_id) and not exists (select 1 from osee_removed_txs txs2 where t1.gamma_id = txs2.rem_gamma_id) and not exists (select 1 from osee_txs_archived txs3 where t1.gamma_id = txs3.gamma_id)";
+ "select gamma_id from %s t1 where not exists (select 1 from osee_txs txs1 where t1.gamma_id = txs1.gamma_id) and not exists (select 1 from osee_txs_archived txs3 where t1.gamma_id = txs3.gamma_id)";
private static final String EMPTY_TRANSACTIONS =
- "select transaction_id from osee_tx_details txd where tx_type = 0 and not exists (select 1 from osee_txs txs1 where txd.transaction_id = txs1.transaction_id) and not exists (select 1 from osee_removed_txs txs2 where txd.transaction_id = txs2.transaction_id or txd.transaction_id = txs2.rem_transaction_id) and not exists (select 1 from osee_txs_archived txs3 where txd.transaction_id = txs3.transaction_id)";
+ "select transaction_id from osee_tx_details txd where tx_type = 0 and not exists (select 1 from osee_txs txs1 where txd.transaction_id = txs1.transaction_id) and not exists (select 1 from osee_txs_archived txs3 where txd.transaction_id = txs3.transaction_id)";
private static final String DELETE_GAMMAS = "DELETE FROM %s WHERE gamma_id = ?";
private static final String DELETE_EMPTY_TRANSACTIONS = "DELETE FROM osee_tx_details WHERE transaction_id = ?";