/** * Deserialize date from general dateTime text. Date values are expected to match W3C XML Schema * standard format as CCYY-MM-DDThh:mm:ss, with optional leading minus sign and trailing seconds * decimal, as necessary. This method follows standard JiBX deserializer usage requirements by * accepting a <code>null</code> input. * * @param text text to be parsed (may be <code>null</code>) * @return converted date, or <code>null</code> if passed <code>null</code> input * @throws IllegalArgumentException on parse error */ public static Date deserializeDateTime(String text) throws IllegalArgumentException { if (text == null) { return null; } else { return new Date(parseDateTime(text)); } }
Timestamp stamp = new Timestamp(parseDateTime(text)); stamp.setNanos(nano);
/** * Deserialize date from general dateTime text. Date values are expected to * match W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss, with * optional leading minus sign and trailing seconds decimal, as necessary. * This method follows standard JiBX deserializer usage requirements by * accepting a <code>null</code> input. * * @param text text to be parsed (may be <code>null</code>) * * @return converted date, or <code>null</code> if passed <code>null</code> * input * * @throws IllegalArgumentException on parse error */ public static Date deserializeDateTime(String text) throws IllegalArgumentException { if (text == null) { return null; } else { return new Date(parseDateTime(text)); } }
/** * Deserialize date from general dateTime text. Date values are expected to * match W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss, with * optional leading minus sign and trailing seconds decimal, as necessary. * This method follows standard JiBX deserializer usage requirements by * accepting a <code>null</code> input. * * @param text text to be parsed (may be <code>null</code>) * * @return converted date, or <code>null</code> if passed <code>null</code> * input * * @throws IllegalArgumentException on parse error */ public static Date deserializeDateTime(String text) throws IllegalArgumentException { if (text == null) { return null; } else { return new Date(parseDateTime(text)); } }
Timestamp stamp = new Timestamp(parseDateTime(text)); stamp.setNanos(nano);
Timestamp stamp = new Timestamp(parseDateTime(text)); stamp.setNanos(nano);
} else { try { dateToMatch = new Date(DateUtil.parseDateTime(this.toMatch.toString())); } catch (IllegalArgumentException e) { throw new ServiceException(
if (referenceValue != null) { try { refValue = new Date(DateUtil.parseDateTime(referenceValue)); } catch (IllegalArgumentException e) { try { if (referenceValue != null) { try { refValue = new Date(DateUtil.parseDateTime(referenceValue)); } catch (IllegalArgumentException e) { try {
} else { try { refDate = new Date(DateUtil.parseDateTime(referenceValue)); } catch (IllegalArgumentException e) { throw new ServiceException(
@Test public void testExplicitFixedTimeCoverageSelector() throws Exception { String fixedTimeStr = "2012-06-01T03:00:00.000Z"; // Use explicit default value strategy: DimensionDefaultValueSetting defaultValueSetting = new DimensionDefaultValueSetting(); defaultValueSetting.setStrategyType(Strategy.FIXED); defaultValueSetting.setReferenceValue(fixedTimeStr); setupResourceDimensionDefaultValue(WATTEMP_FUTURE, ResourceInfo.TIME, defaultValueSetting); long fixedTime = DateUtil.parseDateTime(fixedTimeStr); CoverageInfo coverage = getCatalog().getCoverageByName(WATTEMP_FUTURE.getLocalPart()); java.util.Date d = (java.util.Date) wms.getDefaultTime(coverage); assertTrue("Returns a valid Default time", d != null); assertTrue("Default time should be the fixed one", d.getTime() == fixedTime); }
getCatalog().getFeatureTypeByName(TIME_ELEVATION_CUSTOM.getLocalPart()); long fixed = DateUtil.parseDateTime(fixedStr);
@Test public void testExplicitFixedTimeVectorSelector() throws Exception { int fid = 1000; String fixedTimeStr = "2012-06-01T03:00:00.000Z"; // Use explicit default value DimensionInfo setup: DimensionDefaultValueSetting defaultValueSetting = new DimensionDefaultValueSetting(); defaultValueSetting.setStrategyType(Strategy.FIXED); defaultValueSetting.setReferenceValue(fixedTimeStr); long fixedTime = DateUtil.parseDateTime(fixedTimeStr); setupFeatureTimeDimension(defaultValueSetting); FeatureTypeInfo timeWithStartEnd = getCatalog().getFeatureTypeByName(TIME_WITH_START_END.getLocalPart()); Date twoDaysAgo = addFeatureWithTimeTwoDaysAgo(fid++); this.addFeature(fid++, twoDaysAgo, Double.valueOf(0d)); java.util.Date d = (java.util.Date) wms.getDefaultTime(timeWithStartEnd); assertTrue("Default time is null", d != null); assertTrue("Default time should be the fixed one", d.getTime() == fixedTime); // Add some features with timestamps in the future: addFeatureWithTimeDayAfterTomorrow(fid++); addFeatureWithTimeOneYearFromNow(fid++); d = (java.util.Date) wms.getDefaultTime(timeWithStartEnd); assertTrue("Default time is null", d != null); assertTrue("Default time should be the fixed one", d.getTime() == fixedTime); addFeatureWithTimeTodayMidnight(fid++); d = (java.util.Date) wms.getDefaultTime(timeWithStartEnd); assertTrue("Default time is null", d != null); assertTrue("Default time should be the fixed one", d.getTime() == fixedTime); }