Package org.hdiv.state

Examples of org.hdiv.state.IState


   */
  public String compose(String action, String parameter, String value, boolean editable, boolean isActionParam,
      String charEncoding) {

    // Get actual IState
    IState state = this.getStatesStack().peek();
    if (state.getAction() != null && state.getAction().trim().length() == 0) {
      state.setAction(action);
    }
    return this.compose(parameter, value, editable, isActionParam, charEncoding);
  }
View Full Code Here


    }

    String decodedParams = this.getDecodedValue(parameters, charEncoding);

    // Get actual IState
    IState state = this.getStatesStack().peek();
    state.setParams(decodedParams);

    if (this.hdivConfig.getConfidentiality()) {
      // replace real values with confidential ones
      parameters = this.applyConfidentialityToParams(parameters, method);
    }
View Full Code Here

   * @since HDIV 2.0.6
   */
  protected boolean isUserDefinedNonValidationParameter(String parameter) {

    // Get actual IState
    IState state = this.getStatesStack().peek();
    String action = state.getAction();

    if (this.hdivConfig.isParameterWithoutValidation(action, parameter)) {

      if (log.isDebugEnabled()) {
        log.debug("parameter " + parameter + " doesn't need validation. It is user defined parameter.");
View Full Code Here

    if (!editable) {
      decodedValue = this.getDecodedValue(value, charEncoding);
    }

    // Get actual IState
    IState state = this.getStatesStack().peek();

    IParameter parameter = state.getParameter(parameterName);
    if (parameter != null) {
      if (parameter.isEditable() != editable) {
        // A parameter can be created as editable but if a new non editable value is added, the parameter is
        // changed to non editable. This is required in some frameworks like Struts 2.
        parameter.setEditable(editable);
      }
      parameter.addValue(decodedValue);
    } else {
      // create a new parameter and add to the request
      parameter = createParameter(parameterName, decodedValue, editable, editableDataType, isActionParam,
          charEncoding);
      state.addParameter(parameter);
    }

    return parameter;
  }
View Full Code Here

   *            name of the new parameter
   */
  public void mergeParameters(String oldParameter, String newParameter) {

    // Get actual IState
    IState state = this.getStatesStack().peek();
    IParameter storedParameter = state.getParameter(oldParameter);

    if (storedParameter.getValues().size() > 0) {

      IParameter parameter = this.composeParameter(newParameter, storedParameter.getValuePosition(0), false, "",
          false, Constants.ENCODING_UTF_8);
View Full Code Here

  public void testAddPage() {

    IPage page = new Page();
    page.setId(20);

    IState state = new State(0);
    state.setAction("/action");
    IParameter param = new Parameter("name", "value", false, null, true);
    state.addParameter(param);
    page.addState(state);

    session.addPage("20", page);

  }
View Full Code Here

  public void testGetState() {

    IPage page = new Page();
    page.setId(20);

    IState state = new State(0);
    state.setAction("/action");
    IParameter param = new Parameter("name", "value", false, null, true);
    state.addParameter(param);
    page.addState(state);

    session.addPage("20", page);

    // Restore state
    IState restored = session.getState("20", 0);

    assertNotNull(restored);
    assertEquals(state, restored);
  }
View Full Code Here

  public void testGetPage() {

    IPage page = new Page();
    page.setId(20);

    IState state = new State(0);
    state.setAction("/action");
    IParameter param = new Parameter("name", "value", false, null, true);
    state.addParameter(param);
    page.addState(state);

    session.addPage("20", page);

    // Restore page
View Full Code Here

    IPage page1 = new Page();
    IPage page2 = new Page();
    IPage page3 = new Page();

    IState state1 = new State(0);
    IState state2 = new State(0);
    IState state3 = new State(0);

    page1.addState(state1);
    page1.setId(1);
    cache.addPage("1");
View Full Code Here

    String stateId = dataComposer.endRequest();
    dataComposer.endPage();

    assertNotNull(stateId);

    IState state = this.stateUtil.restoreState(stateId);

    assertEquals("test.do", state.getAction());
    List<String> values = state.getParameter("parameter1").getValues();
    assertEquals(1, values.size());
    assertEquals("2", values.get(0));
  }
View Full Code Here

TOP

Related Classes of org.hdiv.state.IState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.