Package net.fortuna.ical4j.model

Examples of net.fortuna.ical4j.model.Calendar


  /**
   * Internal load calendar file from filesystem.
   */
  // o_clusterOK by:cg This must not be synchronized because the caller already synchronized
  private Kalendar loadCalendarFromFile(String type, String calendarID) {
    Calendar calendar = readCalendar(type, calendarID);
    Kalendar kalendar = createKalendar(type, calendarID, calendar);
    return kalendar;
  }
View Full Code Here


    } catch (FileNotFoundException fne) {
      throw new OLATRuntimeException("Not found: " + calendarFile, fne);
    }
   
    CalendarBuilder builder = new CalendarBuilder();
    Calendar calendar = null;
    try {
      calendar = builder.build(in);
    } catch (Exception e) {
      throw new OLATRuntimeException("Error parsing calendar file.", e);
    } finally {
View Full Code Here

  public Kalendar buildKalendarFrom(String calendarContent, String calType, String calId) {
    Kalendar kalendar = null;
    BufferedReader reader = new BufferedReader(new StringReader(calendarContent));
    CalendarBuilder builder = new CalendarBuilder();
    try {
      Calendar calendar = builder.build(reader);
      kalendar = createKalendar(calType, calId, calendar);
    } catch (Exception e) {
      throw new OLATRuntimeException("Error parsing calendar file.", e);
    } finally {
      if (reader != null) {
View Full Code Here

   * Be sure to have the newest calendar (reload calendar in synchronized block before safe it).
   * @param calendar
   */
  // o_clusterOK by:cg only called by Junit-test 
  public boolean persistCalendar(Kalendar kalendar) {
    Calendar calendar = buildCalendar(kalendar);
    boolean success = writeCalendarFile(calendar,kalendar.getType(), kalendar.getCalendarID());
    calendarCache.update(getKeyFor(kalendar.getType(), kalendar.getCalendarID()), kalendar);
    return success;
  }
View Full Code Here

    Preferences guiPreferences = ureq.getUserSession().getGuiPreferences();
    guiPreferences.putAndSave(KalendarConfig.class, kalendar.getCalendarID(), config);
  }
 
  private Calendar buildCalendar(Kalendar kalendar) {
    Calendar calendar = new Calendar();
    // add standard propeties
    calendar.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
    calendar.getProperties().add(Version.VERSION_2_0);
    calendar.getProperties().add(CalScale.GREGORIAN);
    for (Iterator<KalendarEvent> iter = kalendar.getEvents().iterator(); iter.hasNext();) {
      KalendarEvent kEvent = iter.next();
      VEvent vEvent = getVEvent(kEvent);
      calendar.getComponents().add(vEvent);
    }
    return calendar;
  }
View Full Code Here

  /**
   * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) {
    Calendar icalDoc = null;
   
    ServletOutputStream ostream = null;
    try {
      String pathInfo = request.getPathInfo();
      Tracing.logDebug("doGet pathInfo=" + pathInfo, ICalServlet.class);
View Full Code Here

    if (calendarManager.calendarExists(calendarType, calendarID)) {
      // read and return the calendar file
      return calendarManager.readCalendar(calendarType, calendarID);
    } else {
      // return an empty calendar file
      return new Calendar();
    }
     
   
  }
View Full Code Here

        assertThat(Helpers.contentType(proxy.getResult()), is("text/calendar"));
        assertThat(Helpers.charset(proxy.getResult()), is("utf-8"));
        assertThat(Helpers.header("Content-Disposition", proxy.getResult()), is("inline"));

        CalendarBuilder builder = new CalendarBuilder();
        Calendar calendar = builder.build(new ByteArrayInputStream(Helpers.contentAsBytes(proxy.getResult())));

        ComponentList list = calendar.getComponents(Component.VEVENT);
        List<String> uids = new ArrayList<String>();
        for (Object obj : list) {
            VEvent vEvent = (VEvent) obj;
            uids.add(vEvent.getUid().getValue());
        }
View Full Code Here

        assertThat(Helpers.contentType(proxy.getResult()), is("text/calendar"));
        assertThat(Helpers.charset(proxy.getResult()), is("utf-8"));
        assertThat(Helpers.header("Content-Disposition", proxy.getResult()), is("inline"));

        CalendarBuilder builder = new CalendarBuilder();
        Calendar calendar = builder.build(new ByteArrayInputStream(Helpers.contentAsBytes(proxy.getResult())));

        ComponentList list = calendar.getComponents(Component.VEVENT);
        List<String> uids = new ArrayList<String>();
        for (Object obj : list) {
            VEvent vEvent = (VEvent) obj;
            uids.add(vEvent.getUid().getValue());
        }
View Full Code Here

        assertThat(Helpers.contentType(proxy.getResult()), is("text/calendar"));
        assertThat(Helpers.charset(proxy.getResult()), is("utf-8"));
        assertThat(Helpers.header("Content-Disposition", proxy.getResult()), is("inline"));

        CalendarBuilder builder = new CalendarBuilder();
        Calendar calendar = builder.build(new ByteArrayInputStream(Helpers.contentAsBytes(proxy.getResult())));

        ComponentList list = calendar.getComponents(Component.VEVENT);
        List<String> uids = new ArrayList<String>();
        for (Object obj : list) {
            VEvent vEvent = (VEvent) obj;
            uids.add(vEvent.getUid().getValue());
        }
View Full Code Here

TOP

Related Classes of net.fortuna.ical4j.model.Calendar

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.