Class AttachmentItem
java.lang.Object
com.webmethods.caf.faces.data.attachments.AttachmentItem
- All Implemented Interfaces:
IAttachmentItem
,Serializable
- Direct Known Subclasses:
PortalAttachmentItem
Wraps Information about an attachment
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected long
The length of the file (number of bytes).protected String
The MIME type of the file content.protected boolean
Holds whether the attachment is deletableprotected String
The URL for downloading the file to a browser.protected String
The name of the attachment item.protected String
Holds the icon urlprotected String
Holds the attachment idprotected boolean
Holds whether the attachment is updatableprotected Date
Holds the last modified date -
Constructor Summary
ConstructorsConstructorDescriptionDefault ConstructorAttachmentItem
(String id, String fileName, String contentType, long contentLength, String downloadLink) Constructor -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the length of the file (number of bytes).Returns the MIME type of the file content.Returns the URL for downloading the file to a browser.org.apache.commons.fileupload.FileItem
Gets the FileItem representation of the attachment.Returns the name of the attachment item.Returns the icon url (may be null)getId()
Returns the id of the attachmentReturns the date when the attachment was last modifiedboolean
Returns whether the attachment is deletable by the current userboolean
Returns whether the attachment is updateable by the current uservoid
setContentLength
(long contentLength) Sets the attachment content lengthvoid
setContentType
(String contentType) Sets the content typevoid
setDeletable
(boolean deletable) Sets whether the attachment is deletablevoid
setDownloadLink
(String downloadLink) Sets the attachment download linkvoid
setFileName
(String fileName) Sets the attachment file namevoid
setIconUrl
(String iconUrl) Sets the attachment icon URLvoid
Sets the attachment idvoid
setLastModifiedDate
(Date lastModifiedDate) Sets the date when the attachment was last modifiedvoid
setUpdatable
(boolean updatable) Sets whether the attachment is updateable
-
Field Details
-
fId
Holds the attachment id -
fFileName
The name of the attachment item. -
fContentType
The MIME type of the file content. http://en.wikipedia.org/wiki/Internet_media_type -
fContentLength
protected long fContentLengthThe length of the file (number of bytes). -
fDownloadLink
The URL for downloading the file to a browser. The URL can be absolute (i.e. http://mysite/att/myfile.txt) or relative to some path in the webapp (i.e. /myappcontext/mycustomdownloadservlet/myfile.txt). -
fIconUrl
Holds the icon url -
fUpdatable
protected boolean fUpdatableHolds whether the attachment is updatable -
fDeletable
protected boolean fDeletableHolds whether the attachment is deletable -
lastModifiedDate
Holds the last modified date
-
-
Constructor Details
-
AttachmentItem
public AttachmentItem()Default Constructor -
AttachmentItem
public AttachmentItem(String id, String fileName, String contentType, long contentLength, String downloadLink) Constructor- Parameters:
id
- Some unique identifier for the item within it's container. Each item in an attachment provider must have a unique id. The format of the id is up to the implementor. In the simple case, the id could be the same as the fileName.fileName
- The name of the attachment item.contentType
- The MIME type of the file content. http://en.wikipedia.org/wiki/Internet_media_typecontentLength
- The length of the file (number of bytes).downloadLink
- The URL for downloading the file to a browser. The URL can be absolute (i.e. http://mysite/att/myfile.txt) or relative to some path in the webapp (i.e. /myappcontext/mycustomdownloadservlet/myfile.txt).
-
-
Method Details
-
getId
Description copied from interface:IAttachmentItem
Returns the id of the attachment- Specified by:
getId
in interfaceIAttachmentItem
-
setId
Sets the attachment id- Parameters:
id
- the id to set
-
getContentLength
public long getContentLength()Description copied from interface:IAttachmentItem
Returns the length of the file (number of bytes).- Specified by:
getContentLength
in interfaceIAttachmentItem
-
setContentLength
public void setContentLength(long contentLength) Sets the attachment content length- Parameters:
contentLength
- the contentLength to set
-
getContentType
Description copied from interface:IAttachmentItem
Returns the MIME type of the file content. http://en.wikipedia.org/wiki/Internet_media_type- Specified by:
getContentType
in interfaceIAttachmentItem
-
setContentType
Sets the content type- Parameters:
contentType
- the contentType to set
-
getFileName
Description copied from interface:IAttachmentItem
Returns the name of the attachment item.- Specified by:
getFileName
in interfaceIAttachmentItem
-
setFileName
Sets the attachment file name- Parameters:
fileName
- the fileName to set
-
getDownloadLink
Description copied from interface:IAttachmentItem
Returns the URL for downloading the file to a browser. The URL can be absolute (i.e. http://mysite/att/myfile.txt) or relative to some path in the webapp (i.e. /myappcontext/mycustomdownloadservlet/myfile.txt).- Specified by:
getDownloadLink
in interfaceIAttachmentItem
-
setDownloadLink
Sets the attachment download link- Parameters:
downloadLink
- the downloadLink to set
-
getIconUrl
Description copied from interface:IAttachmentItem
Returns the icon url (may be null)- Specified by:
getIconUrl
in interfaceIAttachmentItem
-
setIconUrl
Sets the attachment icon URL- Parameters:
iconUrl
- the iconUrl to set
-
isDeletable
public boolean isDeletable()Description copied from interface:IAttachmentItem
Returns whether the attachment is deletable by the current user- Specified by:
isDeletable
in interfaceIAttachmentItem
- Returns:
- true or false
-
isUpdatable
public boolean isUpdatable()Description copied from interface:IAttachmentItem
Returns whether the attachment is updateable by the current user- Specified by:
isUpdatable
in interfaceIAttachmentItem
- Returns:
- true or false
-
setDeletable
public void setDeletable(boolean deletable) Sets whether the attachment is deletable- Parameters:
deletable
- true if the attachment is deletable, false otherwise
-
setUpdatable
public void setUpdatable(boolean updatable) Sets whether the attachment is updateable- Parameters:
updatable
- true if the attachment is updatable, false otherwise
-
getFileItem
Gets the FileItem representation of the attachment. This implementation always returns null- Specified by:
getFileItem
in interfaceIAttachmentItem
- Returns:
- implementation of FileItem
- Throws:
IOException
-
getLastModifiedDate
Returns the date when the attachment was last modified- Specified by:
getLastModifiedDate
in interfaceIAttachmentItem
-
setLastModifiedDate
Sets the date when the attachment was last modified- Parameters:
lastModifiedDate
- the last modified date
-