public class AttachmentItem extends Object implements Serializable, IAttachmentItem
Modifier and Type | Field and Description |
---|---|
protected long |
fContentLength
The length of the file (number of bytes).
|
protected String |
fContentType
The MIME type of the file content.
|
protected boolean |
fDeletable
Holds whether the attachment is deletable
|
protected String |
fDownloadLink
The URL for downloading the file to a browser.
|
protected String |
fFileName
The name of the attachment item.
|
protected String |
fIconUrl
Holds the icon url
|
protected String |
fId
Holds the attachment id
|
protected boolean |
fUpdatable
Holds whether the attachment is updatable
|
protected Date |
lastModifiedDate
Holds the last modified date
|
Constructor and Description |
---|
AttachmentItem()
Default Constructor
|
AttachmentItem(String id,
String fileName,
String contentType,
long contentLength,
String downloadLink)
Constructor
|
Modifier and Type | Method and Description |
---|---|
long |
getContentLength()
Returns the length of the file (number of bytes).
|
String |
getContentType()
Returns the MIME type of the file content.
|
String |
getDownloadLink()
Returns the URL for downloading the file to a browser.
|
org.apache.commons.fileupload.FileItem |
getFileItem()
Gets the FileItem representation of the attachment.
|
String |
getFileName()
Returns the name of the attachment item.
|
String |
getIconUrl()
Returns the icon url (may be null)
|
String |
getId()
Returns the id of the attachment
|
Date |
getLastModifiedDate()
Returns the date when the attachment was last modified
|
boolean |
isDeletable()
Returns whether the attachment is deletable by the
current user
|
boolean |
isUpdatable()
Returns whether the attachment is updateable by the
current user
|
void |
setContentLength(long contentLength)
Sets the attachment content length
|
void |
setContentType(String contentType)
Sets the content type
|
void |
setDeletable(boolean deletable)
Sets whether the attachment is deletable
|
void |
setDownloadLink(String downloadLink)
Sets the attachment download link
|
void |
setFileName(String fileName)
Sets the attachment file name
|
void |
setIconUrl(String iconUrl)
Sets the attachment icon URL
|
void |
setId(String id)
Sets the attachment id
|
void |
setLastModifiedDate(Date lastModifiedDate)
Sets the date when the attachment was last modified
|
void |
setUpdatable(boolean updatable)
Sets whether the attachment is updateable
|
protected String fId
protected String fFileName
protected String fContentType
protected long fContentLength
protected String fDownloadLink
protected String fIconUrl
protected boolean fUpdatable
protected boolean fDeletable
protected Date lastModifiedDate
public AttachmentItem()
public AttachmentItem(String id, String fileName, String contentType, long contentLength, String downloadLink)
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).public String getId()
IAttachmentItem
getId
in interface IAttachmentItem
public void setId(String id)
id
- the id to setpublic long getContentLength()
IAttachmentItem
getContentLength
in interface IAttachmentItem
public void setContentLength(long contentLength)
contentLength
- the contentLength to setpublic String getContentType()
IAttachmentItem
getContentType
in interface IAttachmentItem
public void setContentType(String contentType)
contentType
- the contentType to setpublic String getFileName()
IAttachmentItem
getFileName
in interface IAttachmentItem
public void setFileName(String fileName)
fileName
- the fileName to setpublic String getDownloadLink()
IAttachmentItem
getDownloadLink
in interface IAttachmentItem
public void setDownloadLink(String downloadLink)
downloadLink
- the downloadLink to setpublic String getIconUrl()
IAttachmentItem
getIconUrl
in interface IAttachmentItem
public void setIconUrl(String iconUrl)
iconUrl
- the iconUrl to setpublic boolean isDeletable()
IAttachmentItem
isDeletable
in interface IAttachmentItem
public boolean isUpdatable()
IAttachmentItem
isUpdatable
in interface IAttachmentItem
public void setDeletable(boolean deletable)
deletable
- true if the attachment is deletable, false otherwisepublic void setUpdatable(boolean updatable)
updatable
- true if the attachment is updatable, false otherwisepublic org.apache.commons.fileupload.FileItem getFileItem() throws IOException
getFileItem
in interface IAttachmentItem
IOException
public Date getLastModifiedDate()
getLastModifiedDate
in interface IAttachmentItem
public void setLastModifiedDate(Date lastModifiedDate)
lastModifiedDate
- the last modified date