Package org.openbravo.client.application
Class ParameterUtils
- java.lang.Object
-
- org.openbravo.client.application.ParameterUtils
-
public class ParameterUtils extends Object
Utility class for Parameters handling- Author:
- iperdomo
-
-
Constructor Summary
Constructors Constructor Description ParameterUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,String>
buildRequestMap(javax.servlet.http.HttpServletRequest request)
Returns a Map<String, String> with all parameters in the servlet request.static Object
getJSExpressionResult(Map<String,String> parameters, javax.servlet.http.HttpSession session, String expression)
Returns the result of evaluating the given JavaScript expression.static Object
getParameterDefaultValue(Map<String,String> parameters, Parameter parameter, javax.servlet.http.HttpSession session, org.codehaus.jettison.json.JSONObject _context)
Returns the default value of the given parameter based on the request information.static DomainType
getParameterDomainType(Parameter parameter)
static Object
getParameterFixedValue(Map<String,String> parameters, Parameter parameter)
Returns the Fixed value of the given parameter.static String
getParameterStringValue(ParameterValue parameterValue)
Returns the String representation of the Value.static Object
getParameterValue(ParameterValue parameterValue)
Returns an Object with the Value of the Parameter Value.static void
setDefaultParameterValue(ParameterValue value)
static void
setParameterValue(ParameterValue parameterValue, org.codehaus.jettison.json.JSONObject requestValue)
-
-
-
Method Detail
-
setParameterValue
public static void setParameterValue(ParameterValue parameterValue, org.codehaus.jettison.json.JSONObject requestValue)
-
setDefaultParameterValue
public static void setDefaultParameterValue(ParameterValue value)
-
getParameterDomainType
public static DomainType getParameterDomainType(Parameter parameter)
-
getParameterValue
public static Object getParameterValue(ParameterValue parameterValue)
Returns an Object with the Value of the Parameter Value. This object can be a String, a java.util.Date, long, boolean or a BigDecimal.- Parameters:
parameterValue
- the Parameter Value we want to get the Value from.- Returns:
- the Value of the Parameter Value.
-
getParameterStringValue
public static String getParameterStringValue(ParameterValue parameterValue)
Returns the String representation of the Value.- Parameters:
parameterValue
- the Parameter Value we want to get the Value from.- Returns:
- the Value of the Parameter Value.
-
getParameterFixedValue
public static Object getParameterFixedValue(Map<String,String> parameters, Parameter parameter)
Returns the Fixed value of the given parameter. If the value is a JS expression it returns the result of the expression based on the parameters passed in from the request.- Parameters:
parameters
- the parameters passed in from the requestparameter
- the parameter we want to get the Fixed Value from- Returns:
- the Fixed Value of the parameter
-
getParameterDefaultValue
public static Object getParameterDefaultValue(Map<String,String> parameters, Parameter parameter, javax.servlet.http.HttpSession session, org.codehaus.jettison.json.JSONObject _context) throws ScriptException
Returns the default value of the given parameter based on the request information.- Parameters:
parameters
- the parameters passed in from the requestparameter
- the parameter to get the Default Value fromsession
- the HttpSession of the request_context
- the JSONObject with the context information of the request.- Returns:
- the DefaultValue of the Parameter.
- Throws:
ScriptException
- Error occurred executing the script to calculate the defaultValue of the parameter
-
getJSExpressionResult
public static Object getJSExpressionResult(Map<String,String> parameters, javax.servlet.http.HttpSession session, String expression) throws ScriptException
Returns the result of evaluating the given JavaScript expression.- Parameters:
parameters
- Map of Strings with the request map parameters.session
- optional HttpSession object.expression
- String with the JavaScript expression to be evaluated.- Returns:
- an Object with the result of the expression evaluation.
- Throws:
ScriptException
- Error occurred in the script execution
-
-