diff options
author | Ryan D. Brooks | 2011-08-30 19:52:39 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2011-08-30 19:52:39 +0000 |
commit | 44834d49f03702c2bb8c965f806c3db484c55a32 (patch) | |
tree | 53991b4848b64ed207fa0aa486919c8c24627932 /plugins/org.eclipse.osee.framework.search.engine | |
parent | aa90fd82608ec282917e26bc885631d4ce1f02de (diff) | |
download | org.eclipse.osee-44834d49f03702c2bb8c965f806c3db484c55a32.tar.gz org.eclipse.osee-44834d49f03702c2bb8c965f806c3db484c55a32.tar.xz org.eclipse.osee-44834d49f03702c2bb8c965f806c3db484c55a32.zip |
refactor: Remove redundant tag by branch logic
Diffstat (limited to 'plugins/org.eclipse.osee.framework.search.engine')
4 files changed, 1 insertions, 122 deletions
diff --git a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/ISearchEngineTagger.java b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/ISearchEngineTagger.java index c07cd23c931..567fb72ccd4 100644 --- a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/ISearchEngineTagger.java +++ b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/ISearchEngineTagger.java @@ -12,7 +12,6 @@ package org.eclipse.osee.framework.search.engine; import java.io.InputStream; import java.util.concurrent.FutureTask; -import org.eclipse.osee.framework.core.exception.OseeCoreException; /** * @author Roberto E. Escobar @@ -20,21 +19,6 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; public interface ISearchEngineTagger { /** - * Create tags for a particular branch. - * - * @param branchId of branch to tag - */ - public void tagByBranchId(int branchId) throws OseeCoreException; - - /** - * Create tags for a particular branch. Notifies listener of tagging events. - * - * @param listener object listening for tag events - * @param branchId of branch to tag - */ - public void tagByBranchId(ITagListener listener, int queryId) throws OseeCoreException; - - /** * Create tags for queue query id. * * @param queryId queryId to tag diff --git a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/attribute/AttributeDataStore.java b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/attribute/AttributeDataStore.java index 1b057e2dd3e..500e7631a99 100644 --- a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/attribute/AttributeDataStore.java +++ b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/attribute/AttributeDataStore.java @@ -34,16 +34,6 @@ public final class AttributeDataStore { private static final String LOAD_ATTRIBUTE = "SELECT attr1.gamma_id, attr1.VALUE, attr1.uri, attr1.attr_type_id FROM osee_attribute attr1, osee_tag_gamma_queue tgq1 WHERE attr1.gamma_id = tgq1.gamma_id AND tgq1.query_id = ?"; - private static final String GET_TAGGABLE_SQL_BODY = - " FROM osee_attribute attr1, osee_attribute_type type1, osee_txs txs1 WHERE txs1.gamma_id = attr1.gamma_id AND attr1.attr_type_id = type1.attr_type_id AND type1.tagger_id IS NOT NULL"; - - private static final String FIND_ALL_TAGGABLE_ATTRIBUTES = - "SELECT DISTINCT attr1.gamma_id, type1.tagger_id" + GET_TAGGABLE_SQL_BODY; - private static final String COUNT_TAGGABLE_ATTRIBUTES = - "SELECT count(DISTINCT attr1.gamma_id)" + GET_TAGGABLE_SQL_BODY; - - private static final String RESTRICT_BY_BRANCH = " AND txs1.branch_id = ?"; - private static final SearchTagQueryBuilder searchTagQueryBuilder = new SearchTagQueryBuilder(); private AttributeDataStore() { @@ -113,21 +103,4 @@ public final class AttributeDataStore { } return toReturn; } - - public static String getAllTaggableGammasByBranchQuery(final int branchId) { - return getBranchTaggingQueries(branchId, false); - } - - public static Object[] getAllTaggableGammasByBranchQueryData(final int branchId) { - return branchId > -1 ? new Object[] {branchId} : new Object[0]; - } - - private static String getBranchTaggingQueries(final int branchId, final boolean isCountQuery) { - StringBuilder builder = new StringBuilder(); - builder.append(isCountQuery ? COUNT_TAGGABLE_ATTRIBUTES : FIND_ALL_TAGGABLE_ATTRIBUTES); - if (branchId > -1) { - builder.append(RESTRICT_BY_BRANCH); - } - return builder.toString(); - } -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/tagger/BranchTaggerRunnable.java b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/tagger/BranchTaggerRunnable.java deleted file mode 100644 index 90b0840b1c8..00000000000 --- a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/tagger/BranchTaggerRunnable.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.search.engine.internal.tagger; - -import java.util.logging.Level; -import org.eclipse.osee.framework.core.exception.OseeDataStoreException; -import org.eclipse.osee.framework.database.core.ConnectionHandler; -import org.eclipse.osee.framework.database.core.IOseeStatement; -import org.eclipse.osee.framework.database.core.OseeConnection; -import org.eclipse.osee.framework.jdk.core.util.Strings; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.search.engine.ISearchEngineTagger; -import org.eclipse.osee.framework.search.engine.ITagListener; -import org.eclipse.osee.framework.search.engine.attribute.AttributeDataStore; - -/** - * @author Roberto E. Escobar - */ -public class BranchTaggerRunnable implements Runnable { - - private final int branchId; - private final BranchToQueryTx branchToQueryTx; - - BranchTaggerRunnable(ISearchEngineTagger tagger, ITagListener listener, int branchId, boolean isCacheAll, int cacheLimit) { - this.branchToQueryTx = new BranchToQueryTx(tagger, listener, isCacheAll, cacheLimit); - this.branchId = branchId; - } - - @Override - public void run() { - try { - branchToQueryTx.execute(); - } catch (Exception ex) { - OseeLog.log(BranchTaggerRunnable.class, Level.SEVERE, ex); - } - } - - private final class BranchToQueryTx extends InputToTagQueueTx { - public BranchToQueryTx(ISearchEngineTagger tagger, ITagListener listener, boolean isCacheAll, int cacheLimit) { - super(tagger, listener, isCacheAll, cacheLimit); - } - - @Override - protected void convertInput(OseeConnection connection) throws OseeDataStoreException, Exception { - IOseeStatement chStmt = ConnectionHandler.getStatement(connection); - try { - String sql = AttributeDataStore.getAllTaggableGammasByBranchQuery(branchId); - chStmt.runPreparedQuery(sql, AttributeDataStore.getAllTaggableGammasByBranchQueryData(branchId)); - while (chStmt.next()) { - String taggerId = chStmt.getString("tagger_id"); - if (Strings.isValid(taggerId)) { - addEntry(connection, chStmt.getLong("gamma_id")); - } - } - } finally { - chStmt.close(); - } - } - } -} diff --git a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/tagger/SearchEngineTagger.java b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/tagger/SearchEngineTagger.java index e90207969a8..b8b854f78d4 100644 --- a/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/tagger/SearchEngineTagger.java +++ b/plugins/org.eclipse.osee.framework.search.engine/src/org/eclipse/osee/framework/search/engine/internal/tagger/SearchEngineTagger.java @@ -74,16 +74,6 @@ public final class SearchEngineTagger implements ISearchEngineTagger { } @Override - public void tagByBranchId(ITagListener listener, int branchId) { - this.executor.submit(new BranchTaggerRunnable(this, listener, branchId, false, CACHE_LIMIT)); - } - - @Override - public void tagByBranchId(int branchId) { - tagByBranchId(null, branchId); - } - - @Override public void tagFromXmlStream(ITagListener listener, InputStream inputStream) throws Exception { InputStreamTagProcessor inputStreamTagProcessor = new InputStreamTagProcessor(this, listener, inputStream, false, CACHE_LIMIT); |