public abstract class AbstractMessagingConnector extends AbstractLogEnabled implements MessagingConnector, Initializable, Serviceable
MessagingConnector
with cache.Modifier and Type | Class and Description |
---|---|
(package private) class |
AbstractMessagingConnector.EmailCacheKey
Internal class for key of events count cache
|
(package private) class |
AbstractMessagingConnector.EventCacheKey
Internal class for key of events cache
|
(package private) class |
AbstractMessagingConnector.EventCountCacheKey
Internal class for key of events count cache
|
MessagingConnector.AttendeeInformation, MessagingConnector.FreeBusyStatus, MessagingConnector.ResponseType
Modifier and Type | Field and Description |
---|---|
private Cache<AbstractMessagingConnector.EmailCacheKey,List<EmailMessage>> |
_emailsCache |
private Cache<UserIdentity,Integer> |
_emailsCountCache |
private Cache<AbstractMessagingConnector.EventCacheKey,List<CalendarEvent>> |
_eventsCache |
private Cache<AbstractMessagingConnector.EventCountCacheKey,Integer> |
_eventsCountCache |
private List<String> |
_populationIds |
protected UserPopulationDAO |
_userPopulationDAO
The user population DAO
|
ROLE
Constructor and Description |
---|
AbstractMessagingConnector() |
Modifier and Type | Method and Description |
---|---|
String |
createEvent(String title,
String description,
String place,
boolean isAllDay,
Date startDate,
Date endDate,
EventRecurrenceTypeEnum recurrenceType,
Date untilDate,
Map<String,Boolean> attendees,
UserIdentity organiser)
Create an event
|
void |
deleteEvent(String eventId,
UserIdentity organiser)
Delete an event
|
List<String> |
getAllowedPopulationIds()
Get the list of population id allowed to the messaging connector
|
Map<String,MessagingConnector.AttendeeInformation> |
getAttendees(String eventId,
UserIdentity organiser)
Get the map of attendees for an event
|
List<CalendarEvent> |
getEvents(UserIdentity userIdentity,
Date fromDate,
Date untilDate,
int maxEvents)
Get the list of events betweend two dates for a given user
|
int |
getEventsCount(UserIdentity userIdentity,
Date fromDate,
Date untilDate)
Return the number of upcoming events
|
Map<String,MessagingConnector.FreeBusyStatus> |
getFreeBusy(Date startDate,
Date endDate,
boolean isAllDay,
Set<String> attendees,
UserIdentity organiser)
Get free/busy status for attendees for a time window
|
int |
getUnreadEmailCount(UserIdentity userIdentity)
Return the number of unread mails for a given user
|
List<EmailMessage> |
getUnreadEmails(UserIdentity userIdentity,
int maxEmails)
Return the unread emails for a given user
|
void |
initialize() |
protected abstract List<EmailMessage> |
internalGetEmails(UserIdentity userIdentity,
int maxEmails)
Get emails (no caching)
|
protected abstract int |
internalGetEmailsCount(UserIdentity userIdentity)
Get emails count (no caching)
|
protected abstract List<CalendarEvent> |
internalGetEvents(UserIdentity userIdentity,
Date fromDate,
Date untilDate,
int maxEvents)
Get events between two date (no caching)
|
protected abstract int |
internalGetEventsCount(UserIdentity userIdentity,
Date fromDate,
Date untilDate)
Get events count between two date (no caching)
|
protected boolean |
isAllowed(UserIdentity userIdentity)
True if the user is allowed
|
boolean |
isEventExist(String eventId,
UserIdentity organiser)
True if the event exist in the messaging connector
|
boolean |
isUserExist(UserIdentity userIdentity)
True if the user exist
|
void |
service(ServiceManager manager) |
void |
setAttendees(String eventId,
Map<String,Boolean> attendees,
UserIdentity organiser)
Set attendees for an event
|
boolean |
supportInvitation()
Tell if the messaging connector supports event invitation
|
void |
updateEvent(String eventId,
String title,
String description,
String place,
boolean isAllDay,
Date startDate,
Date endDate,
EventRecurrenceTypeEnum recurrenceType,
Date untilDate,
Map<String,Boolean> attendees,
UserIdentity organiser)
Update an event
|
getLogger, setLogger
protected UserPopulationDAO _userPopulationDAO
private Cache<AbstractMessagingConnector.EventCacheKey,List<CalendarEvent>> _eventsCache
private Cache<AbstractMessagingConnector.EventCountCacheKey,Integer> _eventsCountCache
private Cache<AbstractMessagingConnector.EmailCacheKey,List<EmailMessage>> _emailsCache
private Cache<UserIdentity,Integer> _emailsCountCache
private List<String> _populationIds
public AbstractMessagingConnector()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void initialize()
initialize
in interface Initializable
public List<String> getAllowedPopulationIds()
MessagingConnector
getAllowedPopulationIds
in interface MessagingConnector
protected boolean isAllowed(UserIdentity userIdentity)
userIdentity
- the user identitypublic List<CalendarEvent> getEvents(UserIdentity userIdentity, Date fromDate, Date untilDate, int maxEvents) throws MessagingConnectorException
MessagingConnector
getEvents
in interface MessagingConnector
userIdentity
- the owner of the eventsfromDate
- The start date of searchuntilDate
- The end date of searchmaxEvents
- the maximum number of events to retrieveMessagingConnectorException
- if failed to get eventspublic int getEventsCount(UserIdentity userIdentity, Date fromDate, Date untilDate) throws MessagingConnectorException
MessagingConnector
getEventsCount
in interface MessagingConnector
userIdentity
- the owner of the eventsfromDate
- The start date of searchuntilDate
- The end date of searchMessagingConnectorException
- if failed to get events' countpublic List<EmailMessage> getUnreadEmails(UserIdentity userIdentity, int maxEmails) throws MessagingConnectorException
MessagingConnector
getUnreadEmails
in interface MessagingConnector
userIdentity
- the recipient of the mailsmaxEmails
- The max number of emails to returnMessagingConnectorException
- if failed to get mailspublic int getUnreadEmailCount(UserIdentity userIdentity) throws MessagingConnectorException
MessagingConnector
getUnreadEmailCount
in interface MessagingConnector
userIdentity
- the receiver of the mailsMessagingConnectorException
- if failed to get unread mails ' countprotected abstract List<CalendarEvent> internalGetEvents(UserIdentity userIdentity, Date fromDate, Date untilDate, int maxEvents) throws MessagingConnectorException
userIdentity
- The user identityfromDate
- The date to start searchuntilDate
- The date to end searchmaxEvents
- The maximum number of events to retrieveMessagingConnectorException
- if failed to get events from serverprotected abstract int internalGetEventsCount(UserIdentity userIdentity, Date fromDate, Date untilDate) throws MessagingConnectorException
userIdentity
- The user identityfromDate
- The date to start searchuntilDate
- The date to end searchMessagingConnectorException
- if failed to get events from serverprotected abstract List<EmailMessage> internalGetEmails(UserIdentity userIdentity, int maxEmails) throws MessagingConnectorException
userIdentity
- The user identitymaxEmails
- The maximum number of emails to retrieveMessagingConnectorException
- if failed to get events from serverprotected abstract int internalGetEmailsCount(UserIdentity userIdentity) throws MessagingConnectorException
userIdentity
- The user identityMessagingConnectorException
- if failed to get events from serverpublic boolean supportInvitation() throws MessagingConnectorException
MessagingConnector
supportInvitation
in interface MessagingConnector
MessagingConnectorException
- if failed to get events from serverpublic boolean isEventExist(String eventId, UserIdentity organiser) throws MessagingConnectorException
MessagingConnector
isEventExist
in interface MessagingConnector
eventId
- the event idorganiser
- the organiserMessagingConnectorException
- if an error occurredpublic String createEvent(String title, String description, String place, boolean isAllDay, Date startDate, Date endDate, EventRecurrenceTypeEnum recurrenceType, Date untilDate, Map<String,Boolean> attendees, UserIdentity organiser) throws MessagingConnectorException
MessagingConnector
createEvent
in interface MessagingConnector
title
- the event titledescription
- the event descriptionplace
- the event placeisAllDay
- if the event is all daystartDate
- the event start dateendDate
- the event end daterecurrenceType
- recurrence typeuntilDate
- until date of the recurring eventattendees
- the map of attendees (email -> optional or requested) to setorganiser
- the event organiserMessagingConnectorException
- if failed to get events from serverpublic void updateEvent(String eventId, String title, String description, String place, boolean isAllDay, Date startDate, Date endDate, EventRecurrenceTypeEnum recurrenceType, Date untilDate, Map<String,Boolean> attendees, UserIdentity organiser) throws MessagingConnectorException
MessagingConnector
updateEvent
in interface MessagingConnector
eventId
- the event id to deletetitle
- the event titledescription
- the event descriptionplace
- the event placeisAllDay
- if the event is all daystartDate
- the event start dateendDate
- the event end daterecurrenceType
- recurrence typeuntilDate
- until date of the recurring eventattendees
- the map of attendees (email -> optional or requested) to setorganiser
- the event organiserMessagingConnectorException
- if failed to get events from serverpublic void deleteEvent(String eventId, UserIdentity organiser) throws MessagingConnectorException
MessagingConnector
deleteEvent
in interface MessagingConnector
eventId
- the event id to deleteorganiser
- the event organiserMessagingConnectorException
- if failed to get events from serverpublic Map<String,MessagingConnector.AttendeeInformation> getAttendees(String eventId, UserIdentity organiser) throws MessagingConnectorException
MessagingConnector
getAttendees
in interface MessagingConnector
eventId
- the event idorganiser
- the event organiserMessagingConnectorException
- if failed to get events from serverpublic void setAttendees(String eventId, Map<String,Boolean> attendees, UserIdentity organiser) throws MessagingConnectorException
MessagingConnector
setAttendees
in interface MessagingConnector
eventId
- the event idattendees
- the map of attendees (email -> optional or requested) to setorganiser
- the event organiserMessagingConnectorException
- if failed to get events from serverpublic Map<String,MessagingConnector.FreeBusyStatus> getFreeBusy(Date startDate, Date endDate, boolean isAllDay, Set<String> attendees, UserIdentity organiser) throws MessagingConnectorException
MessagingConnector
getFreeBusy
in interface MessagingConnector
startDate
- the start dateendDate
- the end dateisAllDay
- true if is an allday eventattendees
- the list of attendees emailorganiser
- the event organiserMessagingConnectorException
- if failed to get events from serverpublic boolean isUserExist(UserIdentity userIdentity) throws MessagingConnectorException
MessagingConnector
isUserExist
in interface MessagingConnector
userIdentity
- the user identityMessagingConnectorException
- if failed to get events from server