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; }
public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Method(parameters, value); }
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 { method = new Method(parameters, value);
@Override public Calendar transform(Calendar object) { if (!Method.REQUEST.equals(object.getMethod())) { throw new IllegalArgumentException("Expecting REQUEST method in source"); } return super.transform(object); } }
/** * 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; } }
@Override public Calendar transform(Calendar object) { if (!Method.REQUEST.equals(object.getMethod())) { throw new IllegalArgumentException("Expecting REQUEST method in source"); } return super.transform(object); } }
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 { method = new Method(parameters, value);
/** * 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(); } }
@Override public Calendar transform(Calendar object) { if (!Method.REQUEST.equals(object.getMethod())) { throw new IllegalArgumentException("Expecting REQUEST method in source"); } return super.transform(object); } }
public Property createProperty(final String name) { return new Method(); } };
if (Method.CANCEL.equals(methodIcal)) { method = HandleMethod.CANCEL; } else if (Method.REQUEST.equals(methodIcal)) { method = HandleMethod.ADD_UPDATE; } else if (Method.REFRESH.equals(methodIcal)) { method = null; } else if (Method.ADD.equals(methodIcal)) { method = HandleMethod.ADD_UPDATE; } else if (Method.COUNTER.equals(methodIcal)) { method = null; } else if (Method.DECLINE_COUNTER.equals(methodIcal)) { method = null; } else if (Method.PUBLISH.equals(methodIcal)) { method = HandleMethod.ADD_UPDATE; } else if (Method.REPLY.equals(methodIcal)) { method = null; } else { log.warn(String.format("Expected method '%s' is overridden by method from iCal '%s'", expectedMethod.name(), methodIcal.getValue()));
/** * 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(); } }
@Override public Calendar transform(Calendar object) { if (!Method.REQUEST.equals(object.getMethod())) { throw new IllegalArgumentException("Expecting REQUEST method in source"); } return super.transform(object); } }
public Property createProperty(final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Method(parameters, value); }
/** * 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(); } }
private void processPostRequest(Calendar calendar, ScheduleMultiResponse ms) { if (!Method.REQUEST.equals(calendar.getMethod())) { return; } processPostFreeBusyRequest(calendar, ms); }
public Method createProperty() { return new Method(); } }
/** * 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(); } }
private void processPostRequest(Calendar calendar, ScheduleMultiResponse ms) { if (!Method.REQUEST.equals(calendar.getMethod())) { return; } processPostFreeBusyRequest(calendar, ms); }
public Property createProperty() { return new Method(); } }