Пример #1
0
 private EventPrivacy privacy(Event oldEvent, CalendarSensitivity sensitivity) {
   if (sensitivity == null) {
     return oldEvent != null ? oldEvent.getPrivacy() : EventPrivacy.PUBLIC;
   }
   switch (sensitivity) {
     case CONFIDENTIAL:
     case PERSONAL:
     case PRIVATE:
       return EventPrivacy.PRIVATE;
     case NORMAL:
     default:
       return EventPrivacy.PUBLIC;
   }
 }
Пример #2
0
  public IApplicationData convert(Event e) {
    MSTask mse = new MSTask();

    mse.setSubject(e.getTitle());
    mse.setDescription(e.getDescription());

    if (e.getPriority() <= 1) {
      mse.setImportance(0);
    } else if (e.getPriority() > 1 && e.getPriority() <= 3) {
      mse.setImportance(1);
    } else {
      mse.setImportance(2);
    }
    mse.setSensitivity(
        e.getPrivacy() == EventPrivacy.PUBLIC
            ? CalendarSensitivity.NORMAL
            : CalendarSensitivity.PRIVATE);

    Date dateTimeEnd = new Date(e.getStartDate().getTime() + e.getDuration() * 1000);

    mse.setUtcDueDate(dateTimeEnd);
    mse.setDueDate(getDateInTimeZone(dateTimeEnd, e.getTimezoneName()));

    // if (e.getAlert() != null && e.getAlert() != 0) {
    // mse.setReminderSet(true);
    // Calendar cal = Calendar.getInstance();
    // cal.setTime(e.getDate());
    // cal.add(Calendar.SECOND, e.getAlert());
    // mse.setReminderTime(cal.getTime());
    // }

    mse.setStartDate(getDateInTimeZone(e.getStartDate(), e.getTimezoneName()));
    mse.setUtcStartDate(e.getStartDate());
    mse.setRecurrence(getRecurrence(e.getRecurrence()));

    return mse;
  }