/** * Check if Calendar contains the given method, in a faster way (string comparison) * @param m Method to compare * @param n Method to compare * @return true if same else false */ private static boolean compareMethod(Method m, Method n) { try { return m.getValue().equals(n.getValue()); } catch (NullPointerException e) { return false; } }
if (ADD.getValue().equals(value)) { method = ADD; else if (CANCEL.getValue().equals(value)) { method = CANCEL; else if (COUNTER.getValue().equals(value)) { method = COUNTER; else if (DECLINE_COUNTER.getValue().equals(value)) { method = DECLINE_COUNTER; else if (PUBLISH.getValue().equals(value)) { method = PUBLISH; else if (REFRESH.getValue().equals(value)) { method = REFRESH; else if (REPLY.getValue().equals(value)) { method = REPLY; else if (REQUEST.getValue().equals(value)) { method = REQUEST; } else {
if (ADD.getValue().equals(value)) { method = ADD; else if (CANCEL.getValue().equals(value)) { method = CANCEL; else if (COUNTER.getValue().equals(value)) { method = COUNTER; else if (DECLINE_COUNTER.getValue().equals(value)) { method = DECLINE_COUNTER; else if (PUBLISH.getValue().equals(value)) { method = PUBLISH; else if (REFRESH.getValue().equals(value)) { method = REFRESH; else if (REPLY.getValue().equals(value)) { method = REPLY; else if (REQUEST.getValue().equals(value)) { method = REQUEST; } else {
/** * Returns an appropriate MIME Content-Type for the specified calendar object. * @param calendar a calendar instance * @param charset an optional encoding * @return a content type string */ public static String getContentType(Calendar calendar, Charset charset) { final StringBuilder b = new StringBuilder("text/calendar"); final Method method = (Method) calendar.getProperty(Property.METHOD); if (method != null) { b.append("; method="); b.append(method.getValue()); } if (charset != null) { b.append("; charset="); b.append(charset); } return b.toString(); } }
/** * Returns an appropriate MIME Content-Type for the specified calendar object. * @param calendar a calendar instance * @param charset an optional encoding * @return a content type string */ public static String getContentType(Calendar calendar, Charset charset) { final StringBuilder b = new StringBuilder("text/calendar"); final Method method = calendar.getProperty(Property.METHOD); if (method != null) { b.append("; method="); b.append(method.getValue()); } if (charset != null) { b.append("; charset="); b.append(charset); } return b.toString(); } }
/** * Returns an appropriate MIME Content-Type for the specified calendar object. * @param calendar a calendar instance * @param charset an optional encoding * @return a content type string */ public static String getContentType(Calendar calendar, Charset charset) { final StringBuilder b = new StringBuilder("text/calendar"); final Method method = calendar.getProperty(Property.METHOD); if (method != null) { b.append("; method="); b.append(method.getValue()); } if (charset != null) { b.append("; charset="); b.append(charset); } return b.toString(); } }
/** * Returns an appropriate MIME Content-Type for the specified calendar object. * @param calendar a calendar instance * @param charset an optional encoding * @return a content type string */ public static String getContentType(Calendar calendar, Charset charset) { final StringBuffer b = new StringBuffer("text/calendar"); final Method method = (Method) calendar.getProperty(Property.METHOD); if (method != null) { b.append("; method="); b.append(method.getValue()); } if (charset != null) { b.append("; charset="); b.append(charset); } return b.toString(); } }
/** * Returns an appropriate MIME Content-Type for the specified calendar object. * @param calendar a calendar instance * @param charset an optional encoding * @return a content type string */ public static String getContentType(Calendar calendar, Charset charset) { final StringBuilder b = new StringBuilder("text/calendar"); final Method method = (Method) calendar.getProperty(Property.METHOD); if (method != null) { b.append("; method="); b.append(method.getValue()); } if (charset != null) { b.append("; charset="); b.append(charset); } return b.toString(); } }
public static ICalGenerator forMethod(final Method method) { final ICalGenerator generator; if (Method.REQUEST.equals(method)) { generator = exportAllFields(); } else if (Method.CANCEL.equals(method)) { generator = new ICalGenerator(); generator.exportsVEvent = new ArrayList<>(Arrays.asList(VEVENT_UID, VEVENT_DTSTAMP, VEVENT_DTSTART, VEVENT_SEQUENCE, VEVENT_ORGANIZER, VEVENT_ATTENDEES, VEVENT_RRULE, VEVENT_EX_DATE)); } else { throw new UnsupportedOperationException(String.format("No generator for method '%s'", method.getValue())); } generator.method = method; return generator; }
log.warn(String.format("Expected method '%s' is overridden by method from iCal '%s'", expectedMethod.name(), methodIcal.getValue()));