Class FileAttachmentWrapper

  • All Implemented Interfaces:
    java.io.Serializable

    public class FileAttachmentWrapper
    extends java.lang.Object
    implements java.io.Serializable
    The FileAttachmentWrapper captures the set of parameters required to represent the data of file attachment component. An instance of this class is available during form submission, which could be used to fetch the file attachment data for further processing. This is also used to prefill file attachment PrefillData data in the form.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      FileAttachmentWrapper​(java.lang.String fileName, java.lang.String contentType, byte[] bytes)
      Creates file attachment wrapper object using file name, content type and file binary as bytes
      FileAttachmentWrapper​(java.lang.String fileName, java.lang.String contentType, byte[] bytes, java.lang.String dataRef)
      Creates file attachment wrapper object using file name, content type, file binary as bytes and reference to the data model
      FileAttachmentWrapper​(java.lang.String fileName, java.lang.String contentType, byte[] bytes, java.lang.String uri, java.lang.String dataRef)  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String getContentType()
      Returns the content type of the file binary
      java.lang.String getDataRef()
      Returns reference to the data model
      java.lang.String getFileName()
      Deprecated. 
      java.lang.String getFileNameV2()
      Returns the file name of the file attachment
      java.io.InputStream getInputStream()
      Returns input stream for the bytes
      java.lang.String getUri()
      URI of file attachment wrapper.
      java.lang.String getUuid()
      Returns the unique identifier of the file attachment
      byte[] getValue()
      Returns the bytes for the binary
      void setBytes​(byte[] bytes)
      sets bytes of the file
      void setContentType​(java.lang.String contentType)
      Sets the content type of the file binary
      void setDatRef​(java.lang.String dataRef)
      Sets the reference to the data model
      void setFileName​(java.lang.String fileName)
      Sets the file name of the file attachment
      void setUri​(java.lang.String uri)
      Sets the URI of the file attachment
      void setUuid​(java.lang.String uuid)
      sets unique identifier for the file attachments
      java.lang.String toJson()
      Returns serialized version of file attachment wrapper as a json string
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileAttachmentWrapper

        public FileAttachmentWrapper​(java.lang.String fileName,
                                     java.lang.String contentType,
                                     byte[] bytes)
        Creates file attachment wrapper object using file name, content type and file binary as bytes
        Parameters:
        fileName - file name
        contentType - content type of the file binary
        bytes - bytes of the file
      • FileAttachmentWrapper

        public FileAttachmentWrapper​(java.lang.String fileName,
                                     java.lang.String contentType,
                                     byte[] bytes,
                                     java.lang.String dataRef)
        Creates file attachment wrapper object using file name, content type, file binary as bytes and reference to the data model
        Parameters:
        fileName - file name
        contentType - content type of the file binary
        bytes - byte of the file
        dataRef - reference to the data model
      • FileAttachmentWrapper

        public FileAttachmentWrapper​(java.lang.String fileName,
                                     java.lang.String contentType,
                                     byte[] bytes,
                                     java.lang.String uri,
                                     java.lang.String dataRef)
    • Method Detail

      • getFileName

        public java.lang.String getFileName()
        Deprecated.
        Returns the file name of the file attachment. This additionally also contains the name of the component in it (for example) if component name is abc and file name is xyz.pdf, then this would return abc/xyz.pdf
        Returns:
        {String} file name
      • getFileNameV2

        public java.lang.String getFileNameV2()
        Returns the file name of the file attachment
        Returns:
        {String} file name
      • getContentType

        public java.lang.String getContentType()
        Returns the content type of the file binary
        Returns:
        {String} content type
      • getDataRef

        public java.lang.String getDataRef()
        Returns reference to the data model
        Returns:
        {String} reference to the data model
      • setFileName

        public void setFileName​(java.lang.String fileName)
        Sets the file name of the file attachment
        Parameters:
        fileName - file name of the attachment
      • setUri

        public void setUri​(java.lang.String uri)
        Sets the URI of the file attachment
        Parameters:
        uri - uri of the file attachment
      • setContentType

        public void setContentType​(java.lang.String contentType)
        Sets the content type of the file binary
        Parameters:
        contentType - content type of the file binary
      • setDatRef

        public void setDatRef​(java.lang.String dataRef)
        Sets the reference to the data model
        Parameters:
        dataRef - reference to the data model
      • getInputStream

        public java.io.InputStream getInputStream()
        Returns input stream for the bytes
        Returns:
        {InputStream} input stream of bytes
      • getValue

        public byte[] getValue()
        Returns the bytes for the binary
        Returns:
        {byte}
      • getUri

        public java.lang.String getUri()
        URI of file attachment wrapper. This could be a URI (dataURL) or base 64 encoded binary URI
        Returns:
        {String} uri of the file binary
      • getUuid

        public java.lang.String getUuid()
        Returns the unique identifier of the file attachment
        Returns:
      • setUuid

        public void setUuid​(java.lang.String uuid)
        sets unique identifier for the file attachments
        Parameters:
        uuid - {String} uuid represented as string
      • setBytes

        public void setBytes​(byte[] bytes)
        sets bytes of the file
        Parameters:
        bytes - {byte[]} bytes representing the file binary
      • toJson

        public java.lang.String toJson()
        Returns serialized version of file attachment wrapper as a json string
        Returns:
        {String} json representing file attachment wrapper