Class AttachmentUtils


  • public class AttachmentUtils
    extends Object
    Utility class to manage Attachments. It includes a cached map of the attachment configuration of each client in the system.
    • Constructor Detail

      • AttachmentUtils

        public AttachmentUtils()
    • Method Detail

      • getAttachmentConfig

        public static AttachmentConfig getAttachmentConfig()
        Gets the Attachment Configuration associated to the client active in OBContext
        Returns:
        Activate Attachment Configuration for the current OBContext client
      • getAttachmentConfig

        public static AttachmentConfig getAttachmentConfig​(String clientId)
        Gets the Attachment Configuration associated to the active client
        Parameters:
        clientId - Client using openbravo
        Returns:
        Activated Attachment Configuration for this client
      • setAttachmentConfig

        public static void setAttachmentConfig​(String strClient,
                                               String strAttConfig)
        Updates the current active attachment configuration for the client.
        Parameters:
        strClient - The Client whose attachment configuration has changed.
        strAttConfig - The new Attachment Configuration.
      • getAttachmentMethod

        public static AttachmentMethod getAttachmentMethod()
        Gets the Attachment Method related to the active Attachment Configuration of the current client. In case the client does not have any attachment configuration the default Attachment Method is returned.
        Returns:
        The AttachmentMethod to use for the current client.
      • getDefaultAttachmentMethod

        public static AttachmentMethod getDefaultAttachmentMethod()
        Gets the default Attachment Method
        Returns:
        Default Attachment Method
      • getTabAttachmentsForRows

        public static List<org.codehaus.jettison.json.JSONObject> getTabAttachmentsForRows​(Tab tab,
                                                                                           String[] recordIds)
        Get JSONObject list with data of the attachments in given tab and records
        Parameters:
        tab - tab to take attachments
        recordIds - list of record IDs where taken attachments
        Returns:
        List of JSONOject with attachments information values
      • getPropertyPathValue

        public static Object getPropertyPathValue​(Parameter parameter,
                                                  String tabId,
                                                  String recordId)
                                           throws OBException
        Get the String value of a parameter with a property path
        Parameters:
        parameter - parameter in which is defined the property path
        tabId - table which stores the record with the desired value
        recordId - record which has the column with the value to search
        Returns:
        the String value of the column indicated in the property path
        Throws:
        OBException - generated if there is distinct than one record to search