Class AttachmentUtils
- java.lang.Object
-
- org.openbravo.client.application.attachment.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.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_METHOD
static String
DEFAULT_METHOD_ID
-
Constructor Summary
Constructors Constructor Description AttachmentUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AttachmentConfig
getAttachmentConfig()
Gets the Attachment Configuration associated to the client active in OBContextstatic AttachmentConfig
getAttachmentConfig(String clientId)
Gets the Attachment Configuration associated to the active clientstatic AttachmentMethod
getAttachmentMethod()
Gets the Attachment Method related to the active Attachment Configuration of the current client.static AttachmentMethod
getDefaultAttachmentMethod()
Gets the default Attachment Methodstatic Object
getPropertyPathValue(Parameter parameter, String tabId, String recordId)
Get the String value of a parameter with a property pathstatic List<org.codehaus.jettison.json.JSONObject>
getTabAttachmentsForRows(Tab tab, String[] recordIds)
Get JSONObject list with data of the attachments in given tab and recordsstatic void
setAttachmentConfig(String strClient, String strAttConfig)
Updates the current active attachment configuration for the client.
-
-
-
Field Detail
-
DEFAULT_METHOD
public static final String DEFAULT_METHOD
- See Also:
- Constant Field Values
-
DEFAULT_METHOD_ID
public static final String DEFAULT_METHOD_ID
- See Also:
- Constant Field Values
-
-
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 attachmentsrecordIds
- 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 pathtabId
- table which stores the record with the desired valuerecordId
- 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
-
-