コード例 #1
1
 protected void setClientAllday(VProperty property) {
   if (property != null) {
     // set VALUE=DATE param
     if (!property.hasParam("VALUE")) {
       property.addParam("VALUE", "DATE");
     }
     // remove TZID
     property.removeParam("TZID");
     String value = property.getValue();
     if (value.length() != 8) {
       // try to convert datetime value to date value
       try {
         Calendar calendar = Calendar.getInstance();
         SimpleDateFormat dateParser = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
         calendar.setTime(dateParser.parse(value));
         calendar.add(Calendar.HOUR_OF_DAY, 12);
         SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMdd");
         value = dateFormatter.format(calendar.getTime());
       } catch (ParseException e) {
         LOGGER.warn("Invalid date value in allday event: " + value);
       }
     }
     property.setValue(value);
   }
 }
コード例 #2
0
 protected String getAttendeeStatus() {
   String status = null;
   List<VProperty> attendeeProperties = getFirstVeventProperties("ATTENDEE");
   if (attendeeProperties != null) {
     for (VProperty property : attendeeProperties) {
       String attendeeEmail = getEmailValue(property);
       if (email.equalsIgnoreCase(attendeeEmail) && property.hasParam("PARTSTAT")) {
         // found current user attendee line
         status = property.getParam("PARTSTAT").getValue();
         break;
       }
     }
   }
   return status;
 }
コード例 #3
0
 protected void setServerAllday(VProperty property) {
   if (vTimezone != null) {
     // set TZID param
     if (!property.hasParam("TZID")) {
       property.addParam("TZID", vTimezone.getPropertyValue("TZID"));
     }
     // remove VALUE
     property.removeParam("VALUE");
     String value = property.getValue();
     if (value.length() != 8) {
       LOGGER.warn("Invalid date value in allday event: " + value);
     }
     property.setValue(property.getValue() + "T000000");
   }
 }
コード例 #4
0
 private void fixAttendees(VObject vObject, boolean fromServer) {
   if (vObject.properties != null) {
     for (VProperty property : vObject.properties) {
       if ("ATTENDEE".equalsIgnoreCase(property.getKey())) {
         if (fromServer) {
           // If this is coming from the server, strip out RSVP for this
           // user as an attendee where the partstat is something other
           // than PARTSTAT=NEEDS-ACTION since the RSVP confuses iCal4 into
           // thinking the attendee has not replied
           if (isCurrentUser(property) && property.hasParam("RSVP", "TRUE")) {
             VProperty.Param partstat = property.getParam("PARTSTAT");
             if (partstat == null || !"NEEDS-ACTION".equals(partstat.getValue())) {
               property.removeParam("RSVP");
             }
           }
         } else {
           property.setValue(replaceIcal4Principal(property.getValue()));
         }
       }
     }
   }
 }
コード例 #5
0
  /**
   * Build recipients value for VCalendar.
   *
   * @param isNotification if true, filter recipients that should receive meeting notifications
   * @return notification/event recipients
   */
  public Recipients getRecipients(boolean isNotification) {

    HashSet<String> attendees = new HashSet<String>();
    HashSet<String> optionalAttendees = new HashSet<String>();

    // get recipients from first VEVENT
    List<VProperty> attendeeProperties = getFirstVeventProperties("ATTENDEE");
    if (attendeeProperties != null) {
      for (VProperty property : attendeeProperties) {
        // exclude current user and invalid values from recipients
        // also exclude no action attendees
        String attendeeEmail = getEmailValue(property);
        if (!email.equalsIgnoreCase(attendeeEmail)
            && attendeeEmail != null
            && attendeeEmail.indexOf('@') >= 0
            // return all attendees for user calendar folder, filter for notifications
            && (!isNotification
                // notify attendee if reply explicitly requested
                || (property.hasParam("RSVP", "TRUE"))
                || (
                // workaround for iCal bug: do not notify if reply explicitly not requested
                !(property.hasParam("RSVP", "FALSE"))
                    && ((property.hasParam("PARTSTAT", "NEEDS-ACTION")
                        // need to include other PARTSTATs participants for CANCEL notifications
                        || property.hasParam("PARTSTAT", "ACCEPTED")
                        || property.hasParam("PARTSTAT", "DECLINED")
                        || property.hasParam("PARTSTAT", "TENTATIVE")))))) {
          if (property.hasParam("ROLE", "OPT-PARTICIPANT")) {
            optionalAttendees.add(attendeeEmail);
          } else {
            attendees.add(attendeeEmail);
          }
        }
      }
    }
    Recipients recipients = new Recipients();
    recipients.organizer = getEmailValue(getFirstVeventProperty("ORGANIZER"));
    recipients.attendees = StringUtil.join(attendees, ", ");
    recipients.optionalAttendees = StringUtil.join(optionalAttendees, ", ");
    return recipients;
  }
コード例 #6
0
 private void fixTzid(VProperty property) {
   if (property != null && !property.hasParam("TZID")) {
     property.addParam("TZID", vTimezone.getPropertyValue("TZID"));
   }
 }
コード例 #7
0
 protected boolean isAllDay(VObject vObject) {
   VProperty dtstart = vObject.getProperty("DTSTART");
   return dtstart != null && dtstart.hasParam("VALUE", "DATE");
 }