Пример #1
0
  public ViewFragment showUpdateForm(
      BeanType bean,
      HttpServletRequest req,
      UserType user,
      URIParser uriParser,
      ValidationException validationException,
      FormCallback formCallback)
      throws Exception {

    log.info("User " + user + " requested update " + this.typeLogName + " form for " + bean);

    Document doc = createDocument(req, uriParser, user);
    Element updateTypeElement = doc.createElement("Update" + typeElementName);
    doc.getFirstChild().appendChild(updateTypeElement);

    appendBean(bean, updateTypeElement, doc);

    if (validationException != null) {
      updateTypeElement.appendChild(validationException.toXML(doc));
      updateTypeElement.appendChild(RequestUtils.getRequestParameters(req, doc));
    }

    this.appendUpdateFormData(bean, doc, updateTypeElement, user, req, uriParser, formCallback);

    return createViewFragment(doc);
  }
Пример #2
0
  public ViewFragment showAddForm(
      HttpServletRequest req,
      UserType user,
      URIParser uriParser,
      ValidationException validationException,
      FormCallback formCallback)
      throws Exception {

    log.info("User " + user + " requested add " + this.typeLogName + " form");

    Document doc = createDocument(req, uriParser, user);
    Element addTypeElement = doc.createElement("Add" + typeElementName);
    doc.getFirstChild().appendChild(addTypeElement);

    if (validationException != null) {
      addTypeElement.appendChild(validationException.toXML(doc));
      addTypeElement.appendChild(RequestUtils.getRequestParameters(req, doc));
    }

    this.appendAddFormData(doc, addTypeElement, user, req, uriParser, formCallback);

    return createViewFragment(doc);
  }