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:
  • Field Details

  • 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)
    • getHttpRequestURI

      public String getHttpRequestURI()
      Returns:
      request URI using method ServletUtils.getRequestURI(HttpServletRequest) with parameter httpRequest.
    • 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.
      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 requestURI, String queryString)
      Sets request parameter requestUrl.
      Parameters:
      requestURI - 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
    • setReturnUrl

      @Deprecated public void setReturnUrl(String value)
      Deprecated.
      Used in mobile interface
      <c:set target="${form}" property="returnUrl" value="${reopenProcessUrl}"/>
    • getReturnChildUiid

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

      @Deprecated public void setReturnChildUiid(String value)
      Deprecated.
      Used in mobile interface
      <c:set target="${form}" property="returnChildUiid" value="${uiid}"/>
    • getForward

      public String getForward()
      Returns:
      request parameter forward
    • 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, Date defaultValue)
    • getParamDateTime

      public Date getParamDateTime(String name)
    • getParamDateTime

      public Date getParamDateTime(String name, Predicate<Date> validator) throws BGIllegalArgumentException
      Gets HTTP request parameter first value as type Date .
      Parameters:
      name - parameter name, storing the first day of month in string format TimeUtils.FORMAT_TYPE_YMDHMS.
      validator - optional value validator.
      Returns:
      parameter value or null.
      Throws:
      BGIllegalArgumentException - when validation fails.
    • 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