Menu

Attendees

2014-08-05
2014-08-13
  • Caruyer Perrine

    Caruyer Perrine - 2014-08-05

    Hello,

    I have a new question about attendees list : I would like to remove all attendees of an iCal and add my own attendee.
    Here is what I succeded to do :
    event.removeProperties(Attendee.class);
    event.addAttendee("titi@tutu.fr");
    Is there another way ?

    Thanks ! :)

     
  • Michael Angstadt

    You could also do "event.getAttendees().clear()". Do you think I should add "remove" methods for all the properties too? Like: "event.removeAttendees()"

     
  • Caruyer Perrine

    Caruyer Perrine - 2014-08-06

    Hm, I first tried "event.getAttendees().clear()" but it didn't work, so that I looked for another way...
    I confess I have not tried to look into the code to understand why, but looking quickly this morning I think we lose pointer on the effective List in method :
    public <t extends="" icalproperty=""> List<t> getProperties(Class<t> clazz)</t></t></t>

    I think it's good idea to remove properties, because sometimes we have to parse an iCalendar, change just some things, and write the new iCalendar..

    I'm sorry to give you always more work ;)

     
  • Michael Angstadt

    Ah, I forgot about that, you are right. However, you should be able to use the "removeProperties()" method to remove properties. Is there any reason why you prefer not to? :)

     
  • Caruyer Perrine

    Caruyer Perrine - 2014-08-11

    Yes I can use this method, and that's what I do :)
    It's not a problem because I want to remove ALL attendees in my iCal, but if I wanted to remove only one of them, I think I can't ?

    But you're right, at the moment, I have no need of that.. just an idea for a possible improvement ;)

     
  • Michael Angstadt

    I don't know. Both techniques require about the same amount of code. If a "remove" method existed, you would first have to find the property that you want to remove before removing it. Still, having a "remove" method for each property would make things more consistent.

    :::java
    //existing code
    List<Attendee> attendees = event.getAttendees();
    event.removeProperties(Attendee.class)
    for (Attendee attendee : attendees){
      if (!shouldRemove(attendee)){
        event.addAttendee(attendee);
      }
    }
    
    //with "removeAttendee()" method
    for (Attendee attendee : event.getAttendees()){
      if (shouldRemove(attendee)){
        event.removeAttendee(attendee);
      }
    }
    
     

Anonymous
Anonymous

Add attachments
Cancel