summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn F. Cook2011-08-02 16:05:40 (EDT)
committer Ryan D. Brooks2011-08-02 16:05:40 (EDT)
commitdad30d551e147defe4d124ec94b7c6aa704b08cf (patch)
treedf00bdb845c0acdda98346d6650f1b25c749ad25
parenta75fa5b6a515a19ae050b72a1d53ce1abc8b40c8 (diff)
downloadorg.eclipse.osee-dad30d551e147defe4d124ec94b7c6aa704b08cf.zip
org.eclipse.osee-dad30d551e147defe4d124ec94b7c6aa704b08cf.tar.gz
org.eclipse.osee-dad30d551e147defe4d124ec94b7c6aa704b08cf.tar.bz2
refinement[bgz_350331]: Migrate PurgeTransactionBlam to server side command line
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseTransactionRecordAccessor.java10
-rw-r--r--plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java5
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java4
-rw-r--r--plugins/org.eclipse.osee.framework.database/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/DatabaseTransactions.java1
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/Activator.java9
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/PurgeTransactionOperation.java (renamed from plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeTransactionOperation.java)60
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java28
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeTransactionTest.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/TransactionEventTest.java27
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/DeletionTest.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/PurgeTransactionEventUtil.java33
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TransactionEvent.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java10
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java1
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java1
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java31
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java41
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PurgeTransactionBlam.java59
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportEditor.java2
25 files changed, 189 insertions, 170 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseTransactionRecordAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseTransactionRecordAccessor.java
index b484334..40bcf83 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseTransactionRecordAccessor.java
+++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseTransactionRecordAccessor.java
@@ -43,6 +43,9 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess
private static final String SELECT_TRANSACTIONS_BY_QUERY_ID =
"select * from osee_tx_details txd, osee_join_id oji where txd.transaction_id = oji.id and oji.query_id = ?";
+ private static final String GET_PRIOR_TRANSACTION =
+ "select transaction_id FROM osee_tx_details where branch_id = ? and transaction_id < ? order by transaction_id desc";
+
private final IOseeDatabaseService oseeDatabaseService;
private final BranchCache branchCache;
private final TransactionRecordFactory factory;
@@ -155,4 +158,11 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess
public void load(TransactionCache transactionCache) throws OseeCoreException {
// Not implemented
}
+
+ @Override
+ public TransactionRecord getOrLoadPriorTransaction(TransactionCache cache, int transactionNumber, int branchId) throws OseeCoreException {
+ int priorTransactionId =
+ oseeDatabaseService.runPreparedQueryFetchObject(-1, GET_PRIOR_TRANSACTION, branchId, transactionNumber);
+ return cache.getOrLoad(priorTransactionId);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java
index 55e0b8f..9c2fd41 100644
--- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java
+++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java
@@ -78,4 +78,9 @@ public class MockOseeTransactionDataAccessor implements ITransactionDataAccessor
// Empty
}
+ @Override
+ public TransactionRecord getOrLoadPriorTransaction(TransactionCache cache, int transactionNumber, int branchId) throws OseeCoreException {
+ return null;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java
index 91da62a..58d6b2b 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java
@@ -50,4 +50,6 @@ public interface ITransactionDataAccessor {
public void load(TransactionCache transactionCache) throws OseeCoreException;
+ public TransactionRecord getOrLoadPriorTransaction(TransactionCache cache, int transactionNumber, int branchId) throws OseeCoreException;
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java
index 8e77ef1..4aa3a6a 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java
@@ -151,6 +151,10 @@ public class TransactionCache implements IOseeCache<TransactionRecord> {
public void storeItems(Collection<TransactionRecord> toStore) throws OseeCoreException {
}
+ public TransactionRecord getPriorTransaction(TransactionRecord transactionId) throws OseeCoreException {
+ return getDataAccessor().getOrLoadPriorTransaction(this, transactionId.getId(), transactionId.getBranchId());
+ }
+
public TransactionRecord getTransaction(Branch branch, TransactionVersion revision) throws OseeCoreException {
TransactionRecord toReturn = null;
if (TransactionVersion.BASE == revision) {
diff --git a/plugins/org.eclipse.osee.framework.database/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.database/META-INF/MANIFEST.MF
index 172e4e9..ba24cb2 100644
--- a/plugins/org.eclipse.osee.framework.database/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.database/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@ Export-Package: org.eclipse.osee.framework.database,
org.eclipse.osee.framework.database.operation
Bundle-ActivationPolicy: lazy
Eclipse-ExtensibleAPI: true
+DynamicImport-Package: *
Bundle-Vendor: Eclipse Open System Engineering Environment
Import-Package: org.eclipse.core.runtime,
org.eclipse.core.runtime.jobs,
@@ -16,6 +17,8 @@ Import-Package: org.eclipse.core.runtime,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.model.cache,
org.eclipse.osee.framework.core.operation,
org.eclipse.osee.framework.core.services,
org.eclipse.osee.framework.core.util,
@@ -30,4 +33,3 @@ Import-Package: org.eclipse.core.runtime,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Service-Component: OSGI-INF/uri.connection.contributor.xml
Require-Bundle: org.eclipse.equinox.ds
-DynamicImport-Package: *
diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/DatabaseTransactions.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/DatabaseTransactions.java
index c45d67b..797611b 100644
--- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/DatabaseTransactions.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/DatabaseTransactions.java
@@ -69,5 +69,4 @@ public final class DatabaseTransactions {
}
}
}
-
}
diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/Activator.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/Activator.java
index 0029b14..5f9f7fc 100644
--- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/Activator.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/Activator.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.database.internal;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.util.ServiceDependencyTracker;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
@@ -29,6 +30,7 @@ public class Activator implements BundleActivator, IOseeDatabaseServiceProvider
private ServiceDependencyTracker databaseServiceTracker;
private ServiceTracker dbTracker;
+ private ServiceTracker cacheTracker;
private DatabaseInfoProvider databaseInfoProvider;
@Override
@@ -42,6 +44,9 @@ public class Activator implements BundleActivator, IOseeDatabaseServiceProvider
dbTracker = new ServiceTracker(bundleContext, IOseeDatabaseService.class.getName(), null);
dbTracker.open(true);
+
+ cacheTracker = new ServiceTracker(bundleContext, IOseeCachingService.class.getName(), null);
+ cacheTracker.open(true);
}
public DatabaseInfoProvider getDatabaseInfoProvider() {
@@ -61,6 +66,7 @@ public class Activator implements BundleActivator, IOseeDatabaseServiceProvider
public void stop(BundleContext context) throws Exception {
databaseServiceTracker.close();
dbTracker.close();
+ cacheTracker.close();
databaseInfoProvider = null;
instance = null;
}
@@ -69,4 +75,7 @@ public class Activator implements BundleActivator, IOseeDatabaseServiceProvider
return instance;
}
+ public static IOseeCachingService getOseeCachingService() {
+ return (IOseeCachingService) getInstance().cacheTracker.getService();
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeTransactionOperation.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/PurgeTransactionOperation.java
index 8a48e20..854fb57 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeTransactionOperation.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/PurgeTransactionOperation.java
@@ -9,7 +9,7 @@
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.skynet.core.artifact;
+package org.eclipse.osee.framework.database.operation;
import java.util.ArrayList;
import java.util.Arrays;
@@ -18,6 +18,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.enums.ModificationType;
@@ -26,6 +28,8 @@ import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.TransactionDoesNotExist;
import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.cache.TransactionCache;
+import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
@@ -35,12 +39,8 @@ import org.eclipse.osee.framework.database.core.IdJoinQuery;
import org.eclipse.osee.framework.database.core.JoinUtility;
import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.database.core.TransactionJoinQuery;
+import org.eclipse.osee.framework.database.internal.Activator;
import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event.PurgeTransactionEventUtil;
-import org.eclipse.osee.framework.skynet.core.event.model.TransactionEvent;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
/**
* @author Ryan D. Brooks
@@ -75,7 +75,21 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation {
private final int[] txIdsToDelete;
private final boolean force;
private boolean success;
- private TransactionEvent transactionEvent;
+
+ public static interface PurgeTransactionListener {
+ void onPurgeTransactionSuccess(Collection<TransactionRecord> transactions);
+ }
+
+ private final Set<PurgeTransactionListener> listeners = new CopyOnWriteArraySet<PurgeTransactionListener>();
+ private Collection<TransactionRecord> changedTransactions;
+
+ public PurgeTransactionOperation(IOseeDatabaseService databaseService, boolean force, OperationLogger logger, int... txIdsToDelete) {
+ super(databaseService, String.format("Delete transactions: %s", Arrays.toString(txIdsToDelete)),
+ Activator.PLUGIN_ID, logger);
+ this.txIdsToDelete = txIdsToDelete;
+ this.force = force;
+ this.success = false;
+ }
public PurgeTransactionOperation(IOseeDatabaseService databaseService, boolean force, int... txIdsToDelete) {
super(databaseService, String.format("Delete transactions: %s", Arrays.toString(txIdsToDelete)),
@@ -85,8 +99,22 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation {
this.success = false;
}
+ public void addListener(PurgeTransactionListener listener) {
+ if (listener != null) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(PurgeTransactionListener listener) {
+ if (listener != null) {
+ listeners.remove(listener);
+ }
+ }
+
@Override
protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
+ log();
+ log("Purging Transactions...");
Conditions.checkNotNull(txIdsToDelete, "transaction ids to delete");
Conditions.checkExpressionFailOnTrue(txIdsToDelete.length <= 0, "transaction ids to delete cannot be empty");
@@ -97,7 +125,7 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation {
Map<TransactionRecord, TransactionRecord> deleteToPreviousTx =
findPriorTransactions(monitor, txsToDeleteQuery, 0.20);
- transactionEvent = PurgeTransactionEventUtil.createPurgeTransactionEvent(deleteToPreviousTx.keySet());
+ changedTransactions = deleteToPreviousTx.keySet();
txsToDeleteQuery.store(connection);
@@ -117,6 +145,7 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation {
monitor.subTask("Remove Tx Rows");
List<Object[]> txsToDelete = new ArrayList<Object[]>();
for (int txId : txIdsToDelete) {
+ log(" Adding tx to list:" + txId);
txsToDelete.add(new Object[] {txId});
}
ConnectionHandler.runBatchUpdate(connection, DELETE_TX_DETAILS, txsToDelete);
@@ -134,13 +163,17 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation {
} finally {
clearJoin(connection, txsToDeleteQuery);
}
+ log("...done.");
}
@Override
- protected void handleTxFinally(IProgressMonitor monitor) throws OseeCoreException {
- if (success) {
- OseeEventManager.kickTransactionEvent(this, transactionEvent);
+ protected void handleTxFinally(IProgressMonitor monitor) {
+ if (success && changedTransactions != null) {
+ for (PurgeTransactionListener listener : listeners) {
+ listener.onPurgeTransactionSuccess(changedTransactions);
+ }
}
+ changedTransactions = null;
}
private void computeNewTxCurrents(OseeConnection connection, Collection<Object[]> txsUpdate, String itemId, String tableName, Map<Integer, IdJoinQuery> affected) throws OseeCoreException {
@@ -215,13 +248,14 @@ public class PurgeTransactionOperation extends AbstractDbTxOperation {
Map<TransactionRecord, TransactionRecord> deleteToPreviousTx =
new HashMap<TransactionRecord, TransactionRecord>();
double workStep = workPercentage / txIdsToDelete.length;
+ TransactionCache transactionCache = Activator.getOseeCachingService().getTransactionCache();
for (int index = 0; index < txIdsToDelete.length; index++) {
monitor.subTask(String.format("Fetching Previous Tx Info: [%d of %d]", index + 1, txIdsToDelete.length));
int fromTx = txIdsToDelete[index];
- TransactionRecord fromTransaction = TransactionManager.getTransactionId(fromTx);
+ TransactionRecord fromTransaction = transactionCache.getOrLoad(fromTx);
TransactionRecord previousTransaction;
try {
- previousTransaction = TransactionManager.getPriorTransaction(fromTransaction);
+ previousTransaction = transactionCache.getPriorTransaction(fromTransaction);
} catch (TransactionDoesNotExist ex) {
throw new OseeArgumentException(
"You are trying to delete Transaction [%d] which is a baseline transaction. If your intent is to delete the Branch use the delete Branch Operation. \n\nNO TRANSACTIONS WERE DELETED.",
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java
index 2b73bdd..9abb833 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java
@@ -28,6 +28,7 @@ import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.database.operation.ConsolidateArtifactVersionTxOperation;
import org.eclipse.osee.framework.database.operation.ParseWindowsDirectoryListingOperation;
+import org.eclipse.osee.framework.database.operation.PurgeTransactionOperation;
import org.eclipse.osee.framework.database.operation.PruneWorkspaceOperation;
import org.eclipse.osee.framework.database.operation.FindInvalidUTF8CharsOperation;
import org.eclipse.osee.framework.database.operation.ConsolidateRelationsTxOperation;
@@ -232,6 +233,32 @@ public class ServerAdminCommandProvider implements CommandProvider {
return Operations.executeAsJob(operation, false);
}
+ public Job _purge_transactions(CommandInterpreter ci) {
+ OperationLogger logger = new CommandInterpreterLogger(ci);
+
+ //to be purged
+ final Collection<String> transactions = new ArrayList<String>();
+
+ boolean force = false;
+ for (String arg = ci.nextArgument(); Strings.isValid(arg); arg = ci.nextArgument()) {
+ if (arg.equals("--force")) {
+ force = true;
+ } else {
+ transactions.add(arg);
+ }
+ }
+ int transactions_int[] = new int[transactions.size()];
+ int index = 0;
+ for (String tx : transactions) {
+ transactions_int[index++] = Integer.parseInt(tx);
+ }
+
+ IOperation operation =
+ new PurgeTransactionOperation(Activator.getOseeDatabaseService(), force, logger, transactions_int);
+
+ return Operations.executeAsJob(operation, false);
+ }
+
@Override
public String getHelp() {
StringBuilder sb = new StringBuilder();
@@ -250,6 +277,7 @@ public class ServerAdminCommandProvider implements CommandProvider {
sb.append(" schedule <delay seconds> <iterations> <command> - runs the command after the specified delay and repeat given number of times\n");
sb.append(" purge_relation_type -force excute the operation, relationType1 ...\n");
sb.append(" parse_dir - converts the given file into a formatted CSV file\n");
+ sb.append(" purge_transactions [--force] <transaction ids> - ");
sb.append(" purge_attribute_type <attr ids> - deletes specified rows from osee_artifact_type_attributes and osee_attribute_type\n");
sb.append(" prune_workspace [preserve_file_pattern] workspace_path purge_file_pattern - delete files that are found in workspace_path and whose filenames match purge_file_pattern. Any filename that matches the optional preserve_file_pattern are not deleted\n");
sb.append(" find_invalid_utf8 - finds invalid UTF8 chars in table osee_attribute\n");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeTransactionTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeTransactionTest.java
index 74c44e8..15834d9 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeTransactionTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeTransactionTest.java
@@ -24,10 +24,10 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.operation.IOperation;
import org.eclipse.osee.framework.core.test.mocks.Asserts;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.mocks.DbTestUtil;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
import org.eclipse.osee.framework.skynet.core.util.FrameworkTestUtil;
+import org.eclipse.osee.framework.skynet.core.utility.PurgeTransactionOperationWithListener;
import org.eclipse.osee.support.test.util.DemoSawBuilds;
import org.eclipse.osee.support.test.util.TestUtil;
@@ -98,8 +98,7 @@ public class PurgeTransactionTest {
}
private void purge(int transactionId, Map<String, Integer> dbCount) throws Exception {
- IOperation operation =
- new PurgeTransactionOperation(Activator.getInstance().getOseeDatabaseService(), true, transactionId);
+ IOperation operation = PurgeTransactionOperationWithListener.getPurgeTransactionOperation(true, transactionId);
Asserts.testOperation(operation, IStatus.OK);
DbTestUtil.getTableRowCounts(dbCount, tables);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/TransactionEventTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/TransactionEventTest.java
index 3103748..f843d22 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/TransactionEventTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/TransactionEventTest.java
@@ -13,25 +13,21 @@ package org.eclipse.osee.framework.skynet.core.event;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
import org.eclipse.osee.framework.core.operation.IOperation;
import org.eclipse.osee.framework.core.test.mocks.Asserts;
import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.PurgeTransactionOperation;
import org.eclipse.osee.framework.skynet.core.event.model.Sender;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionChange;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionEventType;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.mocks.MockTransactionEventListener;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.utility.PurgeTransactionOperationWithListener;
import org.eclipse.osee.support.test.util.TestUtil;
import org.junit.After;
import org.junit.Assert;
@@ -110,8 +106,7 @@ public abstract class TransactionEventTest {
Assert.assertEquals(1, OseeEventManager.getNumberOfListeners());
// Delete it
- IOperation operation =
- new PurgeTransactionOperation(Activator.getInstance().getOseeDatabaseService(), false, transIdToDelete);
+ IOperation operation = PurgeTransactionOperationWithListener.getPurgeTransactionOperation(false, transIdToDelete);
Asserts.testOperation(operation, IStatus.OK);
// Verify that all stuff reverted
@@ -124,22 +119,8 @@ public abstract class TransactionEventTest {
Assert.assertEquals(TransactionEventType.Purged, resultTransEvent.getEventType());
- Collection<TransactionChange> transactions = resultTransEvent.getTransactions();
- Assert.assertEquals(1, transactions.size());
-
- TransactionChange transChange = transactions.iterator().next();
- Assert.assertEquals(transIdToDelete, transChange.getTransactionId());
- Assert.assertEquals(CoreBranches.COMMON.getGuid(), transChange.getBranchGuid());
-
- Collection<DefaultBasicGuidArtifact> artifacts = transChange.getArtifacts();
- Assert.assertEquals(1, artifacts.size());
-
- DefaultBasicGuidArtifact guidArt = artifacts.iterator().next();
-
- Assert.assertEquals(CoreBranches.COMMON.getGuid(), guidArt.getBranchGuid());
- Assert.assertEquals(newArt.getGuid(), guidArt.getGuid());
-
- Assert.assertEquals(CoreArtifactTypes.GeneralData.getGuid(), guidArt.getArtTypeGuid());
+ Collection<TransactionChange> transactionChanges = resultTransEvent.getTransactionChanges();
+ Assert.assertTrue(transactionChanges.isEmpty());
TestUtil.severeLoggingEnd(monitorLog, (isRemoteTest() ? Arrays.asList("") : new ArrayList<String>()));
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/DeletionTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/DeletionTest.java
index 21d8d31..651fddc 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/DeletionTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/DeletionTest.java
@@ -32,9 +32,9 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.skynet.core.artifact.PurgeTransactionOperation;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
+import org.eclipse.osee.framework.skynet.core.utility.PurgeTransactionOperationWithListener;
import org.junit.Before;
/**
@@ -170,7 +170,7 @@ public class DeletionTest {
if (DELETE_TRANSACTION_TEST) {
IOseeDatabaseServiceProvider databaseProvider = Activator.getInstance();
IOperation operation =
- new PurgeTransactionOperation(databaseProvider.getOseeDatabaseService(), true, deletionTransaction);
+ PurgeTransactionOperationWithListener.getPurgeTransactionOperation(true, deletionTransaction);
Asserts.testOperation(operation, IStatus.OK);
if (DEBUG) {
System.err.println("Deleting the Transaction");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
index 7a28943..6212076 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
@@ -65,6 +65,7 @@ import org.eclipse.osee.framework.skynet.core.httpRequests.UpdateBranchStateHttp
import org.eclipse.osee.framework.skynet.core.httpRequests.UpdateBranchTypeHttpRequestOperation;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
+import org.eclipse.osee.framework.skynet.core.utility.PurgeTransactionOperationWithListener;
/**
* Provides access to all branches as well as support for creating branches of all types
@@ -319,8 +320,9 @@ public class BranchManager {
* Permanently removes transactions and any of their backing data that is not referenced by any other transactions.
*/
public static Job purgeTransactions(IJobChangeListener jobChangeListener, boolean force, final int... transactionIdNumbers) {
- IOperation op =
- new PurgeTransactionOperation(Activator.getInstance().getOseeDatabaseService(), force, transactionIdNumbers);
+ final IOperation op =
+ PurgeTransactionOperationWithListener.getPurgeTransactionOperation(force, transactionIdNumbers);
+
return Operations.executeAsJob(op, true, Job.LONG, jobChangeListener);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java
index 6e97e88..5c64fa0 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java
@@ -153,7 +153,7 @@ public class FrameworkEventUtil {
RemoteTransactionEvent1 event = new RemoteTransactionEvent1();
event.setNetworkSender(getRemoteNetworkSender(transEvent.getNetworkSender()));
event.setEventTypeGuid(transEvent.getEventType().getGuid());
- for (TransactionChange change : transEvent.getTransactions()) {
+ for (TransactionChange change : transEvent.getTransactionChanges()) {
RemoteTransactionChange1 remChange = new RemoteTransactionChange1();
remChange.setBranchGuid(change.getBranchGuid());
remChange.setTransactionId(change.getTransactionId());
@@ -178,7 +178,7 @@ public class FrameworkEventUtil {
for (RemoteBasicGuidArtifact1 remGuidArt : remChange.getArtifacts()) {
eventArts.add(getBasicGuidArtifact(remGuidArt));
}
- event.getTransactions().add(change);
+ event.addTransactionChange(change);
}
return event;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/PurgeTransactionEventUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/PurgeTransactionEventUtil.java
index a957532..d2f064f 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/PurgeTransactionEventUtil.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/PurgeTransactionEventUtil.java
@@ -10,29 +10,21 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.event;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.change.Change;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionChange;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionEventType;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
-import org.eclipse.osee.framework.skynet.core.revision.ChangeManager;
import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
/**
@@ -47,30 +39,7 @@ public final class PurgeTransactionEventUtil {
public static TransactionEvent createPurgeTransactionEvent(Collection<TransactionRecord> purgedTransactions) {
TransactionEvent transactionEvent = new TransactionEvent();
transactionEvent.setEventType(TransactionEventType.Purged);
- List<TransactionChange> txChanges = transactionEvent.getTransactions();
- for (TransactionRecord txRecord : purgedTransactions) {
- try {
- Branch branch = BranchManager.getBranch(txRecord.getBranchId());
-
- TransactionChange transChange = new TransactionChange();
- transChange.setTransactionId(txRecord.getId());
- transChange.setBranchGuid(branch.getGuid());
-
- Collection<Change> changes = new ArrayList<Change>();
- IOperation operation = ChangeManager.comparedToPreviousTx(txRecord, changes);
- Operations.executeWorkAndCheckStatus(operation);
-
- Collection<DefaultBasicGuidArtifact> eventArts = transChange.getArtifacts();
- for (Change change : changes) {
- Artifact art = change.getChangeArtifact();
- eventArts.add(art.getBasicGuidArtifact());
- }
- txChanges.add(transChange);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
return transactionEvent;
}
@@ -78,7 +47,7 @@ public final class PurgeTransactionEventUtil {
if (transEvent.getEventType() == TransactionEventType.Purged) {
Set<Artifact> artifactsInCache = new HashSet<Artifact>();
- for (TransactionChange transChange : transEvent.getTransactions()) {
+ for (TransactionChange transChange : transEvent.getTransactionChanges()) {
try {
TransactionManager.deCache(transChange.getTransactionId());
} catch (OseeCoreException ex1) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TransactionEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TransactionEvent.java
index 007dfbb..ff89def 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TransactionEvent.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TransactionEvent.java
@@ -36,8 +36,12 @@ public class TransactionEvent extends FrameworkEvent {
* <p>
* Objects of the following type(s) are allowed in the list {@link DefaultBasicGuidArtifact }
*/
- public List<TransactionChange> getTransactions() {
- return this.transactions;
+ public List<TransactionChange> getTransactionChanges() {
+ return transactions;
+ }
+
+ public void addTransactionChange(TransactionChange txChange) {
+ transactions.add(txChange);
}
/**
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java
index c86fa04..ce0159f 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java
@@ -26,6 +26,7 @@ import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.cache.ITransactionDataAccessor;
import org.eclipse.osee.framework.core.model.cache.TransactionCache;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
import org.eclipse.osee.framework.skynet.core.artifact.HttpClientMessage;
/**
@@ -33,6 +34,9 @@ import org.eclipse.osee.framework.skynet.core.artifact.HttpClientMessage;
*/
public class ClientTransactionAccessor implements ITransactionDataAccessor {
+ private static final String GET_PRIOR_TRANSACTION =
+ "select transaction_id FROM osee_tx_details where branch_id = ? and transaction_id < ? order by transaction_id desc";
+
private final TransactionRecordFactory txFactory;
private final BranchCache branchCache;
@@ -80,4 +84,10 @@ public class ClientTransactionAccessor implements ITransactionDataAccessor {
}
}
+ @Override
+ public TransactionRecord getOrLoadPriorTransaction(TransactionCache cache, int transactionNumber, int branchId) throws OseeCoreException {
+ int priorTransactionId =
+ ConnectionHandler.runPreparedQueryFetchInt(-1, GET_PRIOR_TRANSACTION, branchId, transactionNumber);
+ return cache.getOrLoad(priorTransactionId);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java
index 040fcdb..0f925cf 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java
@@ -22,6 +22,7 @@ import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionDelta;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.DatabaseTransactions;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeSql;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java
index 90f82d2..7e069c4 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java
@@ -29,6 +29,7 @@ import org.eclipse.osee.framework.core.model.TransactionDelta;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.DatabaseTransactions;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeSql;
import org.eclipse.osee.framework.database.core.SQL3DataType;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java
index 409e37a..f62b571 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java
@@ -51,9 +51,6 @@ public final class TransactionManager {
private static final String SELECT_TRANSACTIONS =
"SELECT * FROM osee_tx_details WHERE branch_id = ? ORDER BY transaction_id DESC";
- private static final String GET_PRIOR_TRANSACTION =
- "SELECT MAX(transaction_id) AS prior_id FROM osee_tx_details WHERE branch_id = ? AND transaction_id < ?";
-
private static final String SELECT_COMMIT_TRANSACTIONS =
"SELECT transaction_id FROM osee_tx_details WHERE commit_art_id = ?";
@@ -193,29 +190,6 @@ public final class TransactionManager {
transactionRecord.getBranchId(), transactionRecord.getTxType().getId());
}
- /**
- * @return The prior transactionId, or null if there is no prior.
- */
- public static TransactionRecord getPriorTransaction(TransactionRecord transactionId) throws OseeCoreException {
- TransactionRecord priorTransactionId = null;
- IOseeStatement chStmt = ConnectionHandler.getStatement();
-
- try {
- chStmt.runPreparedQuery(GET_PRIOR_TRANSACTION, transactionId.getBranchId(), transactionId.getId());
-
- if (chStmt.next()) {
- int priorId = chStmt.getInt("prior_id");
- if (chStmt.wasNull()) {
- throw new TransactionDoesNotExist("the prior transation id was null");
- }
- priorTransactionId = getTransactionId(priorId);
- }
- } finally {
- chStmt.close();
- }
- return priorTransactionId;
- }
-
public static TransactionRecord getTransactionAtDate(IOseeBranch branch, Date maxDateExclusive) throws OseeCoreException {
Conditions.checkNotNull(branch, "branch");
Conditions.checkNotNull(maxDateExclusive, "max date exclusive");
@@ -289,4 +263,9 @@ public final class TransactionManager {
}
return transactionRecord;
}
+
+ public static TransactionRecord getPriorTransaction(TransactionRecord transactionId) throws OseeCoreException {
+ TransactionCache txCache = getTransactionCache();
+ return txCache.getPriorTransaction(transactionId);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java
new file mode 100644
index 0000000..82958e5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java
@@ -0,0 +1,41 @@
+/*
+ * Created on Jun 15, 2011
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.utility;
+
+import java.util.Collection;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.database.operation.PurgeTransactionOperation;
+import org.eclipse.osee.framework.database.operation.PurgeTransactionOperation.PurgeTransactionListener;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
+import org.eclipse.osee.framework.skynet.core.event.PurgeTransactionEventUtil;
+import org.eclipse.osee.framework.skynet.core.event.model.TransactionEvent;
+import org.eclipse.osee.framework.skynet.core.internal.Activator;
+
+public class PurgeTransactionOperationWithListener {
+ public static IOperation getPurgeTransactionOperation(boolean force, final int... transactionIdNumbers) {
+ final PurgeTransactionOperation op =
+ new PurgeTransactionOperation(Activator.getInstance().getOseeDatabaseService(), force, transactionIdNumbers);
+
+ PurgeTransactionListener listener = new PurgeTransactionListener() {
+
+ @Override
+ public void onPurgeTransactionSuccess(Collection<TransactionRecord> transactions) {
+ TransactionEvent transactionEvent = PurgeTransactionEventUtil.createPurgeTransactionEvent(transactions);
+ try {
+ OseeEventManager.kickTransactionEvent(op, transactionEvent);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, "Error sending purge transaction events", ex);
+ }
+ }
+ };
+ op.addListener(listener);
+ return op;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 976ead2..db99bf6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -183,9 +183,6 @@
<extension point="org.eclipse.search.searchResultViewPages">
<viewPage class="org.eclipse.osee.framework.ui.skynet.search.page.ArtifactSearchPage" id="org.eclipse.osee.framework.ui.skynet.ArtifactSearchViewPage" searchResultClass="org.eclipse.osee.framework.ui.skynet.search.ArtifactSearchResult"/>
</extension>
- <extension id="PurgeTransaction" point="org.eclipse.osee.framework.ui.skynet.BlamOperation">
- <Operation className="org.eclipse.osee.framework.ui.skynet.blam.operation.PurgeTransactionBlam"/>
- </extension>
<extension
id="FindArtifactsWithMinAttributeContraintProblems"
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PurgeTransactionBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PurgeTransactionBlam.java
deleted file mode 100644
index 3163a60..0000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/PurgeTransactionBlam.java
+++ /dev/null
@@ -1,59 +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 java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-
-/**
- * @author Ryan D. Brooks
- */
-public class PurgeTransactionBlam extends AbstractBlam {
-
- @Override
- public String getName() {
- return "Purge Transaction";
- }
-
- @Override
- public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception {
- List<Integer> txs = Lib.stringToIntegerList(variableMap.getString("Transaction List"));
- boolean force = variableMap.getBoolean("Force Delete");
- int[] txIds = new int[txs.size()];
- for (int index = 0; index < txs.size(); index++) {
- txIds[index] = txs.get(index);
- }
- Job job = BranchManager.purgeTransactions(null, force, txIds);
- job.join();
- }
-
- @Override
- public String getXWidgetsXml() {
- StringBuilder builder = new StringBuilder();
- builder.append("<xWidgets>");
- builder.append("<XWidget xwidgetType=\"XText\" displayName=\"Transaction List\" />");
- builder.append("<XWidget xwidgetType=\"XCheckBox\" displayName=\"Force Delete\" />");
- builder.append("</xWidgets>");
- return builder.toString();
- }
-
- @Override
- public Collection<String> getCategories() {
- return Arrays.asList("Admin");
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java
index 9d50429..ea045fa 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java
@@ -22,6 +22,7 @@ import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionDelta;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.framework.database.core.DatabaseTransactions;
import org.eclipse.osee.framework.plugin.core.util.Jobs;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportEditor.java
index bda7e6d..5bdecb1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportEditor.java
@@ -156,7 +156,7 @@ public class ChangeReportEditor extends FormEditor implements IChangeReportView
txDeltas[0] = changeUiData.getTxDelta().getStartTx().getId();
txDeltas[1] = changeUiData.getTxDelta().getEndTx().getId();
for (int transactionIdToMatch : txDeltas) {
- for (TransactionChange transChange : transEvent.getTransactions()) {
+ for (TransactionChange transChange : transEvent.getTransactionChanges()) {
if (transactionIdToMatch == transChange.getTransactionId()) {
close(false);
break;