/** * Convenience method for retrieving a named property. * * @param name name of the property to retrieve * @return the first matching property in the property list with the specified name */ public final <T extends Property> T getProperty(final String name) { return (T) getProperties().getProperty(name); }
/** * {@inheritDoc} */ public int hashCode() { return new HashCodeBuilder().append(getName()).append(getProperties()) .toHashCode(); }
/** * Convenience method for retrieving a list of named properties. * * @param name name of properties to retrieve * @return a property list containing only properties with the specified name */ public final <C extends Property> PropertyList<C> getProperties(final String name) { return getProperties().getProperties(name); }
/** * {@inheritDoc} */ public int hashCode() { return new HashCodeBuilder().append(getName()).append(getProperties()) .toHashCode(); }
/** * Convenience method for retrieving a list of named properties. * * @param name name of properties to retrieve * @return a property list containing only properties with the specified name */ public final <C extends Property> PropertyList<C> getProperties(final String name) { return getProperties().getProperties(name); }
/** * Invoke validation on the component properties in its current state. * * @throws ValidationException where any of the component properties is not in a valid state */ protected final void validateProperties() throws ValidationException { for (final Property property : getProperties()) { property.validate(); } }
/** * {@inheritDoc} */ public int hashCode() { return new HashCodeBuilder().append(getName()).append(getProperties()) .toHashCode(); }
/** * {@inheritDoc} */ public boolean equals(final Object arg0) { if (arg0 instanceof Component) { final Component c = (Component) arg0; return new EqualsBuilder().append(getName(), c.getName()) .append(getProperties(), c.getProperties()).isEquals(); } return super.equals(arg0); }
/** * Convenience method for retrieving a named property. * * @param name name of the property to retrieve * @return the first matching property in the property list with the specified name */ public final Property getProperty(final String name) { return getProperties().getProperty(name); }
/** * Invoke validation on the component properties in its current state. * * @throws ValidationException where any of the component properties is not in a valid state */ protected final void validateProperties() throws ValidationException { for (final Property property : getProperties()) { property.validate(); } }
/** * {@inheritDoc} */ public boolean equals(final Object arg0) { if (arg0 instanceof Component) { final Component c = (Component) arg0; return new EqualsBuilder().append(getName(), c.getName()) .append(getProperties(), c.getProperties()).isEquals(); } return super.equals(arg0); }
@Override public Component transform(Component object) { Uid uid = object.getProperties().getProperty(Property.UID); if (uid == null) { object.getProperties().add(uidGenerator.generateUid()); } return object; } }
/** * Gets start date. * * @param comp The component. * @return The date. */ private Date getStartDate(Component comp) { DtStart prop = (DtStart) comp.getProperties().getProperty( Property.DTSTART); return (prop != null) ? prop.getDate() : null; }
/** * Gets recurrence id. * * @param comp The component. * @return The date. */ private final Date getRecurrenceId(Component comp) { RecurrenceId rid = (RecurrenceId) comp.getProperties().getProperty( Property.RECURRENCE_ID); return (rid != null) ? rid.getDate() : null; }
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)); } }
/** * Gets start date. * @param comp The component. * @return The date. */ private Date getStartDate(Component comp) { DtStart prop = (DtStart) comp.getProperties().getProperty( Property.DTSTART); return (prop != null) ? prop.getDate() : null; }
@Override public Component transform(Component object) { PropertyList<Attendee> attendees = object.getProperties().getProperties(Property.ATTENDEE); if (attendees.contains(attendee)) { attendees.remove(attendee); } attendees.add(attendee); object.getProperties().addAll(attendees); return object; } }
@Override public Component transform(Component object) { PropertyList<Property> props = object.getProperties(); Organizer oldOrganizer = props.getProperty(Property.ORGANIZER); if (oldOrganizer != null) { props.remove(oldOrganizer); } props.add(organizer); return object; } }
/** * 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."); } }