Issue #2731 Fixed calendar conversion issuse with OGC

Change-Id: I78bd0fd36082302bcbc83062671c8d77236cb632

Former-commit-id: 0847d1fb74 [formerly 737ed09ade] [formerly 973e5ab34b] [formerly 0847d1fb74 [formerly 737ed09ade] [formerly 973e5ab34b] [formerly 61c5133612 [formerly 973e5ab34b [formerly 9667ac26165431819cddab45ec2e081b6a560da8]]]]
Former-commit-id: 61c5133612
Former-commit-id: 3ac522a0f2 [formerly 0deff30baa] [formerly 470e15dc9f4113610a854d27cfa64bc48de14704 [formerly 786f3d1978]]
Former-commit-id: cd185b454a6cfeec5d05658c43917a2fa32c9fa1 [formerly 2f452749c2]
Former-commit-id: 34dcbd9032
This commit is contained in:
Dave Hladky 2014-01-22 15:03:01 -06:00
parent e07652ca7b
commit 33487f04c1
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.
**/
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.
*
* </pre>
*
@ -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;
}

View file

@ -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.
* </pre>
*
* @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.
}

View file

@ -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.
* </pre>
*
* @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);

View file

@ -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.
* </pre>
*
* @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();
}
}

View file

@ -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.
* </pre>
*
* @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()));

View file

@ -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.
*
* </pre>
*
@ -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;
}

View file

@ -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.
* </pre>
*
* @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,