/** * {@inheritDoc} */ public final Property copy() { // URI are immutable return new Attendee(new ParameterList(getParameters(), false), calAddress); }
private static void safelySetNewValue(Attendee element, String newPart) { try { element.setValue(MAILTO + ":" + newPart); } catch (URISyntaxException e) { } }
public Property createProperty() { return new Attendee(); } }
@Test public void shouldLeaveAttendeeAsItIs() throws URISyntaxException { Attendee attendee = new Attendee("mailto:mobile-media-applications@1und1.de"); attendee.getParameters().add(new Cn("Mobile Media")); RuleManager.applyTo(attendee); assertEquals("mailto:mobile-media-applications@1und1.de", attendee.getValue()); }
@Override public void execute(String input) { ParameterValidator.getInstance().assertOneOrLess(input, getParameters()); } });
URI attendeeUri = attendee.getCalAddress(); final String email = (attendeeUri != null) ? attendeeUri.getSchemeSpecificPart() : null; final Cn cn = (Cn) attendee.getParameter(Parameter.CN); final CuType cuType = (CuType) attendee.getParameter(Parameter.CUTYPE); final PartStat partStat = (PartStat) attendee.getParameter(Parameter.PARTSTAT); final Rsvp rsvp = (Rsvp) attendee.getParameter(Parameter.RSVP); final Role role = (Role) attendee.getParameter(Parameter.ROLE); Iterator<Parameter> iter = attendee.getParameters().iterator();
@Override public void applyTo(Attendee element) { if (element == null) { return; } URI calAddress = element.getCalAddress(); if (calAddress == null) { return; } String scheme = calAddress.getScheme(); if (scheme != null && StringUtils.startsWithIgnoreCase(scheme, MAILTO)) { String part = calAddress.getSchemeSpecificPart(); if (part != null && part.length() >= MIN_LENGTH && StringUtils.startsWith(part, APOSTROPHE) && StringUtils.endsWith(part, APOSTROPHE)) { String newPart = part.substring(1, part.length() - 1); safelySetNewValue(element, newPart); } } }
/** * Test method for {@link net.fortuna.ical4j.model.property.Attendee#Attendee(java.lang.String)}. */ public void testAttendeeString() throws URISyntaxException { try { new Attendee("MAILTO:CET Meeting Room@university.edu"); fail("Should throw URISyntaxException"); } catch (URISyntaxException use) { LOG.info("Caught exception: " + use.getMessage()); } CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true); Attendee attendee = new Attendee("MAILTO:CET Meeting Room@university.edu"); assertEquals(new URI("MAILTO:CET%20Meeting%20Room@university.edu"), attendee.getCalAddress()); }
if (! a.getValue().equals(user.getValue())) { attendees.remove(numAttendees); } else { a.getParameters().remove(a.getParameter(Parameter.PARTSTAT)); a.getParameters().add(action); numAttendees++;
/** * @param cb IcalCallback object * @param attProp * @return BwAttendee * @throws Throwable */ public static BwAttendee getAttendee(final IcalCallback cb, final Attendee attProp) throws Throwable { ParameterList pars = attProp.getParameters(); BwAttendee att = initAttendeeVoter(cb, attProp.getValue(), pars); att.setPartstat(getOptStr(pars, "PARTSTAT")); if (att.getPartstat() == null) { att.setPartstat(IcalDefs.partstatValNeedsAction); } att.setRole(getOptStr(pars, "ROLE")); return att; }
protected static void loadRelatedParties(List<GenericValue> relatedParties, PropertyList componentProps, Map<String, Object> context) { PropertyList attendees = componentProps.getProperties("ATTENDEE"); for (GenericValue partyValue : relatedParties) { if ("CAL_ORGANIZER~CAL_OWNER".contains(partyValue.getString("roleTypeId"))) { // RFC 2445 4.6.1, 4.6.2, and 4.6.3 ORGANIZER can appear only once replaceProperty(componentProps, createOrganizer(partyValue, context)); } else { String partyId = partyValue.getString("partyId"); boolean newAttendee = true; Attendee attendee = null; Iterator<Attendee> i = UtilGenerics.cast(attendees.iterator()); while (i.hasNext()) { attendee = i.next(); Parameter xParameter = attendee.getParameter(partyIdXParamName); if (xParameter != null && partyId.equals(xParameter.getValue())) { loadPartyAssignment(attendee, partyValue, context); newAttendee = false; break; } } if (newAttendee) { attendee = createAttendee(partyValue, context); componentProps.add(attendee); } } } }
public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Attendee(parameters, value); }
@Test public void shouldCorrectlyRemoveApostrophes() throws URISyntaxException { Attendee attendee = new Attendee("mailto:'mobile-media-applications@1und1.de'"); attendee.getParameters().add(new Cn("Mobile Media")); RuleManager.applyTo(attendee); assertEquals("mailto:mobile-media-applications@1und1.de", attendee.getValue()); }
@Override public void execute(String input) { ParameterValidator.getInstance().assertOneOrLess(input, getParameters()); } });
@Override public void applyTo(Attendee element) { if (element == null) { return; } URI calAddress = element.getCalAddress(); if (calAddress == null) { return; } String scheme = calAddress.getScheme(); if (scheme != null && StringUtils.startsWithIgnoreCase(scheme, MAILTO)) { String part = calAddress.getSchemeSpecificPart(); if (part != null && part.length() >= MIN_LENGTH && StringUtils.startsWith(part, APOSTROPHE) && StringUtils.endsWith(part, APOSTROPHE)) { String newPart = part.substring(1, part.length() - 1); safelySetNewValue(element, newPart); } } }
/** * {@inheritDoc} */ public final Property copy() { // URI are immutable return new Attendee(new ParameterList(getParameters(), false), calAddress); }
public Property createProperty() { return new Attendee(); } }