diff options
author | jmisinco | 2015-06-15 21:05:19 +0000 |
---|---|---|
committer | jmisinco | 2015-06-15 21:05:19 +0000 |
commit | c202a9514c59517d3250784264e4e79587830b87 (patch) | |
tree | d5317985d82d947ab1835266a4f7cfa7db9f7d47 /plugins | |
parent | 70b0b8398f99099e5fe7a9f844c2f971fc69d354 (diff) | |
download | org.eclipse.osee-c202a9514c59517d3250784264e4e79587830b87.tar.gz org.eclipse.osee-c202a9514c59517d3250784264e4e79587830b87.tar.xz org.eclipse.osee-c202a9514c59517d3250784264e4e79587830b87.zip |
refactor[ats_ATS186558]: Consolidate 3 OseeSql classes into 1
Change-Id: I109e3def8583d32722f68bf450489fed1d706536
Diffstat (limited to 'plugins')
33 files changed, 83 insertions, 265 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.server/META-INF/MANIFEST.MF index 29eb58d8a63..52dacb3fa5b 100644 --- a/plugins/org.eclipse.osee.framework.core.server/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.core.server/META-INF/MANIFEST.MF @@ -15,6 +15,7 @@ Import-Package: javax.servlet;version="2.5.0", org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.core.model.cache, org.eclipse.osee.framework.core.operation, + org.eclipse.osee.framework.core.sql, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.jdk.core.util.time, diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java index 798c196c592..4b785cfdc8e 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java @@ -18,7 +18,7 @@ import org.eclipse.osee.framework.core.data.IUserToken; import org.eclipse.osee.framework.core.data.OseeSessionGrant; import org.eclipse.osee.framework.core.model.cache.IOseeTypeFactory; import org.eclipse.osee.framework.core.server.OseeServerProperties; -import org.eclipse.osee.framework.core.server.internal.util.OseeSql; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.jdbc.JdbcClient; diff --git a/plugins/org.eclipse.osee.framework.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core/META-INF/MANIFEST.MF index fba1ed2c67c..4a366d13d4c 100644 --- a/plugins/org.eclipse.osee.framework.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.core/META-INF/MANIFEST.MF @@ -24,6 +24,7 @@ Export-Package: org.eclipse.osee.framework.core.data, org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.ops, + org.eclipse.osee.framework.core.sql, org.eclipse.osee.framework.core.threading, org.eclipse.osee.framework.core.util Bundle-ActivationPolicy: lazy diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/util/OseeSql.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java index a4ba9b09940..d52465f0a54 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/util/OseeSql.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.server.internal.util; +package org.eclipse.osee.framework.core.sql; import java.util.Properties; import org.eclipse.osee.framework.core.enums.ConflictStatus; @@ -68,16 +68,36 @@ public enum OseeSql { private final String sql; private final String hints; + private final boolean isDynamicHint; private OseeSql(String sql, String hints) { this.sql = sql; this.hints = hints; + this.isDynamicHint = false; } private OseeSql(String sql) { this(sql, null); } + private OseeSql(String sql, boolean isDynamicHint) { + this.sql = sql; + this.hints = null; + this.isDynamicHint = isDynamicHint; + } + + public String getSql() { + return sql; + } + + public String getHints() { + return hints; + } + + public boolean getIsDynamicHint() { + return isDynamicHint; + } + public static Properties getSqlProperties(boolean areHintsSupported) throws OseeCoreException { Properties sqlProperties = new Properties(); for (OseeSql oseeSql : OseeSql.values()) { @@ -97,8 +117,8 @@ public enum OseeSql { private static String getHintsOrderedFirstRows() { return "/*+ ordered */"; - } + private static class Strings { private static final String HINTS__ORDERED__INDEX__ARTIFACT_CONFLICT = " /*+ ordered index(atr1) index(atr2) index(txs2) */"; @@ -111,4 +131,5 @@ public enum OseeSql { private static final String SELECT_CURRENT_ARTIFACTS_PREFIX = "SELECT%s aj.art_id, txs.gamma_id, mod_type, art_type_id, guid, txs.branch_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.tx_current "; } + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF index 3e7eed4ce1f..d963b2ad629 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF @@ -76,6 +76,7 @@ Import-Package: com.google.common.collect;version="15.0.0", org.eclipse.osee.framework.core.model.type, org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.services, + org.eclipse.osee.framework.core.sql, org.eclipse.osee.framework.core.util, org.eclipse.osee.framework.lifecycle, org.eclipse.osee.framework.logging, diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java index 97d06f8bfee..788e23b4e2d 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java @@ -29,13 +29,13 @@ import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.exception.OseeDataStoreException; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.internal.Activator; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; @@ -231,7 +231,7 @@ public final class ArtifactLoader { /** * loads or reloads artifacts based on artifact ids and branch uuids - * + * * @param artifacts * @param locks */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java index c38ca274d4c..2b76b5196f2 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java @@ -11,11 +11,11 @@ package org.eclipse.osee.framework.skynet.core.artifact; import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.event.model.EventModType; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData; /** @@ -53,7 +53,7 @@ public class ArtifactTransactionData extends BaseTransactionData { @Override protected void internalClearDirtyState() { - // provided for subclass implementation + // provided for subclass implementation } @Override diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java index 67b5b04f310..80832ec2156 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java @@ -20,6 +20,7 @@ import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.enums.DeletionFlag; import org.eclipse.osee.framework.core.enums.LoadLevel; import org.eclipse.osee.framework.core.enums.ModificationType; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Strings; @@ -27,7 +28,6 @@ import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager; import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute; import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; import org.eclipse.osee.jdbc.JdbcStatement; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java index 452912e797e..692b1f3f2aa 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java @@ -17,8 +17,8 @@ import org.eclipse.osee.framework.core.enums.LoadLevel; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.type.RelationType; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationManager; import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; 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 c031d7f1ef0..c2cb146bfbb 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 @@ -19,12 +19,12 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Collections; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.internal.Activator; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.utility.AbstractDbTxOperation; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; @@ -40,10 +40,10 @@ 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() + // - " END"; + " 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() + // + " END"; private static final String UPDATE_ARTIFACTS = "INSERT INTO osee_txs (transaction_id, gamma_id, mod_type, tx_current, branch_id) SELECT ?, txs1.gamma_id, txs1.mod_type, " + TX_CURRENT_SETTINGS + ", ? FROM osee_attribute attr1, osee_txs txs1 WHERE attr1.art_id = ? AND txs1.gamma_id = attr1.gamma_id AND txs1.branch_id = ? AND txs1.tx_current <> ? AND NOT EXISTS (SELECT 'x' FROM osee_txs txs2, osee_attribute attr2 WHERE txs2.branch_id = ? AND txs2.transaction_id = ? AND txs2.gamma_id = attr2.gamma_id AND attr2.attr_id = attr1.attr_id)"; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java index a1fee67aae7..565fe70dca0 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java @@ -12,11 +12,11 @@ package org.eclipse.osee.framework.skynet.core.attribute; import org.eclipse.osee.framework.core.exception.OseeExceptions; import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.skynet.core.artifact.Attribute; import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData; import org.eclipse.osee.orcs.rest.client.OseeClient; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeSql.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeSql.java deleted file mode 100644 index 29bccfbbb61..00000000000 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeSql.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.skynet.core.internal; - -import java.sql.DatabaseMetaData; -import java.util.Properties; -import org.eclipse.osee.framework.core.enums.ConflictStatus; -import org.eclipse.osee.framework.core.enums.ModificationType; -import org.eclipse.osee.framework.core.enums.TxChange; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.jdbc.JdbcDbType; - -/** - * @author Ryan D. Brooks - */ -public enum OseeSql { - - TX_GET_ALL_TRANSACTIONS("SELECT * FROM osee_tx_details WHERE transaction_id = ?"), - TX_GET_MAX_AS_LARGEST_TX("SELECT max(transaction_id) as largest_transaction_id FROM osee_tx_details WHERE branch_id = ?"), - TX_GET_PREVIOUS_TX_NOT_CURRENT_ARTIFACTS("SELECT txs.transaction_id, txs.gamma_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 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 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()), - - 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"), - MERGE_GET_RELATIONS_FOR_BRANCH("SELECT rel.a_art_id, rel.b_art_id FROM osee_txs txs, osee_relation_link rel WHERE txs.branch_id = ? and txs.gamma_id = rel.gamma_id"), - - CONFLICT_GET_ARTIFACTS_DEST("SELECT%s art2.art_type_id, art1.art_id, txs1.mod_type AS source_mod_type, txs1.gamma_id AS source_gamma, txs2.mod_type AS dest_mod_type, txs2.gamma_id AS dest_gamma FROM osee_txs txs1, osee_attribute art1, osee_artifact art2, osee_txs txs2 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (1,2) AND txs1.gamma_id = art1.gamma_id AND art1.art_id = art2.art_id AND art2.gamma_id = txs2.gamma_id AND txs2.branch_id = ? AND ((txs2.tx_current = 1 AND txs2.gamma_id not in (SELECT txs.gamma_id FROM osee_txs txs WHERE branch_id = ? AND txs.transaction_id = ?)) OR (txs2.tx_current = 2 and txs2.transaction_id > ?)) ORDER BY art2.art_id", Strings.HINTS__ORDERED__INDEX__ARTIFACT_CONFLICT), - CONFLICT_GET_ARTIFACTS_SRC("SELECT%s art1.art_type_id, art1.art_id, txs1.mod_type AS source_mod_type, txs1.gamma_id AS source_gamma, txs2.mod_type AS dest_mod_type, txs2.gamma_id AS dest_gamma FROM osee_txs txs1, osee_artifact art1, osee_attribute art2, osee_txs txs2 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (1,2) AND txs1.gamma_id = art1.gamma_id AND art1.art_id = art2.art_id AND art2.gamma_id = txs2.gamma_id AND txs2.branch_id = ? AND ((txs2.tx_current = 1 AND txs2.gamma_id not in (SELECT txs.gamma_id FROM osee_txs txs WHERE txs.branch_id = ? AND txs.transaction_id = ?)) OR (txs2.tx_current = 2 and txs2.transaction_id > ?)) ORDER BY art1.art_id", Strings.HINTS__ORDERED__INDEX__ARTIFACT_CONFLICT), - CONFLICT_GET_ATTRIBUTES("SELECT%s atr1.art_id, txs1.mod_type, atr1.attr_type_id, atr1.attr_id, atr1.gamma_id AS source_gamma, atr1.value AS source_value, atr2.gamma_id AS dest_gamma, atr2.value as dest_value, txs2.mod_type AS dest_mod_type FROM osee_txs txs1, osee_attribute atr1, osee_attribute atr2, osee_txs txs2 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (1,2) AND txs1.gamma_id = atr1.gamma_id AND atr1.attr_id = atr2.attr_id AND atr2.gamma_id = txs2.gamma_id AND txs2.branch_id = ? AND txs2.tx_current in (1,2) AND NOT EXISTS (SELECT 1 FROM osee_txs txs WHERE txs.branch_id = ? AND txs.transaction_id = ? AND ((txs1.gamma_id = txs.gamma_id and txs1.mod_type = txs.mod_type) OR (txs2.gamma_id = txs.gamma_id and txs2.mod_type = txs.mod_type))) ORDER BY attr_id", Strings.HINTS__ORDERED__INDEX__ATTRIBUTE_CONFLICT), - CONFLICT_GET_HISTORICAL_ATTRIBUTES("SELECT%s atr.attr_id, atr.art_id, source_gamma_id, dest_gamma_id, attr_type_id, mer.merge_branch_id, mer.dest_branch_id, value as source_value, status FROM osee_merge mer, osee_conflict con, osee_attribute atr Where mer.commit_transaction_id = ? AND mer.merge_branch_id = con.merge_branch_id And con.source_gamma_id = atr.gamma_id AND con.status in (" + ConflictStatus.COMMITTED.getValue() + ", " + ConflictStatus.INFORMATIONAL.getValue() + " ) order by attr_id", getHintsOrderedFirstRows()), - - LOAD_HISTORICAL_ARTIFACTS("SELECT%s aj.art_id, txs.branch_id, txs.gamma_id, txs.mod_type, art_type_id, guid, aj.transaction_id as stripe_transaction_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.transaction_id <= aj.transaction_id AND txs.branch_id = aj.branch_id order by aj.branch_id, art.art_id, txs.transaction_id desc", getHintsOrderedFirstRows()), - LOAD_HISTORICAL_ATTRIBUTES("SELECT att.art_id, att.attr_id, att.value, att.gamma_id, att.attr_type_id, att.uri, aj.branch_id, txs.mod_type, txs.transaction_id, aj.transaction_id as stripe_transaction_id FROM osee_join_artifact aj, osee_attribute att, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = att.art_id AND att.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.transaction_id <= aj.transaction_id order by txs.branch_id, att.art_id, att.attr_id, txs.transaction_id desc"), - LOAD_CURRENT_ATTRIBUTES(Strings.SELECT_CURRENT_ATTRIBUTES_PREFIX + "= 1 order by al1.branch_id, al1.art_id, att1.attr_id, txs.transaction_id desc", getHintsOrderedFirstRows()), - LOAD_CURRENT_ATTRIBUTES_WITH_DELETED(Strings.SELECT_CURRENT_ATTRIBUTES_PREFIX + "IN (1, 3) order by al1.branch_id, al1.art_id, att1.attr_id, txs.transaction_id desc", getHintsOrderedFirstRows()), - LOAD_ALL_CURRENT_ATTRIBUTES(Strings.SELECT_CURRENT_ATTRIBUTES_PREFIX + "IN (1, 2, 3) order by al1.branch_id, al1.art_id, att1.attr_id, txs.transaction_id desc", getHintsOrderedFirstRows()), - - 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 FROM osee_join_artifact aj, osee_relation_link rel, osee_txs txs WHERE aj.query_id = ? AND (aj.art_id = rel.a_art_id OR aj.art_id = rel.b_art_id) AND rel.gamma_id = txs.gamma_id AND txs.tx_current = " + TxChange.CURRENT.getValue() + " AND aj.branch_id = txs.branch_id", getHintsOrderedFirstRows()), - LOAD_CURRENT_ARTIFACTS(Strings.SELECT_CURRENT_ARTIFACTS_PREFIX + "= 1", getHintsOrderedFirstRows()), - LOAD_CURRENT_ARTIFACTS_WITH_DELETED(Strings.SELECT_CURRENT_ARTIFACTS_PREFIX + "in (1, 2)", getHintsOrderedFirstRows()), - - LOAD_REVISION_HISTORY_TRANSACTION_ATTR("SELECT %s txs.transaction_id from osee_attribute arv, osee_txs txs where arv.art_id = ? and arv.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.transaction_id <=?", getHintsOrderedFirstRows()), - LOAD_REVISION_HISTORY_TRANSACTION_REL("SELECT %s txs.transaction_id from osee_relation_link rel, osee_txs txs where (rel.a_art_id = ? or rel.b_art_id = ?) and rel.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.transaction_id <=?", getHintsOrderedFirstRows()), - - CHANGE_BRANCH_ATTRIBUTE_WAS("SELECT%s attxs1.attr_id, attxs1.value as was_value, txs1.mod_type FROM osee_join_artifact 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.art_id AND txs1.branch_id = ja1.branch_id AND ja1.query_id = ?", getHintsOrderedFirstRows()), - CHANGE_TX_ATTRIBUTE_WAS("SELECT%s att1.attr_id, att1.value as was_value, txs1.mod_type FROM osee_join_artifact al1, osee_attribute att1, osee_txs txs1 WHERE al1.art_id = att1.art_id AND att1.gamma_id = txs1.gamma_id AND txs1.transaction_id < ? AND al1.query_id = ? AND txs1.branch_id = al1.branch_id order by txs1.branch_id, att1.art_id, att1.attr_id, txs1.transaction_id desc", getHintsOrderedFirstRows()), - 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", getHintsOrderedFirstRows()), - 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", getHintsOrderedFirstRows()), - 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() + ") ", getHintsOrderedFirstRows()), - CHANGE_TX_ARTIFACT("select art.art_id, art.art_type_id, art.gamma_id, txs.mod_type FROM osee_txs txs, osee_artifact art WHERE txs.branch_id = ? and txs.transaction_id = ? AND txs.gamma_id = art.gamma_id AND txs.mod_type in (" + ModificationType.DELETED.getValue() + ", " + ModificationType.NEW.getValue() + ", " + ModificationType.INTRODUCED.getValue() + ") "), - CHANGE_TX_ARTIFACT_FOR_SPECIFIC_ARTIFACT(CHANGE_TX_ARTIFACT.sql + " and art.art_id =?"), - CHANGE_TX_MODIFYING("SELECT arj.art_id, arj.branch_id, txs.transaction_id from osee_join_artifact arj, osee_artifact art, osee_txs txs, osee_branch br where arj.query_id = ? AND arj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = arj.branch_id AND txs.transaction_id <= arj.transaction_id AND txs.branch_id = br.branch_id AND txs.transaction_id <> br.baseline_transaction_id", getHintsOrderedFirstRows()), - CHANGE_BRANCH_MODIFYING("SELECT count(txs.transaction_id) as tx_count, arj.branch_id, arj.art_id FROM osee_join_artifact arj, osee_artifact art, osee_txs txs, osee_branch br where arj.query_id = ? AND arj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = arj.branch_id and txs.branch_id = br.branch_id AND txs.transaction_id <> br.baseline_transaction_id group by arj.art_id, arj.branch_id", getHintsOrderedFirstRows()), - - IS_ARTIFACT_ON_BRANCH("SELECT%s count(1) from osee_artifact av1, osee_txs txs1 where av1.art_id = ? and av1.gamma_id = txs1.gamma_id and txs1.branch_id = ?", getHintsOrderedFirstRows()), - QUERY_BUILDER("%s", getHintsOrderedFirstRows()); - - private final String sql; - private final String hints; - - private OseeSql(String sql, String hints) { - this.sql = sql; - this.hints = hints; - } - - private OseeSql(String sql) { - this(sql, null); - } - - public static Properties getSqlProperties(DatabaseMetaData metaData) throws OseeCoreException { - Properties sqlProperties = new Properties(); - boolean areHintsSupported = JdbcDbType.areHintsSupported(metaData); - for (OseeSql oseeSql : OseeSql.values()) { - String sql; - - if (oseeSql.hints == null) { - sql = oseeSql.sql; - } else { - String hints = areHintsSupported ? oseeSql.hints : ""; - sql = String.format(oseeSql.sql, hints); - } - - sqlProperties.setProperty(oseeSql.toString(), sql); - } - return sqlProperties; - } - - private static String getHintsOrderedFirstRows() { - return "/*+ ordered */"; - - } - private static class Strings { - private static final String HINTS__ORDERED__INDEX__ARTIFACT_CONFLICT = - " /*+ ordered index(atr1) index(atr2) index(txs2) */"; - private static final String HINTS__ORDERED__INDEX__ATTRIBUTE_CONFLICT = - " /*+ ordered index(atr1) index(atr2) index(txs2) */"; - - private static final String SELECT_CURRENT_ATTRIBUTES_PREFIX = - "SELECT%s att1.art_id, att1.attr_id, att1.value, att1.gamma_id, att1.attr_type_id, att1.uri, al1.branch_id, txs.mod_type, txs.transaction_id FROM osee_join_artifact al1, osee_attribute att1, osee_txs txs WHERE al1.query_id = ? AND al1.art_id = att1.art_id AND att1.gamma_id = txs.gamma_id AND txs.branch_id = al1.branch_id AND txs.tx_current "; - - private static final String SELECT_CURRENT_ARTIFACTS_PREFIX = - "SELECT%s aj.art_id, txs.gamma_id, mod_type, art_type_id, guid, txs.branch_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.tx_current "; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java index 0a01442b4a5..8f93e1d1844 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java @@ -16,6 +16,7 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.osee.cache.admin.CacheAdmin; import org.eclipse.osee.framework.core.client.ClientSessionManager; import org.eclipse.osee.framework.core.services.IOseeCachingService; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java index ae403c639c8..82d583ddb74 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java @@ -11,10 +11,10 @@ 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.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.MutableInteger; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.utility.IdJoinQuery; import org.eclipse.osee.framework.skynet.core.utility.JoinUtility; @@ -88,7 +88,7 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess switch (transactionType) { case BASE: toReturn = - loadTransaction(cache, SELECT_BASE_TRANSACTION, branch.getUuid(), TransactionDetailsType.Baselined); + loadTransaction(cache, SELECT_BASE_TRANSACTION, branch.getUuid(), TransactionDetailsType.Baselined); break; case HEAD: toReturn = loadTransaction(cache, SELECT_HEAD_TRANSACTION, branch.getUuid(), branch.getUuid()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java index b107d1f727e..9116176a1be 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java @@ -13,10 +13,10 @@ package org.eclipse.osee.framework.skynet.core.relation; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.model.event.DefaultBasicUuidRelation; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidRelation; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData; /** diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java index e8f63501766..baa357b13d2 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java @@ -20,6 +20,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.operation.IOperation; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.HashCollection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -27,7 +28,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta; import org.eclipse.osee.framework.skynet.core.change.Change; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; @@ -37,7 +37,7 @@ import org.eclipse.osee.jdbc.JdbcStatement; /** * Public API class for access to change data from branches and transactionIds - * + * * @author Jeff C. Phillips * @author Donald G. Dunne */ @@ -97,7 +97,7 @@ public final class ChangeManager { /** * For the given list of artifacts determine which transactions (on that artifact's branch) affected that artifact. * The branch's baseline transaction is excluded. - * + * * @return a map of artifact to collection of TransactionIds which affected the given artifact */ public static HashCollection<Artifact, TransactionRecord> getModifingTransactions(Collection<Artifact> artifacts) throws OseeCoreException { @@ -141,7 +141,7 @@ public final class ChangeManager { /** * For the given list of artifacts determine which branches (in the branch hierarchy for that artifact) affected that * artifact. - * + * * @return a map of artifact to collection of branches which affected the given artifact */ public static HashCollection<Artifact, Branch> getModifingBranches(Collection<Artifact> artifacts) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java index 0955edcfa63..51d3d482de6 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java @@ -24,6 +24,7 @@ import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.exception.BranchMergeException; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; @@ -34,7 +35,6 @@ import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict; import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflictBuilder; import org.eclipse.osee.framework.skynet.core.conflict.Conflict; import org.eclipse.osee.framework.skynet.core.conflict.ConflictBuilder; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; @@ -103,7 +103,7 @@ public class ConflictManagerInternal { if (sourceBranch == null || destinationBranch == null) { throw new OseeArgumentException("Source Branch = %s Destination Branch = %s", sourceBranch == null ? "NULL" : sourceBranch.getUuid(), - destinationBranch == null ? "NULL" : destinationBranch.getUuid()); + destinationBranch == null ? "NULL" : destinationBranch.getUuid()); } monitor.beginTask( String.format("Loading Merge Manager for Branch %d into Branch %d", sourceBranch.getUuid(), @@ -195,7 +195,7 @@ public class ConflictManagerInternal { artId = nextArtId; if (destModType == ModificationType.DELETED && sourceModType == ModificationType.MODIFIED || // - destModType == ModificationType.MODIFIED && sourceModType == ModificationType.DELETED) { + destModType == ModificationType.MODIFIED && sourceModType == ModificationType.DELETED) { artifactConflictBuilder = new ArtifactConflictBuilder(sourceGamma, destGamma, artId, baselineTransaction, sourceBranch, @@ -246,15 +246,15 @@ public class ConflictManagerInternal { String sourceValue = chStmt.getString("source_value") != null ? chStmt.getString("source_value") : chStmt.getString("dest_value"); - if (attrId != nextAttrId && isAttributeConflictValid(destGamma, sourceBranch)) { - attrId = nextAttrId; - attributeConflictBuilder = - new AttributeConflictBuilder(sourceGamma, destGamma, artId, baselineTransaction, sourceBranch, - destinationBranch, sourceValue, attrId, attrTypeId); + if (attrId != nextAttrId && isAttributeConflictValid(destGamma, sourceBranch)) { + attrId = nextAttrId; + attributeConflictBuilder = + new AttributeConflictBuilder(sourceGamma, destGamma, artId, baselineTransaction, sourceBranch, + destinationBranch, sourceValue, attrId, attrTypeId); - conflictBuilders.add(attributeConflictBuilder); - artIdSet.add(artId); - } + conflictBuilders.add(attributeConflictBuilder); + artIdSet.add(artId); + } } while (chStmt.next()); } } finally { @@ -266,7 +266,7 @@ public class ConflictManagerInternal { /** * Checks source branch hierarchy to see if the conflict gamma exists. If it does, its not a real conflict because * the source branch has already seen this change. - * + * * @return Returns True if the AttributeConflict candidate is really a conflict. */ private static boolean isAttributeConflictValid(int destinationGammaId, Branch sourceBranch) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java index fdd5df801fd..14665f3f5fe 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java @@ -23,6 +23,7 @@ import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.DeletionFlag; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; import org.eclipse.osee.framework.jdk.core.type.HashCollection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -37,7 +38,6 @@ import org.eclipse.osee.framework.skynet.core.change.Change; import org.eclipse.osee.framework.skynet.core.change.ChangeBuilder; import org.eclipse.osee.framework.skynet.core.change.RelationChange; import org.eclipse.osee.framework.skynet.core.change.RelationChangeBuilder; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.revision.acquirer.ArtifactChangeAcquirer; import org.eclipse.osee.framework.skynet.core.revision.acquirer.AttributeChangeAcquirer; @@ -48,7 +48,7 @@ import org.eclipse.osee.jdbc.JdbcStatement; /** * Acquires changes for either branches or transactions. - * + * * @author Jeff C. Phillips */ public final class RevisionChangeLoader { @@ -134,20 +134,20 @@ public final class RevisionChangeLoader { switch (changeType) { case artifact: ArtifactChangeAcquirer artifactChangeAcquirer = - new ArtifactChangeAcquirer(sourceBranch, transactionId, monitor, specificArtifact, artIds, - changeBuilders, newAndDeletedArtifactIds); + new ArtifactChangeAcquirer(sourceBranch, transactionId, monitor, specificArtifact, artIds, + changeBuilders, newAndDeletedArtifactIds); changeBuilders = artifactChangeAcquirer.acquireChanges(); break; case attribute: AttributeChangeAcquirer attributeChangeAcquirer = - new AttributeChangeAcquirer(sourceBranch, transactionId, monitor, specificArtifact, artIds, - changeBuilders, newAndDeletedArtifactIds); + new AttributeChangeAcquirer(sourceBranch, transactionId, monitor, specificArtifact, artIds, + changeBuilders, newAndDeletedArtifactIds); changeBuilders = attributeChangeAcquirer.acquireChanges(); break; case relation: RelationChangeAcquirer relationChangeAcquirer = - new RelationChangeAcquirer(sourceBranch, transactionId, monitor, specificArtifact, artIds, - changeBuilders, newAndDeletedArtifactIds); + new RelationChangeAcquirer(sourceBranch, transactionId, monitor, specificArtifact, artIds, + changeBuilders, newAndDeletedArtifactIds); changeBuilders = relationChangeAcquirer.acquireChanges(); break; 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 02dea81e7e3..06b01f93feb 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 @@ -19,12 +19,12 @@ import org.eclipse.osee.framework.core.enums.ModificationType; 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.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; 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.change.ArtifactChangeBuilder; import org.eclipse.osee.framework.skynet.core.change.ChangeBuilder; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; 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 25a6c0f5e19..ed88ad59fd4 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 @@ -24,6 +24,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.model.type.AttributeType; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; @@ -31,7 +32,6 @@ import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager; import org.eclipse.osee.framework.skynet.core.change.ArtifactChangeBuilder; import org.eclipse.osee.framework.skynet.core.change.AttributeChangeBuilder; import org.eclipse.osee.framework.skynet.core.change.ChangeBuilder; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.skynet.core.utility.ArtifactJoinQuery; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java index 1bc586cffb6..93f50fb36c9 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java @@ -17,12 +17,12 @@ import org.eclipse.osee.framework.core.enums.ModificationType; 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.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; 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.change.ChangeBuilder; import org.eclipse.osee.framework.skynet.core.change.RelationChangeBuilder; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; 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 1788eff3d94..7482bd68eb1 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 @@ -13,9 +13,9 @@ package org.eclipse.osee.framework.skynet.core.transaction; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; /** @@ -129,7 +129,7 @@ public abstract class BaseTransactionData { /** * Should not be called by application. This should only be called once after the transaction has been committed. - * + * * @param artifactEvent TODO */ protected abstract void internalAddToEvents(ArtifactEvent artifactEvent) throws OseeCoreException; 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 24058f62f37..a5d41da9ddd 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 @@ -26,13 +26,13 @@ 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.TransactionCache; import org.eclipse.osee.framework.core.services.IOseeCachingService; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime; import org.eclipse.osee.framework.skynet.core.User; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; -import org.eclipse.osee.framework.skynet.core.internal.OseeSql; import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.types.IArtifact; import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; @@ -42,7 +42,7 @@ import org.eclipse.osee.jdbc.JdbcStatement; /** * Manages a cache of <code>TransactionId</code>. - * + * * @author Jeff C. Phillips */ public final class TransactionManager { diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java index 24f9075b92f..c66caa497ca 100644 --- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java +++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java @@ -31,6 +31,7 @@ import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.enums.CoreRelationTypes; import org.eclipse.osee.framework.core.enums.DeletionFlag; import org.eclipse.osee.framework.core.enums.LoadLevel; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.jdbc.JdbcClient; @@ -47,7 +48,6 @@ import org.eclipse.osee.orcs.db.internal.IdentityManager; import org.eclipse.osee.orcs.db.internal.OrcsObjectFactory; import org.eclipse.osee.orcs.db.internal.SqlProvider; import org.eclipse.osee.orcs.db.internal.loader.criteria.CriteriaOrcsLoad; -import org.eclipse.osee.orcs.db.internal.sql.OseeSql; import org.eclipse.osee.orcs.db.internal.sql.join.AbstractJoinQuery; import org.eclipse.osee.orcs.db.internal.sql.join.ArtifactJoinQuery; import org.eclipse.osee.orcs.db.internal.sql.join.IJoinAccessor; diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java index 01fe3992939..7937b4ea4b0 100644 --- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java +++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/ArtifactQuerySqlContextFactoryImplTest.java @@ -26,6 +26,7 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.enums.CoreRelationTypes; import org.eclipse.osee.framework.core.enums.QueryOption; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.logger.Log; @@ -55,7 +56,6 @@ import org.eclipse.osee.orcs.db.internal.search.QuerySqlContext; import org.eclipse.osee.orcs.db.internal.search.QuerySqlContextFactory; import org.eclipse.osee.orcs.db.internal.search.tagger.TagCollector; import org.eclipse.osee.orcs.db.internal.search.tagger.TagProcessor; -import org.eclipse.osee.orcs.db.internal.sql.OseeSql; import org.eclipse.osee.orcs.db.internal.sql.SqlHandlerFactory; import org.eclipse.osee.orcs.db.internal.sql.join.AbstractJoinQuery; import org.eclipse.osee.orcs.db.internal.sql.join.CharJoinQuery; diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/BranchQuerySqlContextFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/BranchQuerySqlContextFactoryImplTest.java index 9fa0a05968b..d98d244258a 100644 --- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/BranchQuerySqlContextFactoryImplTest.java +++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/BranchQuerySqlContextFactoryImplTest.java @@ -26,6 +26,7 @@ import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.BranchArchivedState; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.logger.Log; @@ -50,7 +51,6 @@ import org.eclipse.osee.orcs.db.internal.SqlProvider; import org.eclipse.osee.orcs.db.internal.search.Engines; import org.eclipse.osee.orcs.db.internal.search.QuerySqlContext; import org.eclipse.osee.orcs.db.internal.search.QuerySqlContextFactory; -import org.eclipse.osee.orcs.db.internal.sql.OseeSql; import org.eclipse.osee.orcs.db.internal.sql.join.AbstractJoinQuery; import org.eclipse.osee.orcs.db.internal.sql.join.IdJoinQuery; import org.eclipse.osee.orcs.db.internal.sql.join.SqlJoinFactory; diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/TxQuerySqlContextFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/TxQuerySqlContextFactoryImplTest.java index 2afacbb0484..31fff01d5b9 100644 --- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/TxQuerySqlContextFactoryImplTest.java +++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/TxQuerySqlContextFactoryImplTest.java @@ -18,6 +18,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; import org.eclipse.osee.framework.core.enums.TransactionDetailsType; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.logger.Log; @@ -41,7 +42,6 @@ import org.eclipse.osee.orcs.db.internal.SqlProvider; import org.eclipse.osee.orcs.db.internal.search.Engines; import org.eclipse.osee.orcs.db.internal.search.QuerySqlContext; import org.eclipse.osee.orcs.db.internal.search.QuerySqlContextFactory; -import org.eclipse.osee.orcs.db.internal.sql.OseeSql; import org.eclipse.osee.orcs.db.internal.sql.join.AbstractJoinQuery; import org.eclipse.osee.orcs.db.internal.sql.join.IdJoinQuery; import org.eclipse.osee.orcs.db.internal.sql.join.SqlJoinFactory; diff --git a/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF index 2f157af2ddf..8d831b41b4b 100644 --- a/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF @@ -20,6 +20,7 @@ Import-Package: com.google.common.base;version="15.0.0", org.eclipse.osee.framework.core.model.change, org.eclipse.osee.framework.core.model.type, org.eclipse.osee.framework.core.operation, + org.eclipse.osee.framework.core.sql, org.eclipse.osee.framework.jdk.core.text, org.eclipse.osee.framework.jdk.core.text.change, org.eclipse.osee.framework.jdk.core.text.rules, diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/SqlProvider.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/SqlProvider.java index c92d7637752..049d7de32a8 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/SqlProvider.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/SqlProvider.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.osee.orcs.db.internal; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.orcs.db.internal.sql.OseeSql; /** * @author Roberto E. Escobar diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/SqlObjectLoader.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/SqlObjectLoader.java index 3d5fec45f06..506b9f02cf2 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/SqlObjectLoader.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/SqlObjectLoader.java @@ -14,6 +14,7 @@ import java.util.concurrent.CancellationException; import org.eclipse.osee.executor.admin.HasCancellation; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.LoadLevel; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.jdbc.JdbcClient; @@ -44,7 +45,6 @@ import org.eclipse.osee.orcs.db.internal.loader.processor.RelationLoadProcessor; import org.eclipse.osee.orcs.db.internal.loader.processor.TransactionLoadProcessor; import org.eclipse.osee.orcs.db.internal.search.QuerySqlContext; import org.eclipse.osee.orcs.db.internal.sql.AbstractSqlWriter; -import org.eclipse.osee.orcs.db.internal.sql.OseeSql; import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants; import org.eclipse.osee.orcs.db.internal.sql.SqlContext; import org.eclipse.osee.orcs.db.internal.sql.SqlHandler; diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java index c56ec28fc3c..8a139854a89 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java @@ -15,6 +15,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.Identifiable; import org.eclipse.osee.framework.jdk.core.type.Identity; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/OseeSql.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/OseeSql.java deleted file mode 100644 index aefacc319bd..00000000000 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/OseeSql.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.orcs.db.internal.sql; - -import org.eclipse.osee.framework.core.enums.ConflictStatus; -import org.eclipse.osee.framework.core.enums.ModificationType; -import org.eclipse.osee.framework.core.enums.TxChange; - -/** - * @author Ryan D. Brooks - */ -public enum OseeSql { - - TX_GET_ALL_TRANSACTIONS("SELECT * FROM osee_tx_details WHERE transaction_id = ?"), - TX_GET_MAX_AS_LARGEST_TX("SELECT max(transaction_id) as largest_transaction_id FROM osee_tx_details WHERE branch_id = ?"), - - 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"), - MERGE_GET_RELATIONS_FOR_BRANCH("SELECT rel.a_art_id, rel.b_art_id FROM osee_txs txs, osee_relation_link rel WHERE txs.branch_id = ? and txs.gamma_id = rel.gamma_id"), - - CONFLICT_GET_ARTIFACTS_DEST("SELECT%s art2.art_type_id, art1.art_id, txs1.mod_type AS source_mod_type, txs1.gamma_id AS source_gamma, txs2.mod_type AS dest_mod_type, txs2.gamma_id AS dest_gamma FROM osee_txs txs1, osee_attribute art1, osee_artifact art2, osee_txs txs2 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (1,2) AND txs1.gamma_id = art1.gamma_id AND art1.art_id = art2.art_id AND art2.gamma_id = txs2.gamma_id AND txs2.branch_id = ? AND ((txs2.tx_current = 1 AND txs2.gamma_id not in (SELECT txs.gamma_id FROM osee_txs txs WHERE txs.transaction_id = ?)) OR txs2.tx_current = 2)", Strings.HINTS__ORDERED__INDEX__ARTIFACT_CONFLICT), - CONFLICT_GET_ARTIFACTS_SRC("SELECT%s art1.art_type_id, art1.art_id, txs1.mod_type AS source_mod_type, txs1.gamma_id AS source_gamma, txs2.mod_type AS dest_mod_type, txs2.gamma_id AS dest_gamma FROM osee_txs txs1, osee_artifact art1, osee_attribute art2, osee_txs txs2 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (1,2) AND txs1.gamma_id = art1.gamma_id AND art1.art_id = art2.art_id AND art2.gamma_id = txs2.gamma_id AND txs2.branch_id = ? AND ((txs2.tx_current = 1 AND txs2.gamma_id not in (SELECT txs.gamma_id FROM osee_txs txs WHERE txs.transaction_id = ?)) OR txs2.tx_current = 2)", Strings.HINTS__ORDERED__INDEX__ARTIFACT_CONFLICT), - CONFLICT_GET_ATTRIBUTES("SELECT%s atr1.art_id, txs1.mod_type, atr1.attr_type_id, atr1.attr_id, atr1.gamma_id AS source_gamma, atr1.value AS source_value, atr2.gamma_id AS dest_gamma, atr2.value as dest_value, txs2.mod_type AS dest_mod_type FROM osee_txs txs1, osee_attribute atr1, osee_attribute atr2, osee_txs txs2 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (1,2) AND txs1.gamma_id = atr1.gamma_id AND atr1.attr_id = atr2.attr_id AND atr2.gamma_id = txs2.gamma_id AND txs2.branch_id = ? AND ((txs2.tx_current = 1 AND txs2.gamma_id not in (SELECT txs.gamma_id FROM osee_txs txs WHERE txs.transaction_id = ? )) OR txs2.tx_current = 2) ORDER BY attr_id", Strings.HINTS__ORDERED__INDEX__ATTRIBUTE_CONFLICT), - CONFLICT_GET_HISTORICAL_ATTRIBUTES("SELECT%s atr.attr_id, atr.art_id, source_gamma_id, dest_gamma_id, attr_type_id, mer.merge_branch_id, mer.dest_branch_id, value as source_value, status FROM osee_merge mer, osee_conflict con, osee_attribute atr Where mer.commit_transaction_id = ? AND mer.merge_branch_id = con.merge_branch_id And con.source_gamma_id = atr.gamma_id AND con.status in (" + ConflictStatus.COMMITTED.getValue() + ", " + ConflictStatus.INFORMATIONAL.getValue() + " ) order by attr_id", true), - - LOAD_REVISION_HISTORY_TRANSACTION_ATTR("SELECT %s txs.transaction_id from osee_attribute arv, osee_txs txs where arv.art_id = ? and arv.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.transaction_id <=?", true), - LOAD_REVISION_HISTORY_TRANSACTION_REL("SELECT %s txs.transaction_id from osee_relation_link rel, osee_txs txs where (rel.a_art_id = ? or rel.b_art_id = ?) and rel.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.transaction_id <=?", true), - - CHANGE_BRANCH_ATTRIBUTE_WAS("SELECT%s attxs1.attr_id, attxs1.value as was_value, txs1.mod_type FROM osee_join_artifact 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.art_id AND txs1.branch_id = ja1.branch_id AND ja1.query_id = ?", true), - CHANGE_TX_ATTRIBUTE_WAS("SELECT%s att1.attr_id, att1.value as was_value, txs1.mod_type FROM osee_join_artifact al1, osee_attribute att1, osee_txs txs1 WHERE al1.art_id = att1.art_id AND att1.gamma_id = txs1.gamma_id AND txs1.transaction_id < ? AND al1.query_id = ? AND txs1.branch_id = al1.branch_id order by txs1.branch_id, att1.art_id, att1.attr_id, txs1.transaction_id desc", true), - 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", true), - 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", true), - 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() + ") ", true), - CHANGE_TX_ARTIFACT("select art.art_id, art.art_type_id, art.gamma_id, txs.mod_type FROM osee_txs txs, osee_artifact art WHERE txs.branch_id = ? and txs.transaction_id = ? AND txs.gamma_id = art.gamma_id AND txs.mod_type in (" + ModificationType.DELETED.getValue() + ", " + ModificationType.NEW.getValue() + ", " + ModificationType.INTRODUCED.getValue() + ") "), - CHANGE_TX_ARTIFACT_FOR_SPECIFIC_ARTIFACT(CHANGE_TX_ARTIFACT.sql + " and art.art_id =?"), - CHANGE_TX_MODIFYING("SELECT arj.art_id, arj.branch_id, txs.transaction_id from osee_join_artifact arj, osee_artifact art, osee_txs txs, osee_branch br where arj.query_id = ? AND arj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = arj.branch_id AND txs.transaction_id <= arj.transaction_id AND txs.branch_id = br.branch_id AND txs.transaction_id <> br.baseline_transaction_id", true), - CHANGE_BRANCH_MODIFYING("SELECT count(txs.transaction_id) as tx_count, arj.branch_id, arj.art_id FROM osee_join_artifact arj, osee_artifact art, osee_txs txs, osee_branch br where arj.query_id = ? AND arj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = arj.branch_id and txs.branch_id = br.branch_id AND txs.transaction_id <> br.baseline_transaction_id group by arj.art_id, arj.branch_id", true), - - IS_ARTIFACT_ON_BRANCH("SELECT%s count(1) from osee_artifact av1, osee_txs txs1 where av1.art_id = ? and av1.gamma_id = txs1.gamma_id and txs1.branch_id = ?", true), - QUERY_BUILDER("%s", true); - - private final String sql; - private final String hints; - private final boolean isDynamicHint; - - private OseeSql(String sql, String hints) { - this.sql = sql; - this.hints = hints; - this.isDynamicHint = false; - } - - private OseeSql(String sql) { - this(sql, null); - } - - private OseeSql(String sql, boolean isDynamicHint) { - this.sql = sql; - this.hints = null; - this.isDynamicHint = isDynamicHint; - } - - public String getSql() { - return sql; - } - - protected String getHints() { - return hints; - } - - protected boolean getIsDynamicHint() { - return isDynamicHint; - } - - private static class Strings { - private static final String HINTS__ORDERED__INDEX__ARTIFACT_CONFLICT = - " /*+ ordered index(atr1) index(atr2) index(txs2) */"; - private static final String HINTS__ORDERED__INDEX__ATTRIBUTE_CONFLICT = - " /*+ ordered index(atr1) index(atr2) index(txs2) */"; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/StaticSqlProvider.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/StaticSqlProvider.java index 9f88cd079c0..3837d7332e7 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/StaticSqlProvider.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/StaticSqlProvider.java @@ -12,6 +12,7 @@ package org.eclipse.osee.orcs.db.internal.sql; import java.util.HashMap; import java.util.Map; +import org.eclipse.osee.framework.core.sql.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.logger.Log; |