Examples of DateType


Examples of ucar.nc2.units.DateType

    entries.addContent( entry);
    String id = StringUtil.allow( ds.getUniqueID(), ".", '-');
    entry.setAttribute("entry", id);
    entry.addContent("THREDDS-motherlode");

    DateType today = new DateType(false, new Date());
    Element dateInfo = new Element("dateInfo", defNS);
    metaElem.addContent( dateInfo);
    dateInfo.setAttribute("created", today.toDateString());
    dateInfo.setAttribute("accessioned", today.toDateString());

    Element status = new Element("statusOf", defNS);
    metaElem.addContent( status);
    status.setAttribute("status", "Accessioned");
View Full Code Here

Examples of ucar.nc2.units.DateType

    Element tp = new Element("timeAndPeriod", defNS);
    Element ti = new Element("timeInfo", defNS);
    tc.addContent(tp.addContent(ti));

    Element time;
    DateType startDate = dateRange.getStart();
    DateType endDate = dateRange.getEnd();
    if (endDate.isPresent()) {

      String units = "Days ago";
      TimeDuration duration = dateRange.getDuration();
      double value = -0.0;

      try {
        TimeUnit tdayUnit = new TimeUnit("days");
        value = duration.getValue(tdayUnit);

      } catch (Exception e) {
        e.printStackTrace();
      }

      time = new Element("timeRelative", defNS);
      Element begin = new Element("begin", defNS);
      begin.setAttribute("units", units);
      begin.addContent(Double.toString(value));
      time.addContent( begin);

      Element end = new Element("end", defNS);
      end.setAttribute("units", units);
      end.addContent("0");
      time.addContent( end);

    } else {
      // LOOK not tested
      time = new Element("timeAD", defNS);
      Element begin = new Element("begin", defNS);
      begin.setAttribute("date", startDate.toDateString());
      time.addContent( begin);

      Element end = new Element("end", defNS);
      end.setAttribute("date", endDate.toDateString());
      time.addContent( end);
    }

    ti.addContent(time);
    return tc;
View Full Code Here

Examples of ucar.nc2.units.DateType

    startTime.delete( 0, matcher.start());

    try
    {
      ( (InvDatasetImpl) dataset ).setTimeCoverage(
              new DateRange( new DateType( startTime.toString(), null, null ), null,
                             new TimeDuration( this.duration ), null ) );
    }
    catch ( Exception e )
    {
      log.warn( "addMetadata(): Start time <" + startTime.toString() + "> or duration <" + this.duration + "> not parsable" +
View Full Code Here

Examples of ucar.nc2.units.DateType

    if (lastModDate.getType() == null || !lastModDate.getType().equals("modified")) {
      throw new IllegalArgumentException("Date type must be \"modified\" (was \"" + lastModDate.getType() + "\").");
    }

    // Check for existing last modified date and remove if one exists.
    DateType curLastModDateType = this.getLastModifiedDate();
    if (curLastModDateType != null) {
      tm.getDates().remove(curLastModDateType);
    }

    // Set the last modified date with the given DateType.
View Full Code Here

Examples of ucar.nc2.units.DateType

  public void setLastModifiedDate(Date lastModDate) {
    if (lastModDate == null)
      throw new IllegalArgumentException("Last modified date can't be null.");

    // Set the last modified date with the given Date.
    DateType lastModDateType = new DateType(false, lastModDate);
    lastModDateType.setType("modified");
    setLastModifiedDate(lastModDateType);
  }
View Full Code Here

Examples of ucar.nc2.units.DateType

    }

    DateRange tc = ds.getTimeCoverage();
    if (tc != null) {
      buff.append("<h3>TimeCoverage:</h3>\n<ul>\n");
      DateType start = tc.getStart();
      if ((start != null) && !start.isBlank())
        buff.append(" <li><em>  Start: </em> ").append(start.toDateTimeString()).append("\n");
      DateType end = tc.getEnd();
      if ((end != null) && !end.isBlank()) {
        buff.append(" <li><em>  End: </em> ").append(end.toDateTimeString()).append("\n");
      }
      TimeDuration duration = tc.getDuration();
      if ((duration != null) && !duration.isBlank())
        buff.append(" <li><em>  Duration: </em> ").append(StringUtil.quoteHtmlContent(duration.toString())).append("\n");
      TimeDuration resolution = tc.getResolution();
View Full Code Here

Examples of ucar.nc2.units.DateType

    private ThreddsCatalogUtils() {}

    public static DateType datePointToDateType( ThreddsMetadata.DatePoint datePoint )
            throws ParseException
    {
        return new DateType( datePoint.getDate(), datePoint.getDateFormat(), datePoint.getType());
    }
View Full Code Here

Examples of ucar.nc2.units.DateType

    }

    public static DateType datePointBuilderToDateType( ThreddsMetadataBuilder.DatePointBuilder datePoint )
            throws ParseException
    {
        return new DateType( datePoint.getDate(), datePoint.getDateFormat(), datePoint.getType());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.