Package com.google.api.gbase.client

Examples of com.google.api.gbase.client.GoogleBaseAttributesExtension


      // publishing new entry
      entry = new GoogleBaseEntry();  
    }

    // prepare an 'events and activities' item for publishing
    GoogleBaseAttributesExtension gbaseAttributes =
      entry.getGoogleBaseAttributes();
    entry.setTitle(new PlainTextConstruct(event.getTitle()));
    entry.setContent(new PlainTextConstruct(event.getDescription()));
    gbaseAttributes.setItemType("events and activities");

    // 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");
    gbaseAttributes.addUrlAttribute("performer url", "http://code.google.com/apis/gdata.html");
   
    if (event.getBaseUrl() != null) {
      // updating event
      baseService.update(event.getBaseUrl(), entry);
    } else {
View Full Code Here

TOP

Related Classes of com.google.api.gbase.client.GoogleBaseAttributesExtension

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.