Package org.ametys.plugins.exchange
Class EWSConnector
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.messagingconnector.AbstractMessagingConnector
-
- org.ametys.plugins.exchange.EWSConnector
-
- All Implemented Interfaces:
MessagingConnector,LogEnabled,Initializable,Component,Serviceable
public class EWSConnector extends AbstractMessagingConnector
The connector used by the messaging connector plugin when connecting to Exchange Server.
Implemented through the Microsoft EWS API.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ametys.plugins.messagingconnector.MessagingConnector
MessagingConnector.AttendeeInformation, MessagingConnector.FreeBusyStatus, MessagingConnector.ResponseType
-
-
Field Summary
Fields Modifier and Type Field Description static StringINNER_ROLEThe avalon role-
Fields inherited from class org.ametys.plugins.messagingconnector.AbstractMessagingConnector
_cacheManager, _cryptoHelper, _currentUserProvider, _userPopulationDAO, _userPref
-
Fields inherited from interface org.ametys.plugins.messagingconnector.MessagingConnector
ROLE
-
-
Constructor Summary
Constructors Constructor Description EWSConnector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected microsoft.exchange.webservices.data.core.ExchangeServicegetService(UserIdentity userIdentity)Get the service of connexion to the server exchangeprotected static Stringhtml2text(String html)Converts a given html String into a plain text StringStringinternalCreateEvent(String title, String description, String place, boolean isAllDay, ZonedDateTime startDate, ZonedDateTime endDate, EventRecurrenceTypeEnum recurrenceType, ZonedDateTime untilDate, Map<String,Boolean> attendees, UserIdentity organiser)Create an eventvoidinternalDeleteEvent(String eventId, UserIdentity organiser)Delete an eventMap<String,MessagingConnector.AttendeeInformation>internalGetAttendees(String eventId, UserIdentity organiser)Get the map of attendees for an eventprotected List<EmailMessage>internalGetEmails(UserIdentity userIdentity, int maxEmails)Get emails (no caching)protected intinternalGetEmailsCount(UserIdentity userIdentity)Get emails count (no caching)protected List<CalendarEvent>internalGetEvents(UserIdentity userIdentity, int maxDays, int maxEvents)Get upcoming events (no caching)protected intinternalGetEventsCount(UserIdentity userIdentity, int maxDays)Get upcoming events count (no caching)Map<String,MessagingConnector.FreeBusyStatus>internalGetFreeBusy(Date startDate, Date endDate, boolean isAllDay, Set<String> attendees, UserIdentity organiser)Get free/busy status for attendees for a time windowbooleaninternalIsEventExist(String eventId, UserIdentity organiser)True if the event exist in the messaging connectorvoidinternalSetAttendees(String eventId, Map<String,Boolean> attendees, UserIdentity organiser)Set attendees for an eventvoidinternalUpdateEvent(String eventId, String title, String description, String place, boolean isAllDay, ZonedDateTime startDate, ZonedDateTime endDate, EventRecurrenceTypeEnum recurrenceType, ZonedDateTime untilDate, Map<String,Boolean> attendees, UserIdentity organiser)Update an eventbooleanisUserExist(UserIdentity userIdentity)True if the user existvoidservice(ServiceManager manager)booleansupportInvitation()Tell if the messaging connector supports event invitationbooleansupportUserCredential(UserIdentity userIdentity)Check if a user credential should be saved-
Methods inherited from class org.ametys.plugins.messagingconnector.AbstractMessagingConnector
createEvent, deleteEvent, getAllowedPopulationIds, getAttendees, getEvents, getEventsCount, getFreeBusy, getUnreadEmailCount, getUnreadEmails, getUserCryptedPassword, getUserPassword, initialize, isAllowed, isEventExist, setAttendees, setUserPassword, updateEvent, userCredentialNeeded
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
INNER_ROLE
public static final String INNER_ROLE
The avalon role
-
-
Constructor Detail
-
EWSConnector
public EWSConnector()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractMessagingConnector- Throws:
ServiceException
-
getService
protected microsoft.exchange.webservices.data.core.ExchangeService getService(UserIdentity userIdentity) throws URISyntaxException
Get the service of connexion to the server exchange- Parameters:
userIdentity- The user identity- Returns:
- the service
- Throws:
URISyntaxException- if an error occurred
-
supportUserCredential
public boolean supportUserCredential(UserIdentity userIdentity)
Description copied from interface:MessagingConnectorCheck if a user credential should be saved- Specified by:
supportUserCredentialin interfaceMessagingConnector- Overrides:
supportUserCredentialin classAbstractMessagingConnector- Parameters:
userIdentity- The useridentity involved in the demand- Returns:
- true if this implementation supports user credential (and is configured to use them)
-
internalGetEvents
protected List<CalendarEvent> internalGetEvents(UserIdentity userIdentity, int maxDays, int maxEvents) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorGet upcoming events (no caching)- Specified by:
internalGetEventsin classAbstractMessagingConnector- Parameters:
userIdentity- The user identitymaxDays- The maximum number of days to search formaxEvents- The maximum number of events to retrieve- Returns:
- The calendar events
- Throws:
MessagingConnectorException- if failed to get events from server
-
internalGetEventsCount
protected int internalGetEventsCount(UserIdentity userIdentity, int maxDays) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorGet upcoming events count (no caching)- Specified by:
internalGetEventsCountin classAbstractMessagingConnector- Parameters:
userIdentity- The user identitymaxDays- The maximum number of days to search for- Returns:
- The number of calendar events
- Throws:
MessagingConnectorException- if failed to get events from server
-
internalGetEmails
protected List<EmailMessage> internalGetEmails(UserIdentity userIdentity, int maxEmails) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorGet emails (no caching)- Specified by:
internalGetEmailsin classAbstractMessagingConnector- Parameters:
userIdentity- The user identitymaxEmails- The maximum number of emails to retrieve- Returns:
- The emails
- Throws:
MessagingConnectorException- if failed to get events from server
-
internalGetEmailsCount
protected int internalGetEmailsCount(UserIdentity userIdentity) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorGet emails count (no caching)- Specified by:
internalGetEmailsCountin classAbstractMessagingConnector- Parameters:
userIdentity- The user identity- Returns:
- The emails count
- Throws:
MessagingConnectorException- if failed to get events from server
-
supportInvitation
public boolean supportInvitation() throws MessagingConnectorException
Description copied from interface:MessagingConnectorTell if the messaging connector supports event invitation- Specified by:
supportInvitationin interfaceMessagingConnector- Overrides:
supportInvitationin classAbstractMessagingConnector- Returns:
- true if the messaging connector supports event invitation
- Throws:
MessagingConnectorException- if failed to get events from server
-
internalIsEventExist
public boolean internalIsEventExist(String eventId, UserIdentity organiser) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorTrue if the event exist in the messaging connector- Overrides:
internalIsEventExistin classAbstractMessagingConnector- Parameters:
eventId- the event idorganiser- the organiser- Returns:
- true if the event exist
- Throws:
MessagingConnectorException- if an error occurred
-
internalCreateEvent
public String internalCreateEvent(String title, String description, String place, boolean isAllDay, ZonedDateTime startDate, ZonedDateTime endDate, EventRecurrenceTypeEnum recurrenceType, ZonedDateTime untilDate, Map<String,Boolean> attendees, UserIdentity organiser) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorCreate an event- Overrides:
internalCreateEventin classAbstractMessagingConnector- Parameters:
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 organiser- Returns:
- the id of the event created
- Throws:
MessagingConnectorException- if failed to get events from server
-
internalUpdateEvent
public void internalUpdateEvent(String eventId, String title, String description, String place, boolean isAllDay, ZonedDateTime startDate, ZonedDateTime endDate, EventRecurrenceTypeEnum recurrenceType, ZonedDateTime untilDate, Map<String,Boolean> attendees, UserIdentity organiser) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorUpdate an event- Overrides:
internalUpdateEventin classAbstractMessagingConnector- Parameters:
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 organiser- Throws:
MessagingConnectorException- if failed to get events from server
-
internalDeleteEvent
public void internalDeleteEvent(String eventId, UserIdentity organiser) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorDelete an event- Overrides:
internalDeleteEventin classAbstractMessagingConnector- Parameters:
eventId- the event id to deleteorganiser- the event organiser- Throws:
MessagingConnectorException- if failed to get events from server
-
internalGetAttendees
public Map<String,MessagingConnector.AttendeeInformation> internalGetAttendees(String eventId, UserIdentity organiser) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorGet the map of attendees for an event- Overrides:
internalGetAttendeesin classAbstractMessagingConnector- Parameters:
eventId- the event idorganiser- the event organiser- Returns:
- the map of attendees (email -> attendee information)
- Throws:
MessagingConnectorException- if failed to get events from server
-
internalSetAttendees
public void internalSetAttendees(String eventId, Map<String,Boolean> attendees, UserIdentity organiser) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorSet attendees for an event- Overrides:
internalSetAttendeesin classAbstractMessagingConnector- Parameters:
eventId- the event idattendees- the map of attendees (email -> optional or requested) to setorganiser- the event organiser- Throws:
MessagingConnectorException- if failed to get events from server
-
internalGetFreeBusy
public Map<String,MessagingConnector.FreeBusyStatus> internalGetFreeBusy(Date startDate, Date endDate, boolean isAllDay, Set<String> attendees, UserIdentity organiser) throws MessagingConnectorException
Description copied from class:AbstractMessagingConnectorGet free/busy status for attendees for a time window- Overrides:
internalGetFreeBusyin classAbstractMessagingConnector- Parameters:
startDate- the start dateendDate- the end dateisAllDay- true if is an allday eventattendees- the list of attendees emailorganiser- the event organiser- Returns:
- the map of attendees (email -> freeBusy status)
- Throws:
MessagingConnectorException- if failed to get events from server
-
isUserExist
public boolean isUserExist(UserIdentity userIdentity) throws MessagingConnectorException
Description copied from interface:MessagingConnectorTrue if the user exist- Specified by:
isUserExistin interfaceMessagingConnector- Overrides:
isUserExistin classAbstractMessagingConnector- Parameters:
userIdentity- the user identity- Returns:
- true if the user exist
- Throws:
MessagingConnectorException- if failed to get events from server
-
-