Class ExchangeItemUtil
- java.lang.Object
-
- de.uplanet.lucy.server.businesslogic.exchange.util.impl.ExchangeItemUtil
-
- All Implemented Interfaces:
IExchangeItemUtil
@Scriptable public final class ExchangeItemUtil extends Object implements IExchangeItemUtil
Utility class for MS Exchange items.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttachmentToItem(String p_strItemId, File p_file, String p_strFileName, String p_strMimeType, boolean p_bIsContactPhoto, boolean p_bDeleteAfter)
Adds a file as attachment to an MS Exchange item.void
addAttachmentToItem(String p_strItemId, String p_strFile, String p_strFileName, String p_strMimeType, boolean p_bIsContactPhoto, boolean p_bDeleteAfter)
Adds a file as attachment to an MS Exchange item.void
copyAttachmentToItem(String p_strSrcAttId, String p_strDstItemId, String p_strFileName, boolean p_bIsContactPhoto)
Copies an attachment from an item to another one.String
copyItemToFolder(String p_strSourceId, String p_strDstFldrHref)
Copy an item to a folder.List<IAttachmentInfo>
getAttachments(String p_strItemId)
Returns a list ofAttachmentInfo
instances for the item identified by the given ID.static IExchangeItemUtil
getInstance()
Returns an instance initialized with a Exchange connection for the currently logged in user.static IExchangeItemUtil
getInstance(Connection p_conn)
Returns an instance initialized with the given Exchange connection.String
getMailboxOfItem(String p_strItemId)
Tries to determine the mailbox an item with the given ID/HREF belongs to.String
getPermanentID(String p_strTableName, String p_strId)
Returns the permanent ID (e.g.String
moveItemToFolder(String p_strSourceId, String p_strDstFldrHref)
Move an item to a folder.void
removeAttachmentFromItem(String p_strAttachmentId)
Removes an attachment from an item.void
saveAttachment(IAttachmentInfo p_attachment, File p_fileDestination)
Saves an attachment to the given destination file.void
saveAttachment(IAttachmentInfo p_attachment, String p_strFileDest)
Saves an attachment to the given destination file.void
saveAttachment(String p_strId, File p_fileDestination)
Saves an attachment to the given destination file.void
saveAttachment(String p_strId, String p_strFileDest)
Saves an attachment to the given destination file.
-
-
-
Method Detail
-
getInstance
public static IExchangeItemUtil getInstance()
Returns an instance initialized with a Exchange connection for the currently logged in user.- Returns:
- the instance
-
getInstance
public static IExchangeItemUtil getInstance(Connection p_conn)
Returns an instance initialized with the given Exchange connection.- Parameters:
p_conn
- the MS Exchange connection- Returns:
- the instance
-
getPermanentID
public String getPermanentID(String p_strTableName, String p_strId) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Returns the permanent ID (e.g. value of field PermanentURL) of an item stored in the given table with the given ID.- Specified by:
getPermanentID
in interfaceIExchangeItemUtil
- Parameters:
p_strTableName
- The name of the table the item is stored in.p_strId
- The item ID value.- Returns:
- The permanent URL or
null
if item was not found. - Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
getMailboxOfItem
public String getMailboxOfItem(String p_strItemId) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Tries to determine the mailbox an item with the given ID/HREF belongs to. This method is only available when using MS Exchange 2003-2007.- Specified by:
getMailboxOfItem
in interfaceIExchangeItemUtil
- Parameters:
p_strItemId
- The ID of the item.- Returns:
- The item's mailbox or an empty string if it could not be determined.
- Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
copyItemToFolder
public String copyItemToFolder(String p_strSourceId, String p_strDstFldrHref) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Copy an item to a folder.- Specified by:
copyItemToFolder
in interfaceIExchangeItemUtil
- Parameters:
p_strSourceId
- The ID of the item to copy.p_strDstFldrHref
- The HREF of the destination folder.- Returns:
- The new item HREF or
null
if the operation failed. - Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
moveItemToFolder
public String moveItemToFolder(String p_strSourceId, String p_strDstFldrHref) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Move an item to a folder.- Specified by:
moveItemToFolder
in interfaceIExchangeItemUtil
- Parameters:
p_strSourceId
- The ID of the item to move.p_strDstFldrHref
- The HREF of the destination folder.- Returns:
- The new item HREF or
null
if the operation failed. - Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
getAttachments
public List<IAttachmentInfo> getAttachments(String p_strItemId) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Returns a list ofAttachmentInfo
instances for the item identified by the given ID. To get the content of an attachment, usesaveAttachment(..)
.- Specified by:
getAttachments
in interfaceIExchangeItemUtil
- Parameters:
p_strItemId
- The ID of the item.- Returns:
- A list of
AttachmentInfo
instances. - Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
saveAttachment
public void saveAttachment(String p_strId, String p_strFileDest) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Saves an attachment to the given destination file.- Specified by:
saveAttachment
in interfaceIExchangeItemUtil
- Parameters:
p_strId
- The ID identifying the attachment.p_strFileDest
- The destination file to save the attachment.- Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
saveAttachment
public void saveAttachment(String p_strId, File p_fileDestination) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Saves an attachment to the given destination file.- Specified by:
saveAttachment
in interfaceIExchangeItemUtil
- Parameters:
p_strId
- The ID identifying the attachment.p_fileDestination
- The destination file to save the attachment.- Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
saveAttachment
public void saveAttachment(IAttachmentInfo p_attachment, String p_strFileDest) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Saves an attachment to the given destination file.- Specified by:
saveAttachment
in interfaceIExchangeItemUtil
- Parameters:
p_attachment
- The attachment object.p_strFileDest
- The destination file to save the attachment.- Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
saveAttachment
public void saveAttachment(IAttachmentInfo p_attachment, File p_fileDestination) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Saves an attachment to the given destination file.- Specified by:
saveAttachment
in interfaceIExchangeItemUtil
- Parameters:
p_attachment
- The attachment object.p_fileDestination
- The destination file to save the attachment.- Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
addAttachmentToItem
public void addAttachmentToItem(String p_strItemId, File p_file, String p_strFileName, String p_strMimeType, boolean p_bIsContactPhoto, boolean p_bDeleteAfter) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Adds a file as attachment to an MS Exchange item.- Specified by:
addAttachmentToItem
in interfaceIExchangeItemUtil
- Parameters:
p_strItemId
- The ID of the item to which the file will be attached.p_file
- The file to add as attachment.p_strFileName
- The name of the attachment.p_strMimeType
- The MIME type of the attachment, if empty application/octet-stream is used.p_bIsContactPhoto
-true
if an image file should be attached to a contact, orfalse
otherwise.p_bDeleteAfter
-true
if the file should be deleted after it has been attached, orfalse
otherwise.- Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
addAttachmentToItem
public void addAttachmentToItem(String p_strItemId, String p_strFile, String p_strFileName, String p_strMimeType, boolean p_bIsContactPhoto, boolean p_bDeleteAfter) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Adds a file as attachment to an MS Exchange item.- Specified by:
addAttachmentToItem
in interfaceIExchangeItemUtil
- Parameters:
p_strItemId
- The ID of the item to which the file will be attached.p_strFile
- The path of the file to add as attachment.p_strFileName
- The name of the attachment.p_strMimeType
- The MIME type of the attachment, if empty application/octet-stream is used.p_bIsContactPhoto
-true
if an image file should be attached to a contact, orfalse
otherwise.p_bDeleteAfter
-true
if the file should be deleted after it has been attached, orfalse
otherwise.- Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
copyAttachmentToItem
public void copyAttachmentToItem(String p_strSrcAttId, String p_strDstItemId, String p_strFileName, boolean p_bIsContactPhoto) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Copies an attachment from an item to another one.- Specified by:
copyAttachmentToItem
in interfaceIExchangeItemUtil
- Parameters:
p_strSrcAttId
- The source attachment ID.p_strDstItemId
- The destination item ID.p_strFileName
- The file name.p_bIsContactPhoto
- True, if content is a contact photo.- Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
removeAttachmentFromItem
public void removeAttachmentFromItem(String p_strAttachmentId) throws de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
Description copied from interface:IExchangeItemUtil
Removes an attachment from an item.- Specified by:
removeAttachmentFromItem
in interfaceIExchangeItemUtil
- Parameters:
p_strAttachmentId
- The ID identifying the attachment.- Throws:
de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtilException
- If the operation failed.
-
-