Class AttachmentItem

java.lang.Object
com.webmethods.caf.faces.data.attachments.AttachmentItem
All Implemented Interfaces:
IAttachmentItem, Serializable
Direct Known Subclasses:
PortalAttachmentItem

public class AttachmentItem extends Object implements Serializable, IAttachmentItem
Wraps Information about an attachment
See Also:
  • Field Details

    • fId

      protected String fId
      Holds the attachment id
    • fFileName

      protected String fFileName
      The name of the attachment item.
    • fContentType

      protected String fContentType
      The MIME type of the file content. http://en.wikipedia.org/wiki/Internet_media_type
    • fContentLength

      protected long fContentLength
      The length of the file (number of bytes).
    • fIconUrl

      protected String fIconUrl
      Holds the icon url
    • fUpdatable

      protected boolean fUpdatable
      Holds whether the attachment is updatable
    • fDeletable

      protected boolean fDeletable
      Holds whether the attachment is deletable
    • lastModifiedDate

      protected Date 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_type
      contentLength - 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

      public String getId()
      Description copied from interface: IAttachmentItem
      Returns the id of the attachment
      Specified by:
      getId in interface IAttachmentItem
    • setId

      public void setId(String id)
      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 interface IAttachmentItem
    • setContentLength

      public void setContentLength(long contentLength)
      Sets the attachment content length
      Parameters:
      contentLength - the contentLength to set
    • getContentType

      public String 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 interface IAttachmentItem
    • setContentType

      public void setContentType(String contentType)
      Sets the content type
      Parameters:
      contentType - the contentType to set
    • getFileName

      public String getFileName()
      Description copied from interface: IAttachmentItem
      Returns the name of the attachment item.
      Specified by:
      getFileName in interface IAttachmentItem
    • setFileName

      public void setFileName(String fileName)
      Sets the attachment file name
      Parameters:
      fileName - the fileName to set
    • getDownloadLink

      public String 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 interface IAttachmentItem
    • setDownloadLink

      public void setDownloadLink(String downloadLink)
      Sets the attachment download link
      Parameters:
      downloadLink - the downloadLink to set
    • getIconUrl

      public String getIconUrl()
      Description copied from interface: IAttachmentItem
      Returns the icon url (may be null)
      Specified by:
      getIconUrl in interface IAttachmentItem
    • setIconUrl

      public void setIconUrl(String iconUrl)
      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 interface IAttachmentItem
      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 interface IAttachmentItem
      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

      public org.apache.commons.fileupload.FileItem getFileItem() throws IOException
      Gets the FileItem representation of the attachment. This implementation always returns null
      Specified by:
      getFileItem in interface IAttachmentItem
      Returns:
      implementation of FileItem
      Throws:
      IOException
    • getLastModifiedDate

      public Date getLastModifiedDate()
      Returns the date when the attachment was last modified
      Specified by:
      getLastModifiedDate in interface IAttachmentItem
    • setLastModifiedDate

      public void setLastModifiedDate(Date lastModifiedDate)
      Sets the date when the attachment was last modified
      Parameters:
      lastModifiedDate - the last modified date