diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java index 4b06740e42..dd37c4793a 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java @@ -20,8 +20,8 @@ package com.raytheon.uf.common.dataplugin.madis; * further licensing information. **/ +import java.util.Calendar; import java.util.Collections; -import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -74,6 +74,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Oct 14, 2013 2361 njensen Removed IDecoderGettable * Dec 10, 2013 2616 mpduff Added stationId to the unique constraint + * jan 22, 2014 2713 dhladky Calendar conversion. * * * @@ -124,7 +125,7 @@ public class MadisRecord extends PersistablePluginDataObject implements /** A string denoting the time of observation */ @DynamicSerializeElement @Transient - private Date timeObs; + private Calendar timeObs; /** A float denoting the dewpoint temp */ @DynamicSerializeElement @@ -905,11 +906,11 @@ public class MadisRecord extends PersistablePluginDataObject implements this.pressure_qcr = pressure_qcr; } - public void setTimeObs(Date timeObs) { + public void setTimeObs(Calendar timeObs) { this.timeObs = timeObs; } - public Date getTimeObs() { + public Calendar getTimeObs() { return timeObs; } diff --git a/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/CalendarConverter.java b/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/CalendarConverter.java index 77268b284f..2ca31e996f 100644 --- a/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/CalendarConverter.java +++ b/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/CalendarConverter.java @@ -41,6 +41,7 @@ import org.apache.commons.beanutils.Converter; * bphillip Initial Creation * Mar 13, 2013 1789 bsteffen Move Calendar and Date parsing out of * ConvertUtil and also fix date parsing. + * jan 22, 2014 2731 dhladky Calendar converter now returns a calendar. * * * @author bphillip @@ -62,7 +63,7 @@ public class CalendarConverter implements Converter { String date = (String) value; try { // see if string is in ISO 8601 - return DatatypeConverter.parseDateTime(date).getTime(); + return DatatypeConverter.parseDateTime(date); } catch (Exception e) { // try to match the pattern. } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisFeatureFactory.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisFeatureFactory.java index 4a01d2f377..c2ed9e13f6 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisFeatureFactory.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisFeatureFactory.java @@ -21,7 +21,7 @@ package com.raytheon.uf.edex.plugin.madis.ogc; **/ import java.util.ArrayList; -import java.util.Date; +import java.util.Calendar; import java.util.List; import org.geotools.feature.simple.SimpleFeatureBuilder; @@ -46,6 +46,7 @@ import com.vividsolutions.jts.geom.Point; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 04/01/2013 1746 dhladky Initial creation + * jan 22, 2014 2713 dhladky Calendar conversion. * * * @author dhladky @@ -97,7 +98,7 @@ public class MadisFeatureFactory implements FeatureFactory { getFeatureType()); builder.set(LOCATION_KEY, record.getLocation().getLocation()); builder.set(MadisPointDataTransform.STATION_ID, record.getLocation().getStationId()); - builder.set(MadisPointDataTransform.TIME_OBS, record.getTimeObs().getTime()); + builder.set(MadisPointDataTransform.TIME_OBS, record.getTimeObs()); builder.set(MadisPointDataTransform.PROVIDER, record.getProvider()); builder.set(MadisPointDataTransform.SUB_PROVIDER, record.getSubProvider()); builder.set(MadisPointDataTransform.DATASET, record.getDataset()); @@ -155,7 +156,7 @@ public class MadisFeatureFactory implements FeatureFactory { builder.setDefaultGeometry(LOCATION_KEY); builder.add(LOCATION_KEY, Point.class); builder.add(MadisPointDataTransform.STATION_ID, String.class); - builder.add(MadisPointDataTransform.TIME_OBS, Date.class); + builder.add(MadisPointDataTransform.TIME_OBS, Calendar.class); builder.add(MadisPointDataTransform.PROVIDER, String.class); builder.add(MadisPointDataTransform.SUB_PROVIDER, String.class); builder.add(MadisPointDataTransform.DATASET, Integer.class); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisLayerCollector.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisLayerCollector.java index fcb7ad08ac..ce096a1e2c 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisLayerCollector.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisLayerCollector.java @@ -21,7 +21,6 @@ package com.raytheon.uf.edex.plugin.madis.ogc; **/ import java.util.Calendar; -import java.util.TimeZone; import com.raytheon.uf.common.dataplugin.madis.MadisRecord; import com.raytheon.uf.edex.ogc.common.db.ILayerStore; @@ -36,6 +35,7 @@ import com.raytheon.uf.edex.ogc.common.db.SingleLayerCollector; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 04/01/2013 1746 dhladky Initial creation + * jan 22, 2014 2713 dhladky Calendar conversion. * * * @author dhladky @@ -60,9 +60,7 @@ public class MadisLayerCollector extends */ @Override protected Calendar getTime(MadisRecord record) { - Calendar rval = Calendar.getInstance(TimeZone.getTimeZone("GMT")); - rval.setTime(record.getTimeObs()); - return rval; + return record.getTimeObs(); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/feature/Madis.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/feature/Madis.java index 0f8470d055..1fb06ec5ab 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/feature/Madis.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/feature/Madis.java @@ -24,6 +24,7 @@ import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; +import java.util.TimeZone; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -56,6 +57,7 @@ import com.raytheon.uf.edex.ogc.common.feature.ObsLocation; * Jun 03, 2013 1763 dhladky Altered QCD values map * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Sept 19,2013 2388 dhladky Fixed creation of geometry (location assignment) + * jan 22, 2014 2713 dhladky Calendar conversion. * * * @author dhladky @@ -250,10 +252,9 @@ public class Madis extends AbstractFeatureType { record.setSubProvider(this.getSub_provider()); record.setDataset(this.getDataset()); record.setRestriction(this.getRestriction()); - Date date = new Date(this.getTimeObs().toGregorianCalendar() - .getTimeInMillis()); - record.setDataTime(new DataTime(date)); - record.setTimeObs(date); + Calendar cal = this.getTimeObs().toGregorianCalendar(); + record.setDataTime(new DataTime(cal.getTime())); + record.setTimeObs(cal); record.setLocation(getSfcObsLocation(this.getObsLocation())); record.setDewpoint(this.getDewpoint()); record.setDewpoint_qcd(QCD.fromVal(this.getDewpoint_qcd())); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/src/com/raytheon/uf/edex/plugin/madis/registry/MadisRegistryCollectorAddon.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/src/com/raytheon/uf/edex/plugin/madis/registry/MadisRegistryCollectorAddon.java index 237523dc73..00a781a4b0 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/src/com/raytheon/uf/edex/plugin/madis/registry/MadisRegistryCollectorAddon.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/src/com/raytheon/uf/edex/plugin/madis/registry/MadisRegistryCollectorAddon.java @@ -44,6 +44,7 @@ import com.raytheon.uf.edex.plugin.madis.ogc.MadisLayer; * Sept 2, 2013 #2098 dhladky Improved time management. * Sept 9, 2013 #2351 dhladky Speed improvements * Jan 13, 2014 #2679 dhladky multiple ingest layers for a single request window. + * jan 22, 2014 2713 dhladky Calendar conversion. * * * @@ -79,7 +80,7 @@ public class MadisRegistryCollectorAddon extends */ @Override protected Date getTime(MadisRecord record) { - Date time = record.getTimeObs(); + Date time = record.getTimeObs().getTime(); return time; } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisDecoder.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisDecoder.java index 496fd9db79..9a1d3d1c6a 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisDecoder.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisDecoder.java @@ -24,6 +24,7 @@ import java.io.File; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.TimeZone; @@ -56,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate; * Jun 17, 2013 2113 dhladky QPID memory usage alleviation * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Dec 10, 2013 2616 mpduff Set overwrite allowed on MadisRecord. + * jan 22, 2014 2713 dhladky Calendar conversion. * * * @author dhladky @@ -792,9 +794,10 @@ public class MadisDecoder extends AbstractDecoder { sb.append(":01"); try { - Date time = getDateFormatter().get().parse(sb.toString()); - rec.setTimeObs(time); + Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); + cal.setTime(time); + rec.setTimeObs(cal); } catch (ParseException e) { statusHandler.handle(Priority.PROBLEM,