Issue #2537 point data code cleanup.
Former-commit-id:84dd9b10d6
[formerly42107fba5c
] [formerlya4e3a4a03b
] [formerly7889c14b35
[formerlya4e3a4a03b
[formerly 8809ac9faa7669e7a0817b9b1c15c322b05e06a2]]] Former-commit-id:7889c14b35
Former-commit-id: ad0bd85eb3b2bf617012e11ec19831b5f9d526eb [formerly62ca7b1df6
] Former-commit-id:a4e3bf34b8
This commit is contained in:
parent
da8d574656
commit
65147cfb78
7 changed files with 111 additions and 177 deletions
|
@ -43,10 +43,11 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 20, 2009 chammack Initial creation.
|
||||
* 5/27/2009 1982 grichard Updated stationId key const.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Apr 20, 2009 chammack Initial creation.
|
||||
* may 27, 2009 1982 grichard Updated stationId key const.
|
||||
* Nov 26, 2013 2537 bsteffen Remove unused functionality.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -56,8 +57,6 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
|
||||
public class PointDataRequest {
|
||||
|
||||
private static final String PLUGIN = "pointdata";
|
||||
|
||||
private static final String PLUGINNAME_KEY = "pluginName";
|
||||
|
||||
private static final String STATIONID_KEY = "location.stationId";
|
||||
|
@ -66,61 +65,15 @@ public class PointDataRequest {
|
|||
|
||||
private static final String REFTIME_KEY = DATATIME_KEY + ".refTime";
|
||||
|
||||
private static final String REQUESTED_PARAMETERS_KEY = "requestedParameters";
|
||||
|
||||
private static final String RESTRICT_LEVEL = "restrictLevel";
|
||||
|
||||
private static final String RESTRICT_PARAMETER = "restrictParameter";
|
||||
|
||||
private static final String ID = "id";
|
||||
|
||||
private PointDataRequest() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Request point data for a set of stations or points, over a given set of
|
||||
* parameters, at a specific point in time.
|
||||
*
|
||||
*
|
||||
* The request can be additionally constrained by optional
|
||||
* RequestConstraints.
|
||||
*
|
||||
* @param dt
|
||||
* the datatime to request the data for (required)
|
||||
* @param pluginName
|
||||
* the plugin to use (required)
|
||||
* @param parameters
|
||||
* the parameters to request (required)
|
||||
* @param stationIds
|
||||
* the station IDs to constrain to (optional)
|
||||
* @param constraints
|
||||
* additional constraints (optional)
|
||||
* @return
|
||||
*/
|
||||
public static PointDataContainer requestPointData(DataTime dt,
|
||||
String pluginName, String[] parameters, String[] stationIds,
|
||||
Map<String, RequestConstraint> constraints) throws VizException {
|
||||
DataTime[] dts = null;
|
||||
if (dt != null) {
|
||||
dts = new DataTime[] { dt };
|
||||
}
|
||||
return requestPointDataInternal(dts, null, pluginName, parameters,
|
||||
stationIds, constraints, false, null, null);
|
||||
}
|
||||
|
||||
public static PointDataContainer requestPointData(TimeRange tr,
|
||||
String pluginName, String[] parameters, String[] stationIds,
|
||||
Map<String, RequestConstraint> constraints) throws VizException {
|
||||
return requestPointDataInternal(null, tr, pluginName, parameters,
|
||||
stationIds, constraints, false, null, null);
|
||||
}
|
||||
|
||||
public static PointDataContainer requestPointData(DataTime[] dt,
|
||||
String pluginName, String[] parameters, String[] stationIds,
|
||||
Map<String, RequestConstraint> constraints) throws VizException {
|
||||
return requestPointDataInternal(dt, null, pluginName, parameters,
|
||||
stationIds, constraints, true, null, null);
|
||||
stationIds, constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,7 +97,7 @@ public class PointDataRequest {
|
|||
String pluginName, String[] parameters, String[] stationIds,
|
||||
Map<String, RequestConstraint> constraints) throws VizException {
|
||||
return requestPointDataInternal(null, null, pluginName, parameters,
|
||||
stationIds, constraints, true, null, null);
|
||||
stationIds, constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +127,7 @@ public class PointDataRequest {
|
|||
dts = new DataTime[] { dt };
|
||||
}
|
||||
return requestPointDataInternal(dts, null, pluginName, parameters,
|
||||
stationIds, constraints, true, null, null);
|
||||
stationIds, constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,7 +153,7 @@ public class PointDataRequest {
|
|||
String pluginName, String[] parameters, String[] stationIds,
|
||||
Map<String, RequestConstraint> constraints) throws VizException {
|
||||
return requestPointDataInternal(null, tr, pluginName, parameters,
|
||||
stationIds, constraints, true, null, null);
|
||||
stationIds, constraints);
|
||||
}
|
||||
|
||||
public static String[] getParameterNames(String pluginName,
|
||||
|
@ -213,7 +166,9 @@ public class PointDataRequest {
|
|||
rcMap.putAll(constraints);
|
||||
}
|
||||
rcMap.put(PLUGINNAME_KEY, new RequestConstraint(pluginName));
|
||||
rcMap.put("mode", new RequestConstraint("getParameters"));
|
||||
rcMap.put(PointDataServerRequest.REQUEST_MODE_KEY,
|
||||
new RequestConstraint(
|
||||
PointDataServerRequest.REQUEST_MODE_PARAMETERS));
|
||||
|
||||
PointDataServerRequest request = new PointDataServerRequest(rcMap);
|
||||
|
||||
|
@ -227,38 +182,9 @@ public class PointDataRequest {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request all levels for point data for a set of stations or points, over a
|
||||
* given set of parameters, at a specific point in time.
|
||||
*
|
||||
* The request can be additionally constrained by optional
|
||||
* RequestConstraints.
|
||||
*
|
||||
* @param dt
|
||||
* the datatime to request the data for (required)
|
||||
* @param pluginName
|
||||
* the plugin to use (required)
|
||||
* @param parameters
|
||||
* the parameters to request (required)
|
||||
* @param stationIds
|
||||
* the station IDs to constrain to (optional)
|
||||
* @param constraints
|
||||
* additional constraints (optional)
|
||||
* @return
|
||||
*/
|
||||
public static PointDataContainer requestPointDataAtLevel(DataTime dt,
|
||||
String pluginName, String[] parameters, String[] stationIds,
|
||||
Map<String, RequestConstraint> constraints, String levelParameter,
|
||||
double[] levelValues) throws VizException {
|
||||
return requestPointDataInternal(new DataTime[] { dt }, null,
|
||||
pluginName, parameters, stationIds, constraints, false,
|
||||
levelParameter, levelValues);
|
||||
}
|
||||
|
||||
private static PointDataContainer requestPointDataInternal(DataTime[] dt,
|
||||
TimeRange tr, String pluginName, String[] parameters,
|
||||
String[] stationIds, Map<String, RequestConstraint> constraints,
|
||||
boolean allLevels, String levelParameter, double[] levelValues)
|
||||
String[] stationIds, Map<String, RequestConstraint> constraints)
|
||||
throws VizException {
|
||||
try {
|
||||
Validate.notNull(pluginName, "Plugin Name is required");
|
||||
|
@ -275,7 +201,7 @@ public class PointDataRequest {
|
|||
first = false;
|
||||
}
|
||||
|
||||
rcMap.put(REQUESTED_PARAMETERS_KEY,
|
||||
rcMap.put(PointDataServerRequest.REQUEST_PARAMETERS_KEY,
|
||||
new RequestConstraint(sb.toString()));
|
||||
|
||||
if (dt != null && dt.length > 0) {
|
||||
|
@ -303,7 +229,7 @@ public class PointDataRequest {
|
|||
}
|
||||
|
||||
if (stationIds != null) {
|
||||
RequestConstraint rc = new RequestConstraint();
|
||||
RequestConstraint rc = new RequestConstraint(stationIds);
|
||||
rc.setConstraintValueList(stationIds);
|
||||
|
||||
rcMap.put(STATIONID_KEY, rc);
|
||||
|
@ -311,32 +237,11 @@ public class PointDataRequest {
|
|||
|
||||
rcMap.put(PLUGINNAME_KEY, new RequestConstraint(pluginName));
|
||||
rcMap.putAll(constraints);
|
||||
String mode = "select";
|
||||
if (allLevels) {
|
||||
mode = "select2d";
|
||||
} else if (levelParameter != null) {
|
||||
mode = "selectSpecific";
|
||||
rcMap.put(RESTRICT_PARAMETER, new RequestConstraint(
|
||||
levelParameter));
|
||||
StringBuffer sb1 = new StringBuffer();
|
||||
for (int i = 0; i < levelValues.length; i++) {
|
||||
if (i != 0) {
|
||||
sb1.append(",");
|
||||
}
|
||||
sb1.append(levelValues[i]);
|
||||
}
|
||||
rcMap.put(RESTRICT_LEVEL, new RequestConstraint(sb1.toString()));
|
||||
}
|
||||
|
||||
rcMap.put("mode", new RequestConstraint(mode));
|
||||
rcMap.put(PointDataServerRequest.REQUEST_MODE_KEY,
|
||||
new RequestConstraint(
|
||||
PointDataServerRequest.REQUEST_MODE_2D));
|
||||
|
||||
/*
|
||||
* String script = ScriptCreator.createScript(PLUGIN, rcMap, 9999,
|
||||
* mode); long t0 = System.currentTimeMillis();
|
||||
*
|
||||
* Object[] result = Connector.getInstance().connect(script, null,
|
||||
* 60000);
|
||||
*/
|
||||
|
||||
PointDataServerRequest request = new PointDataServerRequest(rcMap);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<parameter name="numProfLvls" numDims="1" type="INT" />
|
||||
<parameter name="pressure" numDims="2" type="FLOAT" unit="Pa" dimension="maxLevels"/>
|
||||
<parameter name="temperature" numDims="2" type="FLOAT" unit="K" dimension="maxLevels"/>
|
||||
<parameter name="specHum" numDims="2" type="FLOAT" unit="kg/Kg" dimension="maxLevels"/>
|
||||
<parameter name="specHum" numDims="2" type="FLOAT" unit="kg/kg" dimension="maxLevels"/>
|
||||
<parameter name="omega" numDims="2" type="FLOAT" unit="Pa/s" dimension="maxLevels"/>
|
||||
<parameter name="uComp" numDims="2" type="FLOAT" unit="m/s" dimension="maxLevels"/>
|
||||
<parameter name="vComp" numDims="2" type="FLOAT" unit="m/s" dimension="maxLevels"/>
|
||||
|
|
|
@ -46,7 +46,6 @@ import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
|||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||
import com.raytheon.uf.common.pointdata.PointDataConstants;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
|
@ -69,6 +68,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Oct 31, 2013 2502 bsteffen Initial creation
|
||||
* Nov 26, 2013 2537 bsteffen Minor code cleanup.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -77,15 +77,6 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
*/
|
||||
public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
||||
|
||||
// TODO this should be in PointDataServerRequest
|
||||
private static final String REQUEST_PARAMETERS_KEY = "requestedParameters";
|
||||
|
||||
// TODO this should be in PointDataServerRequest
|
||||
private static final String REQUEST_MODE_KEY = "mode";
|
||||
|
||||
// TODO this should be in PointDataServerRequest
|
||||
private static final String REQUEST_MODE_2D = "select2d";
|
||||
|
||||
private static class TwoDimensionalParameterGroup {
|
||||
|
||||
public final String countParameter;
|
||||
|
@ -181,10 +172,7 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
|||
Map<String, RequestConstraint> rcMap = new HashMap<String, RequestConstraint>();
|
||||
String[] locations = request.getLocationNames();
|
||||
if (locations != null && locations.length != 0) {
|
||||
RequestConstraint rc = new RequestConstraint();
|
||||
rc.setConstraintType(ConstraintType.IN);
|
||||
rc.setConstraintValueList(locations);
|
||||
rcMap.put(locationDatabaseKey, rc);
|
||||
rcMap.put(locationDatabaseKey, new RequestConstraint(locations));
|
||||
}
|
||||
Map<String, Object> identifiers = request.getIdentifiers();
|
||||
if (identifiers != null) {
|
||||
|
@ -220,6 +208,9 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
|||
"Unable to complete the PointDataRequestMessage for request: "
|
||||
+ request, e);
|
||||
}
|
||||
if(pdc == null){
|
||||
return new IGeometryData[0];
|
||||
}
|
||||
LevelFactory lf = LevelFactory.getInstance();
|
||||
/* Convert the point data container into a list of IGeometryData */
|
||||
List<IGeometryData> result = new ArrayList<IGeometryData>(
|
||||
|
@ -282,8 +273,8 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
|||
DbQueryRequest dbQueryRequest) {
|
||||
Map<String, RequestConstraint> constraints = dbQueryRequest
|
||||
.getConstraints();
|
||||
constraints.put(REQUEST_MODE_KEY,
|
||||
new RequestConstraint(REQUEST_MODE_2D));
|
||||
constraints.put(PointDataServerRequest.REQUEST_MODE_KEY,
|
||||
new RequestConstraint(PointDataServerRequest.REQUEST_MODE_2D));
|
||||
/*
|
||||
* Figure out what parameters we actually need.
|
||||
*/
|
||||
|
@ -312,10 +303,8 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
|||
parameters.add(fcstHrPointDataKey);
|
||||
}
|
||||
|
||||
RequestConstraint rc = new RequestConstraint();
|
||||
rc.setConstraintType(ConstraintType.IN);
|
||||
rc.setConstraintValueList(parameters.toArray(new String[0]));
|
||||
constraints.put(REQUEST_PARAMETERS_KEY, rc);
|
||||
constraints.put(PointDataServerRequest.REQUEST_PARAMETERS_KEY,
|
||||
new RequestConstraint(parameters));
|
||||
|
||||
return new PointDataServerRequest(constraints);
|
||||
}
|
||||
|
@ -342,8 +331,6 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory {
|
|||
Coordinate c = new Coordinate(pdv.getFloat(longitudePointDataKey),
|
||||
pdv.getFloat(latitudePointDataKey));
|
||||
data.setGeometry(new GeometryFactory().createPoint(c));
|
||||
// TODO python will break if attributes is null
|
||||
data.setAttributes(new HashMap<String, Object>(0));
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,11 +47,13 @@ import com.raytheon.uf.common.time.TimeRange;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 17, 2013 bsteffen Initial creation
|
||||
* Feb 14, 2013 1614 bsteffen Refactor data access framework to use
|
||||
* single request.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 17, 2013 bsteffen Initial creation
|
||||
* Feb 14, 2013 1614 bsteffen Refactor data access framework to use
|
||||
* single request.
|
||||
* Nov 26, 2013 2537 bsteffen Fix NPEs for dataTimes and timeRange requests.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -215,7 +217,7 @@ public abstract class AbstractDataPluginFactory
|
|||
String[] dataTimeStrings = new String[dataTimes.length];
|
||||
int index = 0;
|
||||
for (DataTime dataTime : dataTimes) {
|
||||
dataTimeStrings[index] = dataTime.toString();
|
||||
dataTimeStrings[index] = String.valueOf(dataTime);
|
||||
++index;
|
||||
}
|
||||
requestConstraint.setConstraintValueList(dataTimeStrings);
|
||||
|
@ -237,13 +239,15 @@ public abstract class AbstractDataPluginFactory
|
|||
TimeRange timeRange) {
|
||||
DbQueryRequest dbQueryRequest = this.buildDbQueryRequest(request);
|
||||
/* Add the TimeRange Constraint */
|
||||
RequestConstraint requestConstraint = new RequestConstraint();
|
||||
requestConstraint.setConstraintType(ConstraintType.BETWEEN);
|
||||
String[] dateTimeStrings = new String[] {
|
||||
timeRange.getStart().toString(), timeRange.getEnd().toString() };
|
||||
requestConstraint.setBetweenValueList(dateTimeStrings);
|
||||
dbQueryRequest.addConstraint(FIELD_DATATIME, requestConstraint);
|
||||
|
||||
if (timeRange != null) {
|
||||
RequestConstraint requestConstraint = new RequestConstraint();
|
||||
requestConstraint.setConstraintType(ConstraintType.BETWEEN);
|
||||
String[] dateTimeStrings = new String[] {
|
||||
timeRange.getStart().toString(),
|
||||
timeRange.getEnd().toString() };
|
||||
requestConstraint.setBetweenValueList(dateTimeStrings);
|
||||
dbQueryRequest.addConstraint(FIELD_DATATIME, requestConstraint);
|
||||
}
|
||||
return dbQueryRequest;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ package com.raytheon.uf.common.pointdata;
|
|||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
|
@ -34,9 +33,11 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 16, 2011 #8070 ekladstrup Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Feb 16, 2011 8070 ekladstrup Initial creation
|
||||
* Nov 26, 2013 2537 bsteffen Move common constants here.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -44,8 +45,15 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
|||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class PointDataServerRequest implements IServerRequest,
|
||||
ISerializableObject {
|
||||
public class PointDataServerRequest implements IServerRequest {
|
||||
|
||||
public static final String REQUEST_PARAMETERS_KEY = "requestedParameters";
|
||||
|
||||
public static final String REQUEST_MODE_KEY = "mode";
|
||||
|
||||
public static final String REQUEST_MODE_2D = "select2d";
|
||||
|
||||
public static final String REQUEST_MODE_PARAMETERS = "getParameters";
|
||||
|
||||
// the information needed for a PointDataQuery object
|
||||
@DynamicSerializeElement
|
||||
|
|
|
@ -60,16 +60,20 @@ import com.raytheon.uf.common.serialization.SerializationException;
|
|||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 12, 2008 #1448 chammack Initial creation
|
||||
* Jun 17, 2010 #5091 njensen Optimized primitive arrays
|
||||
* Mar 01, 2011 njensen Restructured deserializeArray()
|
||||
* Sep 14, 2012 #1169 djohnson Add ability to write another object into the stream directly.
|
||||
* Sep 28, 2012 #1195 djohnson Add ability to specify adapter at field level.
|
||||
* Nov 02, 2012 1302 djohnson No more field level adapters.
|
||||
* Apr 25, 2013 1954 bsteffen Size Collections better.
|
||||
* Jul 23, 2013 2215 njensen Updated for thrift 0.9.0
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Aug 12, 2008 1448 chammack Initial creation
|
||||
* Jun 17, 2010 5091 njensen Optimized primitive arrays
|
||||
* Mar 01, 2011 njensen Restructured deserializeArray()
|
||||
* Sep 14, 2012 1169 djohnson Add ability to write another object into
|
||||
* the stream directly.
|
||||
* Sep 28, 2012 1195 djohnson Add ability to specify adapter at field
|
||||
* level.
|
||||
* Nov 02, 2012 1302 djohnson No more field level adapters.
|
||||
* Apr 25, 2013 1954 bsteffen Size Collections better.
|
||||
* Jul 23, 2013 2215 njensen Updated for thrift 0.9.0
|
||||
* Nov 26, 2013 2537 bsteffen Add support for void type lists which are
|
||||
* sometimes created by python.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1183,6 +1187,29 @@ public class ThriftSerializationContext extends BaseSerializationContext {
|
|||
}
|
||||
return list;
|
||||
}
|
||||
case TType.VOID:
|
||||
if (listFieldClazz == null || listFieldClazz.isArray()) {
|
||||
Object[] array = new Object[innerList.size];
|
||||
protocol.readListEnd();
|
||||
return array;
|
||||
} else {
|
||||
// this is a List but due to the encoded element type
|
||||
// we can safely assume it's all nulls
|
||||
List<String> list = null;
|
||||
if (listFieldClazz != null) {
|
||||
if (!listFieldClazz.isInterface()
|
||||
&& List.class.isAssignableFrom(listFieldClazz)) {
|
||||
list = (List<String>) listFieldClazz.newInstance();
|
||||
}
|
||||
}
|
||||
if (list == null) {
|
||||
list = new ArrayList<String>(innerList.size);
|
||||
}
|
||||
for (int i = 0; i < innerList.size; i++) {
|
||||
list.add(null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
default:
|
||||
if (listFieldClazz != null && listFieldClazz.isArray()) {
|
||||
// Slower catch-all implementation
|
||||
|
|
|
@ -34,11 +34,12 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 16, 2011 8070 ekladstrup Initial creation
|
||||
* Aug 09, 2011 9696 gzhou add handle for request from nativeLib
|
||||
* May 15, 2013 1869 bsteffen Remove DataURI column from ldadmesonet.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Feb 16, 2011 8070 ekladstrup Initial creation
|
||||
* Aug 09, 2011 9696 gzhou add handle for request from nativeLib
|
||||
* May 15, 2013 1869 bsteffen Remove DataURI column from ldadmesonet.
|
||||
* Nov 26, 2013 2537 bsteffen Use constants in the request class.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -78,19 +79,21 @@ public class PointDataServerRequestHandler implements
|
|||
|
||||
// get mode
|
||||
String mode = "";
|
||||
constraint = map.get("mode");
|
||||
constraint = map.get(PointDataServerRequest.REQUEST_MODE_KEY);
|
||||
if (constraint != null) {
|
||||
mode = constraint.getConstraintValue();
|
||||
map.remove("mode");
|
||||
map.remove(PointDataServerRequest.REQUEST_MODE_KEY);
|
||||
}
|
||||
|
||||
// create PointDataQuery
|
||||
PointDataQuery query = new PointDataQuery(pluginName);
|
||||
|
||||
// find requested parameters if applicable
|
||||
if (map.containsKey("requestedParameters")) {
|
||||
String params = map.get("requestedParameters").getConstraintValue();
|
||||
map.remove("requestedParameters");
|
||||
if (map.containsKey(PointDataServerRequest.REQUEST_PARAMETERS_KEY)) {
|
||||
String params = map.get(
|
||||
PointDataServerRequest.REQUEST_PARAMETERS_KEY)
|
||||
.getConstraintValue();
|
||||
map.remove(PointDataServerRequest.REQUEST_PARAMETERS_KEY);
|
||||
query.setParameters(params);
|
||||
}
|
||||
|
||||
|
@ -103,7 +106,7 @@ public class PointDataServerRequestHandler implements
|
|||
}
|
||||
|
||||
// check if requestAllLevels should be called or only specific levels
|
||||
if (mode.equals("select2d")) {
|
||||
if (mode.equals(PointDataServerRequest.REQUEST_MODE_2D)) {
|
||||
query.requestAllLevels();
|
||||
} else if (mode.equals("selectSpecific")) {
|
||||
query.requestSpecificLevel(levelParameter, levelValues);
|
||||
|
@ -111,7 +114,7 @@ public class PointDataServerRequestHandler implements
|
|||
|
||||
// perform action based on mode
|
||||
PointDataContainer container = null;
|
||||
if (mode.equals("getParameters")) {
|
||||
if (mode.equals(PointDataServerRequest.REQUEST_MODE_PARAMETERS)) {
|
||||
return query.getAvailableParameters();
|
||||
} else {
|
||||
container = query.execute();
|
||||
|
|
Loading…
Add table
Reference in a new issue