Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2011-02-28 17:49:51 -0500
committerRyan D. Brooks2011-02-28 17:49:51 -0500
commit20cd8b7cee6ee90f8530207d0b8fa1e732297a61 (patch)
tree8f5eaa24a0851230a38a8d8bf6552014b48eb5d7 /plugins/org.eclipse.osee.framework.database
parent5f2c7dc480ee7ca052b9ffd9fc8cd9178703d960 (diff)
downloadorg.eclipse.osee-20cd8b7cee6ee90f8530207d0b8fa1e732297a61.tar.gz
org.eclipse.osee-20cd8b7cee6ee90f8530207d0b8fa1e732297a61.tar.xz
org.eclipse.osee-20cd8b7cee6ee90f8530207d0b8fa1e732297a61.zip
refactor: Provide direct support for OperationLogger in AbstractOperation
Diffstat (limited to 'plugins/org.eclipse.osee.framework.database')
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/AbstractDbTxOperation.java6
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java26
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/InvalidTxCurrentsAndModTypes.java10
3 files changed, 22 insertions, 20 deletions
diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/AbstractDbTxOperation.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/AbstractDbTxOperation.java
index db1b1e8423..d3f77125bf 100644
--- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/AbstractDbTxOperation.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/AbstractDbTxOperation.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.database.core;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
/**
@@ -22,6 +23,11 @@ public abstract class AbstractDbTxOperation extends AbstractOperation {
private final IOseeDatabaseService databaseService;
+ public AbstractDbTxOperation(IOseeDatabaseService databaseService, String operationName, String pluginId, OperationLogger logger) {
+ super(operationName, pluginId, logger);
+ this.databaseService = databaseService;
+ }
+
public AbstractDbTxOperation(IOseeDatabaseService databaseService, String operationName, String pluginId) {
super(operationName, pluginId);
this.databaseService = databaseService;
diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java
index 4fa03c262b..2d154cde38 100644
--- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java
@@ -71,13 +71,11 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
private long previousNetGammaId;
private int previousBranchId;
private int previuosTransactionId;
- private final OperationLogger logger;
private int updateTxsCounter;
private int deleteTxsCounter;
public ConsolidateArtifactVersionTxOperation(IOseeDatabaseService databaseService, OperationLogger logger) {
- super(databaseService, "Consolidate Artifact Versions", Activator.PLUGIN_ID);
- this.logger = logger;
+ super(databaseService, "Consolidate Artifact Versions", Activator.PLUGIN_ID, logger);
}
private void init() throws OseeCoreException {
@@ -158,7 +156,7 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
}
}
if (!knownCase) {
- logger.log(String.format("unknown case: artifact id: %d branch_id: %d", previousArtifactId, previousBranchId));
+ log(String.format("unknown case: artifact id: %d branch_id: %d", previousArtifactId, previousBranchId));
}
}
@@ -170,8 +168,8 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
if (true) {
findArtifactMods();
- logger.log("updateTxsCurrentModData size: " + updateTxsCurrentModData.size());
- logger.log("addressingToDelete size: " + addressingToDelete.size());
+ log("updateTxsCurrentModData size: " + updateTxsCurrentModData.size());
+ log("addressingToDelete size: " + addressingToDelete.size());
getDatabaseService().runBatchUpdate(connection, prepareSql(UPDATE_TXS_MOD_CURRENT, false),
updateTxsCurrentModData);
@@ -181,9 +179,9 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
}
findObsoleteGammas();
- logger.log("gamma join size: " + gammaJoin.size());
+ log("gamma join size: " + gammaJoin.size());
- logger.log("Number of artifact version rows deleted: " + getDatabaseService().runBatchUpdate(connection,
+ log("Number of artifact version rows deleted: " + getDatabaseService().runBatchUpdate(connection,
DELETE_ARTIFACT_VERSIONS, deleteArtifactVersionData));
deleteArtifactVersionData = null;
@@ -204,17 +202,17 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
private void updataConflicts(String columnName) throws OseeCoreException {
int count = getDatabaseService().runPreparedUpdate(connection, String.format(UPDATE_CONFLICTS, columnName));
- logger.log(String.format("updated %s in %d rows", columnName, count));
+ log(String.format("updated %s in %d rows", columnName, count));
}
private void setBaselineTransactions() throws OseeCoreException {
int count = getDatabaseService().runPreparedUpdate(connection, SET_BASELINE_TRANSACTION);
- logger.log(String.format("updated %d baseline transactions", count));
+ log(String.format("updated %d baseline transactions", count));
}
private void populateArts() throws OseeCoreException {
int count = getDatabaseService().runPreparedUpdate(connection, POPULATE_ARTS);
- logger.log(String.format("inserted %d rows into osee_artifact", count));
+ log(String.format("inserted %d rows into osee_artifact", count));
}
private void findObsoleteGammas() throws OseeCoreException {
@@ -249,7 +247,7 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
private void determineAffectedAddressingAndFix(boolean archived) throws OseeCoreException {
try {
- logger.log("query id: " + gammaJoin.getQueryId());
+ log("query id: " + gammaJoin.getQueryId());
chStmt.runPreparedQuery(10000, String.format(SELECT_ADDRESSING, archived ? "_archived" : ""),
gammaJoin.getQueryId());
@@ -315,7 +313,7 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
if (addressingToDelete.size() > 99960 || force) {
deleteTxsCounter +=
getDatabaseService().runBatchUpdate(connection, prepareSql(DELETE_TXS, archived), addressingToDelete);
- logger.log("Number of txs" + archivedStr + " rows deleted: " + deleteTxsCounter);
+ log("Number of txs" + archivedStr + " rows deleted: " + deleteTxsCounter);
addressingToDelete.clear();
}
@@ -323,7 +321,7 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
updateTxsCounter +=
getDatabaseService().runBatchUpdate(connection, prepareSql(UPDATE_TXS_GAMMAS, archived),
updateAddressingData);
- logger.log("Number of txs" + archivedStr + " rows updated: " + updateTxsCounter);
+ log("Number of txs" + archivedStr + " rows updated: " + updateTxsCounter);
updateAddressingData.clear();
}
diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/InvalidTxCurrentsAndModTypes.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/InvalidTxCurrentsAndModTypes.java
index 196a0ac820..12d03c7bf0 100644
--- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/InvalidTxCurrentsAndModTypes.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/InvalidTxCurrentsAndModTypes.java
@@ -35,7 +35,6 @@ public class InvalidTxCurrentsAndModTypes extends AbstractOperation {
"update osee_txs%s set tx_current = ? where transaction_id = ? and gamma_id = ?";
private final List<Address> addresses = new ArrayList<Address>();
- private final OperationLogger logger;
private final List<Object[]> purgeData = new ArrayList<Object[]>();
private final List<Object[]> currentData = new ArrayList<Object[]>();
@@ -47,11 +46,10 @@ public class InvalidTxCurrentsAndModTypes extends AbstractOperation {
public InvalidTxCurrentsAndModTypes(String operationName, String tableName, String columnName, OperationLogger logger, boolean isFixOperationEnabled, boolean archived) {
super(
"InvalidTxCurrentsAndModTypes " + operationName + tableName + " fix:" + isFixOperationEnabled + " archived:" + archived,
- Activator.PLUGIN_ID);
+ Activator.PLUGIN_ID, logger);
this.tableName = tableName;
this.columnName = columnName;
this.isFixOperationEnabled = isFixOperationEnabled;
- this.logger = logger;
txsTableName = archived ? "_archived" : "";
}
@@ -65,7 +63,7 @@ public class InvalidTxCurrentsAndModTypes extends AbstractOperation {
}
private void logIssue(String issue, Address address) {
- logger.log(issue, String.valueOf(address.getBranchId()), String.valueOf(address.getItemId()),
+ log(issue, String.valueOf(address.getBranchId()), String.valueOf(address.getItemId()),
String.valueOf(address.getTransactionId()), String.valueOf(address.getGammaId()),
address.getModType().toString(), address.getTxCurrent().toString());
}
@@ -160,7 +158,7 @@ public class InvalidTxCurrentsAndModTypes extends AbstractOperation {
@Override
protected void doWork(IProgressMonitor monitor) throws Exception {
- logger.log("Starting " + getName());
+ log("Starting " + getName());
checkForCancelledStatus(monitor);
@@ -197,6 +195,6 @@ public class InvalidTxCurrentsAndModTypes extends AbstractOperation {
fixIssues(monitor);
- logger.log("Completed " + getName());
+ log("Completed " + getName());
}
} \ No newline at end of file

Back to the top