Пример #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 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");
   }
 }
Пример #3
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()));
         }
       }
     }
   }
 }