diff options
author | Ryan D. Brooks | 2017-03-07 00:30:25 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2020-12-15 22:28:07 +0000 |
commit | 8335563be6f98815326e59017a7d9f9e6b11b9a3 (patch) | |
tree | dc813f4191a8e5811d53db358d03590109d0a591 | |
parent | 4da6392273866bf766ca15d65280c6b1abeb5c02 (diff) | |
download | org.eclipse.osee-8335563be6f98815326e59017a7d9f9e6b11b9a3.tar.gz org.eclipse.osee-8335563be6f98815326e59017a7d9f9e6b11b9a3.tar.xz org.eclipse.osee-8335563be6f98815326e59017a7d9f9e6b11b9a3.zip |
feature: Fix applicabililty on deleted artifacts
Change-Id: I98616ce21ef86688064c15c83bc7fb37d4ef8612
3 files changed, 31 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/SystemSafetyResource.java b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/SystemSafetyResource.java index 4000d860740..d778578be78 100644 --- a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/SystemSafetyResource.java +++ b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/SystemSafetyResource.java @@ -130,3 +130,10 @@ public final class SystemSafetyResource { } return strB.toString(); } + + @Path("fix") + @GET + @Produces(MediaType.TEXT_HTML) + public String fixApplic() { + return String.valueOf(orcsApi.getQueryFactory().deepQuery().fixApplicOnDelete()); + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/DeepQueryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/DeepQueryImpl.java index ddfdaa475d1..9cc30478f66 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/DeepQueryImpl.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/DeepQueryImpl.java @@ -19,6 +19,7 @@ import org.eclipse.osee.framework.core.data.AttributeTypeId; import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.jdbc.JdbcClient; import org.eclipse.osee.jdbc.JdbcStatement; +import org.eclipse.osee.jdbc.OseePreparedStatement; import org.eclipse.osee.orcs.data.ArtifactTypes; import org.eclipse.osee.orcs.db.internal.sql.join.IdJoinQuery; import org.eclipse.osee.orcs.search.DeepQuery; @@ -65,4 +66,25 @@ public class DeepQueryImpl implements DeepQuery { } return attributeValues; } + + @Override + public int fixApplicOnDelete() { + int counter = 0; + try (JdbcStatement chStmt = jdbcClient.getStatement()) { + String SELECT_LOST_APPLIC = + "select txs1.app_id, txs2.branch_id, txs2.transaction_id, txs2.gamma_id from osee_txs txs1, osee_txs txs2 where txs1.branch_id = txs2.branch_id and txs1.gamma_id = txs2.gamma_id and txs1.app_id <> txs2.app_id and txs2.mod_type = 3 and txs2.app_id = 1 and txs2.tx_current = 2"; + chStmt.runPreparedQuery(JDBC__MAX_FETCH_SIZE, SELECT_LOST_APPLIC); + String UPDATE_APPLIC = + "UPDATE osee_txs SET app_id = ? WHERE branch_id = ? AND transaction_id = ? AND gamma_id = ?"; + OseePreparedStatement addressing = jdbcClient.getBatchStatement(UPDATE_APPLIC); + while (chStmt.next()) { + addressing.addToBatch(chStmt.getLong("app_id"), chStmt.getLong("branch_id"), + chStmt.getLong("transaction_id"), chStmt.getLong("gamma_id")); + counter++; + } + addressing.execute(); + + } + return counter; + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/DeepQuery.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/DeepQuery.java index ee338cb7550..e9e0b973c05 100644 --- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/DeepQuery.java +++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/DeepQuery.java @@ -29,4 +29,6 @@ public interface DeepQuery { DeepQuery andIsOfType(ArtifactTypeId... artifactTypes); List<Pair<ArtifactId, String>> collect(AttributeTypeId attributeType); + + int fixApplicOnDelete(); }
\ No newline at end of file |