Interface Attachment
-
public interface Attachment
Attachment 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 void
addListener(AttachmentListener listener)
Adds a new listener to the attachment.java.lang.String
consume()
Returns the location of the attachment so that it can be opened by the application.AsynchDataProgress
download(java.lang.String downloadFilePath, MessagingCompletionHandler completionHandler)
Start the download of the attachment asynchronously.Capability
getConsumeCapability()
Returns a Capability object that indicates if the attachment can be consumed.Capability
getDownloadCapability()
Returns a Capability object that indicates if the attachment can be downloaded.int
getDuration()
Duration of video or audio attachment represented in seconds.java.lang.String
getId()
The unique ID of the attachment.java.lang.String
getLocation()
Location of attachment.java.lang.String
getLocationForConsumption()
Deprecated.THIS METHOD WILL BE REMOVED IN RELEASE VERSION 3.3.java.lang.String
getMessageId()
The ID of the message that the attachment is associated with.java.lang.String
getMimeType()
MIME Type of attachment.java.lang.String
getName()
Name of attachment.Capability
getRemoveCapability()
Returns a Capability object that indicates if the attachment can be removed.long
getSize()
Size of attachment in bytes.AttachmentStatus
getStatus()
Status of attachment.Capability
getUpdateGeneratedContentCapability()
Returns a Capability object that indicates if the attachment's "generated content" property can be changed.Capability
getUpdateLocationCapability()
Returns a Capability object that indicates if the attachment's location property can be changed.Capability
getUpdateMimeTypeCapability()
Returns a Capability object that indicates if the attachment's MIME type property can be changed.Capability
getUpdateNameCapability()
Returns a Capability object that indicates if the attachment's name property can be changed.Capability
getUpdateThumbnailCapability()
Returns a Capability object that indicates if the attachment's thumbnail property can be changed.boolean
isGeneratedContent()
Indicates whether attachment was generated by client application or provided by user.boolean
isThumbnail()
Is attachment a thumbnail.void
removeListener(AttachmentListener listener)
Removes a listener from the attachment.void
setGeneratedContent(boolean isGeneratedContent, MessagingCompletionHandler completionHandler)
Set isGeneratedContent property.void
setLocation(java.lang.String location, MessagingCompletionHandler completionHandler)
Set attachment location.void
setMimeType(java.lang.String mimeType, MessagingCompletionHandler messagingCompletionHandler)
Set attachment MIME type.void
setName(java.lang.String name, MessagingCompletionHandler completionHandler)
Set attachment name.void
setThumbnail(boolean isThumbnail, MessagingCompletionHandler completionHandler)
Set isThumbnail property.
-
-
-
Method Detail
-
addListener
void addListener(AttachmentListener listener)
Adds a new listener to the attachment.- Parameters:
listener
-AttachmentListener
to be added to the service.
-
removeListener
void removeListener(AttachmentListener listener)
Removes a listener from the attachment.- Parameters:
listener
-AttachmentListener
instance 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:
status
of 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 handler
which 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 handler
which 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 handler
which 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 handler
which 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 handler
which 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 handler
which 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
Capability
object 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
Capability
object 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:
Capability
object 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:
Capability
object 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:
Capability
object 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:
Capability
object 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:
Capability
object 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:
Capability
object that indicates if the attachment can be removed.- See Also:
Message.removeAttachment(Attachment, MessagingCompletionHandler)
-
-