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
|
_userPopulationDAO
ROLE
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, updateEvent
getLogger, setLogger
protected 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 Serviceable
service
in class AbstractMessagingConnector
ServiceException
public void initialize()
initialize
in interface Initializable
initialize
in class AbstractMessagingConnector
public 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
AbstractMessagingConnector
internalGetEvents
in class AbstractMessagingConnector
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 int internalGetEventsCount(UserIdentity userIdentity, Date fromDate, Date untilDate) throws MessagingConnectorException
AbstractMessagingConnector
internalGetEventsCount
in class AbstractMessagingConnector
userIdentity
- 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
AbstractMessagingConnector
internalGetEmails
in class AbstractMessagingConnector
userIdentity
- The user identitymaxEmails
- The maximum number of emails to retrieveMessagingConnectorException
- if failed to get events from serverprotected int internalGetEmailsCount(UserIdentity userIdentity) throws MessagingConnectorException
AbstractMessagingConnector
internalGetEmailsCount
in class AbstractMessagingConnector
userIdentity
- The user identityMessagingConnectorException
- if failed to get events from server