Class AttachImplementation

  • Direct Known Subclasses:
    CoreAttachImplementation

    public abstract class AttachImplementation
    extends Object
    Public class to allow extend the Attachment Functionality. Modules implementing new attachment method must implement this class. The class must implement the org.openbravo.client.kernel.ComponentProvider.Qualifier with the Attachment Method's Search Key so the AttachImplementationManager can load the corresponding class.
    • Constructor Detail

      • AttachImplementation

        public AttachImplementation()
    • Method Detail

      • uploadFile

        public abstract void uploadFile​(Attachment attachment,
                                        String dataType,
                                        Map<String,​Object> parameters,
                                        File file,
                                        String tabId)
                                 throws OBException
        Method in charge of File upload. Invoked when a new file is attached to a record.
        Parameters:
        attachment - The attachment created in c_file
        dataType - DataType of the attachment
        parameters - A map with the metadata and its values to be updated in the corresponding file management system and in the attachment
        file - The file to be uploaded
        tabId - The tabID where the file is attached
        Throws:
        OBException - Thrown when any error occurs during the upload
      • downloadFile

        public abstract File downloadFile​(Attachment attachment)
                                   throws OBException
        Method invoked when an attached file needs to be downloaded from the corresponding file management system.
        Parameters:
        attachment - The attachment that will be downloaded
        Returns:
        the attached file.
        Throws:
        OBException - Thrown when any error occurs during the download
      • deleteFile

        public abstract void deleteFile​(Attachment attachment)
                                 throws OBException
        Method invoked when an attached file needs to be removed from the corresponding file management system.
        Parameters:
        attachment - The attachment to be removed
        Throws:
        OBException - Thrown when any error occurs when deleting the file
      • updateFile

        public abstract void updateFile​(Attachment attachment,
                                        String tabId,
                                        Map<String,​Object> parameters)
                                 throws OBException
        Method invoked when an existing attachment metadata is updated.
        Parameters:
        attachment - The attachment to be modified
        tabId - The tabID where the file was attached
        parameters - The metadata with the new values.
        Throws:
        OBException - Thrown when any error occurs when updating the file
      • isTempFile

        public abstract boolean isTempFile()
        Method invoked to check if the downloaded file has to be deleted when the download is completed by the user. Some attachment methods might create temporary files in Openbravo server that should be removed when the download is completed.
        Returns:
        true if the downloaded File has to be deleted.