Package com.google.gdata.data

Examples of com.google.gdata.data.DateTime


                feedEntry.addHtmlLink(alternate, "", "alternate");
            }

            Date date = item.getDate();
            if (date != null) {
                DateTime datetime = new DateTime(date);
                feedEntry.setUpdated(datetime);
            }
            return feedEntry;

        } else if (data != null) {
View Full Code Here


    // set data on event
    entry.setTitle(new PlainTextConstruct(event.getTitle()));
    entry.setContent(new PlainTextConstruct(event.getDescription()));
    When when = new When();
    DateTime startDateTime = new DateTime(event.getStartDate());
    startDateTime.setDateOnly(true);

    // we must add 1 day to the event as the end-date is exclusive
    Calendar endDateCal = new GregorianCalendar();
    endDateCal.setTime(event.getEndDate());
    endDateCal.add(Calendar.DATE, 1);
    DateTime endDateTime = new DateTime(endDateCal.getTime());
    endDateTime.setDateOnly(true);

    when.setStartTime(startDateTime);
    when.setEndTime(endDateTime);
    entry.getTimes().add(when);
    if (event.getCalendarUrl() != null) {
View Full Code Here

    // this sample currently only demonstrates publishing all-day events
    // an event in Google Base must have a start-time and end-time, so
    // this simulates that by adding 1 day to the end-date specified, if the
    // start and end times are identical
    DateTime startDateTime = new DateTime(event.getStartDate());
    startDateTime.setDateOnly(true);

    DateTime endDateTime = null;

    if (event.getStartDate().equals(event.getEndDate())) {
      Calendar endDateCal = new GregorianCalendar();
      endDateCal.setTime(event.getEndDate());
      endDateCal.add(Calendar.DATE, 1);
      endDateTime = new DateTime(endDateCal.getTime());
    } else {
      endDateTime = new DateTime(event.getEndDate());
    }
    endDateTime.setDateOnly(true);
 
    gbaseAttributes.addDateTimeRangeAttribute("event date range",
        new DateTimeRange(startDateTime, endDateTime));
   
    gbaseAttributes.addTextAttribute("event performer", "Google mashup test");
View Full Code Here

      InputStream resultStream = request.getResponseStream();

      mediaSource = new MediaStreamSource(resultStream,
          request.getResponseContentType().toString());

      DateTime lastModified =
          request.getResponseDateHeader(GDataProtocol.Header.LAST_MODIFIED);
      if (lastModified != null) {
        mediaSource.setLastModified(lastModified);
      }
      String etag = request.getResponseHeader(GDataProtocol.Header.ETAG);
View Full Code Here

        + uname + "/private/composite";
    String fields = "entry(@gd:etag,id,title,gd:who[@email='" + uname + "'])";

    CalendarQuery partialQuery = new CalendarQuery(new URL(eventsFeedUrl));
    partialQuery.setFields(fields);
    DateTime startTime = DateTime.now();
    partialQuery.setMinimumStartTime(startTime);
    partialQuery.setMaximumStartTime(
        new DateTime(startTime.getValue() + 604800000, startTime.getTzShift()));

    CalendarEventFeed events = service.query(
        partialQuery, CalendarEventFeed.class);
    for (CalendarEventEntry event : events.getEntries()) {
      String eventId = event.getId()
View Full Code Here

    // If a recurrence was requested, add it. Otherwise, set the
    // time (the current date and time) and duration (30 minutes)
    // of the event.
    if (recurData == null) {
      Calendar calendar = new GregorianCalendar();
      DateTime startTime = new DateTime(calendar.getTime(), TimeZone
          .getDefault());

      calendar.add(Calendar.MINUTE, 30);
      DateTime endTime = new DateTime(calendar.getTime(),
          TimeZone.getDefault());

      When eventTimes = new When();
      eventTimes.setStartTime(startTime);
      eventTimes.setEndTime(endTime);
View Full Code Here

   */
  private void queryEntries(ContactsExampleParameters parameters)
      throws IOException, ServiceException {
    Query myQuery = new Query(feedUrl);
    if (parameters.getUpdatedMin() != null) {
      DateTime startTime = DateTime.parseDateTime(parameters.getUpdatedMin());
      myQuery.setUpdatedMin(startTime);
    }
    if (parameters.getMaxResults() != null) {
      myQuery.setMaxResults(parameters.getMaxResults().intValue());
    }
View Full Code Here

           
            Date pubDate = getPublishedDate()==null ? postDate : getPublishedDate();
            Date edtDate = getEditedDate()==null ? postDate : getEditedDate();
            Date updDate = getUpdatedDate()==null ? postDate : getUpdatedDate();
           
            e.setPublished(new DateTime(pubDate, tz));
            e.setEdited(new DateTime(edtDate, tz));
            e.setUpdated(new DateTime(updDate, tz));
           
            String blogId = getBlogID();
            if (blogId == null)
                throw new ArgumentNotSetException("blogID");
           
View Full Code Here

  }
 
  public void testMakeDocumentExtractsRequiredMetadata() {
    String id = "ID";
    String uri = "http://localhost";
    DateTime dt = DateTime.now();
    String contentNonce = "\u9762" + System.currentTimeMillis();
   
    Entry entry = new Entry();
    entry.setId(id);
    entry.setUpdated(dt);
    entry.addHtmlLink(uri, "en", "example");
    entry.setContent(
        TextConstruct.create(TextConstruct.Type.TEXT, contentNonce, null));
   
    Document doc = null;
    try {
      doc = GdConnector.makeDocument(entry);
    } catch (RepositoryException re) {
      fail(re.toString());
    }
   
    assertEquals(id,
        getFirstStringValue(doc, SpiConstants.PROPNAME_DOCID));
    assertEquals(uri,
        getFirstStringValue(doc, SpiConstants.PROPNAME_DISPLAYURL));
    assertEquals(dt.toStringRfc822(),
        getFirstStringValue(doc, SpiConstants.PROPNAME_LASTMODIFIED));
    assertTrue(getFirstStringValue(doc, SpiConstants.PROPNAME_CONTENT)
        .contains(contentNonce));
  }
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

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.