Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2017-01-25 00:38:40 +0000
committerDavid W. Miller2017-01-25 00:38:40 +0000
commit492e2f30d13730850cb3966d00ab9f0debe3f409 (patch)
tree185cfb1440d0c4e1c9c11b914ee9cc9e6052424a /plugins/org.eclipse.osee.orcs.db
parent6a6f69d4c98f0b0d0c88d453e4ccbfb5a627947a (diff)
downloadorg.eclipse.osee-492e2f30d13730850cb3966d00ab9f0debe3f409.tar.gz
org.eclipse.osee-492e2f30d13730850cb3966d00ab9f0debe3f409.tar.xz
org.eclipse.osee-492e2f30d13730850cb3966d00ab9f0debe3f409.zip
refactor: Add OSEE_JOIN_ID4 table for artifact loading
Change-Id: Ifad6566556415e092b08550ba1352dfccd576615 Signed-off-by: Morgan E. Cook <Morgan.e.cook@boeing.com>
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.db')
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/LoadSqlWriter.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/SqlObjectLoader.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/ArtifactQueryContextLoadExecutor.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/LoadExecutor.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/UuidsLoadExecutor.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/ArtifactSqlHandler.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/RelationSqlHandler.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/ArtifactLoadProcessor.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/AttributeLoadProcessor.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/migration/V0.25.0_2016_12_20_1436__Osee_ID4Join_Schema.sql11
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/TableEnum.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/DatabaseJoinAccessor.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/Id4JoinQuery.java (renamed from plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/ArtifactJoinQuery.java)85
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/SqlJoinFactory.java10
16 files changed, 104 insertions, 79 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java
index d32ed2e980..34556238fd 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java
@@ -80,9 +80,9 @@ public class CreateBranchDatabaseTxCallable extends JdbcTransaction {
"INSERT INTO osee_merge (source_branch_id, dest_branch_id, merge_branch_id, commit_transaction_id) VALUES (?,?,?,?)";
private final static String SELECT_ATTRIBUTE_ADDRESSING_FROM_JOIN =
- "SELECT item.gamma_id, txs.mod_type, txs.app_id FROM osee_attribute item, osee_txs txs, osee_join_artifact artjoin WHERE txs.branch_id = ? AND txs.tx_current <> ? AND txs.gamma_id = item.gamma_id AND item.art_id = artjoin.art_id and artjoin.query_id = ? ORDER BY txs.transaction_id DESC";
+ "SELECT item.gamma_id, txs.mod_type, txs.app_id FROM osee_attribute item, osee_txs txs, osee_join_id4 artjoin WHERE txs.branch_id = ? AND txs.tx_current <> ? AND txs.gamma_id = item.gamma_id AND item.art_id = artjoin.id2 and artjoin.query_id = ? ORDER BY txs.transaction_id DESC";
private final static String SELECT_ARTIFACT_ADDRESSING_FROM_JOIN =
- "SELECT item.gamma_id, txs.mod_type, txs.app_id FROM osee_artifact item, osee_txs txs, osee_join_artifact artjoin WHERE txs.branch_id = ? AND txs.tx_current <> ? AND txs.gamma_id = item.gamma_id AND item.art_id = artjoin.art_id and artjoin.query_id = ? ORDER BY txs.transaction_id DESC";
+ "SELECT item.gamma_id, txs.mod_type, txs.app_id FROM osee_artifact item, osee_txs txs, osee_join_id4 artjoin WHERE txs.branch_id = ? AND txs.tx_current <> ? AND txs.gamma_id = item.gamma_id AND item.art_id = artjoin.id2 and artjoin.query_id = ? ORDER BY txs.transaction_id DESC";
private static final String TEST_MERGE_BRANCH_EXISTENCE =
"SELECT COUNT(1) FROM osee_merge WHERE source_branch_id = ? AND dest_branch_id = ?";
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/LoadSqlWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/LoadSqlWriter.java
index 6a156b0830..37859ebb5d 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/LoadSqlWriter.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/LoadSqlWriter.java
@@ -39,7 +39,7 @@ public class LoadSqlWriter extends AbstractSqlWriter {
@Override
public void writeSelect(Iterable<SqlHandler<?>> handlers) throws OseeCoreException {
String txAlias = getLastAlias(TableEnum.TXS_TABLE);
- String artJoinAlias = getLastAlias(TableEnum.ARTIFACT_JOIN_TABLE);
+ String artJoinAlias = getLastAlias(TableEnum.JOIN_ID4_TABLE);
write("SELECT%s ", getSqlHint());
write("%s.gamma_id, %s.mod_type, %s.branch_id, %s.transaction_id, %s.app_id", txAlias, txAlias, txAlias, txAlias,
@@ -47,7 +47,7 @@ public class LoadSqlWriter extends AbstractSqlWriter {
if (OptionsUtil.isHistorical(getOptions())) {
write(", %s.transaction_id as stripe_transaction_id", txAlias);
}
- write(",\n %s.art_id", artJoinAlias);
+ write(",\n %s.id2", artJoinAlias);
for (SqlHandler<?> handler : handlers) {
setHandlerLevel(handler);
write(", ");
@@ -57,10 +57,10 @@ public class LoadSqlWriter extends AbstractSqlWriter {
@Override
public void writeGroupAndOrder() throws OseeCoreException {
- String artAlias = getLastAlias(TableEnum.ARTIFACT_JOIN_TABLE);
+ String artAlias = getLastAlias(TableEnum.JOIN_ID4_TABLE);
String txAlias = getLastAlias(TableEnum.TXS_TABLE);
- write("\n ORDER BY %s.branch_id, %s.art_id", txAlias, artAlias);
+ write("\n ORDER BY %s.branch_id, %s.id2", txAlias, artAlias);
if (hasAlias(TableEnum.ATTRIBUTE_TABLE)) {
write(", %s.attr_id", getLastAlias(TableEnum.ATTRIBUTE_TABLE));
}
@@ -82,13 +82,13 @@ public class LoadSqlWriter extends AbstractSqlWriter {
@Override
public String getTxBranchFilter(String txsAlias, boolean allowDeleted) {
StringBuilder sb = new StringBuilder();
- String artJoinAlias = getLastAlias(TableEnum.ARTIFACT_JOIN_TABLE);
+ String artJoinAlias = getLastAlias(TableEnum.JOIN_ID4_TABLE);
writeTxFilter(txsAlias, artJoinAlias, sb, allowDeleted);
sb.append(" AND ");
sb.append(txsAlias);
sb.append(".branch_id = ");
sb.append(artJoinAlias);
- sb.append(".branch_id");
+ sb.append(".id1");
return sb.toString();
}
@@ -134,7 +134,7 @@ public class LoadSqlWriter extends AbstractSqlWriter {
sb.append(txsAlias);
sb.append(".transaction_id <= ");
sb.append(artJoinAlias);
- sb.append(".transaction_id");
+ sb.append(".id3");
if (!areDeletedIncluded) {
sb.append(" AND ");
sb.append(txsAlias);
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 2c6fbfedbe..610c5d8b11 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
@@ -49,7 +49,7 @@ import org.eclipse.osee.orcs.db.internal.sql.SqlContext;
import org.eclipse.osee.orcs.db.internal.sql.SqlHandler;
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.ArtifactJoinQuery;
+import org.eclipse.osee.orcs.db.internal.sql.join.Id4JoinQuery;
import org.eclipse.osee.orcs.db.internal.sql.join.SqlJoinFactory;
/**
@@ -113,7 +113,7 @@ public class SqlObjectLoader {
writer.build(handler);
}
- public void loadArtifacts(HasCancellation cancellation, LoadDataHandler handler, ArtifactJoinQuery join, CriteriaOrcsLoad criteria, LoadSqlContext loadContext, int fetchSize) throws OseeCoreException {
+ public void loadArtifacts(HasCancellation cancellation, LoadDataHandler handler, Id4JoinQuery join, CriteriaOrcsLoad criteria, LoadSqlContext loadContext, int fetchSize) throws OseeCoreException {
logger.trace("Sql Artifact Load - artifactJoinQuery[%s] loadSqlContext[%s]", join, loadContext);
if (!join.isEmpty()) {
try {
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/ArtifactQueryContextLoadExecutor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/ArtifactQueryContextLoadExecutor.java
index caba8a6259..d19ad71292 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/ArtifactQueryContextLoadExecutor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/ArtifactQueryContextLoadExecutor.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.orcs.db.internal.loader.executors;
import java.util.List;
import java.util.function.Consumer;
import org.eclipse.osee.executor.admin.HasCancellation;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.RelationalConstants;
import org.eclipse.osee.framework.core.data.TransactionId;
@@ -29,7 +30,7 @@ import org.eclipse.osee.orcs.db.internal.loader.criteria.CriteriaOrcsLoad;
import org.eclipse.osee.orcs.db.internal.search.engines.ArtifactQuerySqlContext;
import org.eclipse.osee.orcs.db.internal.sql.SqlContext;
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.Id4JoinQuery;
import org.eclipse.osee.orcs.db.internal.sql.join.SqlJoinFactory;
/**
@@ -50,7 +51,7 @@ public class ArtifactQueryContextLoadExecutor extends AbstractLoadExecutor {
public void load(HasCancellation cancellation, LoadDataHandler handler, CriteriaOrcsLoad criteria, Options options) throws OseeCoreException {
int fetchSize = computeFetchSize(queryContext);
- ArtifactJoinQuery join = createArtifactIdJoin(getJdbcClient(), cancellation, fetchSize);
+ Id4JoinQuery join = createId4Join(getJdbcClient(), cancellation, fetchSize);
LoadSqlContext loadContext = new LoadSqlContext(queryContext.getSession(), options, queryContext.getBranch());
getLoader().loadArtifacts(cancellation, handler, join, criteria, loadContext, fetchSize);
@@ -64,8 +65,8 @@ public class ArtifactQueryContextLoadExecutor extends AbstractLoadExecutor {
return LoadUtil.computeFetchSize(fetchSize);
}
- private ArtifactJoinQuery createArtifactIdJoin(JdbcClient jdbcClient, HasCancellation cancellation, int fetchSize) throws OseeCoreException {
- ArtifactJoinQuery artifactJoin = joinFactory.createArtifactJoinQuery();
+ private Id4JoinQuery createId4Join(JdbcClient jdbcClient, HasCancellation cancellation, int fetchSize) throws OseeCoreException {
+ Id4JoinQuery artifactJoin = joinFactory.createId4JoinQuery();
try {
for (AbstractJoinQuery join : queryContext.getJoins()) {
join.store();
@@ -76,7 +77,7 @@ public class ArtifactQueryContextLoadExecutor extends AbstractLoadExecutor {
checkCancelled(cancellation);
Integer artId = stmt.getInt("art_id");
BranchId branchUuid = BranchId.valueOf(stmt.getLong("branch_id"));
- artifactJoin.add(artId, branchUuid, transactionId);
+ artifactJoin.add(branchUuid, ArtifactId.valueOf(artId), transactionId);
checkCancelled(cancellation);
};
checkCancelled(cancellation);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/LoadExecutor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/LoadExecutor.java
index 389204c6b3..f069f554b6 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/LoadExecutor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/LoadExecutor.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.orcs.db.internal.loader.executors;
import java.util.Collection;
import org.eclipse.osee.executor.admin.HasCancellation;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -24,7 +25,7 @@ import org.eclipse.osee.orcs.db.internal.loader.LoadSqlContext;
import org.eclipse.osee.orcs.db.internal.loader.LoadUtil;
import org.eclipse.osee.orcs.db.internal.loader.SqlObjectLoader;
import org.eclipse.osee.orcs.db.internal.loader.criteria.CriteriaOrcsLoad;
-import org.eclipse.osee.orcs.db.internal.sql.join.ArtifactJoinQuery;
+import org.eclipse.osee.orcs.db.internal.sql.join.Id4JoinQuery;
import org.eclipse.osee.orcs.db.internal.sql.join.SqlJoinFactory;
/**
@@ -49,10 +50,10 @@ public class LoadExecutor extends AbstractLoadExecutor {
public void load(HasCancellation cancellation, LoadDataHandler handler, CriteriaOrcsLoad criteria, Options options) throws OseeCoreException {
checkCancelled(cancellation);
- ArtifactJoinQuery join = joinFactory.createArtifactJoinQuery();
+ Id4JoinQuery join = joinFactory.createId4JoinQuery();
TransactionId transactionId = OptionsUtil.getFromTransaction(options);
for (Integer artId : artifactIds) {
- join.add(artId, BranchId.valueOf(branch.getId()), transactionId);
+ join.add(branch, ArtifactId.valueOf(artId), transactionId);
}
LoadSqlContext loadContext = new LoadSqlContext(session, options, branch);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/UuidsLoadExecutor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/UuidsLoadExecutor.java
index e9a1fec4ff..830626f4f9 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/UuidsLoadExecutor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/executors/UuidsLoadExecutor.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.orcs.db.internal.loader.executors;
import java.util.Collection;
import org.eclipse.osee.executor.admin.HasCancellation;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -24,8 +25,8 @@ import org.eclipse.osee.orcs.db.internal.loader.LoadSqlContext;
import org.eclipse.osee.orcs.db.internal.loader.LoadUtil;
import org.eclipse.osee.orcs.db.internal.loader.SqlObjectLoader;
import org.eclipse.osee.orcs.db.internal.loader.criteria.CriteriaOrcsLoad;
-import org.eclipse.osee.orcs.db.internal.sql.join.ArtifactJoinQuery;
import org.eclipse.osee.orcs.db.internal.sql.join.CharJoinQuery;
+import org.eclipse.osee.orcs.db.internal.sql.join.Id4JoinQuery;
import org.eclipse.osee.orcs.db.internal.sql.join.SqlJoinFactory;
/**
@@ -53,16 +54,16 @@ public class UuidsLoadExecutor extends AbstractLoadExecutor {
public void load(HasCancellation cancellation, LoadDataHandler handler, CriteriaOrcsLoad criteria, Options options) throws OseeCoreException {
checkCancelled(cancellation);
if (!artifactIds.isEmpty()) {
- ArtifactJoinQuery join = createIdJoin(getJdbcClient(), options);
+ Id4JoinQuery join = createIdJoin(getJdbcClient(), options);
LoadSqlContext loadContext = new LoadSqlContext(session, options, branch);
int fetchSize = LoadUtil.computeFetchSize(artifactIds.size());
getLoader().loadArtifacts(cancellation, handler, join, criteria, loadContext, fetchSize);
}
}
- private ArtifactJoinQuery createIdJoin(JdbcClient jdbcClient, Options options) throws OseeCoreException {
+ private Id4JoinQuery createIdJoin(JdbcClient jdbcClient, Options options) throws OseeCoreException {
- ArtifactJoinQuery toReturn = joinFactory.createArtifactJoinQuery();
+ Id4JoinQuery toReturn = joinFactory.createId4JoinQuery();
CharJoinQuery guidJoin = joinFactory.createCharJoinQuery();
try {
@@ -75,7 +76,7 @@ public class UuidsLoadExecutor extends AbstractLoadExecutor {
getJdbcClient().runQuery(stmt -> {
Integer artId = stmt.getInt("art_id");
- toReturn.add(artId, BranchId.valueOf(branch.getId()), transactionId);
+ toReturn.add(branch, ArtifactId.valueOf(artId), transactionId);
}, artifactIds.size(), GUIDS_TO_IDS, guidJoin.getQueryId());
} finally {
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/ArtifactSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/ArtifactSqlHandler.java
index 93222f8a85..1a7ba7e70b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/ArtifactSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/ArtifactSqlHandler.java
@@ -43,7 +43,7 @@ public class ArtifactSqlHandler extends SqlHandler<CriteriaArtifact> {
@Override
public void addTables(AbstractSqlWriter writer) {
- jArtAlias = writer.addTable(TableEnum.ARTIFACT_JOIN_TABLE);
+ jArtAlias = writer.addTable(TableEnum.JOIN_ID4_TABLE);
artAlias = writer.addTable(TableEnum.ARTIFACT_TABLE);
txsAlias = writer.addTable(TableEnum.TXS_TABLE);
}
@@ -53,7 +53,7 @@ public class ArtifactSqlHandler extends SqlHandler<CriteriaArtifact> {
writer.write(artAlias);
writer.write(".art_id = ");
writer.write(jArtAlias);
- writer.write(".art_id AND ");
+ writer.write(".id2 AND ");
writer.write(jArtAlias);
writer.write(".query_id = ?");
writer.addParameter(criteria.getQueryId());
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java
index 13c23e9267..2b67ed472c 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java
@@ -51,7 +51,7 @@ public class AttributeSqlHandler extends SqlHandler<CriteriaAttribute> {
@Override
public void addTables(AbstractSqlWriter writer) throws OseeCoreException {
- jArtAlias = writer.addTable(TableEnum.ARTIFACT_JOIN_TABLE);
+ jArtAlias = writer.addTable(TableEnum.JOIN_ID4_TABLE);
if (criteria.getIds().size() > 1) {
jIdAlias = writer.addTable(TableEnum.ID_JOIN_TABLE);
@@ -70,7 +70,7 @@ public class AttributeSqlHandler extends SqlHandler<CriteriaAttribute> {
writer.write(attrAlias);
writer.write(".art_id = ");
writer.write(jArtAlias);
- writer.write(".art_id AND ");
+ writer.write(".id2 AND ");
writer.write(jArtAlias);
writer.write(".query_id = ?");
writer.addParameter(criteria.getQueryId());
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/RelationSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/RelationSqlHandler.java
index 32f461bd08..6cbd74a4c1 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/RelationSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/RelationSqlHandler.java
@@ -53,7 +53,7 @@ public class RelationSqlHandler extends SqlHandler<CriteriaRelation> {
@Override
public void addTables(AbstractSqlWriter writer) throws OseeCoreException {
- jArtAlias = writer.addTable(TableEnum.ARTIFACT_JOIN_TABLE);
+ jArtAlias = writer.addTable(TableEnum.JOIN_ID4_TABLE);
if (criteria.getIds().size() > 1) {
jIdAlias = writer.addTable(TableEnum.ID_JOIN_TABLE);
@@ -78,7 +78,7 @@ public class RelationSqlHandler extends SqlHandler<CriteriaRelation> {
@Override
public boolean addPredicates(AbstractSqlWriter writer) throws OseeCoreException {
- writer.write("(%s.a_art_id = %s.art_id OR %s.b_art_id = %s.art_id)", relationAlias, jArtAlias, relationAlias,
+ writer.write("(%s.a_art_id = %s.id2 OR %s.b_art_id = %s.id2)", relationAlias, jArtAlias, relationAlias,
jArtAlias);
writer.write(" AND ");
writer.write(jArtAlias);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/ArtifactLoadProcessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/ArtifactLoadProcessor.java
index b532832cff..506692ea94 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/ArtifactLoadProcessor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/ArtifactLoadProcessor.java
@@ -35,7 +35,7 @@ public class ArtifactLoadProcessor extends LoadProcessor<ArtifactData, ArtifactO
protected ArtifactData createData(Object conditions, ArtifactObjectFactory factory, JdbcStatement chStmt, Options options) throws OseeCoreException {
ArtifactData toReturn = null;
- int artifactId = chStmt.getInt("art_id");
+ int artifactId = chStmt.getInt("id2");
BranchId branch = BranchId.valueOf(chStmt.getLong("branch_id"));
CreateConditions onCreate = asConditions(conditions);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/AttributeLoadProcessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/AttributeLoadProcessor.java
index 5853ce398f..1c73daf206 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/AttributeLoadProcessor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/processor/AttributeLoadProcessor.java
@@ -45,7 +45,7 @@ public class AttributeLoadProcessor extends LoadProcessor<AttributeData, Attribu
AttributeData toReturn = null;
BranchId branch = BranchId.valueOf(chStmt.getLong("branch_id"));
- int artId = chStmt.getInt("art_id");
+ int artId = chStmt.getInt("id2");
int attrId = chStmt.getInt("attr_id");
long gammaId = chStmt.getInt("gamma_id");
ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type"));
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/migration/V0.25.0_2016_12_20_1436__Osee_ID4Join_Schema.sql b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/migration/V0.25.0_2016_12_20_1436__Osee_ID4Join_Schema.sql
new file mode 100644
index 0000000000..4fe6179ac4
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/resource/migration/V0.25.0_2016_12_20_1436__Osee_ID4Join_Schema.sql
@@ -0,0 +1,11 @@
+-- 4 Element Join
+CREATE TABLE OSEE_JOIN_ID4 (
+ QUERY_ID int NOT NULL,
+ ID1 ${db.bigint} NOT NULL,
+ ID2 ${db.bigint} NOT NULL,
+ ID3 ${db.bigint} NOT NULL,
+ ID4 ${db.bigint} NOT NULL,
+ CONSTRAINT OSEE_JOIN_ID4__T_ID1_ID2_ID3_ID4_PK PRIMARY KEY (QUERY_ID, ID1, ID2, ID3, ID4))
+ ${db.organization_index};
+
+CREATE INDEX OSEE_JOIN_ID4__G_IDX ON OSEE_JOIN_ID4 (QUERY_ID); \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/TableEnum.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/TableEnum.java
index 55cbc24c29..0204ccf479 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/TableEnum.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/TableEnum.java
@@ -23,7 +23,7 @@ public enum TableEnum implements AliasEntry {
CHAR_JOIN_TABLE("osee_join_char_id", "jch"),
ID_JOIN_TABLE("osee_join_id", "jid"),
SEARCH_TAGS_TABLE("osee_search_tags", "tag"),
- ARTIFACT_JOIN_TABLE("osee_join_artifact", "jart"),
+ JOIN_ID4_TABLE("osee_join_id4", "jart"),
MERGE_TABLE("osee_merge", "mbr");
private final String tableName;
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/DatabaseJoinAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/DatabaseJoinAccessor.java
index 664c670593..539ad4d6c0 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/DatabaseJoinAccessor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/DatabaseJoinAccessor.java
@@ -25,8 +25,8 @@ public class DatabaseJoinAccessor implements IJoinAccessor {
private static final String SELECT_QUERY_IDS = "select DISTINCT query_id from %s";
- private static final String INSERT_INTO_JOIN_ARTIFACT =
- "INSERT INTO osee_join_artifact (query_id, art_id, branch_id, transaction_id) VALUES (?, ?, ?, ?)";
+ private static final String INSERT_INTO_JOIN_ID4 =
+ "INSERT INTO osee_join_id4 (query_id, id1, id2, id3, id4) VALUES (?, ?, ?, ?, ?)";
private static final String INSERT_INTO_JOIN_TRANSACTION =
"INSERT INTO osee_join_transaction (query_id, gamma_id, transaction_id, branch_id) VALUES (?, ?, ?, ?)";
@@ -43,10 +43,10 @@ public class DatabaseJoinAccessor implements IJoinAccessor {
private static final String DELETE_FROM_JOIN_ID = "DELETE FROM osee_join_id WHERE query_id = ?";
private static final String DELETE_FROM_JOIN_TRANSACTION = "DELETE FROM osee_join_transaction WHERE query_id = ?";
- private static final String DELETE_FROM_JOIN_ARTIFACT = "DELETE FROM osee_join_artifact WHERE query_id = ?";
private static final String DELETE_FROM_TAG_GAMMA_QUEUE = "DELETE FROM osee_tag_gamma_queue WHERE query_id = ?";
private static final String DELETE_FROM_JOIN_EXPORT_IMPORT = "DELETE FROM osee_join_export_import WHERE query_id =?";
private static final String DELETE_FROM_JOIN_CHAR_ID = "DELETE FROM osee_join_char_id WHERE query_id =?";
+ private static final String DELETE_FROM_JOIN_ID4 = "DELETE FROM osee_join_id4 WHERE query_id = ?";
private static final String INSERT_INTO_JOIN_CLEANUP =
"INSERT INTO osee_join_cleanup (query_id, table_name, issued_at, expires_in) VALUES (?,?,?,?)";
@@ -55,7 +55,7 @@ public class DatabaseJoinAccessor implements IJoinAccessor {
public enum JoinItem {
TRANSACTION("osee_join_transaction", INSERT_INTO_JOIN_TRANSACTION, DELETE_FROM_JOIN_TRANSACTION),
- ARTIFACT("osee_join_artifact", INSERT_INTO_JOIN_ARTIFACT, DELETE_FROM_JOIN_ARTIFACT),
+ ID4("osee_join_id4", INSERT_INTO_JOIN_ID4, DELETE_FROM_JOIN_ID4),
TAG_GAMMA_QUEUE("osee_tag_gamma_queue", INSERT_INTO_TAG_GAMMA_QUEUE, DELETE_FROM_TAG_GAMMA_QUEUE),
EXPORT_IMPORT("osee_join_export_import", INSERT_INTO_JOIN_EXPORT_IMPORT, DELETE_FROM_JOIN_EXPORT_IMPORT),
ID("osee_join_id", INSERT_INTO_JOIN_ID, DELETE_FROM_JOIN_ID),
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/ArtifactJoinQuery.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/Id4JoinQuery.java
index 2d30936842..665b73f6fc 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/ArtifactJoinQuery.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/Id4JoinQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
+ * Copyright (c) 2017 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
@@ -10,42 +10,40 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.sql.join;
-import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.jdbc.SQL3DataType;
+import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.orcs.db.internal.sql.join.DatabaseJoinAccessor.JoinItem;
/**
- * @author Roberto E. Escobar
+ * @author Morgan E. Cook
*/
-public class ArtifactJoinQuery extends AbstractJoinQuery {
+public class Id4JoinQuery extends AbstractJoinQuery {
private final int maxJoinSize;
private final class Entry implements IJoinRow {
- private final Integer artId;
- private final Long branchUuid;
- private final TransactionId transactionId;
+ private final Id id_1;
+ private final Id id_2;
+ private final Id id_3;
+ private final Id id_4;
- private Entry(Integer artId, BranchId branchUuid, TransactionId transactionId) {
- this.artId = artId;
- this.branchUuid = branchUuid.getId();
- this.transactionId = transactionId;
+ private Entry(Id id_1, Id id_2, Id id_3, Id id_4) {
+ this.id_1 = id_1;
+ this.id_2 = id_2;
+ this.id_3 = id_3;
+ this.id_4 = id_4;
}
@Override
public Object[] toArray() {
- return new Object[] {
- getQueryId(),
- artId,
- branchUuid,
- transactionId != null ? transactionId : SQL3DataType.INTEGER};
+ return new Object[] {getQueryId(), id_1, id_2, id_3, id_4};
}
@Override
public String toString() {
- return String.format("art_id=%s, branch_id=%s, transaction_id=%s", artId, branchUuid, transactionId);
+ return String.format("id_1=%s, id_2=%s, id_3=%s, id_4=%s", id_1, id_2, id_3, id_4);
}
@Override
@@ -63,25 +61,28 @@ public class ArtifactJoinQuery extends AbstractJoinQuery {
if (!getOuterType().equals(other.getOuterType())) {
return false;
}
- if (artId == null) {
- if (other.artId != null) {
+ if (id_1 == null) {
+ if (other.id_1 != null) {
return false;
}
- } else if (!artId.equals(other.artId)) {
+ } else if (!id_1.equals(other.id_1)) {
return false;
}
- if (branchUuid == null) {
- if (other.branchUuid != null) {
+ if (id_2 == null) {
+ if (other.id_2 != null) {
return false;
}
- } else if (!branchUuid.equals(other.branchUuid)) {
+ } else if (!id_2.equals(other.id_2)) {
return false;
}
- if (transactionId == null) {
- if (other.transactionId != null) {
+ if (id_3 == null) {
+ if (other.id_3 != null) {
return false;
}
- } else if (!transactionId.equals(other.transactionId)) {
+ } else if (!id_3.equals(other.id_3)) {
+ return false;
+ }
+ if (!id_4.equals(other.id_4)) {
return false;
}
return true;
@@ -92,26 +93,36 @@ public class ArtifactJoinQuery extends AbstractJoinQuery {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
- result = prime * result + (artId == null ? 0 : artId.hashCode());
- result = prime * result + (branchUuid == null ? 0 : branchUuid.hashCode());
- result = prime * result + (transactionId == null ? 0 : transactionId.hashCode());
+ result = prime * result + (id_1 == null ? 0 : id_1.hashCode());
+ result = prime * result + (id_2 == null ? 0 : id_2.hashCode());
+ result = prime * result + (id_3 == null ? 0 : id_3.hashCode());
+ result = prime * result + (id_4 == null ? 0 : id_4.hashCode());
return result;
}
- private ArtifactJoinQuery getOuterType() {
- return ArtifactJoinQuery.this;
+ private Id4JoinQuery getOuterType() {
+ return Id4JoinQuery.this;
}
}
- public ArtifactJoinQuery(IJoinAccessor joinAccessor, Long expiresIn, int queryId, int maxJoinSize) {
- super(joinAccessor, JoinItem.ARTIFACT, expiresIn, queryId);
+ public Id4JoinQuery(IJoinAccessor joinAccessor, Long expiresIn, int queryId, int maxJoinSize) {
+ super(joinAccessor, JoinItem.ID4, expiresIn, queryId);
this.maxJoinSize = maxJoinSize;
}
- public void add(Integer art_id, BranchId branchUuid, TransactionId transactionId) {
- entries.add(new Entry(art_id, branchUuid, transactionId));
+ public void add(Id id_1, Id id_2, Id id_3, Id id_4) {
+ entries.add(new Entry(id_1, id_2, id_3, id_4));
if (entries.size() > maxJoinSize) {
throw new OseeDataStoreException("Exceeded max artifact join size of [%d]", maxJoinSize);
}
}
-} \ No newline at end of file
+
+ public void add(Id id_1, Id id_2, Id id_3) {
+ add(id_1, id_2, id_3, ArtifactId.SENTINEL);
+
+ }
+
+ public void add(Id id_1, Id id_2) {
+ add(id_1, id_2, TransactionId.SENTINEL, ArtifactId.SENTINEL);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/SqlJoinFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/SqlJoinFactory.java
index 90949f5e96..6d0e5cd328 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/SqlJoinFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/SqlJoinFactory.java
@@ -105,13 +105,13 @@ public class SqlJoinFactory {
return new IdJoinQuery(getAccessor(), actualExpiration, getNewQueryId());
}
- public ArtifactJoinQuery createArtifactJoinQuery() {
- return createArtifactJoinQuery(null);
+ public Id4JoinQuery createId4JoinQuery() {
+ return createId4JoinQuery(null);
}
- public ArtifactJoinQuery createArtifactJoinQuery(Long expiresIn) {
- Long actualExpiration = getExpiresIn(expiresIn, EXPIRATION_SECS__ARTIFACT_JOIN_QUERY);
- return new ArtifactJoinQuery(getAccessor(), actualExpiration, getNewQueryId(), getMaxArtifactJoinSize());
+ public Id4JoinQuery createId4JoinQuery(Long expiresIn) {
+ Long actualExpiration = getExpiresIn(expiresIn, EXPIRATION_SECS__ID_JOIN_QUERY);
+ return new Id4JoinQuery(getAccessor(), actualExpiration, getNewQueryId(), getMaxArtifactJoinSize());
}
public TagQueueJoinQuery createTagQueueJoinQuery() {

Back to the top