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
The connector used by the messaging connector plugin when connecting to Exchange Server.
Implemented through the Microsoft EWS API.
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 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected microsoft.exchange.webservices.data.core.ExchangeService
getService
(UserIdentity userIdentity) Get the service of connexion to the server exchangeprotected static String
Converts a given html String into a plain text StringinternalCreateEvent
(String title, String description, String place, boolean isAllDay, ZonedDateTime startDate, ZonedDateTime endDate, EventRecurrenceTypeEnum recurrenceType, ZonedDateTime untilDate, Map<String, Boolean> attendees, UserIdentity organiser) Create an eventvoid
internalDeleteEvent
(String eventId, UserIdentity organiser) Delete an eventinternalGetAttendees
(String eventId, UserIdentity organiser) Get the map of attendees for an eventprotected List<EmailMessage>
internalGetEmails
(UserIdentity userIdentity, int maxEmails) Get emails (no caching)protected int
internalGetEmailsCount
(UserIdentity userIdentity) Get emails count (no caching)protected List<CalendarEvent>
internalGetEvents
(UserIdentity userIdentity, int maxDays, int maxEvents) Get upcoming events (no caching)protected int
internalGetEventsCount
(UserIdentity userIdentity, int maxDays) Get upcoming events count (no caching)internalGetFreeBusy
(Date startDate, Date endDate, boolean isAllDay, Set<String> attendees, UserIdentity organiser) Get free/busy status for attendees for a time windowboolean
internalIsEventExist
(String eventId, UserIdentity organiser) True if the event exist in the messaging connectorvoid
internalSetAttendees
(String eventId, Map<String, Boolean> attendees, UserIdentity organiser) Set attendees for an eventvoid
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) Update an eventboolean
isUserExist
(UserIdentity userIdentity) True if the user existvoid
service
(ServiceManager manager) boolean
Tell if the messaging connector supports event invitationboolean
supportUserCredential
(UserIdentity userIdentity) Check if a user credential should be savedMethods 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 Details
-
INNER_ROLE
The avalon role
-
-
Constructor Details
-
EWSConnector
public EWSConnector()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in 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
Description copied from interface:MessagingConnector
Check if a user credential should be saved- Specified by:
supportUserCredential
in interfaceMessagingConnector
- Overrides:
supportUserCredential
in 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:AbstractMessagingConnector
Get upcoming events (no caching)- Specified by:
internalGetEvents
in 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:AbstractMessagingConnector
Get upcoming events count (no caching)- Specified by:
internalGetEventsCount
in 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:AbstractMessagingConnector
Get emails (no caching)- Specified by:
internalGetEmails
in 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
Description copied from class:AbstractMessagingConnector
Get emails count (no caching)- Specified by:
internalGetEmailsCount
in classAbstractMessagingConnector
- Parameters:
userIdentity
- The user identity- Returns:
- The emails count
- Throws:
MessagingConnectorException
- if failed to get events from server
-
supportInvitation
Description copied from interface:MessagingConnector
Tell if the messaging connector supports event invitation- Specified by:
supportInvitation
in interfaceMessagingConnector
- Overrides:
supportInvitation
in 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:AbstractMessagingConnector
True if the event exist in the messaging connector- Overrides:
internalIsEventExist
in 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 MessagingConnectorExceptionDescription copied from class:AbstractMessagingConnector
Create an event- Overrides:
internalCreateEvent
in 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 MessagingConnectorExceptionDescription copied from class:AbstractMessagingConnector
Update an event- Overrides:
internalUpdateEvent
in 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:AbstractMessagingConnector
Delete an event- Overrides:
internalDeleteEvent
in 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:AbstractMessagingConnector
Get the map of attendees for an event- Overrides:
internalGetAttendees
in 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 MessagingConnectorExceptionDescription copied from class:AbstractMessagingConnector
Set attendees for an event- Overrides:
internalSetAttendees
in 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:AbstractMessagingConnector
Get free/busy status for attendees for a time window- Overrides:
internalGetFreeBusy
in 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
Description copied from interface:MessagingConnector
True if the user exist- Specified by:
isUserExist
in interfaceMessagingConnector
- Overrides:
isUserExist
in classAbstractMessagingConnector
- Parameters:
userIdentity
- the user identity- Returns:
- true if the user exist
- Throws:
MessagingConnectorException
- if failed to get events from server
-
html2text
Converts a given html String into a plain text String- Parameters:
html
- the html String that will be converted- Returns:
- a String plain text of the given html
-