Package ru.bgcrm.struts.form

# Class DynActionForm

java.lang.Object
org.apache.struts.action.ActionForm
ru.bgcrm.struts.form.DynActionForm

All Implemented Interfaces:
  `Serializable`, `org.apache.commons.beanutils.DynaBean`, `org.apache.commons.beanutils.DynaClass`

public class DynActionForm extends org.apache.struts.action.ActionForm implements org.apache.commons.beanutils.DynaBean, org.apache.commons.beanutils.DynaClass
HTTP request execution's context, contains: request, DB connection and response data.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `KEY`
  `Localizer`
  `l`
  `static final String`
  `PARAM_ACTION_METHOD`
  `static final String`
  `PARAM_ACTION_METHOD_OLD`
  `static final String`
  `RESPONSE_TYPE_HTML`
  `static final String`
  `RESPONSE_TYPE_JSON`
  `static final String`
  `RESPONSE_TYPE_STREAM`
  `static DynActionForm`
  `SERVER_FORM`
  Deprecated.
  `static DynActionForm`
  `SYSTEM_FORM`
  System action, not real user request.

  ### Fields inherited from class org.apache.struts.action.ActionForm

  `multipartRequestHandler, servlet`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DynActionForm()`
  Empty constructor for Struts.
  `DynActionForm(String url)`
  Constructor from string URL or only query string.
  `DynActionForm(User user)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `action(Class<? extends BaseAction> clazz)`
  Builds `action` as semicolon separated action ID and method name from `getMethod()`
  `boolean`
  `contains(String name, String key)`
  `Object`
  `get(String name)`
  `Object`
  `get(String name, int index)`
  `Object`
  `get(String name, String key)`
  `String`
  `getAction()`
  Deprecated.
  `String`
  `getAreaId()`
  Area ID is used in
  invalid reference

      BaseAction#restoreRequestParams()

  for preserving request parameters.
  `String`
  `getCloseScript()`
  `ConnectionSet`
  `getConnectionSet()`
  `org.apache.commons.beanutils.DynaClass`
  `getDynaClass()`
  `org.apache.commons.beanutils.DynaProperty[]`
  `getDynaProperties()`
  `org.apache.commons.beanutils.DynaProperty`
  `getDynaProperty(String name)`
  `org.apache.struts.upload.FormFile`
  `getFile()`
  `String`
  `getForwardFile()`
  Deprecated.
  `javax.servlet.http.HttpServletRequest`
  `getHttpRequest()`
  `String`
  `getHttpRequestURI()`
  Deprecated.
  `javax.servlet.http.HttpServletResponse`
  `getHttpResponse()`
  `OutputStream`
  `getHttpResponseOutputStream()`
  `PrintWriter`
  `getHttpResponseWriter()`
  `int`
  `getId()`
  `String`
  `getMethod()`
  `String`
  `getName()`
  `Page`
  `getPage()`
  `String`
  `getPageableId()`
  `ArrayHashMap`
  `getParam()`
  `String`
  `getParam(String name)`
  Gets HTTP request parameter first value.
  `String`
  `getParam(String name, String defaultValue)`
  Gets HTTP request parameter first value.
  `String`
  `getParam(String name, String defaultValue, boolean defaultSet, Predicate<String> validator)`
  Gets HTTP request parameter value.
  `String`
  `getParam(String name, String defaultValue, Predicate<String> validator)`
  `String`
  `getParam(String name, Predicate<String> validator)`
  `boolean`
  `getParamBoolean(String name)`
  `Boolean`
  `getParamBoolean(String name, Boolean defaultValue)`
  `Date`
  `getParamDate(String name)`
  `Date`
  `getParamDate(String name, Date defaultValue)`
  `Date`
  `getParamDate(String name, Date defaultValue, boolean defaultSet)`
  Gets HTTP request parameter first value as type date, format `TimeUtils.FORMAT_TYPE_YMD`.
  `Date`
  `getParamDateTime(String name)`
  Deprecated.
  `Date`
  `getParamDateTime(String name, String format)`
  `Date`
  `getParamDateTime(String name, String format, Date defaultValue)`
  `Date`
  `getParamDateTime(String name, String format, Predicate<Date> validator)`
  Gets HTTP request parameter value with date and time
  `int`
  `getParamInt(String name)`
  `int`
  `getParamInt(String name, int defaultValue)`
  `int`
  `getParamInt(String name, Predicate<Integer> validator)`
  Gets HTTP request parameter first value as type `int`.
  `long`
  `getParamLong(String name)`
  `long`
  `getParamLong(String name, long defaultValue)`
  `Set<Integer>`
  `getParamValues(String name)`
  Gets HTTP request parameter values as type int.
  `List<Integer>`
  `getParamValuesList(String name)`
  Gets HTTP request parameter values as an ordered list of type int.
  `List<String>`
  `getParamValuesListStr(String name)`
  Gets HTTP request parameter values as an ordered list.
  `List<String>`
  `getParamValuesListStr(String name, String exclude)`
  Gets HTTP request parameter values as an ordered list.
  `Set<String>`
  `getParamValuesStr(String name)`
  Gets HTTP request parameter values.
  `YearMonth`
  `getParamYearMonth(String name, Predicate<YearMonth> validator)`
  Gets HTTP request parameter first value as type `YearMonth`.
  `ConfigMap`
  `getPermission()`
  `String`
  `getRequestURI()`
  `String`
  `getRequestUrl()`
  `Response`
  `getResponse()`
  `String`
  `getResponseType()`
  `String`
  `getReturnChildUiid()`
  `String`
  `getReturnUrl()`
  `User`
  `getUser()`
  `int`
  `getUserId()`
  `org.apache.commons.beanutils.DynaBean`
  `newInstance()`
  `String`
  `paramsToQueryString()`
  `void`
  `remove(String name, String key)`
  `void`
  `requestUrl(String path, String queryString)`
  Sets request parameter `requestUrl`.
  `void`
  `set(String name, int index, Object value)`
  `void`
  `set(String name, Object value)`
  `void`
  `set(String name, String key, Object value)`
  `void`
  `setConnectionSet(ConnectionSet value)`
  `void`
  `setForwardFile(String value)`
  Deprecated.
  `void`
  `setHttpRequest(javax.servlet.http.HttpServletRequest httpRequest)`
  `void`
  `setHttpResponse(javax.servlet.http.HttpServletResponse httpResponse)`
  `void`
  `setParam(String name, String value)`
  Sets HTTPS request parameter value.
  `void`
  `setPermission(ConfigMap permission)`
  `void`
  `setRequestAttribute(String key, Object value)`
  Set HTTP request attribute.
  `void`
  `setRequestUrl(String value)`
  `void`
  `setResponseData(String key, Object value)`
  Set response object data.
  `void`
  `setResponseType(String value)`
  Sets request parameter `responseType`
  `void`
  `setUser(User user)`

  ### Methods inherited from class org.apache.struts.action.ActionForm

  `getMultipartRequestHandler, getServlet, getServletWrapper, reset, reset, setMultipartRequestHandler, setServlet, validate, validate`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### KEY

    public static final String KEY
    See Also:
      - Constant Field Values

  - ### RESPONSE_TYPE_HTML

    public static final String RESPONSE_TYPE_HTML
    See Also:
      - Constant Field Values

  - ### RESPONSE_TYPE_JSON

    public static final String RESPONSE_TYPE_JSON
    See Also:
      - Constant Field Values

  - ### RESPONSE_TYPE_STREAM

    public static final String RESPONSE_TYPE_STREAM
    See Also:
      - Constant Field Values

  - ### SYSTEM_FORM

    public static DynActionForm SYSTEM_FORM
    System action, not real user request.

  - ### SERVER_FORM

    @Deprecated public static DynActionForm SERVER_FORM
    Deprecated.

  - ### PARAM_ACTION_METHOD

    public static final String PARAM_ACTION_METHOD
    See Also:
      - Constant Field Values

  - ### PARAM_ACTION_METHOD_OLD

    public static final String PARAM_ACTION_METHOD_OLD
    See Also:
      - Constant Field Values

  - ### l

    public Localizer l

- ## Constructor Details

  - ### DynActionForm

    public DynActionForm()
    Empty constructor for Struts.

  - ### DynActionForm

    public DynActionForm(User user)

  - ### DynActionForm

    public DynActionForm(String url)
    Constructor from string URL or only query string.
    Parameters:
      `url` - the complete URL or only the query string after `?`.

- ## Method Details

  - ### paramsToQueryString

    public String paramsToQueryString()
    Returns:
      request params except `PARAM_REQUEST_URL`, serialized to a query string.

  - ### getHttpRequest

    public javax.servlet.http.HttpServletRequest getHttpRequest()

  - ### setHttpRequest

    public void setHttpRequest(javax.servlet.http.HttpServletRequest httpRequest)

  - ### getRequestURI

    public String getRequestURI()
    Returns:
      http request path without query string

  - ### getHttpRequestURI

    @Deprecated public String getHttpRequestURI()
    Deprecated.
    Use `getRequestURI()`

  - ### getHttpResponse

    public javax.servlet.http.HttpServletResponse getHttpResponse()

  - ### setHttpResponse

    public void setHttpResponse(javax.servlet.http.HttpServletResponse httpResponse)

  - ### getHttpResponseOutputStream

    public OutputStream getHttpResponseOutputStream() throws IOException
    Throws:
      `IOException`

  - ### getHttpResponseWriter

    public PrintWriter getHttpResponseWriter() throws IOException
    Throws:
      `IOException`

  - ### getPage

    public Page getPage()

  - ### getFile

    public org.apache.struts.upload.FormFile getFile()

  - ### getParam

    public ArrayHashMap getParam()
    Returns:
      request parameters

  - ### getMethod

    public String getMethod()
    Returns:
      request parameter `method`, action class method name

  - ### getAction

    @Deprecated public String getAction()
    Deprecated.
    Use `getMethod()`
    Returns:
      request parameter `action`, action class method name

  - ### action

    public String action(Class<? extends BaseAction> clazz)
    Builds `action` as semicolon separated action ID and method name from `getMethod()`
    Parameters:
      `clazz` - the action class
    Returns:
      the generated value

  - ### getId

    public int getId()
    Returns:
      request parameter `id`

  - ### getRequestUrl

    public String getRequestUrl()
    Returns:
      request parameter `requestUrl`

  - ### setRequestUrl

    public void setRequestUrl(String value)

  - ### requestUrl

    public void requestUrl(String path, String queryString)
    Sets request parameter `requestUrl`.
    Parameters:
      `path` - start of `requestUrl`.
      `queryString` - query string, if not blank then added to end after query char.

  - ### getResponseType

    public String getResponseType()
    Returns:
      request parameter `responseType`

  - ### setResponseType

    public void setResponseType(String value)
    Sets request parameter `responseType`
    Parameters:
      `value` - the value

  - ### getReturnUrl

    public String getReturnUrl()
    Returns:
      request parameter `returnUrl`, URL for returning back from an editor

  - ### getReturnChildUiid

    public String getReturnChildUiid()
    Returns:
      request parameter `returnChildUiid`, HTML element ID, for the parent of that has to be placed result of loading `getReturnUrl()`

  - ### getCloseScript

    public String getCloseScript()
    Returns:
      JS code, to be executed for return in UI

  - ### getForwardFile

    @Deprecated public String getForwardFile()
    Deprecated.
    Returns:
      request parameter `forwardFile`, JSP template path

  - ### setForwardFile

    @Deprecated public void setForwardFile(String value)
    Deprecated.
    Sets request parameter `forwardFile`, JSP template path
    Parameters:
      `value` -

  - ### getPageableId

    public String getPageableId()
    Returns:
      request parameter `pageableId` or `action` if it was empty or missing.

  - ### getAreaId

    public String getAreaId()
    Area ID is used in
    invalid reference

        BaseAction#restoreRequestParams()

    for preserving request parameters.
    Returns:
      request parameter `areaId` or `action` if it was empty or missing.

  - ### getParam

    public String getParam(String name, String defaultValue, boolean defaultSet, Predicate<String> validator) throws BGIllegalArgumentException
    Gets HTTP request parameter value.
    Parameters:
      `name` - parameter name.
      `defaultValue` - default value if not presented in request.
      `defaultSet` - set default value back in request for using in JSP.
      `validator` - optional value validator.
    Returns:
    Throws:
      `BGIllegalArgumentException` - if validation fails.

  - ### getParam

    public String getParam(String name, String defaultValue, Predicate<String> validator) throws BGIllegalArgumentException
    Throws:
      `BGIllegalArgumentException`

  - ### getParam

    public String getParam(String name, String defaultValue)
    Gets HTTP request parameter first value.
    Parameters:
      `name` - the parameter's name.
      `defaultValue` - default value.
    Returns:
      the value of parameter with or if not presented.

  - ### getParam

    public String getParam(String name, Predicate<String> validator) throws BGIllegalArgumentException
    Throws:
      `BGIllegalArgumentException`

  - ### getParam

    public String getParam(String name)
    Gets HTTP request parameter first value.
    Parameters:
      `name` - the parameter's name.
    Returns:
      parameter value or null if missing or empty.

  - ### setParam

    public void setParam(String name, String value)
    Sets HTTPS request parameter value.
    Parameters:
      `name` - the parameter's name.
      `value` - the value.

  - ### getParamDate

    public Date getParamDate(String name, Date defaultValue, boolean defaultSet)
    Gets HTTP request parameter first value as type date, format `TimeUtils.FORMAT_TYPE_YMD`.
    Parameters:
      `name` - parameter name.
      `defaultValue` - default value if not presented in request.
      `defaultSet` - set default value back in request for using in JSP.
    Returns:

  - ### getParamDate

    public Date getParamDate(String name, Date defaultValue)

  - ### getParamDate

    public Date getParamDate(String name)

  - ### getParamYearMonth

    public YearMonth getParamYearMonth(String name, Predicate<YearMonth> validator) throws BGIllegalArgumentException
    Gets HTTP request parameter first value as type `YearMonth`.
    Parameters:
      `name` - parameter name, storing the first day of month in string format `TimeUtils.FORMAT_TYPE_YMD`.
      `validator` - optional value validator.
    Returns:
      parameter value or `null`.
    Throws:
      `BGIllegalArgumentException` - when validation fails.

  - ### getParamDateTime

    public Date getParamDateTime(String name, String format, Date defaultValue)

  - ### getParamDateTime

    public Date getParamDateTime(String name, String format)

  - ### getParamDateTime

    public Date getParamDateTime(String name, String format, Predicate<Date> validator) throws BGIllegalArgumentException
    Gets HTTP request parameter value with date and time
    Parameters:
      `name` - parameter name
      `format` - date and time format
      `validator` - optional value validator
    Returns:
      parameter value or `null`
    Throws:
      `BGIllegalArgumentException` - when validation fails

  - ### getParamDateTime

    @Deprecated public Date getParamDateTime(String name)
    Deprecated.

  - ### getParamInt

    public int getParamInt(String name, int defaultValue)

  - ### getParamInt

    public int getParamInt(String name)

  - ### getParamInt

    public int getParamInt(String name, Predicate<Integer> validator) throws BGIllegalArgumentException
    Gets HTTP request parameter first value as type `int`.
    Parameters:
      `name` - parameter name.
      `validator` - optional value validator.
    Returns:
      parsed int value or `0`.
    Throws:
      `BGIllegalArgumentException`

  - ### getParamLong

    public long getParamLong(String name, long defaultValue)

  - ### getParamLong

    public long getParamLong(String name)

  - ### getParamBoolean

    public Boolean getParamBoolean(String name, Boolean defaultValue)

  - ### getParamBoolean

    public boolean getParamBoolean(String name)

  - ### getParamValues

    public Set<Integer> getParamValues(String name)
    Gets HTTP request parameter values as type int.
    Parameters:
      `name` - the parameter name.
    Returns:
      not `null` set with all the parameter values parsed to integer.

  - ### getParamValuesStr

    public Set<String> getParamValuesStr(String name)
    Gets HTTP request parameter values.
    Parameters:
      `name` - the parameter name.
    Returns:
      not `null` set with all the parameter values excluding empty strings.

  - ### getParamValuesList

    public List<Integer> getParamValuesList(String name)
    Gets HTTP request parameter values as an ordered list of type int.
    Parameters:
      `name` - the parameter name.
    Returns:
      not `null` list with all the parameter values parsed to integer.

  - ### getParamValuesListStr

    public List<String> getParamValuesListStr(String name)
    Gets HTTP request parameter values as an ordered list.
    Parameters:
      `name` - the parameter name.
    Returns:
      not `null` list with all the parameter values.

  - ### getParamValuesListStr

    public List<String> getParamValuesListStr(String name, String exclude)
    Gets HTTP request parameter values as an ordered list.
    Parameters:
      `name` - the parameter name.
      `exclude` - excluded value.
    Returns:
      not `null` list with all the parameter values.

  - ### getConnectionSet

    public ConnectionSet getConnectionSet()

  - ### setConnectionSet

    public void setConnectionSet(ConnectionSet value)

  - ### getUser

    public User getUser()

  - ### setUser

    public void setUser(User user)

  - ### getUserId

    public int getUserId()

  - ### getPermission

    public ConfigMap getPermission()

  - ### setPermission

    public void setPermission(ConfigMap permission)

  - ### getResponse

    public Response getResponse()

  - ### setResponseData

    public void setResponseData(String key, Object value)
    Set response object data.
    Parameters:
      `key` -
      `value` -

  - ### setRequestAttribute

    public void setRequestAttribute(String key, Object value)
    Set HTTP request attribute. Unlike response data, not serialized to JSON.
    Parameters:
      `key` -
      `value` -

  - ### get

    public Object get(String name)
    Specified by:
      `get` in interface `org.apache.commons.beanutils.DynaBean`

  - ### set

    public void set(String name, Object value)
    Specified by:
      `set` in interface `org.apache.commons.beanutils.DynaBean`

  - ### contains

    public boolean contains(String name, String key)
    Specified by:
      `contains` in interface `org.apache.commons.beanutils.DynaBean`

  - ### get

    public Object get(String name, int index)
    Specified by:
      `get` in interface `org.apache.commons.beanutils.DynaBean`

  - ### get

    public Object get(String name, String key)
    Specified by:
      `get` in interface `org.apache.commons.beanutils.DynaBean`

  - ### getDynaClass

    public org.apache.commons.beanutils.DynaClass getDynaClass()
    Specified by:
      `getDynaClass` in interface `org.apache.commons.beanutils.DynaBean`

  - ### remove

    public void remove(String name, String key)
    Specified by:
      `remove` in interface `org.apache.commons.beanutils.DynaBean`

  - ### set

    public void set(String name, int index, Object value)
    Specified by:
      `set` in interface `org.apache.commons.beanutils.DynaBean`

  - ### set

    public void set(String name, String key, Object value)
    Specified by:
      `set` in interface `org.apache.commons.beanutils.DynaBean`

  - ### getName

    public String getName()
    Specified by:
      `getName` in interface `org.apache.commons.beanutils.DynaClass`

  - ### getDynaProperty

    public org.apache.commons.beanutils.DynaProperty getDynaProperty(String name)
    Specified by:
      `getDynaProperty` in interface `org.apache.commons.beanutils.DynaClass`

  - ### getDynaProperties

    public org.apache.commons.beanutils.DynaProperty[] getDynaProperties()
    Specified by:
      `getDynaProperties` in interface `org.apache.commons.beanutils.DynaClass`

  - ### newInstance

    public org.apache.commons.beanutils.DynaBean newInstance() throws IllegalAccessException, InstantiationException
    Specified by:
      `newInstance` in interface `org.apache.commons.beanutils.DynaClass`
    Throws:
      `IllegalAccessException`
      `InstantiationException`