Issue #1949 Switch Product Browser from uengine to DbQueryRequest.

Former-commit-id: 4d2bee0f16 [formerly 615565d75c] [formerly 0982076772] [formerly 4d2bee0f16 [formerly 615565d75c] [formerly 0982076772] [formerly bd8a292e90 [formerly 0982076772 [formerly 9b78ecbaf0d54d95c4cc94d2a11a36c250f48a32]]]]
Former-commit-id: bd8a292e90
Former-commit-id: 6486961b02 [formerly 0458726fd1] [formerly 33b5e15e28d06a2fe53b8ee1fb13209cdd41bf76 [formerly 3038d6abd1]]
Former-commit-id: 9d2ae16f17ef12dadd8934a392922d1d5fc56691 [formerly 219ce71a96]
Former-commit-id: 6a5ea02ba0
This commit is contained in:
Ben Steffensmeier 2013-05-01 13:40:41 -05:00
parent 4e92fc5756
commit 3e08fb5184
5 changed files with 49 additions and 25 deletions

View file

@ -50,6 +50,8 @@ import com.raytheon.viz.grid.rsc.GridLoadProperties;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 9, 2011 bsteffen Initial creation
* May 02, 2013 1949 bsteffen Switch Product Browser from uengine to
* DbQueryRequest.
*
* </pre>
*
@ -136,7 +138,7 @@ public class GFEDataDefinition extends
@Override
protected String[] queryData(String param,
HashMap<String, RequestConstraint> queryList) {
Map<String, RequestConstraint> queryList) {
return super.queryData(GFEDataAccessUtil.PARM_ID, queryList);
}

View file

@ -61,6 +61,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 6, 2011 bsteffen Initial creation
* May 02, 2013 1949 bsteffen Switch Product Browser from uengine to
* DbQueryRequest.
*
* </pre>
*
@ -91,7 +93,7 @@ public class CrimssDataDefinition
@Override
protected String[] queryData(String param,
HashMap<String, RequestConstraint> queryList) {
Map<String, RequestConstraint> queryList) {
if (param.equals(POINT)) {
// TODO depending on how much data we have this might be way too
// data to request.

View file

@ -25,7 +25,6 @@ Export-Package: com.raytheon.uf.viz.productbrowser;
com.raytheon.uf.viz.productbrowser.actions;uses:="org.eclipse.core.commands",
com.raytheon.uf.viz.productbrowser.bookmarks,
com.raytheon.uf.viz.productbrowser.xml
Import-Package: com.raytheon.edex.scriptfactory,
Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.message.response,
com.raytheon.uf.common.serialization,
com.raytheon.uf.viz.core.catalog
com.raytheon.uf.common.serialization

View file

@ -31,27 +31,29 @@ import javax.xml.bind.annotation.XmlAccessorType;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.DescriptorMap;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.catalog.CatalogQuery;
import com.raytheon.uf.viz.core.catalog.DbQuery;
import com.raytheon.uf.viz.core.RecordFactory;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference.PreferenceType;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.BundleProductLoader;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.VizWorkbenchManager;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
@ -66,6 +68,8 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 3, 2010 mnash Initial creation
* May 02, 2013 1949 bsteffen Switch Product Browser from uengine to
* DbQueryRequest.
*
* </pre>
*
@ -103,23 +107,23 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
if (!isEnabled()) {
return null;
}
List<Object[]> parameters = null;
Object[] parameters = null;
if (order.length >= 1) {
try {
DbQuery query = new DbQuery(productName);
query.setMaxResults(1);
parameters = query.performQuery();
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(RecordFactory.getInstance()
.getPluginClass(productName));
request.setLimit(1);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
parameters = response.getEntityObjects(Object.class);
} catch (VizException e) {
statusHandler.handle(Priority.ERROR,
"Unable to populate initial product tree", e);
}
if (parameters != null && !parameters.isEmpty()) {
if (parameters.get(0).length > 0) {
return displayName;
} else {
return null;
}
if (parameters != null && parameters.length != 0) {
return displayName;
} else {
return null;
}
@ -172,9 +176,26 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
* @return
*/
protected String[] queryData(String param,
HashMap<String, RequestConstraint> queryList) {
Map<String, RequestConstraint> queryList) {
try {
return CatalogQuery.performQuery(param, queryList);
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(RecordFactory.getInstance().getPluginClass(
productName));
request.setConstraints(queryList);
request.addRequestField(param);
request.setDistinct(true);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
Object[] paramObjs = response.getFieldObjects(param, Object.class);
if (paramObjs != null) {
String[] params = new String[paramObjs.length];
for (int i = 0; i < params.length; i += 1) {
if (paramObjs[i] != null) {
params[i] = paramObjs[i].toString();
}
}
return params;
}
} catch (VizException e) {
statusHandler
.handle(Priority.PROBLEM, "Unable to perform query", e);
@ -238,16 +259,14 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
RequestConstraint contstraint = new RequestConstraint(productName);
queryList.put(PLUGIN_NAME, contstraint);
for (int i = 0; i < order.length; i++) {
try {
String[] items = CatalogQuery.performQuery(order[i], queryList);
String[] items = queryData(order[i], queryList);
if (items != null) {
List<ProductBrowserLabel> labels = formatData(order[i], items);
if (labels != null) {
for (int j = 0; j < labels.size(); j++) {
historyList.add(labels.get(j).getName());
}
}
} catch (VizException e) {
e.printStackTrace();
}
}
return historyList;

View file

@ -73,6 +73,8 @@ import com.raytheon.viz.grid.rsc.GridResourceData;
* ------------ ---------- ----------- --------------------------
* May 21, 2010 bsteffens Initial creation
* May 26, 2010 mnash Used ProductBrowserLabel implementation instead of requery
* May 02, 2013 1949 bsteffen Switch Product Browser from uengine to
* DbQueryRequest.
*
* </pre>
*
@ -175,7 +177,7 @@ public class GridProductBrowserDataDefinition extends
@Override
protected String[] queryData(String param,
HashMap<String, RequestConstraint> queryList) {
Map<String, RequestConstraint> queryList) {
try {
if (getInventory() == null) {
return super.queryData(param, queryList);