Interface Attachment
-
public interface AttachmentAttachment class is representing a message optional parameter. It can contain any file uploaded by sending participant.If user is sending a picture, the client application is responsible for creating a second preview picture and setting proper object parameters. In the case of any other attachment type, a preview is not needed. An attachment can be removed, if parent message hasn't been sent yet.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddListener(AttachmentListener listener)Adds a new listener to the attachment.java.lang.Stringconsume()Returns the location of the attachment so that it can be opened by the application.AsynchDataProgressdownload(java.lang.String downloadFilePath, MessagingCompletionHandler completionHandler)Start the download of the attachment asynchronously.CapabilitygetConsumeCapability()Returns a Capability object that indicates if the attachment can be consumed.CapabilitygetDownloadCapability()Returns a Capability object that indicates if the attachment can be downloaded.intgetDuration()Duration of video or audio attachment represented in seconds.java.lang.StringgetId()The unique ID of the attachment.java.lang.StringgetLocation()Location of attachment.java.lang.StringgetLocationForConsumption()Deprecated.THIS METHOD WILL BE REMOVED IN RELEASE VERSION 3.3.java.lang.StringgetMessageId()The ID of the message that the attachment is associated with.java.lang.StringgetMimeType()MIME Type of attachment.java.lang.StringgetName()Name of attachment.CapabilitygetRemoveCapability()Returns a Capability object that indicates if the attachment can be removed.longgetSize()Size of attachment in bytes.AttachmentStatusgetStatus()Status of attachment.CapabilitygetUpdateGeneratedContentCapability()Returns a Capability object that indicates if the attachment's "generated content" property can be changed.CapabilitygetUpdateLocationCapability()Returns a Capability object that indicates if the attachment's location property can be changed.CapabilitygetUpdateMimeTypeCapability()Returns a Capability object that indicates if the attachment's MIME type property can be changed.CapabilitygetUpdateNameCapability()Returns a Capability object that indicates if the attachment's name property can be changed.CapabilitygetUpdateThumbnailCapability()Returns a Capability object that indicates if the attachment's thumbnail property can be changed.booleanisGeneratedContent()Indicates whether attachment was generated by client application or provided by user.booleanisThumbnail()Is attachment a thumbnail.voidremoveListener(AttachmentListener listener)Removes a listener from the attachment.voidsetGeneratedContent(boolean isGeneratedContent, MessagingCompletionHandler completionHandler)Set isGeneratedContent property.voidsetLocation(java.lang.String location, MessagingCompletionHandler completionHandler)Set attachment location.voidsetMimeType(java.lang.String mimeType, MessagingCompletionHandler messagingCompletionHandler)Set attachment MIME type.voidsetName(java.lang.String name, MessagingCompletionHandler completionHandler)Set attachment name.voidsetThumbnail(boolean isThumbnail, MessagingCompletionHandler completionHandler)Set isThumbnail property.
-
-
-
Method Detail
-
addListener
void addListener(AttachmentListener listener)
Adds a new listener to the attachment.- Parameters:
listener-AttachmentListenerto be added to the service.
-
removeListener
void removeListener(AttachmentListener listener)
Removes a listener from the attachment.- Parameters:
listener-AttachmentListenerinstance that is removed from the service.
-
getId
java.lang.String getId()
The unique ID of the attachment.- Returns:
- the unique ID of attachment.
-
getMessageId
java.lang.String getMessageId()
The ID of the message that the attachment is associated with.- Returns:
- the ID of message that the attachment is associated with.
-
getName
java.lang.String getName()
Name of attachment.- Returns:
- name of attachment.
- See Also:
setName(String, MessagingCompletionHandler),getUpdateNameCapability()
-
getMimeType
java.lang.String getMimeType()
MIME Type of attachment.- Returns:
- MIME type of attachment.
- See Also:
setMimeType(String, MessagingCompletionHandler),getUpdateMimeTypeCapability()
-
isThumbnail
boolean isThumbnail()
Is attachment a thumbnail.- Returns:
- true if attachment is a thumbnail.
- See Also:
setThumbnail(boolean, MessagingCompletionHandler),getUpdateThumbnailCapability()
-
getDuration
int getDuration()
Duration of video or audio attachment represented in seconds.- Returns:
- duration of attachment represented in seconds.
-
getSize
long getSize()
Size of attachment in bytes.- Returns:
- size of attachment in bytes.
-
getLocation
java.lang.String getLocation()
Location of attachment.- Returns:
- location of attachment.
- See Also:
setLocation(String, MessagingCompletionHandler),getUpdateLocationCapability()
-
getStatus
AttachmentStatus getStatus()
Status of attachment.- Returns:
statusof attachment.
-
isGeneratedContent
boolean isGeneratedContent()
Indicates whether attachment was generated by client application or provided by user.- Returns:
- true if attachment is generated content.
- See Also:
setGeneratedContent(boolean, MessagingCompletionHandler),getUpdateGeneratedContentCapability()
-
getLocationForConsumption
java.lang.String getLocationForConsumption()
Deprecated.THIS METHOD WILL BE REMOVED IN RELEASE VERSION 3.3. Use theconsume()method instead.Returns the location of the attachment so that it can be opened by the application. This method has the additional effect of changing the status of the attachment to Opened.- Returns:
- Location of attachment or empty string if location is not avaliable.
-
consume
java.lang.String consume()
Returns the location of the attachment so that it can be opened by the application. This method has the additional effect of changing the status of the attachment to Opened.- Returns:
- Location of attachment or empty string if location is not avaliable.
-
setName
void setName(java.lang.String name, MessagingCompletionHandler completionHandler)Set attachment name.- Parameters:
name- attachment name.completionHandler- Thecompletion handlerwhich will be invoked when the operation returns.
-
setThumbnail
void setThumbnail(boolean isThumbnail, MessagingCompletionHandler completionHandler)Set isThumbnail property.- Parameters:
isThumbnail- new value of isThumbnail property.completionHandler- Thecompletion handlerwhich will be invoked when the operation returns.
-
setGeneratedContent
void setGeneratedContent(boolean isGeneratedContent, MessagingCompletionHandler completionHandler)Set isGeneratedContent property.- Parameters:
isGeneratedContent- new value of isGeneratedContent property.completionHandler- {Thecompletion handlerwhich will be invoked when the operation returns.
-
setLocation
void setLocation(java.lang.String location, MessagingCompletionHandler completionHandler)Set attachment location.- Parameters:
location- attachment location.completionHandler- Thecompletion handlerwhich will be invoked when the operation returns.
-
setMimeType
void setMimeType(java.lang.String mimeType, MessagingCompletionHandler messagingCompletionHandler)Set attachment MIME type.- Parameters:
mimeType- attachment MIME type.messagingCompletionHandler- Thecompletion handlerwhich will be invoked when the operation returns.
-
download
AsynchDataProgress download(java.lang.String downloadFilePath, MessagingCompletionHandler completionHandler)
Start the download of the attachment asynchronously.- Parameters:
downloadFilePath- path to download attachment.completionHandler- Thecompletion handlerwhich will be invoked when the operation returns.- Returns:
- Data retrieval object
- See Also:
getDownloadCapability()
-
getUpdateNameCapability
Capability getUpdateNameCapability()
Returns a Capability object that indicates if the attachment's name property can be changed.This capability is Allowed when the Attachment is in a draft or error state.
- Returns:
- a
Capabilityobject that indicates if the attachment's name property can be changed. - See Also:
setName(String, MessagingCompletionHandler)
-
getUpdateThumbnailCapability
Capability getUpdateThumbnailCapability()
Returns a Capability object that indicates if the attachment's thumbnail property can be changed.This capability is Allowed when the Attachment is in a draft or error state.
- Returns:
- a
Capabilityobject that indicates if the attachment's thumbnail property can be changed. - See Also:
setThumbnail(boolean, MessagingCompletionHandler)
-
getUpdateGeneratedContentCapability
Capability getUpdateGeneratedContentCapability()
Returns a Capability object that indicates if the attachment's "generated content" property can be changed.This capability is Allowed when the Attachment is in a draft or error state.
- Returns:
Capabilityobject that indicates if the attachment's "generated content" property can be changed.- See Also:
setGeneratedContent(boolean, MessagingCompletionHandler)
-
getUpdateLocationCapability
Capability getUpdateLocationCapability()
Returns a Capability object that indicates if the attachment's location property can be changed.This capability is Allowed when the Attachment is in a draft or error state.
- Returns:
Capabilityobject that indicates if the attachment's location property can be changed.- See Also:
setLocation(String, MessagingCompletionHandler)
-
getUpdateMimeTypeCapability
Capability getUpdateMimeTypeCapability()
Returns a Capability object that indicates if the attachment's MIME type property can be changed.This capability is Allowed when the Attachment is in a draft or error state.
- Returns:
Capabilityobject that indicates if the attachment's MIME type property can be changed.- See Also:
setMimeType(String, MessagingCompletionHandler)
-
getDownloadCapability
Capability getDownloadCapability()
Returns a Capability object that indicates if the attachment can be downloaded.This capability is Allowed when all of the following conditions are true:
- The messaging service is online (has an active connection to the server).
- The Attachment is in a "ready to download" state.
- Returns:
Capabilityobject that indicates if the attachment can be downloaded.- See Also:
download(String, MessagingCompletionHandler)
-
getConsumeCapability
Capability getConsumeCapability()
Returns a Capability object that indicates if the attachment can be consumed.This capability is Allowed when the Attachment is in either the downloaded or consumed state.
When the capability is not Allowed, the
getLocationForConsumption()will return an empty string.- Returns:
Capabilityobject that indicates if the attachment can be consumed.- See Also:
getLocationForConsumption()
-
getRemoveCapability
Capability getRemoveCapability()
Returns a Capability object that indicates if the attachment can be removed.This capability is Allowed when the Attachment is in a draft or error state.
- Returns:
Capabilityobject that indicates if the attachment can be removed.- See Also:
Message.removeAttachment(Attachment, MessagingCompletionHandler)
-
-