Package org.silverpeas.core.calendar
Class AttendeeSet
- java.lang.Object
-
- org.silverpeas.core.calendar.AttendeeSet
-
- All Implemented Interfaces:
Serializable
,Iterable<Attendee>
@Embeddable public class AttendeeSet extends Object implements Iterable<Attendee>, Serializable
A set of attendees in a given calendar component.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AttendeeSet()
Constructs an empty set of attendees for the persistence engine.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attendee
add(String email)
Adds an external attendee in this calendar component.Attendee
add(User user)
Adds an internal attendee in this calendar component.AttendeeSet
clear()
Clears this calendar component from all its attendees.boolean
contains(Attendee attendee)
Is the specified attendee participates in this calendar component?boolean
equals(Object obj)
void
forEach(Consumer<? super Attendee> action)
Performs the given action for each attendee in this calendar component until all of them have been processed or the action throws an exception.Optional<Attendee>
get(String id)
Gets the attendee with the specified identifier in this calendar component.int
hashCode()
boolean
isEmpty()
Is there any attendees in this calendar component?boolean
isSameAs(AttendeeSet attendees)
Is this set of attendees is same as the specified one?Iterator<Attendee>
iterator()
AttendeeSet
removeIf(Predicate<Attendee> filter)
Removes all of the attendees that match the specified filter.int
size()
Gets the size in attendees in this calendar component.Spliterator<Attendee>
spliterator()
Stream<Attendee>
stream()
Streams the attendees in this calendar component.
-
-
-
Method Detail
-
forEach
public void forEach(Consumer<? super Attendee> action)
Performs the given action for each attendee in this calendar component until all of them have been processed or the action throws an exception. Exceptions thrown by the action are relayed to the caller.
-
spliterator
public Spliterator<Attendee> spliterator()
- Specified by:
spliterator
in interfaceIterable<Attendee>
-
stream
public Stream<Attendee> stream()
Streams the attendees in this calendar component.- Returns:
- a
Stream
with the attendees in this calendar component.
-
get
public Optional<Attendee> get(String id)
Gets the attendee with the specified identifier in this calendar component. The identifier can be either the identifier of an external attendee (like an email address) or the unique identifier of a user in Silverpeas.- Parameters:
id
- the identifier of the attendee to get: either the identifier of a user in Silverpeas or an identifier referring an external attendee (like an email address).- Returns:
- optionally the attendee matching the given identifier. If no such attendee participates in this calendar component, then the optional value is empty, otherwise it contains the expected attendee.
-
add
public Attendee add(String email)
Adds an external attendee in this calendar component. The attendee is identified by the specified email address.- Parameters:
email
- the email address of the external attendee.- Returns:
- the added attendee.
-
add
public Attendee add(User user)
Adds an internal attendee in this calendar component. The attendee represents the specified Silverpeas user.- Parameters:
user
- a user in Silverpeas.- Returns:
- the added attendee.
-
removeIf
public AttendeeSet removeIf(Predicate<Attendee> filter)
Removes all of the attendees that match the specified filter.- Parameters:
filter
- the predicate against which each attendee is filtered.- Returns:
- the updated attendees in this calendar component.
-
clear
public AttendeeSet clear()
Clears this calendar component from all its attendees.- Returns:
- an empty collection of attendees in this calendar component.
-
isEmpty
public boolean isEmpty()
Is there any attendees in this calendar component?- Returns:
- true if there is no attendees in this calendar component, false otherwise.
-
contains
public boolean contains(Attendee attendee)
Is the specified attendee participates in this calendar component?- Parameters:
attendee
- an attendee.- Returns:
- true if the specified attendee is in the attendees in this calendar component, false otherwise.
-
size
public int size()
Gets the size in attendees in this calendar component.- Returns:
- the number of attendees in this calendar component.
-
isSameAs
public boolean isSameAs(AttendeeSet attendees)
Is this set of attendees is same as the specified one? Two set of attendees are the same if they have the same attendees without any change in their properties (presence, participation, ...).This method differs from equality as they don't compare the same thing: the
equals
method in Java is a comparator by identity, meaning two objects are compared by their unique identifier (either by their OID for non-persistent object or by their persistence identifier for persistent object). TheisSameAs
method is a comparator by value, meaning two objects are compared by their state; so two equal objects (that is referring to a same object) can be different by their state: one representing a given state of the referred object whereas the other represents another state of the referred object.- Parameters:
attendees
- the attendees to compare with.- Returns:
- true if the two set of attendees are equal and have the same state.
-
-