Issue #2731 Fixed calendar conversion issuse with OGC

Change-Id: I78bd0fd36082302bcbc83062671c8d77236cb632

Former-commit-id: 737ed09ade [formerly 973e5ab34b] [formerly 737ed09ade [formerly 973e5ab34b] [formerly 61c5133612 [formerly 9667ac26165431819cddab45ec2e081b6a560da8]]]
Former-commit-id: 61c5133612
Former-commit-id: 0deff30baa [formerly 786f3d1978]
Former-commit-id: 2f452749c2
This commit is contained in:
Dave Hladky 2014-01-22 15:03:01 -06:00
parent 85c611c4aa
commit 34dcbd9032
7 changed files with 25 additions and 19 deletions

View file

@ -20,8 +20,8 @@ package com.raytheon.uf.common.dataplugin.madis;
* further licensing information. * further licensing information.
**/ **/
import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -74,6 +74,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Oct 14, 2013 2361 njensen Removed IDecoderGettable * Oct 14, 2013 2361 njensen Removed IDecoderGettable
* Dec 10, 2013 2616 mpduff Added stationId to the unique constraint * Dec 10, 2013 2616 mpduff Added stationId to the unique constraint
* jan 22, 2014 2713 dhladky Calendar conversion.
* *
* </pre> * </pre>
* *
@ -124,7 +125,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
/** A string denoting the time of observation */ /** A string denoting the time of observation */
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Date timeObs; private Calendar timeObs;
/** A float denoting the dewpoint temp */ /** A float denoting the dewpoint temp */
@DynamicSerializeElement @DynamicSerializeElement
@ -905,11 +906,11 @@ public class MadisRecord extends PersistablePluginDataObject implements
this.pressure_qcr = pressure_qcr; this.pressure_qcr = pressure_qcr;
} }
public void setTimeObs(Date timeObs) { public void setTimeObs(Calendar timeObs) {
this.timeObs = timeObs; this.timeObs = timeObs;
} }
public Date getTimeObs() { public Calendar getTimeObs() {
return timeObs; return timeObs;
} }

View file

@ -41,6 +41,7 @@ import org.apache.commons.beanutils.Converter;
* bphillip Initial Creation * bphillip Initial Creation
* Mar 13, 2013 1789 bsteffen Move Calendar and Date parsing out of * Mar 13, 2013 1789 bsteffen Move Calendar and Date parsing out of
* ConvertUtil and also fix date parsing. * ConvertUtil and also fix date parsing.
* jan 22, 2014 2731 dhladky Calendar converter now returns a calendar.
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -62,7 +63,7 @@ public class CalendarConverter implements Converter {
String date = (String) value; String date = (String) value;
try { try {
// see if string is in ISO 8601 // see if string is in ISO 8601
return DatatypeConverter.parseDateTime(date).getTime(); return DatatypeConverter.parseDateTime(date);
} catch (Exception e) { } catch (Exception e) {
// try to match the pattern. // try to match the pattern.
} }

View file

@ -21,7 +21,7 @@ package com.raytheon.uf.edex.plugin.madis.ogc;
**/ **/
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Calendar;
import java.util.List; import java.util.List;
import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.feature.simple.SimpleFeatureBuilder;
@ -46,6 +46,7 @@ import com.vividsolutions.jts.geom.Point;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 04/01/2013 1746 dhladky Initial creation * 04/01/2013 1746 dhladky Initial creation
* jan 22, 2014 2713 dhladky Calendar conversion.
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -97,7 +98,7 @@ public class MadisFeatureFactory implements FeatureFactory {
getFeatureType()); getFeatureType());
builder.set(LOCATION_KEY, record.getLocation().getLocation()); builder.set(LOCATION_KEY, record.getLocation().getLocation());
builder.set(MadisPointDataTransform.STATION_ID, record.getLocation().getStationId()); 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.PROVIDER, record.getProvider());
builder.set(MadisPointDataTransform.SUB_PROVIDER, record.getSubProvider()); builder.set(MadisPointDataTransform.SUB_PROVIDER, record.getSubProvider());
builder.set(MadisPointDataTransform.DATASET, record.getDataset()); builder.set(MadisPointDataTransform.DATASET, record.getDataset());
@ -155,7 +156,7 @@ public class MadisFeatureFactory implements FeatureFactory {
builder.setDefaultGeometry(LOCATION_KEY); builder.setDefaultGeometry(LOCATION_KEY);
builder.add(LOCATION_KEY, Point.class); builder.add(LOCATION_KEY, Point.class);
builder.add(MadisPointDataTransform.STATION_ID, String.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.PROVIDER, String.class);
builder.add(MadisPointDataTransform.SUB_PROVIDER, String.class); builder.add(MadisPointDataTransform.SUB_PROVIDER, String.class);
builder.add(MadisPointDataTransform.DATASET, Integer.class); builder.add(MadisPointDataTransform.DATASET, Integer.class);

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.edex.plugin.madis.ogc;
**/ **/
import java.util.Calendar; import java.util.Calendar;
import java.util.TimeZone;
import com.raytheon.uf.common.dataplugin.madis.MadisRecord; import com.raytheon.uf.common.dataplugin.madis.MadisRecord;
import com.raytheon.uf.edex.ogc.common.db.ILayerStore; 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 * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 04/01/2013 1746 dhladky Initial creation * 04/01/2013 1746 dhladky Initial creation
* jan 22, 2014 2713 dhladky Calendar conversion.
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -60,9 +60,7 @@ public class MadisLayerCollector extends
*/ */
@Override @Override
protected Calendar getTime(MadisRecord record) { protected Calendar getTime(MadisRecord record) {
Calendar rval = Calendar.getInstance(TimeZone.getTimeZone("GMT")); return record.getTimeObs();
rval.setTime(record.getTimeObs());
return rval;
} }
} }

View file

@ -24,6 +24,7 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.List; import java.util.List;
import java.util.TimeZone;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; 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 * Jun 03, 2013 1763 dhladky Altered QCD values map
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Sept 19,2013 2388 dhladky Fixed creation of geometry (location assignment) * Sept 19,2013 2388 dhladky Fixed creation of geometry (location assignment)
* jan 22, 2014 2713 dhladky Calendar conversion.
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -250,10 +252,9 @@ public class Madis extends AbstractFeatureType {
record.setSubProvider(this.getSub_provider()); record.setSubProvider(this.getSub_provider());
record.setDataset(this.getDataset()); record.setDataset(this.getDataset());
record.setRestriction(this.getRestriction()); record.setRestriction(this.getRestriction());
Date date = new Date(this.getTimeObs().toGregorianCalendar() Calendar cal = this.getTimeObs().toGregorianCalendar();
.getTimeInMillis()); record.setDataTime(new DataTime(cal.getTime()));
record.setDataTime(new DataTime(date)); record.setTimeObs(cal);
record.setTimeObs(date);
record.setLocation(getSfcObsLocation(this.getObsLocation())); record.setLocation(getSfcObsLocation(this.getObsLocation()));
record.setDewpoint(this.getDewpoint()); record.setDewpoint(this.getDewpoint());
record.setDewpoint_qcd(QCD.fromVal(this.getDewpoint_qcd())); record.setDewpoint_qcd(QCD.fromVal(this.getDewpoint_qcd()));

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.edex.plugin.madis.ogc.MadisLayer;
* Sept 2, 2013 #2098 dhladky Improved time management. * Sept 2, 2013 #2098 dhladky Improved time management.
* Sept 9, 2013 #2351 dhladky Speed improvements * Sept 9, 2013 #2351 dhladky Speed improvements
* Jan 13, 2014 #2679 dhladky multiple ingest layers for a single request window. * Jan 13, 2014 #2679 dhladky multiple ingest layers for a single request window.
* jan 22, 2014 2713 dhladky Calendar conversion.
* *
* </pre> * </pre>
* *
@ -79,7 +80,7 @@ public class MadisRegistryCollectorAddon extends
*/ */
@Override @Override
protected Date getTime(MadisRecord record) { protected Date getTime(MadisRecord record) {
Date time = record.getTimeObs(); Date time = record.getTimeObs().getTime();
return time; return time;
} }

View file

@ -24,6 +24,7 @@ import java.io.File;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
@ -56,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jun 17, 2013 2113 dhladky QPID memory usage alleviation * Jun 17, 2013 2113 dhladky QPID memory usage alleviation
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Dec 10, 2013 2616 mpduff Set overwrite allowed on MadisRecord. * Dec 10, 2013 2616 mpduff Set overwrite allowed on MadisRecord.
* jan 22, 2014 2713 dhladky Calendar conversion.
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -792,9 +794,10 @@ public class MadisDecoder extends AbstractDecoder {
sb.append(":01"); sb.append(":01");
try { try {
Date time = getDateFormatter().get().parse(sb.toString()); 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) { } catch (ParseException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,