public class ZimbraConnector extends AbstractMessagingConnector
MessagingConnector.AttendeeInformation, MessagingConnector.FreeBusyStatus, MessagingConnector.ResponseType| Modifier and Type | Field and Description |
|---|---|
protected CurrentUserProvider |
_currentUserProvider
The user preferences manager.
|
protected String |
_domainPreauthSecretKey
Preauth secret key
|
protected JSONUtils |
_jsonUtils
The JSON Utils
|
protected UserManager |
_usersManager
The user manager
|
protected String |
_zimbraUrl
Url to zimbra
|
_userPopulationDAOROLE| Constructor and Description |
|---|
ZimbraConnector() |
| Modifier and Type | Method and Description |
|---|---|
private String |
_computeQueryString(User user,
String targetApp) |
protected String |
_doPreauthRequest(User user)
Zimbra preauth request to log the current user into zimbra and retrieve the ZM_AUTH_TOKEN
|
protected List<Map<String,Object>> |
_extractCalendarProperties(Calendar calendar,
int dayInterval,
int maxEvents)
Extract interesting properties for the calendar.
|
protected Map<String,Object> |
_extractCalendarProperties(VEvent event,
Date date)
Extract interesting properties for the event.
|
protected Calendar |
_getCalendar(User user,
String zmAuthToken,
String dayInterval)
Retrieves a calendar through a query via the Zimbra REST API.
|
protected String |
_getComputedPreauth(String zimbraUser,
String timestamp,
String secretKey)
Compute the preauth key.
|
protected Map<String,Object> |
_getEmailInfo(User user,
String zmAuthToken)
Retrieves some mail info through a query via the Zimbra REST API.
|
protected String |
_sanitizeEventLocation(Location location)
Extract the interesting part of the raw event location.
|
void |
initialize() |
protected 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,
Date fromDate,
Date untilDate,
int maxEvents)
Get events between two date (no caching)
|
protected int |
internalGetEventsCount(UserIdentity userIdentity,
Date fromDate,
Date untilDate)
Get events count between two date (no caching)
|
void |
redirect(Redirector redirector,
String targetApp)
Preauth user and redirect to the zimbra application
|
void |
service(ServiceManager smanager) |
createEvent, deleteEvent, getAllowedPopulationIds, getAttendees, getEvents, getEventsCount, getFreeBusy, getUnreadEmailCount, getUnreadEmails, isAllowed, isEventExist, isUserExist, setAttendees, supportInvitation, updateEventgetLogger, setLoggerprotected CurrentUserProvider _currentUserProvider
protected UserManager _usersManager
protected JSONUtils _jsonUtils
protected String _zimbraUrl
protected String _domainPreauthSecretKey
public ZimbraConnector()
public void service(ServiceManager smanager) throws ServiceException
service in interface Serviceableservice in class AbstractMessagingConnectorServiceExceptionpublic void initialize()
initialize in interface Initializableinitialize in class AbstractMessagingConnectorpublic void redirect(Redirector redirector, String targetApp) throws ProcessingException, IOException
redirector - The redirectortargetApp - The zimbra application (ex: mail)ProcessingException - if failed to redirectIOException - if failed to redirectprotected Map<String,Object> _getEmailInfo(User user, String zmAuthToken)
user - The userzmAuthToken - The auth token corresponding to a currenlty logged
user in zimbra.protected Calendar _getCalendar(User user, String zmAuthToken, String dayInterval)
user - The userzmAuthToken - The auth token corresponding to a currenlty logged
user in zimbra.dayInterval - Interval of day to search for the next eventprotected List<Map<String,Object>> _extractCalendarProperties(Calendar calendar, int dayInterval, int maxEvents)
calendar - The calendardayInterval - Interval of day to search for the next eventmaxEvents - The maximum number of eventsprotected Map<String,Object> _extractCalendarProperties(VEvent event, Date date)
event - The eventdate - The event start date to display (necessary for reccurent
event)protected String _sanitizeEventLocation(Location location)
location - The iCal4j location object.protected String _doPreauthRequest(User user)
user - The user for which the preauth request will be done.null if user is null or has no email.MessagingConnectorException - if failed to get zimbra token for userprivate String _computeQueryString(User user, String targetApp)
protected String _getComputedPreauth(String zimbraUser, String timestamp, String secretKey) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException
zimbraUser - The Zimbra Usertimestamp - The timestampsecretKey - The secret keyNoSuchAlgorithmException - if no Provider supports a MacSpi
implementation for the specified algorithm (HmacSHA1).InvalidKeyException - if the given key is inappropriate for
initializing the MACUnsupportedEncodingException - If the named charset (UTF-8) is not
supportedprotected List<CalendarEvent> internalGetEvents(UserIdentity userIdentity, Date fromDate, Date untilDate, int maxEvents) throws MessagingConnectorException
AbstractMessagingConnectorinternalGetEvents in class AbstractMessagingConnectoruserIdentity - 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 int internalGetEventsCount(UserIdentity userIdentity, Date fromDate, Date untilDate) throws MessagingConnectorException
AbstractMessagingConnectorinternalGetEventsCount in class AbstractMessagingConnectoruserIdentity - The user identityfromDate - The date to start searchuntilDate - The date to end searchMessagingConnectorException - if failed to get events from serverprotected List<EmailMessage> internalGetEmails(UserIdentity userIdentity, int maxEmails) throws MessagingConnectorException
AbstractMessagingConnectorinternalGetEmails in class AbstractMessagingConnectoruserIdentity - The user identitymaxEmails - The maximum number of emails to retrieveMessagingConnectorException - if failed to get events from serverprotected int internalGetEmailsCount(UserIdentity userIdentity) throws MessagingConnectorException
AbstractMessagingConnectorinternalGetEmailsCount in class AbstractMessagingConnectoruserIdentity - The user identityMessagingConnectorException - if failed to get events from server