Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Szijjarto2013-12-20 22:25:56 +0000
committerRoberto E. Escobar2014-03-04 19:42:06 +0000
commitd46d055cd55481074e85bfab6602364262f703d1 (patch)
treecf4aa35c8c934d87a48643fc7dac69b97924fb2c /plugins
parent5b0bda2a16f71edb332c6fed903475d2f001259a (diff)
downloadorg.eclipse.osee-d46d055cd55481074e85bfab6602364262f703d1.tar.gz
org.eclipse.osee-d46d055cd55481074e85bfab6602364262f703d1.tar.xz
org.eclipse.osee-d46d055cd55481074e85bfab6602364262f703d1.zip
feature[ats_AZTD3]: Update legacy search to use server searching
Change-Id: Ic1492449d8bf00856e981ca06261ea5fe6f2b052 Signed-off-by: John Szijjarto <john.j.szijjarto@boeing.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactPersistenceManager.java91
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java46
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeValueSearch.java85
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/FromArtifactsSearch.java106
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ISearchPrimitive.java29
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java52
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotInRelationSearch.java62
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotSearch.java53
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/OrphanArtifactSearch.java82
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java42
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java10
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java12
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java28
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java20
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/NotInRelationFilter.java61
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/OrphanSearchFilter.java68
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java41
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/filter/FilterModelLabelProvider.java6
19 files changed, 204 insertions, 691 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactPersistenceManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactPersistenceManager.java
index d32a1a6d82a..f351c04b654 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactPersistenceManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactPersistenceManager.java
@@ -10,26 +10,18 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact;
-import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED;
-import static org.eclipse.osee.framework.skynet.core.artifact.LoadType.INCLUDE_CACHE;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
-import org.eclipse.osee.framework.core.enums.LoadLevel;
-import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
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.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
@@ -39,95 +31,12 @@ import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
* @author Robert A. Fisher
*/
public class ArtifactPersistenceManager {
- private static final String ARTIFACT_SELECT =
- "SELECT art1.art_id, txs1.branch_id FROM osee_artifact art1, osee_txs txs1 WHERE art1.gamma_id = txs1.gamma_id AND txs1.tx_current = " + TxChange.CURRENT.getValue() + " AND txs1.branch_id = ? AND ";
-
- private static final String ARTIFACT_ID_SELECT = "SELECT art1.art_id FROM osee_artifact art1 WHERE ";
-
private static final String ARTIFACT_NEW_ON_BRANCH =
"SELECT count(1) FROM osee_artifact art, osee_txs txs WHERE art.art_id = ? and art.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.transaction_id = ?";
private static final String RELATION_NEW_ON_BRANCH =
"SELECT count(1) FROM osee_relation_link rel, osee_txs txs WHERE rel.a_art_id = ? and rel.b_art_id = ? and rel.rel_link_type_id = ? and rel.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.transaction_id = ?";
- public static CharSequence getSelectArtIdSql(ISearchPrimitive searchCriteria, List<Object> dataList, IOseeBranch branch) throws OseeCoreException {
- return getSelectArtIdSql(searchCriteria, dataList, null, branch);
- }
-
- private static CharSequence getSelectArtIdSql(ISearchPrimitive searchCriteria, List<Object> dataList, String alias, IOseeBranch branch) throws OseeCoreException {
- StringBuilder sql = new StringBuilder();
-
- sql.append("SELECT ");
- sql.append(searchCriteria.getArtIdColName());
-
- if (alias != null) {
- sql.append(" AS " + alias);
- }
-
- sql.append(" FROM ");
- sql.append(searchCriteria.getTableSql(dataList, branch));
-
- String criteriaSql = searchCriteria.getCriteriaSql(dataList, branch);
- if (criteriaSql.trim().length() != 0) {
- sql.append(" WHERE (");
- sql.append(criteriaSql);
- sql.append(")");
- }
-
- return sql;
- }
-
- public static String getIdSql(List<ISearchPrimitive> searchCriteria, boolean all, List<Object> dataList, IOseeBranch branch) throws OseeCoreException {
- return getSql(searchCriteria, all, ARTIFACT_ID_SELECT, dataList, branch);
- }
-
- private static String getSql(List<ISearchPrimitive> searchCriteria, boolean all, String header, List<Object> dataList, IOseeBranch branch) throws OseeCoreException {
- StringBuilder sql = new StringBuilder(header);
-
- if (all) {
- ISearchPrimitive primitive = null;
- Iterator<ISearchPrimitive> iter = searchCriteria.iterator();
-
- while (iter.hasNext()) {
- primitive = iter.next();
- sql.append("art1.art_id in (");
- sql.append(getSelectArtIdSql(primitive, dataList, branch));
-
- if (iter.hasNext()) {
- sql.append(") AND ");
- }
- }
- sql.append(")");
- } else {
- ISearchPrimitive primitive = null;
- Iterator<ISearchPrimitive> iter = searchCriteria.iterator();
-
- sql.append("art1.art_id IN(SELECT art_id FROM osee_artifact art1, (");
-
- while (iter.hasNext()) {
- primitive = iter.next();
- sql.append(getSelectArtIdSql(primitive, dataList, "desired_art_id", branch));
- if (iter.hasNext()) {
- sql.append(" UNION ALL ");
- }
- }
- sql.append(") ORD_ARTS");
- sql.append(" WHERE art_id = ORD_ARTS.desired_art_id");
-
- sql.append(")");
- }
-
- return sql.toString();
- }
-
- @Deprecated
- public static Collection<Artifact> getArtifacts(List<ISearchPrimitive> searchCriteria, boolean all, IOseeBranch branch, ISearchConfirmer confirmer) throws OseeCoreException {
- LinkedList<Object> queryParameters = new LinkedList<Object>();
- queryParameters.add(BranchManager.getBranchId(branch));
- return ArtifactLoader.getArtifacts(getSql(searchCriteria, all, ARTIFACT_SELECT, queryParameters, branch),
- queryParameters.toArray(), 100, LoadLevel.ALL, INCLUDE_CACHE, confirmer, null, EXCLUDE_DELETED);
- }
-
/**
* @param transaction if the transaction is null then persist is not called
* @param overrideDeleteCheck if <b>true</b> deletes without checking preconditions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java
index c2b7375d5c2..a373aa5bf2b 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java
@@ -10,42 +10,18 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact.search;
-import java.util.List;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.jdk.core.type.BaseIdentity;
-import org.eclipse.osee.framework.jdk.core.type.Identity;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.TokenFactory;
/**
* @author Robert A. Fisher
*/
public class ArtifactTypeSearch implements ISearchPrimitive {
- private final Identity<Long> artifactType;
- private final DeprecatedOperator operation;
- private static final String tables = "osee_artifact";
- private final static String TOKEN = ";";
+ private final IArtifactType artifactType;
- public ArtifactTypeSearch(Identity<Long> type, DeprecatedOperator operation) {
+ public ArtifactTypeSearch(IArtifactType type) {
super();
this.artifactType = type;
- this.operation = operation;
- }
-
- @Override
- public String getArtIdColName() {
- return "art_id";
- }
-
- @Override
- public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException {
- String sql = "osee_artifact.art_type_id = ?";
- dataList.add(artifactType.getGuid());
- return sql;
- }
-
- @Override
- public String getTableSql(List<Object> dataList, IOseeBranch branch) {
- return tables;
}
@Override
@@ -55,17 +31,17 @@ public class ArtifactTypeSearch implements ISearchPrimitive {
@Override
public String getStorageString() {
- return artifactType.getGuid().toString() + TOKEN + operation.name();
+ return artifactType.getGuid().toString();
}
public static ArtifactTypeSearch getPrimitive(String storageString) {
- String[] values = storageString.split(TOKEN);
- if (values.length != 2) {
- throw new IllegalStateException("Value for " + ArtifactTypeSearch.class.getSimpleName() + " not parsable");
- }
+ IArtifactType type = TokenFactory.createArtifactType(Long.parseLong(storageString), "SearchArtType");
+ return new ArtifactTypeSearch(type);
+ }
- Identity<Long> identity = new BaseIdentity<Long>(Long.valueOf(values[0]));
- return new ArtifactTypeSearch(identity, DeprecatedOperator.valueOf(values[1]));
+ @Override
+ public void addToQuery(QueryBuilderArtifact builder) {
+ builder.andIsOfType(artifactType);
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeValueSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeValueSearch.java
index 8777fbaaa5c..e58d8ba4d06 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeValueSearch.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeValueSearch.java
@@ -10,93 +10,48 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact.search;
-import static org.eclipse.osee.framework.skynet.core.artifact.search.DeprecatedOperator.IS;
-import java.util.List;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.jdk.core.type.BaseIdentity;
-import org.eclipse.osee.framework.jdk.core.type.Identity;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.TokenFactory;
+import org.eclipse.osee.framework.jdk.core.util.Conditions;
/**
* @author Robert A. Fisher
*/
public class AttributeValueSearch implements ISearchPrimitive {
- private final Identity<Long> attributeType;
- private String attributeValue;
- private DeprecatedOperator operator;
- private static final String tables = "osee_attribute attr_1, osee_txs txs";
+ private final IAttributeType attributeType;
+ private final String attributeValue;
private final static String TOKEN = ";";
- public AttributeValueSearch(Identity<Long> attributeType, String attributeValue, DeprecatedOperator operator) {
-
- if (attributeValue == null && operator != null) {
- throw new IllegalArgumentException("An attributeValue must be supplied if an operator is supplied");
- }
- if (attributeValue != null && operator == null) {
- throw new IllegalArgumentException("An operator must be supplied if an attributeValue is supplied");
- }
-
+ public AttributeValueSearch(IAttributeType attributeType, String attributeValue) {
+ Conditions.checkNotNull(attributeType, "attributeType");
+ Conditions.checkNotNullOrEmpty(attributeValue, "attributeValue");
+ this.attributeValue = attributeValue;
this.attributeType = attributeType;
-
- if (attributeValue != null && attributeValue.length() == 0) {
- this.attributeValue = null;
- this.operator = IS;
- } else {
- this.attributeValue = attributeValue;
- this.operator = operator;
- }
- }
-
- @Override
- public String getArtIdColName() {
- return "art_id";
- }
-
- @Override
- public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException {
- StringBuilder sql = new StringBuilder();
-
- sql.append(" attr_1.attr_type_id = ? AND attr_1.gamma_id = txs.gamma_id AND txs.tx_current = 1 and txs.branch_id = ?");
-
- dataList.add(attributeType.getGuid());
- dataList.add(BranchManager.getBranchId(branch));
-
- if (attributeValue != null) {
- sql.append(" AND attr_1.value ");
- sql.append(operator);
- sql.append(" ?");
- if (operator == DeprecatedOperator.CONTAINS) {
- dataList.add("%" + attributeValue + "%");
- } else {
- dataList.add(attributeValue);
- }
- }
- return sql.toString();
- }
-
- @Override
- public String getTableSql(List<Object> dataList, IOseeBranch branch) {
- return tables;
}
@Override
public String toString() {
- return "Attribute value: " + attributeType + operator + "\"" + attributeValue + "\"";
+ return "Attribute value: " + attributeType + " \"" + attributeValue + "\"";
}
@Override
public String getStorageString() {
- return attributeType.getGuid().toString() + TOKEN + (attributeValue == null ? "" : attributeValue) + TOKEN + (operator == null ? "" : operator.name());
+ return attributeType.getGuid().toString() + TOKEN + attributeValue;
}
public static AttributeValueSearch getPrimitive(String storageString) {
String[] values = storageString.split(TOKEN);
- if (values.length != 3) {
+ if (values.length != 2) {
throw new IllegalStateException("Value for " + AttributeValueSearch.class.getSimpleName() + " not parsable");
}
- Identity<Long> identity = new BaseIdentity<Long>(Long.valueOf(values[0]));
- return new AttributeValueSearch(identity, values[1], DeprecatedOperator.valueOf(values[2]));
+ IAttributeType type = TokenFactory.createAttributeType(Long.valueOf(values[0]), "SearchAttrType");
+ return new AttributeValueSearch(type, values[1]);
}
+
+ @Override
+ public void addToQuery(QueryBuilderArtifact builder) {
+ builder.and(attributeType, attributeValue, QueryOptions.CONTAINS_MATCH_OPTIONS);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/FromArtifactsSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/FromArtifactsSearch.java
deleted file mode 100644
index c14d0719a7c..00000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/FromArtifactsSearch.java
+++ /dev/null
@@ -1,106 +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.skynet.core.artifact.search;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Robert A. Fisher
- */
-public class FromArtifactsSearch implements ISearchPrimitive {
- private static final String FROM_ARTIFACT_ELEMENT = "FromArtifact";
-
- private final List<ISearchPrimitive> criteria;
- private final boolean all;
-
- @Override
- public String getArtIdColName() {
- return "art_id";
- }
-
- public FromArtifactsSearch(List<ISearchPrimitive> criteria, boolean all) {
- this.criteria = criteria;
- this.all = all;
- }
-
- public FromArtifactsSearch(ISearchPrimitive primitive) {
- this.criteria = new ArrayList<ISearchPrimitive>(1);
- this.criteria.add(primitive);
- // all doesn't matter for just one primitive, so assume true
- this.all = true;
- }
-
- @Override
- public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException {
- return "art_id in (" + ArtifactPersistenceManager.getIdSql(criteria, all, dataList, branch) + ")";
- }
-
- @Override
- public String getTableSql(List<Object> dataList, IOseeBranch branch) {
- return "osee_artifact";
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
-
- sb.append("(");
-
- for (ISearchPrimitive primitive : criteria) {
- sb.append(primitive);
- }
-
- sb.append(")");
-
- return sb.toString();
- }
-
- @Override
- public String getStorageString() {
- try {
- Document document = Jaxp.newDocumentNamespaceAware();
-
- Element root = document.createElement("FromArtifactAttribute");
- root.appendChild(getStorageElements(document));
-
- return Jaxp.getDocumentXml(document);
- } catch (Exception ex) {
- throw new IllegalStateException(ex);
- }
- }
-
- private Element getStorageElements(Document document) {
- Element rootElement = document.createElement(FROM_ARTIFACT_ELEMENT);
- rootElement.setAttribute("all", Boolean.toString(all));
- document.appendChild(rootElement);
-
- Element child;
- for (ISearchPrimitive primitive : criteria) {
- if (primitive instanceof FromArtifactsSearch) {
- child = ((FromArtifactsSearch) primitive).getStorageElements(document);
- } else {
- child = document.createElement("Simple");
- child.setAttribute("class", primitive.getClass().getCanonicalName());
- child.setAttribute("value", primitive.getStorageString());
- }
- rootElement.appendChild(child);
- }
-
- return rootElement;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ISearchPrimitive.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ISearchPrimitive.java
index abebab86d3f..fab892234cc 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ISearchPrimitive.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ISearchPrimitive.java
@@ -10,39 +10,16 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact.search;
-import java.util.List;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
public interface ISearchPrimitive {
/**
- * The sql operators that will provide a set of art_id's for the given search.
- *
- * @return Return SQL string
- * @throws OseeCoreException TODO
- */
- public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException;
-
- /**
- * The name of the column to use as the art_id column.
- *
- * @return Return artifact column name string
- */
- public String getArtIdColName();
-
- /**
- * Returns a list of the tables, comma separated, that are necessary for the sql statement returned from getSql().
- *
- * @return tables string
- * @see ISearchPrimitive#getCriteriaSql(List, IOseeBranch)
- */
- public String getTableSql(List<Object> dataList, IOseeBranch branch);
-
- /**
* Returns a string which can be used to later re-acquire the primitive in full
*
* @return Return storage string
*/
public String getStorageString();
+
+ void addToQuery(QueryBuilderArtifact builder);
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java
index 41f140c3ad8..0aad5a781f2 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java
@@ -10,47 +10,25 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact.search;
-import java.util.List;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.jdk.core.type.BaseIdentity;
-import org.eclipse.osee.framework.jdk.core.type.Identity;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.core.data.IRelationType;
+import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.data.TokenFactory;
+import org.eclipse.osee.framework.core.enums.RelationSide;
/**
* @author Robert A. Fisher
*/
public class InRelationSearch implements ISearchPrimitive {
- private static final String relationTables = "osee_relation_link rel_1, osee_txs txs1";
private final static String TOKEN = ";";
- private final Identity<Long> relationType;
- private final boolean sideA;
+ private final IRelationType relationType;
+ private final Boolean sideA;
- public InRelationSearch(Identity<Long> relationType, boolean sideA) {
+ public InRelationSearch(IRelationType relationType, Boolean sideA) {
this.relationType = relationType;
this.sideA = sideA;
}
@Override
- public String getArtIdColName() {
- return sideA ? "a_art_id" : "b_art_id";
- }
-
- @Override
- public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException {
- dataList.add(relationType.getGuid());
- dataList.add(BranchManager.getBranchId(branch));
- dataList.add(ModificationType.DELETED.getValue());
- return "rel_1.rel_link_type_id = ? AND rel_1.gamma_id = txs1.gamma_id AND txs1.transaction_id = (SELECT max(txs1.transaction_id) FROM osee_relation_link rel2, osee_txs txs1 WHERE rel2.rel_link_id = rel_1.rel_link_id AND rel2.gamma_id = txs1.gamma_id AND txs1.branch_id = ? AND txs1.mod_type <>?)";
- }
-
- @Override
- public String getTableSql(List<Object> dataList, IOseeBranch branch) {
- return relationTables;
- }
-
- @Override
public String toString() {
return "In Relation: " + relationType + " from";
}
@@ -66,7 +44,19 @@ public class InRelationSearch implements ISearchPrimitive {
throw new IllegalStateException("Value for " + InRelationSearch.class.getSimpleName() + " not parsable");
}
- Identity<Long> identity = new BaseIdentity<Long>(Long.valueOf(values[1]));
- return new InRelationSearch(identity, Boolean.parseBoolean(values[0]));
+ IRelationType type = TokenFactory.createRelationType(Long.valueOf(values[1]), "SearchRelType");
+ return new InRelationSearch(type, Boolean.parseBoolean(values[0]));
}
+
+ @Override
+ public void addToQuery(QueryBuilderArtifact builder) {
+ if (sideA == null) {
+ builder.andExists(relationType);
+ } else {
+ RelationSide side = sideA.booleanValue() ? RelationSide.SIDE_A : RelationSide.SIDE_B;
+ IRelationTypeSide rts = TokenFactory.createRelationTypeSide(side, relationType.getGuid(), "SearchRelTypeSide");
+ builder.andExists(rts);
+ }
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotInRelationSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotInRelationSearch.java
new file mode 100644
index 00000000000..3adbce98948
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotInRelationSearch.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.skynet.core.artifact.search;
+
+import org.eclipse.osee.framework.core.data.IRelationType;
+import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.data.TokenFactory;
+import org.eclipse.osee.framework.core.enums.RelationSide;
+
+/**
+ * @author Robert A. Fisher
+ */
+public class NotInRelationSearch implements ISearchPrimitive {
+ private final static String TOKEN = ";";
+ private final IRelationType relationType;
+ private final Boolean sideA;
+
+ public NotInRelationSearch(IRelationType relationType, Boolean sideA) {
+ this.relationType = relationType;
+ this.sideA = sideA;
+ }
+
+ @Override
+ public String toString() {
+ return "Not In Relation: " + relationType + " from";
+ }
+
+ @Override
+ public String getStorageString() {
+ return sideA + TOKEN + relationType.getGuid().toString();
+ }
+
+ public static NotInRelationSearch getPrimitive(String storageString) {
+ String[] values = storageString.split(TOKEN);
+ if (values.length < 2) {
+ throw new IllegalStateException("Value for " + InRelationSearch.class.getSimpleName() + " not parsable");
+ }
+
+ IRelationType type = TokenFactory.createRelationType(Long.valueOf(values[1]), "SearchRelType");
+ return new NotInRelationSearch(type, Boolean.parseBoolean(values[0]));
+ }
+
+ @Override
+ public void addToQuery(QueryBuilderArtifact builder) {
+ if (sideA == null) {
+ builder.andNotExists(relationType);
+ } else {
+ RelationSide side = sideA.booleanValue() ? RelationSide.SIDE_A : RelationSide.SIDE_B;
+ IRelationTypeSide rts = TokenFactory.createRelationTypeSide(side, relationType.getGuid(), "SearchRelTypeSide");
+ builder.andNotExists(rts);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotSearch.java
deleted file mode 100644
index 44a34271da0..00000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotSearch.java
+++ /dev/null
@@ -1,53 +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.skynet.core.artifact.search;
-
-import java.util.List;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager;
-
-/**
- * @author Robert A. Fisher
- */
-public class NotSearch implements ISearchPrimitive {
- private final ISearchPrimitive search;
-
- public NotSearch(ISearchPrimitive search) {
- super();
- this.search = search;
- }
-
- @Override
- public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException {
- return "NOT EXISTS(SELECT 'x' FROM (" + ArtifactPersistenceManager.getSelectArtIdSql(search, dataList, branch) + ") arts" + " WHERE osee_artifact.art_id = arts." + search.getArtIdColName() + ")";
- }
-
- @Override
- public String getArtIdColName() {
- return "art_id";
- }
-
- @Override
- public String getTableSql(List<Object> dataList, IOseeBranch branch) {
- return "osee_artifact";
- }
-
- @Override
- public String getStorageString() {
- return "Not [" + search.getStorageString() + "]";
- }
-
- @Override
- public String toString() {
- return "Not " + search.toString();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/OrphanArtifactSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/OrphanArtifactSearch.java
deleted file mode 100644
index dc2be820335..00000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/OrphanArtifactSearch.java
+++ /dev/null
@@ -1,82 +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.skynet.core.artifact.search;
-
-import java.util.List;
-import org.eclipse.osee.framework.core.data.IArtifactType;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-
-/**
- * @author Jeff C. Phillips
- */
-public class OrphanArtifactSearch implements ISearchPrimitive {
- private static final String LABEL = "Orphan Search: ";
- private static final String tables = "osee_artifact";
- private static final String sql =
- "art_type_id =? AND art_id NOT in (SELECT t2.art_id FROM osee_relation_link t1, osee_artifact t2, osee_txs t4, (SELECT Max(t1.gamma_id) AS gamma_id, t1.rel_link_id, t2.branch_id FROM osee_relation_link t1, osee_txs t2 WHERE t1.gamma_id = t2.gamma_id AND t2.branch_id = ? GROUP BY t1.rel_link_id, t2.branch_id) t6 WHERE t1.rel_link_type_id =? AND t1.b_art_id = t2.art_id AND t1.gamma_id = t4.gamma_id AND t1.rel_link_id = t6.rel_link_id AND t4.branch_id = t6.branch_id AND t1.gamma_id = t6.gamma_id AND t4.mod_type <> " + ModificationType.DELETED.getValue() + " GROUP BY t2.art_id)";
- private final IArtifactType aritfactType;
- private final long relationTypeId;
-
- public OrphanArtifactSearch(IArtifactType aritfactType) throws OseeCoreException {
- this.aritfactType = aritfactType;
- this.relationTypeId = CoreRelationTypes.Default_Hierarchical__Child.getGuid();
- }
-
- @Override
- public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException {
- dataList.add(aritfactType.getGuid());
- dataList.add(BranchManager.getBranchId(branch));
- dataList.add(relationTypeId);
-
- return sql;
- }
-
- @Override
- public String getArtIdColName() {
- return "art_id";
- }
-
- @Override
- public String getTableSql(List<Object> dataList, IOseeBranch branch) {
- return tables;
- }
-
- @Override
- public String toString() {
- return LABEL + aritfactType.getName();
- }
-
- public static OrphanArtifactSearch getPrimitive(String storageString) {
- storageString = storageString.replace(LABEL, "");
- if (storageString.endsWith(";")) {
- storageString = storageString.substring(0, storageString.length() - 1);
- }
- OrphanArtifactSearch search = null;
- try {
- ArtifactType artifactType = ArtifactTypeManager.getType(storageString);
- search = new OrphanArtifactSearch(artifactType);
- } catch (OseeCoreException ex) {
- throw new IllegalStateException("Value for " + OrphanArtifactSearch.class.getSimpleName() + " not parsable");
- }
- return search;
- }
-
- @Override
- public String getStorageString() {
- return LABEL + aritfactType.getName() + ";";
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
index c6c2f40ce81..6a764c1d90c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
@@ -81,6 +81,7 @@ Import-Package: com.lowagie.text;version="2.1.7",
org.eclipse.osee.framework.jdk.core.util.xml,
org.eclipse.osee.framework.logging,
org.eclipse.osee.framework.skynet.core.conflict,
+ org.eclipse.osee.orcs.rest.client,
org.eclipse.zest.layouts,
org.eclipse.zest.layouts.algorithms
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java
index 117d9139ba1..2af6622c6e8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java
@@ -87,10 +87,7 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
private static ISearchPageContainer aContainer;
private Button addButton;
- private Button allButton;
- private Button atLeastOneButton;
private ComboViewer searchTypeList;
- private Button notButton;
private StackLayout selectionLayout;
private static FilterTableViewer filterviewer;
@@ -122,7 +119,6 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
addFilterControls(mainComposite);
addTableControls(mainComposite);
- addSearchScope(mainComposite);
addFilterListeners();
setControl(parent);
@@ -153,24 +149,6 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
return branch;
}
- /**
- * Controls to allow the user to select wether all the filters are combined using AND or OR
- */
- private void addSearchScope(Composite composite) {
- Group allSelectionGroup = new Group(composite, SWT.NONE);
- allSelectionGroup.setText("Artifacts that match");
- allSelectionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- allSelectionGroup.setLayout(new GridLayout(2, false));
-
- allButton = new Button(allSelectionGroup, SWT.RADIO);
- allButton.setText("All filters (AND)");
- allButton.setSelection(true);
-
- atLeastOneButton = new Button(allSelectionGroup, SWT.RADIO);
- atLeastOneButton.setText("At least one filter (OR)");
- }
-
private void createArtifactTypeSearchControls(Composite optionsComposite) {
artifactTypeControls = new Composite(optionsComposite, SWT.NONE);
artifactTypeControls.setLayout(new GridLayout(1, true));
@@ -195,12 +173,6 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
addToSearchTypeList(new ArtifactTypeFilter(artifactTypeControls, artifactTypeList));
}
- private void createOrphanSearchControls(Composite optionsComposite) {
- //uses the artifactTypeList from Artifact_type_filter
- artifactTypeList.getList().select(0);
- addToSearchTypeList(new OrphanSearchFilter("Orphan Search", artifactTypeControls, artifactTypeList));
- }
-
private void addToSearchTypeList(SearchFilter filter) {
searchTypeList.add(filter.getFilterName());
searchTypeList.setData(filter.getFilterName(), filter);
@@ -217,7 +189,6 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
final ComboViewer relationSideList = new ComboViewer(relationControls, SWT.DROP_DOWN | SWT.READ_ONLY);
relationSideList.setContentProvider(new SearchContentProvider());
relationSideList.setLabelProvider(new StringSearchLabelProvider());
- relationSideList.setSorter(new SearchSorter());
try {
for (RelationType linkDescriptor : RelationTypeManager.getValidTypes(getSelectedBranch())) {
@@ -236,6 +207,7 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
(RelationType) relationTypeList.getData(relationTypeList.getCombo().getText());
relationSideList.add(linkDescriptor.getSideAName());
relationSideList.add(linkDescriptor.getSideBName());
+ relationSideList.add("-Either-");
relationSideList.getCombo().select(0);
}
});
@@ -247,10 +219,12 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
RelationType linkDescriptor = (RelationType) relationTypeList.getData(relationTypeList.getCombo().getText());
relationSideList.add(linkDescriptor.getSideAName());
relationSideList.add(linkDescriptor.getSideBName());
+ relationSideList.add("-Either-");
relationSideList.getCombo().select(0);
}
addToSearchTypeList(new InRelationFilter(relationControls, relationTypeList, relationSideList));
+ addToSearchTypeList(new NotInRelationFilter(relationControls, relationTypeList, relationSideList));
}
private void createAttributeSearchControls(Composite optionsComposite) {
@@ -321,10 +295,6 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
searchTypeList.setLabelProvider(new StringSearchLabelProvider());
searchTypeList.setSorter(new SearchSorter());
- notButton = new Button(composite, SWT.CHECK);
- notButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, true, false));
- notButton.setText("Not Equal");
-
selectionLayout = new StackLayout();
Composite optionsComposite = new Composite(filterGroup, SWT.BORDER);
@@ -334,7 +304,6 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
optionsComposite.setLayout(selectionLayout);
createAttributeSearchControls(optionsComposite);
createArtifactTypeSearchControls(optionsComposite);
- createOrphanSearchControls(optionsComposite);
createRelationSearchControls(optionsComposite);
searchTypeList.getCombo().setVisibleItemCount(7);
@@ -355,7 +324,6 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
@Override
public void widgetSelected(SelectionEvent e) {
SearchFilter searchFilter = (SearchFilter) searchTypeList.getData(searchTypeList.getCombo().getText());
- searchFilter.setNot(notButton.getSelection());
searchFilter.addFilterTo(filterviewer);
updateOKStatus();
}
@@ -421,7 +389,7 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
@Override
public boolean performAction() {
NewSearchUI.activateSearchResultView();
- filterviewer.getFilterList().setAllSelected(allButton.getSelection());
+ filterviewer.getFilterList().setAllSelected(true);
AbstractArtifactSearchQuery searchQuery =
new FilterArtifactSearchQuery(filterviewer.getFilterList(), getSelectedBranch());
NewSearchUI.runQueryInBackground(searchQuery);
@@ -431,7 +399,7 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
@Override
public boolean performReplace() {
- filterviewer.getFilterList().setAllSelected(allButton.getSelection());
+ filterviewer.getFilterList().setAllSelected(true);
AbstractArtifactSearchQuery searchQuery =
new FilterArtifactSearchQuery(filterviewer.getFilterList(), getSelectedBranch());
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java
index 7be2169eef1..e59cbb1f1dd 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java
@@ -10,12 +10,10 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.search;
-import static org.eclipse.osee.framework.skynet.core.artifact.search.DeprecatedOperator.EQUAL;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactTypeSearch;
import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
-import org.eclipse.osee.framework.skynet.core.artifact.search.NotSearch;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
import org.eclipse.swt.widgets.Control;
@@ -34,10 +32,7 @@ public class ArtifactTypeFilter extends SearchFilter {
public void addFilterTo(FilterTableViewer filterViewer) {
for (String type : searchTypeList.getList().getSelection()) {
IArtifactType artType = (IArtifactType) searchTypeList.getData(type);
- ISearchPrimitive primitive = new ArtifactTypeSearch(artType, EQUAL);
- if (not) {
- primitive = new NotSearch(primitive);
- }
+ ISearchPrimitive primitive = new ArtifactTypeSearch(artType);
filterViewer.addItem(primitive, getFilterName(), type, "");
}
}
@@ -50,9 +45,6 @@ public class ArtifactTypeFilter extends SearchFilter {
@Override
public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
ISearchPrimitive primitive = ArtifactTypeSearch.getPrimitive(storageString);
- if (isNotEnabled) {
- primitive = new NotSearch(primitive);
- }
filterViewer.addItem(primitive, getFilterName(), type, value);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java
index 60920e1ffea..675a3b47a6d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java
@@ -14,7 +14,6 @@ import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.skynet.core.artifact.search.AttributeValueSearch;
import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
-import org.eclipse.osee.framework.skynet.core.artifact.search.NotSearch;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
@@ -37,13 +36,9 @@ public class AttributeValueFilter extends SearchFilter {
String typeName = attributeTypeList.getCombo().getText();
String value = attributeValue.getText();
- OperatorAndValue result = handleWildCard(value);
IAttributeType attributeType = (IAttributeType) attributeTypeList.getData(typeName);
- ISearchPrimitive primitive = new AttributeValueSearch(attributeType, result.value, result.operator);
- if (not) {
- primitive = new NotSearch(primitive);
- }
- filterViewer.addItem(primitive, getFilterName(), typeName, result.value);
+ ISearchPrimitive primitive = new AttributeValueSearch(attributeType, value);
+ filterViewer.addItem(primitive, getFilterName(), typeName, value);
}
@Override
@@ -54,9 +49,6 @@ public class AttributeValueFilter extends SearchFilter {
@Override
public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
ISearchPrimitive primitive = AttributeValueSearch.getPrimitive(storageString);
- if (isNotEnabled) {
- primitive = new NotSearch(primitive);
- }
filterViewer.addItem(primitive, getFilterName(), type, value);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java
index b9ad394adca..4017c97dbe6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java
@@ -11,14 +11,13 @@
package org.eclipse.osee.framework.ui.skynet.search;
import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.osee.framework.core.data.IOseeBranch;
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.ArtifactPersistenceManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.artifact.search.QueryBuilderArtifact;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModel;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModelList;
@@ -38,30 +37,25 @@ public class FilterArtifactSearchQuery extends AbstractLegacyArtifactSearchQuery
@Override
public Collection<Artifact> getArtifacts() throws OseeCoreException {
boolean firstTime = true;
- List<ISearchPrimitive> criteria = new LinkedList<ISearchPrimitive>();
+
+ QueryBuilderArtifact queryBuilderArtifact = ArtifactQuery.createQueryBuilder(branch);
for (FilterModel model : filterList.getFilters()) {
- criteria.add(model.getSearchPrimitive());
+ model.getSearchPrimitive().addToQuery(queryBuilderArtifact);
if (!firstTime) {
- if (filterList.isAllSelected()) {
- criteriaLabel += " and ";
- } else {
- criteriaLabel += " or ";
- }
+ criteriaLabel += " and ";
}
-
criteriaLabel += model;
firstTime = false;
}
- MaxMatchCountConfirmer confirmer = new MaxMatchCountConfirmer();
- Collection<Artifact> artifacts =
- ArtifactPersistenceManager.getArtifacts(criteria, filterList.isAllSelected(), branch, confirmer);
- if (confirmer.isConfirmed()) {
- return artifacts;
+ List<Artifact> toReturn = new LinkedList<Artifact>();
+ for (Artifact art : queryBuilderArtifact.getResults()) {
+ toReturn.add(art);
}
- return Collections.emptyList();
+
+ return toReturn;
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java
index 1e513404204..83748e5b5a8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java
@@ -10,15 +10,11 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.search;
-import java.util.logging.Level;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
-import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
import org.eclipse.osee.framework.skynet.core.artifact.search.InRelationSearch;
-import org.eclipse.osee.framework.skynet.core.artifact.search.NotSearch;
-import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
import org.eclipse.swt.widgets.Control;
@@ -41,16 +37,15 @@ public class InRelationFilter extends SearchFilter {
String sideName = relationSideList.getCombo().getText();
RelationType relationType = (RelationType) relationTypeList.getData(typeName);
+ Boolean sideAName = null;
try {
- ISearchPrimitive primitive = new InRelationSearch(relationType, relationType.isSideAName(sideName));
- if (not) {
- primitive = new NotSearch(primitive);
- }
-
- filterViewer.addItem(primitive, getFilterName(), typeName, sideName);
+ sideAName = relationType.isSideAName(sideName);
} catch (OseeArgumentException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
+ // do nothing, user wants either
}
+ ISearchPrimitive primitive = new InRelationSearch(relationType, sideAName);
+
+ filterViewer.addItem(primitive, getFilterName(), typeName, sideName);
}
@Override
@@ -61,9 +56,6 @@ public class InRelationFilter extends SearchFilter {
@Override
public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
ISearchPrimitive primitive = InRelationSearch.getPrimitive(storageString);
- if (isNotEnabled) {
- primitive = new NotSearch(primitive);
- }
filterViewer.addItem(primitive, getFilterName(), type, value);
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/NotInRelationFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/NotInRelationFilter.java
new file mode 100644
index 00000000000..6a6c7b8bbc4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/NotInRelationFilter.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.ui.skynet.search;
+
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.osee.framework.core.model.type.RelationType;
+import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
+import org.eclipse.osee.framework.skynet.core.artifact.search.NotInRelationSearch;
+import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class NotInRelationFilter extends SearchFilter {
+ private final ComboViewer relationTypeList;
+ private final ComboViewer relationSideList;
+
+ public NotInRelationFilter(Control optionsControl, ComboViewer relationTypeList, ComboViewer relationSideList) {
+ super("Artifact not in Relation", optionsControl);
+ this.relationTypeList = relationTypeList;
+ this.relationSideList = relationSideList;
+ }
+
+ @Override
+ public void addFilterTo(FilterTableViewer filterViewer) {
+ String typeName = relationTypeList.getCombo().getText();
+ String sideName = relationSideList.getCombo().getText();
+
+ RelationType relationType = (RelationType) relationTypeList.getData(typeName);
+ Boolean sideAName = null;
+ try {
+ sideAName = relationType.isSideAName(sideName);
+ } catch (OseeArgumentException ex) {
+ // do nothing, user wants either
+ }
+ ISearchPrimitive primitive = new NotInRelationSearch(relationType, sideAName);
+
+ filterViewer.addItem(primitive, getFilterName(), typeName, sideName);
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+ @Override
+ public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
+ ISearchPrimitive primitive = NotInRelationSearch.getPrimitive(storageString);
+ filterViewer.addItem(primitive, getFilterName(), type, value);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/OrphanSearchFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/OrphanSearchFilter.java
deleted file mode 100644
index f4f6b087e5c..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/OrphanSearchFilter.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.ui.skynet.search;
-
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.osee.framework.core.data.IArtifactType;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
-import org.eclipse.osee.framework.skynet.core.artifact.search.NotSearch;
-import org.eclipse.osee.framework.skynet.core.artifact.search.OrphanArtifactSearch;
-import org.eclipse.osee.framework.ui.skynet.internal.Activator;
-import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Jeff C. Phillips
- */
-public class OrphanSearchFilter extends SearchFilter {
- private final ListViewer searchTypeList;
-
- public OrphanSearchFilter(String filterName, Control optionsControl, ListViewer searchTypeList) {
- super(filterName, optionsControl);
- this.searchTypeList = searchTypeList;
- }
-
- @Override
- public void addFilterTo(FilterTableViewer filterViewer) {
- try {
- for (String typeName : searchTypeList.getList().getSelection()) {
-
- IArtifactType artifactType = ArtifactTypeManager.getType(typeName);
- ISearchPrimitive primitive = new OrphanArtifactSearch(artifactType);
-
- if (not) {
- primitive = new NotSearch(primitive);
- }
- filterViewer.addItem(primitive, getFilterName(), typeName, "");
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public boolean isValid() {
- return true;
- }
-
- @Override
- public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
- ISearchPrimitive primitive = OrphanArtifactSearch.getPrimitive(storageString);
- if (isNotEnabled) {
- primitive = new NotSearch(primitive);
- }
- filterViewer.addItem(primitive, getFilterName(), type, value);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java
index 91dde4dec95..818aa1a5b6d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java
@@ -10,11 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.search;
-import static org.eclipse.osee.framework.skynet.core.artifact.search.DeprecatedOperator.EQUAL;
-import static org.eclipse.osee.framework.skynet.core.artifact.search.DeprecatedOperator.LIKE;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.skynet.core.artifact.search.DeprecatedOperator;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
import org.eclipse.swt.widgets.Control;
@@ -22,15 +17,12 @@ import org.eclipse.swt.widgets.Control;
* @author Ryan D. Brooks
*/
public abstract class SearchFilter {
- private static final Pattern wildCardPattern = Pattern.compile("(?<!\\\\)\\*");
private final String filterName;
protected Control optionsControl;
- protected boolean not;
public SearchFilter(String filterName, Control optionsControl) {
this.filterName = filterName;
this.optionsControl = optionsControl;
- this.not = false;
}
public abstract void addFilterTo(FilterTableViewer filterViewer);
@@ -39,39 +31,6 @@ public abstract class SearchFilter {
return false;
}
- protected class OperatorAndValue {
- DeprecatedOperator operator;
- String value;
- }
-
- public OperatorAndValue handleWildCard(String value) {
- OperatorAndValue result = new OperatorAndValue();
- Matcher wildCardMatcher = wildCardPattern.matcher(value);
- if (wildCardMatcher.find()) {
- wildCardMatcher.reset();
- value = wildCardMatcher.replaceAll("%");
- result.operator = LIKE;
- } else {
- result.operator = EQUAL;
- }
- result.value = value.replaceAll("\\\\\\*", "*");
- return result;
- }
-
- /**
- * @return Returns the not.
- */
- public boolean isNot() {
- return not;
- }
-
- /**
- * @param not The not to set.
- */
- public void setNot(boolean not) {
- this.not = not;
- }
-
protected String getFilterName() {
return filterName;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/filter/FilterModelLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/filter/FilterModelLabelProvider.java
index 24ec1db1197..79a6403455a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/filter/FilterModelLabelProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/filter/FilterModelLabelProvider.java
@@ -12,7 +12,6 @@ package org.eclipse.osee.framework.ui.skynet.search.filter;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.osee.framework.skynet.core.artifact.search.NotSearch;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.swt.graphics.Image;
@@ -58,11 +57,6 @@ public class FilterModelLabelProvider implements ITableLabelProvider {
switch (columnIndex) {
case FilterTableViewer.DELETE_NUM:
return ImageManager.getImage(FrameworkImage.REMOVE);
- case FilterTableViewer.SEARCH_NUM:
- if (((FilterModel) element).getSearchPrimitive() instanceof NotSearch) {
- return ImageManager.getImage(FrameworkImage.NOT_EQUAL);
- }
- break;
}
return null;
}

Back to the top