Thanks to John Goldfuss for supplying the following solution:
Where where = new Where("","",getLocation());
List locations = googleEntry.getLocations();
if(locations != null && locations.size() > 0){
locations.set(0, where);
}else{
googleEntry.addLocation(where);
}
Thanx, PLA
On Apr 3, 10:39 am, "PLA" <[EMAIL PROTECTED]> wrote:
> Hi
>
> I'm trying to add alocationto an existing CalendarEventEntry with
> the Java Client APIs. When I look at theeventafter the update
> everything but thelocationhas been successfully updated. Is there a
- Hide quoted text -
> trick I'm overlooking? Here is the routine. The user adds anevent
> with just the phone number in the title field and this routine fills
> in the rest of the fields for thecalendarevent.
>
> private void setNewAppointment(CalendarEventEntry
> calendarEventEntry, Employee employee) {
> String title =
> calendarEventEntry.getTitle().getPlainText().trim();
> logger.info(title);
> ServiceOrder serviceOrder =
> serviceOrderDAO.getServiceOrder(title);
> if (Utilities.isBlank(serviceOrder.getDirectoryName())) {
> logger.warning("Service order not found for phone number: " +
> title);
> return;
> }
> else {
> logger.info("Setting appointment for : " +
> serviceOrder.toString());
> }
> calendarEventEntry.setTitle(new
> PlainTextConstruct(serviceOrder.getDirectoryName()));
> calendarEventEntry.setContent(new
> PlainTextConstruct(getDescription(serviceOrder, employee,
> calendarEventEntry)));
> logger.info("Schedule for: " + employee.getEmailAddress());
> if (!Utilities.isBlank(employee.getEmailAddress())) {
> Where where = new Where(Where.Rel.EVENT, "Service Address",
> serviceOrder.getServiceAddress());
> calendarEventEntry.addLocation(where);
> calendarEventEntry.addHtmlLink(getUrlString(serviceOrder), null,
> null);
> ExtendedProperty extendedProperty = new ExtendedProperty();
> extendedProperty.setName("orderKey");
> extendedProperty.setValue(serviceOrder.getPhoneNumber() +
> serviceOrder.getOrderNumber());
> calendarEventEntry.addExtendedProperty(extendedProperty);
> EventEntry updatedEntry = null;
> try {
> updatedEntry = calendarEventEntry.update();
> logger.info("Updated entry title: " +
> updatedEntry.getTitle());
> updateServiceOrder(serviceOrder, calendarEventEntry,
> employee);
> }
> catch (Exception e) {
> logger.warning(e.getMessage());
> e.printStackTrace();
> Email.sendStackTrace(e);
> return;
> }
> logger.info("Published: " + updatedEntry.getPublished() + " " +
> serviceOrder.toString());
> }
> }
>
> Thanx, PLA
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---