diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java index c8b31f425a..3f0de7b2cb 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/Level.java @@ -43,7 +43,6 @@ import javax.xml.bind.annotation.XmlType; import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; -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.status.IUFStatusHandler; @@ -56,10 +55,12 @@ import com.raytheon.uf.common.status.UFStatus.Priority; *
  * SOFTWARE HISTORY
  * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Sep 03, 2009            rjpeter     Initial creation.
- * Dec 20, 2012           njensen   Added Level(String)
+ * Date          Ticket#    Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Sep 03, 2009           rjpeter     Initial creation.
+ * Dec 20, 2012           njensen     Added Level(String)
+ * Feb 12, 2014  2672     bsteffen    Allow String constructor to parse floats.
+ * 
  * 
* * @author rjpeter @@ -73,7 +74,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement @XmlType(namespace = "dataplugin-level") -public class Level extends PersistableDataObject implements ISerializableObject { +public class Level extends PersistableDataObject { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(Level.class); @@ -84,7 +85,7 @@ public class Level extends PersistableDataObject implements ISerializableObject private static final long serialVersionUID = 1L; private static final Pattern PATTERN = Pattern - .compile("([0-9]*)((_([0-9]*))??([a-zA-Z]+))"); + .compile("^(\\d*(?:\\.\\d*)?)(?:_(\\d*(?:\\.\\d*)?))?([a-zA-Z]+)$"); @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LEVEL_GENERATOR") @@ -133,8 +134,8 @@ public class Level extends PersistableDataObject implements ISerializableObject Matcher m = PATTERN.matcher(level); if (m.matches()) { String levelOne = m.group(1); - String levelTwo = m.group(4); - String name = m.group(5); + String levelTwo = m.group(2); + String name = m.group(3); levelonevalue = Double.parseDouble(levelOne); if (levelTwo != null) { diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/dataaccess/RadarGridFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/dataaccess/RadarGridFactory.java index d52d49f4a3..09c4ebb8e7 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/dataaccess/RadarGridFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/dataaccess/RadarGridFactory.java @@ -290,21 +290,21 @@ public class RadarGridFactory extends AbstractGridDataPluginFactory implements } constraints.put(PRODUCT_CODE, pcConstraint); } - if (request.getLevels() != null) { + Level[] levels = request.getLevels(); + if (levels != null && levels.length > 0) { RequestConstraint angleConstraint = new RequestConstraint(null, ConstraintType.IN); - for (Level level : request.getLevels()) { + for (Level level : levels) { angleConstraint.addToConstraintValueList(level .getLevelOneValueAsString()); } constraints.put(PRIMARY_ANGLE, angleConstraint); } - if (request.getLocationNames() != null) { - RequestConstraint icaoConstraint = new RequestConstraint(null, - ConstraintType.IN); - icaoConstraint.setConstraintValueList(request.getLocationNames()); - constraints.put(ICAO, icaoConstraint); + String[] locations = request.getLocationNames(); + if (locations != null && locations.length > 0) { + RequestConstraint rc = new RequestConstraint(locations); + constraints.put(ICAO, rc); } if (request.getEnvelope() != null) { diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/src/com/raytheon/uf/common/dataplugin/satellite/dataaccess/SatelliteGridFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/src/com/raytheon/uf/common/dataplugin/satellite/dataaccess/SatelliteGridFactory.java index 274342c8e8..dd118e6762 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/src/com/raytheon/uf/common/dataplugin/satellite/dataaccess/SatelliteGridFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.satellite/src/com/raytheon/uf/common/dataplugin/satellite/dataaccess/SatelliteGridFactory.java @@ -39,7 +39,6 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord; import com.raytheon.uf.common.dataplugin.satellite.units.SatelliteUnits; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; /** @@ -85,11 +84,11 @@ public class SatelliteGridFactory extends AbstractGridDataPluginFactory protected DefaultGridData constructGridDataResponse(IDataRequest request, PluginDataObject pdo, GridGeometry2D gridGeometry, DataSource dataSource) { - if(pdo instanceof SatelliteRecord == false){ + if (pdo instanceof SatelliteRecord == false) { throw new DataRetrievalException(this.getClass().getSimpleName() + " cannot handle " + pdo.getClass().getSimpleName()); } - + SatelliteRecord satelliteRecord = (SatelliteRecord) pdo; DefaultGridData defaultGridData = new DefaultGridData(dataSource, gridGeometry); @@ -140,19 +139,16 @@ public class SatelliteGridFactory extends AbstractGridDataPluginFactory .getIdentifiers().get(identifier).toString())); } } - if ((request.getParameters() == null) == false) { - RequestConstraint requestConstraint = new RequestConstraint(); - requestConstraint.setConstraintType(ConstraintType.IN); - requestConstraint.setConstraintValueList(request.getParameters()); - constraints.put(FIELD_PYHSICAL_ELEMENT, requestConstraint); + String[] parameters = request.getParameters(); + if (parameters != null && parameters.length > 0) { + RequestConstraint rc = new RequestConstraint(parameters); + constraints.put(FIELD_PYHSICAL_ELEMENT, rc); } - if ((request.getLocationNames() == null) == false) { - RequestConstraint requestConstraint = new RequestConstraint(); - requestConstraint.setConstraintType(ConstraintType.IN); - requestConstraint - .setConstraintValueList(request.getLocationNames()); - constraints.put(FIELD_SECTOR_ID, requestConstraint); + String[] locations = request.getLocationNames(); + if (locations != null && locations.length > 0) { + RequestConstraint rc = new RequestConstraint(locations); + constraints.put(FIELD_SECTOR_ID, rc); } return constraints; diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py index 2953f0dd9d..c5a71a03b5 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py @@ -27,7 +27,7 @@ # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 05/29/13 2023 dgilling Initial Creation. -# +# 02/12/14 2672 bsteffen Allow String constructor to parse floats. # @@ -37,7 +37,7 @@ import re from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.level import MasterLevel -LEVEL_NAMING_REGEX = re.compile("(\d*)((_(\d*))??([a-zA-Z]+))") +LEVEL_NAMING_REGEX = re.compile("^(\d*(?:\.\d*)?)(?:_(\d*(?:\.\d*)?))?([a-zA-Z]+)$") INVALID_VALUE = numpy.float64(-999999) class Level(object): @@ -53,8 +53,8 @@ class Level(object): matcher = LEVEL_NAMING_REGEX.match(str(levelString)) if matcher is not None: self.levelonevalue = numpy.float64(matcher.group(1)) - self.masterLevel = MasterLevel.MasterLevel(matcher.group(5)) - levelTwo = matcher.group(4) + self.masterLevel = MasterLevel.MasterLevel(matcher.group(3)) + levelTwo = matcher.group(2) if levelTwo: self.leveltwovalue = numpy.float64(levelTwo)