Package com.google.gdata.data

Examples of com.google.gdata.data.DateTime


    registry.build(Entry.KEY, Entry.PUBLISHED, RSS)
        .setName(PUB_DATE)
        .setVirtualValue(new VirtualValue() {
          public Object generate(Element element,
              ElementMetadata<?, ?> metadata) {
            DateTime date = element.getTextValue(Entry.PUBLISHED);
            return date == null ? "" : date.toStringRfc822();
          }

          public void parse(Element element, ElementMetadata<?, ?> metadata,
              Object value) throws ParseException {
            DateTime parsed = DateTime.parseRfc822(value.toString());
            element.setTextValue(parsed);
          }
        });

    XmlWireFormatProperties personProperties = new XmlWireFormatProperties();
View Full Code Here


    registry.build(Feed.KEY, Feed.UPDATED, RSS)
        .setName(LAST_BUILD_DATE)
        .setVirtualValue(new VirtualValue() {
          public Object generate(Element element,
              ElementMetadata<?, ?> metadata) {
            DateTime date = element.getTextValue(Feed.UPDATED);
            return date == null ? "" : date.toStringRfc822();
          }

          public void parse(Element element, ElementMetadata<?, ?> metadata,
              Object value) throws ParseException {
            DateTime parsed = DateTime.parseRfc822(value.toString());
            element.setTextValue(parsed);
          }
        });
  }
View Full Code Here

     *
     * @param checkPoint ifModifiedSince date
     */
    public DocumentList resumeTraversal(String checkPoint)
      throws RepositoryException {
      DateTime ifModifiedSince = DateTime.parseDateTime(checkPoint);
      if (LOGGER.isLoggable(Level.INFO))
        LOGGER.info("Using ifModifiedSince of " + ifModifiedSince);
      return fetchResults(ifModifiedSince);
    }
View Full Code Here

     * @return a DocumentList of entries from the feed
     */
    private DocumentList fetchResults (DateTime ifModifiedSince)
      throws RepositoryException {
      List documents = new LinkedList();
      DateTime fetchTime = DateTime.now();
      Query query = new Query(feedUrl);
      query.setMaxResults(MAX_RESULTS);
      if (ifModifiedSince != null) {
        // The use of ifModifiedSince here filters out entries that were
        // modified before the given date.  Logically, we only care about those
        // entries that were modified recently.
        query.setUpdatedMin(ifModifiedSince);
      }
     
      try {
        // The use of ifModifiedSince here tells the server this can avoid
        // returning a result feed if the feed contained only entries that
        // have been modified after the given date.  Without this, when there
        // are no changes, we would still have all of the overhead of fetching
        // the feed's meta data but get zero entries.  In terms of efficiency,
        // we don't care about the feed unless it is going to tell us something
        // new.
        Feed feed = (Feed) service.query(query, Feed.class, ifModifiedSince);
        List entries = feed.getEntries();
        LOGGER.info("Fetched " + entries.size() + " of " +
            feed.getTotalResults() + " total updated entries.");
        Collections.sort(entries, new EntryUpdatedAscendingComparator());
        for (ListIterator ei = entries.listIterator(); ei.hasNext();) {
          Entry entry = (Entry) ei.next();
          documents.add(makeDocument(entry));
        }
      } catch (NotModifiedException nme) {
        // silently return empty result set
        if (LOGGER.isLoggable(Level.INFO))
          LOGGER.info(nme.toString());
      } catch (IOException ioe) {
        throw new RepositoryException(ioe);
      } catch (ServiceException se) {
        throw new RepositoryException(se);
      }
     
      return new GdDocumentList(documents, fetchTime.toString());
    }
View Full Code Here

    return httpConn.getHeaderField(headerName);
  }

  public DateTime getResponseDateHeader(String headerName) {
    long dateValue = httpConn.getHeaderFieldDate(headerName, -1);
    return (dateValue >= 0) ? new DateTime(dateValue) : null;
  }
View Full Code Here

  private DateTime dateToGDateTime(Date date) {
    Calendar cal = new GregorianCalendar();
    cal.setTime(date);
    cal.add(Calendar.MILLISECOND,
        cal.getTimeZone().getOffset(cal.getTimeInMillis()));
    return new DateTime(cal.getTime());
  }
View Full Code Here

            // closed
            // but as long as we can't do that this will have to do

            // initialize with issue creation date in case we don't find any
            // comments
            DateTime closingDate = issueEntry.getPublished();
            for (IssueCommentsEntry comment : comments.getEntries()) {
                Updates updates = comment.getUpdates();
                if (updates != null && issueEntry.getStatus().equals(updates.getStatus())) {
                    closingDate = comment.getPublished();
                }
View Full Code Here

            if (!StringUtils.isBlank(username) && !StringUtils.isBlank(password)) {
        myService.setUserCredentials(username, password);
            }
               
      CalendarQuery myQuery = new CalendarQuery(feedUrl);
      DateTime start = DateTime.now();
      DateTime end   = new DateTime(DateTime.now().getValue() + (2 * refreshInterval));
     
      myQuery.setMinimumStartTime(start);
      myQuery.setMaximumStartTime(end);
     
      // add the fulltext filter if it has been configured
View Full Code Here

   
    String jobIdentity = event.getIcalUID() + (isStartEvent ? "_start" : "_end");

    List<When> times = event.getTimes();
    for (When time : times) {
      DateTime date =
        isStartEvent ? time.getStartTime() : time.getEndTime();
      long dateValue = date.getValue();
     
      /* TODO: TEE: do only create a new trigger when the start/endtime
       * lies in the future. This exclusion is necessary because the SimpleTrigger
       * triggers a job even if the startTime lies in the past. If somebody
       * knows the way to let quartz ignore such triggers this exclusion
View Full Code Here

TOP

Related Classes of com.google.gdata.data.DateTime

Copyright © 2018 www.massapicom. 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.