protected void limitApparitionsNumberIn(Component component){ PropertyList<? extends Property> propertyList = component.getProperties(name); if(propertyList.size() <= maxApparitionNumber){ return; } int toRemove = propertyList.size() - maxApparitionNumber; for(int i = 0; i < toRemove; i++){ component.getProperties().remove(propertyList.get(i)); } }
protected void limitApparitionsNumberIn(Component component){ PropertyList<? extends Property> propertyList = component.getProperties(name); if(propertyList.size() <= maxApparitionNumber){ return; } int toRemove = propertyList.size() - maxApparitionNumber; for(int i = 0; i < toRemove; i++){ component.getProperties().remove(propertyList.get(i)); } }
/** * @param comp * @param name * @return PropertyList */ public static PropertyList getProperties(final Component comp, final String name) { PropertyList props = comp.getProperties(); props = props.getProperties(name); if ((props != null) && (props.size() == 0)) { return null; } return props; }
/** * @param c Component * @param propName Property to check in Component. * @return Returns true if Component contains the property */ public static boolean hasProperty(Component c, String propName){ PropertyList l = c.getProperties().getProperties(propName); return l != null && l.size() > 0; }
protected void limitApparitionsNumberIn(Component component){ PropertyList<? extends Property> propertyList = component.getProperties(name); if(propertyList.size() <= maxApparitionNumber){ return; } int toRemove = propertyList.size() - maxApparitionNumber; for(int i = 0; i < toRemove; i++){ component.getProperties().remove(propertyList.get(i)); } }
/** * Ensure a property occurs once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property does not occur once */ public void assertOne(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs at least once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property occurs more than once */ public void assertOneOrMore(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() < 1) { throw new ValidationException(ASSERT_ONE_OR_MORE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs at least once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property occurs more than once */ public void assertOneOrMore(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() < 1) { throw new ValidationException(ASSERT_ONE_OR_MORE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs at least once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property occurs more than once */ public void assertOneOrMore(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() < 1) { throw new ValidationException(ASSERT_ONE_OR_MORE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property does not occur once */ public void assertOne(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs at least once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property occurs more than once */ public void assertOneOrMore(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() < 1) { throw new ValidationException(ASSERT_ONE_OR_MORE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property does not occur once */ public void assertOne(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property does not occur once */ public void assertOne(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs no more than once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property occurs more than once */ public void assertOneOrLess(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() > 1) { throw new ValidationException(ASSERT_ONE_OR_LESS_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs at least once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property occurs more than once */ public void assertOneOrMore(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() < 1) { throw new ValidationException(ASSERT_ONE_OR_MORE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs no more than once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property occurs more than once */ public void assertOneOrLess(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() > 1) { throw new ValidationException(ASSERT_ONE_OR_LESS_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property does not occur once */ public void assertOne(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {propertyName}); } }
/** * Ensure a property occurs no more than once. * * @param propertyName * the property name * @param properties * a list of properties to query * @throws ValidationException * when the specified property occurs more than once */ public void assertOneOrLess(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() > 1) { throw new ValidationException(ASSERT_ONE_OR_LESS_MESSAGE, new Object[] {propertyName}); } }
/** * Indexing with IndexedPropertyList. */ public void testIndexing() { // a VEvent for more interesting data.. Component component = (Component) calendar.getComponents(Component.VEVENT).iterator().next(); IndexedPropertyList list = new IndexedPropertyList(component.getProperties(), Parameter.CUTYPE); LOG.info(list.getProperties(CuType.INDIVIDUAL.getValue()).size() + " individual attendees."); } }
/** * Test method for {@link net.fortuna.ical4j.data.HCalendarParser#parse(java.io.Reader, net.fortuna.ical4j.data.ContentHandler)}. */ public void testParseReaderContentHandler() throws IOException, ParserException { Calendar icsCalendar = Calendars.load(getClass().getResource("/samples/hcalendar/example1.ics")); // remove prod-id which seems to be not handled by hcalendar.. icsCalendar.getProperties().remove(icsCalendar.getProperty(Property.PRODID)); CalendarBuilder builder = new CalendarBuilder(new HCalendarParser()); Calendar hcalCalendar = builder.build(getClass().getResourceAsStream("/samples/hcalendar/example1.html")); // assertEquals(icsCalendar, hcalCalendar); assertEquals(icsCalendar.getProperties().size(), hcalCalendar.getProperties().size()); assertEquals(icsCalendar.getComponents().size(), hcalCalendar.getComponents().size()); }