Class AttachImplementation
- java.lang.Object
-
- org.openbravo.client.application.attachment.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 Summary
Constructors Constructor Description AttachImplementation()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract void
deleteFile(Attachment attachment)
Method invoked when an attached file needs to be removed from the corresponding file management system.abstract File
downloadFile(Attachment attachment)
Method invoked when an attached file needs to be downloaded from the corresponding file management system.abstract boolean
isTempFile()
Method invoked to check if the downloaded file has to be deleted when the download is completed by the user.abstract void
updateFile(Attachment attachment, String tabId, Map<String,Object> parameters)
Method invoked when an existing attachment metadata is updated.abstract void
uploadFile(Attachment attachment, String dataType, Map<String,Object> parameters, File file, String tabId)
Method in charge of File upload.
-
-
-
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_filedataType
- DataType of the attachmentparameters
- A map with the metadata and its values to be updated in the corresponding file management system and in the attachmentfile
- The file to be uploadedtabId
- 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 modifiedtabId
- The tabID where the file was attachedparameters
- 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.
-
-