Issue #1949 Switch Product Browser from uengine to DbQueryRequest.
Former-commit-id:4d2bee0f16
[formerly615565d75c
] [formerly0982076772
] [formerly4d2bee0f16
[formerly615565d75c
] [formerly0982076772
] [formerlybd8a292e90
[formerly0982076772
[formerly 9b78ecbaf0d54d95c4cc94d2a11a36c250f48a32]]]] Former-commit-id:bd8a292e90
Former-commit-id:6486961b02
[formerly0458726fd1
] [formerly 33b5e15e28d06a2fe53b8ee1fb13209cdd41bf76 [formerly3038d6abd1
]] Former-commit-id: 9d2ae16f17ef12dadd8934a392922d1d5fc56691 [formerly219ce71a96
] Former-commit-id:6a5ea02ba0
This commit is contained in:
parent
4e92fc5756
commit
3e08fb5184
5 changed files with 49 additions and 25 deletions
|
@ -50,6 +50,8 @@ import com.raytheon.viz.grid.rsc.GridLoadProperties;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 9, 2011 bsteffen Initial creation
|
* Mar 9, 2011 bsteffen Initial creation
|
||||||
|
* May 02, 2013 1949 bsteffen Switch Product Browser from uengine to
|
||||||
|
* DbQueryRequest.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -136,7 +138,7 @@ public class GFEDataDefinition extends
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] queryData(String param,
|
protected String[] queryData(String param,
|
||||||
HashMap<String, RequestConstraint> queryList) {
|
Map<String, RequestConstraint> queryList) {
|
||||||
return super.queryData(GFEDataAccessUtil.PARM_ID, queryList);
|
return super.queryData(GFEDataAccessUtil.PARM_ID, queryList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 6, 2011 bsteffen Initial creation
|
* Dec 6, 2011 bsteffen Initial creation
|
||||||
|
* May 02, 2013 1949 bsteffen Switch Product Browser from uengine to
|
||||||
|
* DbQueryRequest.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -91,7 +93,7 @@ public class CrimssDataDefinition
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] queryData(String param,
|
protected String[] queryData(String param,
|
||||||
HashMap<String, RequestConstraint> queryList) {
|
Map<String, RequestConstraint> queryList) {
|
||||||
if (param.equals(POINT)) {
|
if (param.equals(POINT)) {
|
||||||
// TODO depending on how much data we have this might be way too
|
// TODO depending on how much data we have this might be way too
|
||||||
// data to request.
|
// data to request.
|
||||||
|
|
|
@ -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.actions;uses:="org.eclipse.core.commands",
|
||||||
com.raytheon.uf.viz.productbrowser.bookmarks,
|
com.raytheon.uf.viz.productbrowser.bookmarks,
|
||||||
com.raytheon.uf.viz.productbrowser.xml
|
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.message.response,
|
||||||
com.raytheon.uf.common.serialization,
|
com.raytheon.uf.common.serialization
|
||||||
com.raytheon.uf.viz.core.catalog
|
|
||||||
|
|
|
@ -31,27 +31,29 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import org.eclipse.ui.IEditorPart;
|
import org.eclipse.ui.IEditorPart;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
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.requests.RequestConstraint;
|
||||||
|
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.core.DescriptorMap;
|
import com.raytheon.uf.viz.core.DescriptorMap;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
import com.raytheon.uf.viz.core.catalog.CatalogQuery;
|
import com.raytheon.uf.viz.core.RecordFactory;
|
||||||
import com.raytheon.uf.viz.core.catalog.DbQuery;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
|
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
|
||||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||||
import com.raytheon.uf.viz.core.procedures.Bundle;
|
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.AbstractRequestableResourceData;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
|
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceType;
|
import com.raytheon.uf.viz.core.rsc.ResourceType;
|
||||||
import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference.PreferenceType;
|
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.BundleProductLoader;
|
||||||
|
import com.raytheon.viz.ui.EditorUtil;
|
||||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
||||||
|
@ -66,6 +68,8 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* May 3, 2010 mnash Initial creation
|
* May 3, 2010 mnash Initial creation
|
||||||
|
* May 02, 2013 1949 bsteffen Switch Product Browser from uengine to
|
||||||
|
* DbQueryRequest.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -103,26 +107,26 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
|
||||||
if (!isEnabled()) {
|
if (!isEnabled()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<Object[]> parameters = null;
|
Object[] parameters = null;
|
||||||
if (order.length >= 1) {
|
if (order.length >= 1) {
|
||||||
try {
|
try {
|
||||||
DbQuery query = new DbQuery(productName);
|
DbQueryRequest request = new DbQueryRequest();
|
||||||
query.setMaxResults(1);
|
request.setEntityClass(RecordFactory.getInstance()
|
||||||
parameters = query.performQuery();
|
.getPluginClass(productName));
|
||||||
|
request.setLimit(1);
|
||||||
|
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||||
|
.sendRequest(request);
|
||||||
|
parameters = response.getEntityObjects(Object.class);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.ERROR,
|
statusHandler.handle(Priority.ERROR,
|
||||||
"Unable to populate initial product tree", e);
|
"Unable to populate initial product tree", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters != null && !parameters.isEmpty()) {
|
if (parameters != null && parameters.length != 0) {
|
||||||
if (parameters.get(0).length > 0) {
|
|
||||||
return displayName;
|
return displayName;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return displayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
|
@ -172,9 +176,26 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected String[] queryData(String param,
|
protected String[] queryData(String param,
|
||||||
HashMap<String, RequestConstraint> queryList) {
|
Map<String, RequestConstraint> queryList) {
|
||||||
try {
|
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) {
|
} catch (VizException e) {
|
||||||
statusHandler
|
statusHandler
|
||||||
.handle(Priority.PROBLEM, "Unable to perform query", e);
|
.handle(Priority.PROBLEM, "Unable to perform query", e);
|
||||||
|
@ -238,16 +259,14 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
|
||||||
RequestConstraint contstraint = new RequestConstraint(productName);
|
RequestConstraint contstraint = new RequestConstraint(productName);
|
||||||
queryList.put(PLUGIN_NAME, contstraint);
|
queryList.put(PLUGIN_NAME, contstraint);
|
||||||
for (int i = 0; i < order.length; i++) {
|
for (int i = 0; i < order.length; i++) {
|
||||||
try {
|
String[] items = queryData(order[i], queryList);
|
||||||
String[] items = CatalogQuery.performQuery(order[i], queryList);
|
if (items != null) {
|
||||||
List<ProductBrowserLabel> labels = formatData(order[i], items);
|
List<ProductBrowserLabel> labels = formatData(order[i], items);
|
||||||
if (labels != null) {
|
if (labels != null) {
|
||||||
for (int j = 0; j < labels.size(); j++) {
|
for (int j = 0; j < labels.size(); j++) {
|
||||||
historyList.add(labels.get(j).getName());
|
historyList.add(labels.get(j).getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (VizException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return historyList;
|
return historyList;
|
||||||
|
|
|
@ -73,6 +73,8 @@ import com.raytheon.viz.grid.rsc.GridResourceData;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* May 21, 2010 bsteffens Initial creation
|
* May 21, 2010 bsteffens Initial creation
|
||||||
* May 26, 2010 mnash Used ProductBrowserLabel implementation instead of requery
|
* May 26, 2010 mnash Used ProductBrowserLabel implementation instead of requery
|
||||||
|
* May 02, 2013 1949 bsteffen Switch Product Browser from uengine to
|
||||||
|
* DbQueryRequest.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -175,7 +177,7 @@ public class GridProductBrowserDataDefinition extends
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] queryData(String param,
|
protected String[] queryData(String param,
|
||||||
HashMap<String, RequestConstraint> queryList) {
|
Map<String, RequestConstraint> queryList) {
|
||||||
try {
|
try {
|
||||||
if (getInventory() == null) {
|
if (getInventory() == null) {
|
||||||
return super.queryData(param, queryList);
|
return super.queryData(param, queryList);
|
||||||
|
|
Loading…
Add table
Reference in a new issue