davmail.exchange.ews
Class EwsExchangeSession

java.lang.Object
  extended by davmail.exchange.ExchangeSession
      extended by davmail.exchange.ews.EwsExchangeSession

public class EwsExchangeSession
extends ExchangeSession

EWS Exchange adapter. Compatible with Exchange 2007 and hopefully 2010.


Nested Class Summary
protected static class EwsExchangeSession.AttributeCondition
           
protected static class EwsExchangeSession.AutoDiscoverMethod
           
protected  class EwsExchangeSession.Contact
           
protected  class EwsExchangeSession.Event
           
protected  class EwsExchangeSession.Folder
           
protected static class EwsExchangeSession.FolderPath
           
protected static class EwsExchangeSession.HeaderCondition
           
protected static class EwsExchangeSession.IsNullCondition
           
protected static class EwsExchangeSession.MultiCondition
           
protected static class EwsExchangeSession.NotCondition
           
 
Nested classes/interfaces inherited from class davmail.exchange.ExchangeSession
ExchangeSession.Condition, ExchangeSession.ContactPhoto, ExchangeSession.FreeBusy, ExchangeSession.Item, ExchangeSession.ItemResult, ExchangeSession.MessageList, ExchangeSession.MonoCondition, ExchangeSession.Operator
 
Field Summary
protected static String ARCHIVE_ROOT
           
protected static HashSet<String> EVENT_REQUEST_PROPERTIES
           
protected static HashSet<FieldURI> FOLDER_PROPERTIES
           
protected  Map<String,String> folderIdMap
           
protected static HashMap<String,String> GALFIND_ATTRIBUTE_MAP
           
protected static HashSet<String> IGNORE_ATTRIBUTE_SET
           
protected static Map<String,String> importanceToPriorityMap
           
protected static Set<String> ITEM_PROPERTIES
          Common item properties
protected static Set<String> MESSAGE_TYPES
          Message types.
protected static int PAGE_SIZE
           
protected static Map<String,String> priorityToImportanceMap
           
protected static String USERS_ROOT
           
 
Fields inherited from class davmail.exchange.ExchangeSession
ADDRESSBOOK, alias, CALENDAR, CONTACT_ATTRIBUTES, CONTACTS, currentMailboxPath, DRAFTS, email, FREE_BUSY_INTERVAL, GMT_TIMEZONE, httpClient, IMAP_MESSAGE_ATTRIBUTES, INBOX, JUNK, lastSentMessageId, LOGGER, LOWER_CASE_INBOX, mailPath, PASSWORD_FIELDS, POP_MESSAGE_ATTRIBUTES, PUBLIC_ROOT, publicFolderUrl, rootPath, SENDMSG, SENT, serverVersion, TASKS, TOKEN_FIELDS, TRASH, UID_MESSAGE_ATTRIBUTES, UNSENT, USER_NAME_FIELDS, userName, vTimezone, YYYY_MM_DD_HH_MM_SS, YYYY_MM_DD_T_HHMMSS_Z
 
Constructor Summary
EwsExchangeSession(String url, String userName, String password)
           
 
Method Summary
 ExchangeSession.MultiCondition and(ExchangeSession.Condition... condition)
          And search filter.
protected  void appendSubFolders(List<ExchangeSession.Folder> folders, String parentFolderPath, FolderId parentFolderId, ExchangeSession.Condition condition, boolean recursive)
           
protected  EwsExchangeSession.Folder buildFolder(EWSMethod.Item item)
           
protected  EwsExchangeSession.Contact buildGalfindContact(EWSMethod.Item response)
           
protected  davmail.exchange.ews.EwsExchangeSession.Message buildMessage(EWSMethod.Item response)
           
protected  List<FieldUpdate> buildProperties(Map<String,String> properties)
          Message create/update properties
protected  void buildSessionInfo(org.apache.commons.httpclient.HttpMethod method)
           
protected  void checkEndPointUrl(String endPointUrl)
          Check endpoint url.
 ExchangeSession.Condition contains(String attributeName, String value)
          Contains condition.
protected  String convertCalendarDateToExchange(String vcalendarDateValue)
           
protected  String convertDateFromExchange(String exchangeDateValue)
           
protected  String convertDateFromExchangeToTaskDate(String exchangeDateValue)
           
protected  String convertPriorityFromExchange(String exchangeImportanceValue)
           
protected  String convertPriorityToExchange(String vTodoPriorityValue)
           
protected  String convertTaskDateToZulu(String value)
           
 void copyMessage(ExchangeSession.Message message, String targetFolder)
          Copy message to target folder
 int createFolder(String folderPath, String folderClass, Map<String,String> properties)
          Create Exchange folder with given folder class.
 void createMessage(String folderPath, String messageName, HashMap<String,String> properties, javax.mail.internet.MimeMessage mimeMessage)
          Create message in specified folder.
 void deleteFolder(String folderPath)
          Delete Exchange folder.
 void deleteItem(String folderPath, String itemName)
          Delete event named itemName in folder
 void deleteMessage(ExchangeSession.Message message)
          Delete Exchange message.
protected  void executeMethod(EWSMethod ewsMethod)
           
 String formatSearchDate(Date date)
          Format date to exchange search format.
protected  org.apache.commons.httpclient.HttpMethod formLogin(org.apache.commons.httpclient.HttpClient httpClient, org.apache.commons.httpclient.HttpMethod initmethod, String userName, String password)
           
 Map<String,ExchangeSession.Contact> galFind(ExchangeSession.Condition condition, Set<String> returningAttributes, int sizeLimit)
          Search global address list
protected  ExchangeSession.Condition getCalendarItemCondition(ExchangeSession.Condition dateCondition)
           
 ExchangeSession.ContactPhoto getContactPhoto(ExchangeSession.Contact contact)
          Retrieve contact photo attached to contact
protected  byte[] getContent(ExchangeSession.Message message)
          Get raw MIME message content
protected  byte[] getContent(ItemId itemId)
          Get item content.
 List<ExchangeSession.Event> getEventMessages(String folderPath)
          Search calendar messages in provided folder.
protected  EWSMethod.Item getEwsItem(String folderPath, String itemName)
           
protected  String getEwsUrlFromAutoDiscover()
           
protected  String getEwsUrlFromAutoDiscover(String autodiscoverHostname)
           
protected  FolderId getFolderId(String folderPath)
           
protected  FolderId getFolderIdIfExists(String folderPath)
           
protected  String getFreeBusyData(String attendee, String start, String end, int interval)
          Get freebusy data string from Exchange.
 ExchangeSession.Item getItem(String folderPath, String itemName)
          Get item named eventName in folder
protected  Set<String> getItemProperties()
           
protected  FolderId getSubFolderByName(FolderId parentFolderId, String folderName)
           
protected  FolderId getSubFolderIdIfExists(String mailbox, String folderPath)
           
 List<ExchangeSession.Folder> getSubFolders(String folderPath, ExchangeSession.Condition condition, boolean recursive)
          Search folders under given folder matching filter.
protected  String getTimezoneidFromOptions()
           
 ExchangeSession.Condition gt(String attributeName, String value)
          Greater than condition.
 ExchangeSession.Condition gte(String attributeName, String value)
          Greater than or equals condition.
 ExchangeSession.Condition headerIsEqualTo(String headerName, String value)
          MIME header equals condition.
protected  ExchangeSession.ItemResult internalCreateOrUpdateContact(String folderPath, String itemName, Map<String,String> properties, String etag, String noneMatch)
           
protected  ExchangeSession.ItemResult internalCreateOrUpdateEvent(String folderPath, String itemName, String contentClass, String icsBody, String etag, String noneMatch)
           
protected  EwsExchangeSession.Folder internalGetFolder(String folderPath)
          Get folder by path.
 ExchangeSession.Condition isEqualTo(String attributeName, int value)
          Equals condition.
 ExchangeSession.Condition isEqualTo(String attributeName, String value)
          Equals condition.
 ExchangeSession.Condition isFalse(String attributeName)
          Is false condition.
protected static boolean isItemId(String itemName)
           
 boolean isMainCalendar(String folderPath)
          Test if folderPath is main calendar.
 ExchangeSession.Condition isNull(String attributeName)
          Is null condition.
 boolean isSharedFolder(String folderPath)
          Test if folderPath is inside user mailbox.
 ExchangeSession.Condition isTrue(String attributeName)
          Is true condition.
protected  void loadVtimezone()
           
 ExchangeSession.Condition lt(String attributeName, String value)
          Lower than condition.
 ExchangeSession.Condition lte(String attributeName, String value)
          Lower than or equals condition.
 void moveFolder(String folderPath, String targetFolderPath)
          Move folder to target name.
 void moveItem(String sourcePath, String targetPath)
          Move item from source path to target path.
 void moveMessage(ExchangeSession.Message message, String targetFolder)
          Move message to target folder
protected  void moveToTrash(ExchangeSession.Message message)
           
 ExchangeSession.Condition not(ExchangeSession.Condition condition)
          Not search filter.
 ExchangeSession.MultiCondition or(ExchangeSession.Condition... condition)
          Or search filter.
protected  Date parseDateFromExchange(String exchangeDateValue)
           
 void processItem(String folderPath, String itemName)
          Mark event processed named eventName in folder
 List<ExchangeSession.Contact> searchContacts(String folderPath, Set<String> attributes, ExchangeSession.Condition condition, int maxCount)
          Search contacts in provided folder matching the search query.
 List<ExchangeSession.Event> searchEvents(String folderPath, Set<String> attributes, ExchangeSession.Condition condition)
          Search calendar events or messages in provided folder matching the search query.
protected  List<EWSMethod.Item> searchItems(String folderPath, Set<String> attributes, ExchangeSession.Condition condition, FolderQueryTraversal folderQueryTraversal, int maxCount)
           
 ExchangeSession.MessageList searchMessages(String folderPath, Set<String> attributes, ExchangeSession.Condition condition)
          Search folder for messages matching conditions, with given attributes.
 int sendEvent(String icsBody)
          Build and send the MIME message for the provided ICS event.
 void sendMessage(javax.mail.internet.MimeMessage mimeMessage)
          Send Mime message.
protected  void sendMessage(String itemClass, byte[] messageBody)
           
 ExchangeSession.Condition startsWith(String attributeName, String value)
          Starts with condition.
 int updateFolder(String folderPath, Map<String,String> properties)
          Update Exchange folder properties.
 void updateMessage(ExchangeSession.Message message, Map<String,String> properties)
          Update given properties on message.
 
Methods inherited from class davmail.exchange.ExchangeSession
buildLogonMethod, checkFormLoginQueryString, convertBDayToZulu, convertContactProperties, convertFlagToKeyword, convertItemNameToEML, convertKeywordToFlag, convertResentHeader, convertZuluDateToBday, createCalendarFolder, createContactFolder, createMessageFolder, createOrUpdateContact, createOrUpdateItem, getAbsoluteUri, getAlias, getAliasFromLogin, getAllContacts, getAllEvents, getAllMessageUidAndSize, getAllRecipients, getEmail, getEmailAndAliasFromOptions, getEmailSuffixFromHostname, getExchangeZuluDateFormat, getExchangeZuluDateFormatMillisecond, getFolder, getFreebusy, getHttpClient, getPastDelayCondition, getRangeCondition, getScriptBasedFormURL, getServerVersion, getSubCalendarFolders, getSubFolders, getVcardBdayFormat, getVTimezone, getZuluDateFormat, isAuthenticated, isBasicAuthentication, isExpired, parseDate, postLogonMethod, purgeOldestFolderMessages, purgeOldestTrashAndSentMessages, refreshFolder, replaceIcal4Principal, searchEvents, searchEvents, searchEventsOnly, searchMessages, searchMessages, searchTasksOnly, sendMessage, setAuthFormFields, submitLanguageSelectionForm, throwAuthenticationFailed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAGE_SIZE

protected static final int PAGE_SIZE
See Also:
Constant Field Values

ARCHIVE_ROOT

protected static final String ARCHIVE_ROOT
See Also:
Constant Field Values

MESSAGE_TYPES

protected static final Set<String> MESSAGE_TYPES
Message types.

See Also:
http://msdn.microsoft.com/en-us/library/aa565652%28v=EXCHG.140%29.aspx

folderIdMap

protected Map<String,String> folderIdMap

FOLDER_PROPERTIES

protected static final HashSet<FieldURI> FOLDER_PROPERTIES

ITEM_PROPERTIES

protected static final Set<String> ITEM_PROPERTIES
Common item properties


EVENT_REQUEST_PROPERTIES

protected static final HashSet<String> EVENT_REQUEST_PROPERTIES

USERS_ROOT

protected static final String USERS_ROOT
See Also:
Constant Field Values

GALFIND_ATTRIBUTE_MAP

protected static final HashMap<String,String> GALFIND_ATTRIBUTE_MAP

IGNORE_ATTRIBUTE_SET

protected static final HashSet<String> IGNORE_ATTRIBUTE_SET

importanceToPriorityMap

protected static final Map<String,String> importanceToPriorityMap

priorityToImportanceMap

protected static final Map<String,String> priorityToImportanceMap
Constructor Detail

EwsExchangeSession

public EwsExchangeSession(String url,
                          String userName,
                          String password)
                   throws IOException
Throws:
IOException
Method Detail

formLogin

protected org.apache.commons.httpclient.HttpMethod formLogin(org.apache.commons.httpclient.HttpClient httpClient,
                                                             org.apache.commons.httpclient.HttpMethod initmethod,
                                                             String userName,
                                                             String password)
                                                      throws IOException
Overrides:
formLogin in class ExchangeSession
Throws:
IOException

checkEndPointUrl

protected void checkEndPointUrl(String endPointUrl)
                         throws IOException
Check endpoint url.

Parameters:
endPointUrl - endpoint url
Throws:
IOException - on error

buildSessionInfo

protected void buildSessionInfo(org.apache.commons.httpclient.HttpMethod method)
                         throws DavMailException
Specified by:
buildSessionInfo in class ExchangeSession
Throws:
DavMailException

getEwsUrlFromAutoDiscover

protected String getEwsUrlFromAutoDiscover()
                                    throws DavMailAuthenticationException
Throws:
DavMailAuthenticationException

getEwsUrlFromAutoDiscover

protected String getEwsUrlFromAutoDiscover(String autodiscoverHostname)
                                    throws IOException
Throws:
IOException

buildProperties

protected List<FieldUpdate> buildProperties(Map<String,String> properties)
Message create/update properties

Parameters:
properties - flag values map
Returns:
field values

createMessage

public void createMessage(String folderPath,
                          String messageName,
                          HashMap<String,String> properties,
                          javax.mail.internet.MimeMessage mimeMessage)
                   throws IOException
Description copied from class: ExchangeSession
Create message in specified folder. Will overwrite an existing message with same subject in the same folder

Specified by:
createMessage in class ExchangeSession
Parameters:
folderPath - Exchange folder path
messageName - message name
properties - message properties (flags)
mimeMessage - MIME message
Throws:
IOException - when unable to create message

updateMessage

public void updateMessage(ExchangeSession.Message message,
                          Map<String,String> properties)
                   throws IOException
Description copied from class: ExchangeSession
Update given properties on message.

Specified by:
updateMessage in class ExchangeSession
Parameters:
message - Exchange message
properties - Webdav properties map
Throws:
IOException - on error

deleteMessage

public void deleteMessage(ExchangeSession.Message message)
                   throws IOException
Description copied from class: ExchangeSession
Delete Exchange message.

Specified by:
deleteMessage in class ExchangeSession
Parameters:
message - Exchange message
Throws:
IOException - on error

sendMessage

protected void sendMessage(String itemClass,
                           byte[] messageBody)
                    throws IOException
Throws:
IOException

sendMessage

public void sendMessage(javax.mail.internet.MimeMessage mimeMessage)
                 throws IOException,
                        javax.mail.MessagingException
Description copied from class: ExchangeSession
Send Mime message.

Specified by:
sendMessage in class ExchangeSession
Parameters:
mimeMessage - MIME message
Throws:
IOException - on error
javax.mail.MessagingException - on error

getContent

protected byte[] getContent(ExchangeSession.Message message)
                     throws IOException
Description copied from class: ExchangeSession
Get raw MIME message content

Specified by:
getContent in class ExchangeSession
Parameters:
message - Exchange message
Returns:
message body
Throws:
IOException - on error

getContent

protected byte[] getContent(ItemId itemId)
                     throws IOException
Get item content.

Parameters:
itemId - EWS item id
Returns:
item content as byte array
Throws:
IOException - on error

buildMessage

protected davmail.exchange.ews.EwsExchangeSession.Message buildMessage(EWSMethod.Item response)
                                                                throws DavMailException
Throws:
DavMailException

searchMessages

public ExchangeSession.MessageList searchMessages(String folderPath,
                                                  Set<String> attributes,
                                                  ExchangeSession.Condition condition)
                                           throws IOException
Description copied from class: ExchangeSession
Search folder for messages matching conditions, with given attributes.

Specified by:
searchMessages in class ExchangeSession
Parameters:
folderPath - Exchange folder name
attributes - requested Webdav attributes
condition - search filter
Returns:
message list
Throws:
IOException - on error

searchItems

protected List<EWSMethod.Item> searchItems(String folderPath,
                                           Set<String> attributes,
                                           ExchangeSession.Condition condition,
                                           FolderQueryTraversal folderQueryTraversal,
                                           int maxCount)
                                    throws IOException
Throws:
IOException

and

public ExchangeSession.MultiCondition and(ExchangeSession.Condition... condition)
Description copied from class: ExchangeSession
And search filter.

Specified by:
and in class ExchangeSession
Parameters:
condition - search conditions
Returns:
condition

or

public ExchangeSession.MultiCondition or(ExchangeSession.Condition... condition)
Description copied from class: ExchangeSession
Or search filter.

Specified by:
or in class ExchangeSession
Parameters:
condition - search conditions
Returns:
condition

not

public ExchangeSession.Condition not(ExchangeSession.Condition condition)
Description copied from class: ExchangeSession
Not search filter.

Specified by:
not in class ExchangeSession
Parameters:
condition - search condition
Returns:
condition

isEqualTo

public ExchangeSession.Condition isEqualTo(String attributeName,
                                           String value)
Description copied from class: ExchangeSession
Equals condition.

Specified by:
isEqualTo in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
value - attribute value
Returns:
condition

isEqualTo

public ExchangeSession.Condition isEqualTo(String attributeName,
                                           int value)
Description copied from class: ExchangeSession
Equals condition.

Specified by:
isEqualTo in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
value - attribute value
Returns:
condition

headerIsEqualTo

public ExchangeSession.Condition headerIsEqualTo(String headerName,
                                                 String value)
Description copied from class: ExchangeSession
MIME header equals condition.

Specified by:
headerIsEqualTo in class ExchangeSession
Parameters:
headerName - MIME header name
value - attribute value
Returns:
condition

gte

public ExchangeSession.Condition gte(String attributeName,
                                     String value)
Description copied from class: ExchangeSession
Greater than or equals condition.

Specified by:
gte in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
value - attribute value
Returns:
condition

lte

public ExchangeSession.Condition lte(String attributeName,
                                     String value)
Description copied from class: ExchangeSession
Lower than or equals condition.

Specified by:
lte in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
value - attribute value
Returns:
condition

lt

public ExchangeSession.Condition lt(String attributeName,
                                    String value)
Description copied from class: ExchangeSession
Lower than condition.

Specified by:
lt in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
value - attribute value
Returns:
condition

gt

public ExchangeSession.Condition gt(String attributeName,
                                    String value)
Description copied from class: ExchangeSession
Greater than condition.

Specified by:
gt in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
value - attribute value
Returns:
condition

contains

public ExchangeSession.Condition contains(String attributeName,
                                          String value)
Description copied from class: ExchangeSession
Contains condition.

Specified by:
contains in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
value - attribute value
Returns:
condition

startsWith

public ExchangeSession.Condition startsWith(String attributeName,
                                            String value)
Description copied from class: ExchangeSession
Starts with condition.

Specified by:
startsWith in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
value - attribute value
Returns:
condition

isNull

public ExchangeSession.Condition isNull(String attributeName)
Description copied from class: ExchangeSession
Is null condition.

Specified by:
isNull in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
Returns:
condition

isTrue

public ExchangeSession.Condition isTrue(String attributeName)
Description copied from class: ExchangeSession
Is true condition.

Specified by:
isTrue in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
Returns:
condition

isFalse

public ExchangeSession.Condition isFalse(String attributeName)
Description copied from class: ExchangeSession
Is false condition.

Specified by:
isFalse in class ExchangeSession
Parameters:
attributeName - logical Exchange attribute name
Returns:
condition

buildFolder

protected EwsExchangeSession.Folder buildFolder(EWSMethod.Item item)

getSubFolders

public List<ExchangeSession.Folder> getSubFolders(String folderPath,
                                                  ExchangeSession.Condition condition,
                                                  boolean recursive)
                                           throws IOException
Description copied from class: ExchangeSession
Search folders under given folder matching filter.

Specified by:
getSubFolders in class ExchangeSession
Parameters:
folderPath - Exchange folder name
condition - search filter
recursive - deep search if true
Returns:
list of folders
Throws:
IOException - on error

appendSubFolders

protected void appendSubFolders(List<ExchangeSession.Folder> folders,
                                String parentFolderPath,
                                FolderId parentFolderId,
                                ExchangeSession.Condition condition,
                                boolean recursive)
                         throws IOException
Throws:
IOException

internalGetFolder

protected EwsExchangeSession.Folder internalGetFolder(String folderPath)
                                               throws IOException
Get folder by path.

Specified by:
internalGetFolder in class ExchangeSession
Parameters:
folderPath - folder path
Returns:
folder object
Throws:
IOException - on error

createFolder

public int createFolder(String folderPath,
                        String folderClass,
                        Map<String,String> properties)
                 throws IOException
Description copied from class: ExchangeSession
Create Exchange folder with given folder class.

Specified by:
createFolder in class ExchangeSession
Parameters:
folderPath - logical folder name
folderClass - folder class
properties - folder properties
Returns:
status
Throws:
IOException - on error

updateFolder

public int updateFolder(String folderPath,
                        Map<String,String> properties)
                 throws IOException
Description copied from class: ExchangeSession
Update Exchange folder properties.

Specified by:
updateFolder in class ExchangeSession
Parameters:
folderPath - logical folder name
properties - folder properties
Returns:
status
Throws:
IOException - on error

deleteFolder

public void deleteFolder(String folderPath)
                  throws IOException
Description copied from class: ExchangeSession
Delete Exchange folder.

Specified by:
deleteFolder in class ExchangeSession
Parameters:
folderPath - logical folder name
Throws:
IOException - on error

moveMessage

public void moveMessage(ExchangeSession.Message message,
                        String targetFolder)
                 throws IOException
Description copied from class: ExchangeSession
Move message to target folder

Specified by:
moveMessage in class ExchangeSession
Parameters:
message - Exchange message
targetFolder - target folder
Throws:
IOException - on error

copyMessage

public void copyMessage(ExchangeSession.Message message,
                        String targetFolder)
                 throws IOException
Description copied from class: ExchangeSession
Copy message to target folder

Specified by:
copyMessage in class ExchangeSession
Parameters:
message - Exchange message
targetFolder - target folder
Throws:
IOException - on error

moveFolder

public void moveFolder(String folderPath,
                       String targetFolderPath)
                throws IOException
Description copied from class: ExchangeSession
Move folder to target name.

Specified by:
moveFolder in class ExchangeSession
Parameters:
folderPath - current folder name/path
targetFolderPath - target folder name/path
Throws:
IOException - on error

moveItem

public void moveItem(String sourcePath,
                     String targetPath)
              throws IOException
Description copied from class: ExchangeSession
Move item from source path to target path.

Specified by:
moveItem in class ExchangeSession
Parameters:
sourcePath - item source path
targetPath - item target path
Throws:
IOException - on error

moveToTrash

protected void moveToTrash(ExchangeSession.Message message)
                    throws IOException
Specified by:
moveToTrash in class ExchangeSession
Throws:
IOException

searchContacts

public List<ExchangeSession.Contact> searchContacts(String folderPath,
                                                    Set<String> attributes,
                                                    ExchangeSession.Condition condition,
                                                    int maxCount)
                                             throws IOException
Description copied from class: ExchangeSession
Search contacts in provided folder matching the search query.

Specified by:
searchContacts in class ExchangeSession
Parameters:
folderPath - Exchange folder path
attributes - requested attributes
condition - Exchange search query
maxCount - maximum item count
Returns:
list of contacts
Throws:
IOException - on error

getCalendarItemCondition

protected ExchangeSession.Condition getCalendarItemCondition(ExchangeSession.Condition dateCondition)
Specified by:
getCalendarItemCondition in class ExchangeSession

getEventMessages

public List<ExchangeSession.Event> getEventMessages(String folderPath)
                                             throws IOException
Description copied from class: ExchangeSession
Search calendar messages in provided folder.

Specified by:
getEventMessages in class ExchangeSession
Parameters:
folderPath - Exchange folder path
Returns:
list of calendar messages as Event objects
Throws:
IOException - on error

searchEvents

public List<ExchangeSession.Event> searchEvents(String folderPath,
                                                Set<String> attributes,
                                                ExchangeSession.Condition condition)
                                         throws IOException
Description copied from class: ExchangeSession
Search calendar events or messages in provided folder matching the search query.

Specified by:
searchEvents in class ExchangeSession
Parameters:
folderPath - Exchange folder path
attributes - requested attributes
condition - Exchange search query
Returns:
list of calendar messages as Event objects
Throws:
IOException - on error

getItemProperties

protected Set<String> getItemProperties()
Specified by:
getItemProperties in class ExchangeSession

getEwsItem

protected EWSMethod.Item getEwsItem(String folderPath,
                                    String itemName)
                             throws IOException
Throws:
IOException

getItem

public ExchangeSession.Item getItem(String folderPath,
                                    String itemName)
                             throws IOException
Description copied from class: ExchangeSession
Get item named eventName in folder

Specified by:
getItem in class ExchangeSession
Parameters:
folderPath - Exchange folder path
itemName - event name
Returns:
event object
Throws:
IOException - on error

getContactPhoto

public ExchangeSession.ContactPhoto getContactPhoto(ExchangeSession.Contact contact)
                                             throws IOException
Description copied from class: ExchangeSession
Retrieve contact photo attached to contact

Specified by:
getContactPhoto in class ExchangeSession
Parameters:
contact - address book contact
Returns:
contact photo
Throws:
IOException - on error

deleteItem

public void deleteItem(String folderPath,
                       String itemName)
                throws IOException
Description copied from class: ExchangeSession
Delete event named itemName in folder

Specified by:
deleteItem in class ExchangeSession
Parameters:
folderPath - Exchange folder path
itemName - item name
Throws:
IOException - on error

processItem

public void processItem(String folderPath,
                        String itemName)
                 throws IOException
Description copied from class: ExchangeSession
Mark event processed named eventName in folder

Specified by:
processItem in class ExchangeSession
Parameters:
folderPath - Exchange folder path
itemName - item name
Throws:
IOException - on error

sendEvent

public int sendEvent(String icsBody)
              throws IOException
Description copied from class: ExchangeSession
Build and send the MIME message for the provided ICS event.

Specified by:
sendEvent in class ExchangeSession
Parameters:
icsBody - event in iCalendar format
Returns:
HTTP status
Throws:
IOException - on error

internalCreateOrUpdateContact

protected ExchangeSession.ItemResult internalCreateOrUpdateContact(String folderPath,
                                                                   String itemName,
                                                                   Map<String,String> properties,
                                                                   String etag,
                                                                   String noneMatch)
                                                            throws IOException
Specified by:
internalCreateOrUpdateContact in class ExchangeSession
Throws:
IOException

internalCreateOrUpdateEvent

protected ExchangeSession.ItemResult internalCreateOrUpdateEvent(String folderPath,
                                                                 String itemName,
                                                                 String contentClass,
                                                                 String icsBody,
                                                                 String etag,
                                                                 String noneMatch)
                                                          throws IOException
Specified by:
internalCreateOrUpdateEvent in class ExchangeSession
Throws:
IOException

isSharedFolder

public boolean isSharedFolder(String folderPath)
Description copied from class: ExchangeSession
Test if folderPath is inside user mailbox.

Specified by:
isSharedFolder in class ExchangeSession
Parameters:
folderPath - absolute folder path
Returns:
true if folderPath is a public or shared folder

isMainCalendar

public boolean isMainCalendar(String folderPath)
Description copied from class: ExchangeSession
Test if folderPath is main calendar.

Specified by:
isMainCalendar in class ExchangeSession
Parameters:
folderPath - absolute folder path
Returns:
true if folderPath is a public or shared folder

getFreeBusyData

protected String getFreeBusyData(String attendee,
                                 String start,
                                 String end,
                                 int interval)
                          throws IOException
Description copied from class: ExchangeSession
Get freebusy data string from Exchange.

Specified by:
getFreeBusyData in class ExchangeSession
Parameters:
attendee - attendee email address
start - start date in Exchange zulu format
end - end date in Exchange zulu format
interval - freebusy interval in minutes
Returns:
freebusy data or null
Throws:
IOException - on error

loadVtimezone

protected void loadVtimezone()
Specified by:
loadVtimezone in class ExchangeSession

getTimezoneidFromOptions

protected String getTimezoneidFromOptions()

getFolderId

protected FolderId getFolderId(String folderPath)
                        throws IOException
Throws:
IOException

getFolderIdIfExists

protected FolderId getFolderIdIfExists(String folderPath)
                                throws IOException
Throws:
IOException

getSubFolderIdIfExists

protected FolderId getSubFolderIdIfExists(String mailbox,
                                          String folderPath)
                                   throws IOException
Throws:
IOException

getSubFolderByName

protected FolderId getSubFolderByName(FolderId parentFolderId,
                                      String folderName)
                               throws IOException
Throws:
IOException

executeMethod

protected void executeMethod(EWSMethod ewsMethod)
                      throws IOException
Throws:
IOException

buildGalfindContact

protected EwsExchangeSession.Contact buildGalfindContact(EWSMethod.Item response)

galFind

public Map<String,ExchangeSession.Contact> galFind(ExchangeSession.Condition condition,
                                                   Set<String> returningAttributes,
                                                   int sizeLimit)
                                            throws IOException
Description copied from class: ExchangeSession
Search global address list

Specified by:
galFind in class ExchangeSession
Parameters:
condition - search filter
returningAttributes - returning attributes
sizeLimit - size limit
Returns:
matching contacts from gal
Throws:
IOException - on error

parseDateFromExchange

protected Date parseDateFromExchange(String exchangeDateValue)
                              throws DavMailException
Throws:
DavMailException

convertDateFromExchange

protected String convertDateFromExchange(String exchangeDateValue)
                                  throws DavMailException
Throws:
DavMailException

convertCalendarDateToExchange

protected String convertCalendarDateToExchange(String vcalendarDateValue)
                                        throws DavMailException
Throws:
DavMailException

convertDateFromExchangeToTaskDate

protected String convertDateFromExchangeToTaskDate(String exchangeDateValue)
                                            throws DavMailException
Throws:
DavMailException

convertTaskDateToZulu

protected String convertTaskDateToZulu(String value)

formatSearchDate

public String formatSearchDate(Date date)
Format date to exchange search format.

Specified by:
formatSearchDate in class ExchangeSession
Parameters:
date - date object
Returns:
formatted search date

isItemId

protected static boolean isItemId(String itemName)

convertPriorityFromExchange

protected String convertPriorityFromExchange(String exchangeImportanceValue)

convertPriorityToExchange

protected String convertPriorityToExchange(String vTodoPriorityValue)


Copyright © 2001-2013 MickaĆ«l Guessant. All Rights Reserved.