Android Open Source - PhoneGap-Calendar-Plugin Calendar Url






From Project

Back to project page PhoneGap-Calendar-Plugin.

License

The source code is released under:

Apache License

If you think the Android project PhoneGap-Calendar-Plugin listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (c) 2010 Google Inc./*from w w  w  . j  a  v a  2  s  .c o  m*/
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */


/*
 *  Modified by Sergio Martinez. Copyright 2011 Vodafone Group Services Ltd.
 * 
 */

package com.phonegap.calendar.android.model;

import com.google.api.client.googleapis.GoogleUrl;
import com.google.api.client.util.Key;
import com.phonegap.calendar.android.core.CalendarClient;

/**
 * With this class we can instanciate a CalendarUrl object and
 * later obtain the requested feeds in each method corresponding to
 * the operation we want perform
 * @author Yaniv Inbar
 * @author Sergio Martinez Rodriguez
 */
public class CalendarUrl extends GoogleUrl {

  public static final String ROOT_URL = "https://www.google.com/calendar/feeds";

  /**
   * Parameter max-results in CalendarUrl object, 
   * represents the maximum results we can get 
   * for the requested operation
   */
  @Key("max-results")
  public Integer maxResults;

  /**
   * Parameter start-min in CalendarUrl object, represents the 
   * minimum start date of event for the requested search
   */
  @Key("start-min")
  public String startMin;
  
  /**
   * Parameter start-max in CalendarUrl object, represents the 
   * maximum start date of event for the requested search
   */
  @Key("start-max")
  public String startMax;
  
  /**
   * Parameter q in CalendarUrl object, represents that the request
   * performed is going to be like a query at calendar asking just for
   * the events containing the given value for q as search parameter 
   */
  @Key("q")
  public String title;
  

  /**
   * Constructor using an URL String 
   * @param url String with the provided URL
   */
  public CalendarUrl(String url) {
    super(url);
    if (CalendarClient.DEBUG) {
      this.prettyprint = true;
    }
  }

  /**
   * Root user calendar Url
   * @return CalendarUrl
   */
  private static CalendarUrl forRoot() {
    return new CalendarUrl(ROOT_URL);
  }

  /**
   * Default calendar Url
   * @return CalendarUrl
   */
  public static CalendarUrl forCalendarMetafeed() {
    CalendarUrl result = forRoot();
    result.pathParts.add("default");
    return result;
  }

  /**
   * Url for getting all user's calendars
   * @return CalendarUrl
   */
  public static CalendarUrl forAllCalendarsFeed() {
    CalendarUrl result = forCalendarMetafeed();
    result.pathParts.add("allcalendars");
    result.pathParts.add("full");
    return result;
  }

  /**
   * Url for getting owned user's calendars
   * @return CalendarUrl
   */
  public static CalendarUrl forOwnCalendarsFeed() {
    CalendarUrl result = forCalendarMetafeed();
    result.pathParts.add("owncalendars");
    result.pathParts.add("full");
    return result;
  }

  /**
   * Url for getting provided user's calendar events with specified parameters
   * @param userId authenticathed user
   * @param visibility visibility
   * @param  projection projection
   * @return CalendarUrl
   */
  public static CalendarUrl forEventFeed(String userId, String visibility, String projection) {
    CalendarUrl result = forRoot();
    result.pathParts.add(userId);
    result.pathParts.add(visibility);
    result.pathParts.add(projection);
    return result;
  }

  /**
   * Url for getting all authenticathed user events
   * @return CalendarUrl
   */
  public static CalendarUrl forDefaultPrivateFullEventFeed() {
    return forEventFeed("default", "private", "full");
  }
 
  /**
   *  Url for getting authenticathed user events with title search param
   * @return CalendarUrl
   */
  public static CalendarUrl forDefaultPrivateFullEventFeedueriedByTittle(String title) {
      CalendarUrl result = forDefaultPrivateFullEventFeed();
      result.title = (title);
      return result;
    }
  
  /**
   * Url for getting authenticathed user events between the given dates
   * @param startMin min startDate for retrieved events
   * @param startMax max startDate for retrieved events
   * @return CalendarUrl
   */
  public static CalendarUrl forDefaultPrivateFullEventFeedBetweenDates(String startMin, String startMax) {
      CalendarUrl result = forDefaultPrivateFullEventFeed();
      if (startMin!=null)
        result.startMin=startMin;
      if (startMax!=null)
        result.startMax=startMax;
      return result;
    }
  
}




Java Source Code List

com.phonegap.calendar.android.accounts.AccountsUtils.java
com.phonegap.calendar.android.accounts.GoogleAccountUtils.java
com.phonegap.calendar.android.accounts.package-info.java
com.phonegap.calendar.android.adapters.Calendar.java
com.phonegap.calendar.android.adapters.CalendarsManager.java
com.phonegap.calendar.android.adapters.Dt.java
com.phonegap.calendar.android.adapters.Duration.java
com.phonegap.calendar.android.adapters.Event.java
com.phonegap.calendar.android.adapters.Recurrence.java
com.phonegap.calendar.android.adapters.Rule.java
com.phonegap.calendar.android.adapters.package-info.java
com.phonegap.calendar.android.core.CalendarClientFactory.java
com.phonegap.calendar.android.core.CalendarClient.java
com.phonegap.calendar.android.core.CalendarOps.java
com.phonegap.calendar.android.core.package-info.java
com.phonegap.calendar.android.model.AttendeeStatus.java
com.phonegap.calendar.android.model.Author.java
com.phonegap.calendar.android.model.BatchOperation.java
com.phonegap.calendar.android.model.BatchStatus.java
com.phonegap.calendar.android.model.CalendarEntry.java
com.phonegap.calendar.android.model.CalendarFeed.java
com.phonegap.calendar.android.model.CalendarUrl.java
com.phonegap.calendar.android.model.Category.java
com.phonegap.calendar.android.model.Comments.java
com.phonegap.calendar.android.model.Entry.java
com.phonegap.calendar.android.model.EventEntry.java
com.phonegap.calendar.android.model.EventFeed.java
com.phonegap.calendar.android.model.FeedLink.java
com.phonegap.calendar.android.model.Feed.java
com.phonegap.calendar.android.model.Link.java
com.phonegap.calendar.android.model.Reminder.java
com.phonegap.calendar.android.model.Value.java
com.phonegap.calendar.android.model.When.java
com.phonegap.calendar.android.model.Where.java
com.phonegap.calendar.android.model.Who.java
com.phonegap.calendar.android.model.package-info.java
com.phonegap.calendar.android.utils.DateUtils.java
com.phonegap.calendar.android.utils.package-info.java
com.phonegap.calendar.app.ApplicationActivity.java
com.trial.phonegap.plugin.calendar.CalendarAccessorCreator.java
com.trial.phonegap.plugin.calendar.CalendarAccessorGoogle.java
com.trial.phonegap.plugin.calendar.CalendarAccessorMock.java
com.trial.phonegap.plugin.calendar.CalendarPlugin.java