Ejemplo n.º 1
0
  public ActionForward execute(
      ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res)
      throws Exception {
    req.getSession().setAttribute("Maintain", null);
    String id = req.getParameter("id");
    String answerInfo = req.getParameter("answerInfo");
    String userId = (String) req.getSession().getAttribute(WebKeys.USER_ID);
    String operator = req.getParameter("operator");
    String accidentExplain = req.getParameter("accidentExplain");
    String operatorDepend = req.getParameter("operatorDepend");
    String operatorStep = req.getParameter("operatorStep");
    String applyPeople = req.getParameter("applyPeople");
    String applyEmail = req.getParameter("applyEmail");
    String[] MaintainType = req.getParameterValues("maintainType");
    try {
      if (MaintainType == null) {
        SessionErrors.add(req, EcardConstants.CHOOSE_MAINTAIN_TYPE);
        return mapping.getInputForward();
      }
      if (MaintainUtil.answerMaintainInfo(
              id,
              userId,
              answerInfo,
              MaintainType,
              operator,
              accidentExplain,
              operatorDepend,
              operatorStep,
              applyPeople,
              applyEmail)
          == true) {
        SessionErrors.add(req, EcardConstants.EDIT_INFO_SUCCESS);
        req.getSession().setAttribute("Maintain", null);
        Maintain maintain = MaintainUtil.getMaintainById(id);
        req.setAttribute("status", maintain.getStatus());
        return mapping.findForward("portlet.maintain.admin");
      } else {
        return mapping.getInputForward();
      }
      /*if (isTokenValid(req)) {
      	MaintainUtil.addMaintain(applyTitle,applyInfo, MaintainType,userId);
      	resetToken(req);
      }*/

    } catch (PortalException pe) {
      req.setAttribute(PageContext.EXCEPTION, pe);
      return mapping.findForward(Constants.COMMON_ERROR);
    }
  }
  public ActionForward deleteClasses(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    DynaActionForm deleteClassesForm = (DynaActionForm) form;
    String[] selectedClasses = (String[]) deleteClassesForm.get("selectedItems");

    if (selectedClasses.length == 0) {
      ActionErrors actionErrors = new ActionErrors();
      actionErrors.add("errors.classes.notSelected", new ActionError("errors.classes.notSelected"));
      saveErrors(request, actionErrors);
      return mapping.getInputForward();
    }
    List<String> classOIDs = new ArrayList<String>();
    for (String selectedClasse : selectedClasses) {
      classOIDs.add(selectedClasse);
    }

    DeleteClasses.run(classOIDs);

    return listClasses(mapping, form, request, response);
  }
 @Override
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   ActionErrors errors = new ActionErrors();
   try {
     return super.execute(mapping, actionForm, request, response);
   } catch (WrongImportFileSpreadsheetImporterException e) {
     errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("import.status.corrupted_file"));
   } catch (MissingFieldSpreadsheetImporterException e) {
     errors.add(
         ActionErrors.GLOBAL_ERROR,
         new ActionError("import.status.missing_required_field", e.getField()));
   } catch (MissingColumnHeaderSpreadsheetImporterException e) {
     errors.add(
         ActionErrors.GLOBAL_ERROR,
         new ActionError("import.status.wrong_header", e.getColumnName()));
   } catch (MissingWorksheetException e) {
     errors.add(
         ActionErrors.GLOBAL_ERROR,
         new ActionError("import.status.worksheet_not_found", e.getWorksheetName()));
   }
   saveErrors(request, errors);
   return mapping.getInputForward();
 }
Ejemplo n.º 4
0
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    UrgebookForm aWebForm = (UrgebookForm) actionForm;

    if (aWebForm.getMethod() == null) { // 初次进行页面,需要取初始值
      Deal.setBookDefault(aWebForm, request, response); // 设置进入增加页面的初始值
      return actionMapping.getInputForward();
    } else {
      String sMessage = "未能找到 " + aWebForm.getMethod() + " 对应的处理方法";
      CCommonMessage mMessage = new CCommonMessage(); // 统一提示页面
      mMessage.setMessage(sMessage); // 默认为"处理成功!"

      // if (aWebForm.getMethod().equals("print")) {     // 打印
      // Deal.doPrint(aWebForm, request, response);  // 处理打印
      // sMessage = "打印" + mModuleName + "处理成功";
    }

    CCommonMessage mMessage = new CCommonMessage(); // 统一提示页面
    // mMessage.setMessage(sMessage);  // 默认为"处理成功!"
    String[] button = {"关闭"}; // 按钮数组
    String[] onclick = {"parent.window.close()"}; // 按钮响应事件
    mMessage.setButtonName(button);
    mMessage.setOnClickFunc(onclick);
    request.setAttribute(CConstants.MESSAGE_OBJECT, mMessage);
    // 在处理页面最后调用(事先要配置名字为success的forward,在全局配置里有 message)
    return actionMapping.findForward("message");
  }
Ejemplo n.º 5
0
  /**
   * 删除会议主题
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  protected ActionForward doDelete(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    SubjectForm sub = (SubjectForm) form;
    ActionMessages msgs = new ActionMessages();

    // 判断用户是否登录
    UserBean loginUser = super.getLoginUser(request, response);
    if (loginUser == null) msgs.add("err", new ActionMessage("error.need_login"));
    else if (loginUser.getIsAdmin() != UserBean.TRUE)
      msgs.add("err", new ActionMessage("error.can_not_access"));
    else {
      try {
        // 完成数据操作
        if (SubjectDAO.isDelete(sub.getId())) SubjectDAO.delete(sub.getId());
        else msgs.add("err", new ActionMessage("error.subject.used"));

      } catch (Exception e) {
        msgs.add("err", new ActionMessage("error.db"));
        log.error("database error when delete subject", e);
      }
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("error");
    }

    return mapping.getInputForward();
  }
Ejemplo n.º 6
0
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ListForm aWebForm = (ListForm) actionForm;

    if (aWebForm.getMethod() == null) { // 初次进行页面,需要取初始值
      Deal.doList(aWebForm, request, response); // 查询处理
      return actionMapping.getInputForward();
    } else {
      String sMessage = "未能找到 " + aWebForm.getMethod() + " 对应的处理方法";
      if (aWebForm.getMethod().equals("jgys_submit")) { // 修改
        Deal.doList(aWebForm, request, response); // 查询处理
        Deal.doJgys_submit(aWebForm, request, response);
        sMessage = "确定竣工验收报告,并提交到工程结算处理成功";
      }

      CCommonMessage mMessage = new CCommonMessage(); // 统一提示页面
      mMessage.setMessage(sMessage); // 默认为"处理成功!"
      String[] button = {"关闭"}; // 按钮数组
      String[] onclick = {"parent.window.close()"}; // 按钮响应事件
      mMessage.setButtonName(button);
      mMessage.setOnClickFunc(onclick);
      request.setAttribute(CConstants.MESSAGE_OBJECT, mMessage);
      // 在处理页面最后调用(事先要配置名字为success的forward,在全局配置里有 message)
      return actionMapping.findForward("message");
    }
  }
Ejemplo n.º 7
0
 /**
  * Return a URL path that will return control to the current action. This path is generated by
  * adding the specified parameter to the path of the forward specified as the "input" forward for
  * the given mapping.
  *
  * @param mapping the ActionMapping describing the current action's forwards
  * @param param the name of the path parameter to add
  * @param value the value of the parameter to add
  * @exception ServletException if encoding the path parameter fails or input has not been set
  */
 public static String findReturnPath(ActionMapping mapping, Map params) throws Exception {
   ActionForward inputForward = mapping.getInputForward();
   if (inputForward.getPath() == null)
     throw new ServletException(
         "input cannot be null for returnPath on url: " + mapping.getPath());
   ActionForward returnForward = ActionUtils.changeForwardPath(inputForward, params);
   return returnForward.getPath();
 }
Ejemplo n.º 8
0
  /**
   * <br>
   * [機 能] 初期表示処理 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map マップ
   * @param form フォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @return ActionForward フォワード
   * @throws Exception 実行時例外
   */
  private ActionForward __doInit(
      ActionMapping map,
      Rsv010Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws Exception {

    try {

      con.setAutoCommit(true);
      RequestModel reqMdl = getRequestModel(req);
      Rsv010Biz biz = new Rsv010Biz(reqMdl, con);

      Rsv010ParamModel paramMdl = new Rsv010ParamModel();
      paramMdl.setParam(form);

      // 管理者フラグを設定する
      biz.setAdmFlg(paramMdl);

      // 施設グループの編集が可能か判定しフラグをセットする。
      biz.setGroupEditFlg(paramMdl);

      // 施設グループコンボリストを設定する
      biz.setGroupComboList(paramMdl);

      // 施設予約情報一覧を取得する
      int sessionUserSid = getSessionUserSid(req);
      biz.setYoyakuWeek(paramMdl, sessionUserSid);

      // 自動リロード時間を設定する
      biz.set010Reloadtime(con, paramMdl, sessionUserSid);

      paramMdl.setFormData(form);

      // 施設データが存在する場合のみ画像データを取得
      if (form.getRsv010SisetuList() != null && form.getRsv010SisetuList().size() > 0) {

        // テンポラリディレクトリパスを取得
        CommonBiz cmnBiz = new CommonBiz();
        String tempDir = cmnBiz.getTempDir(getTempPath(req), form.getRsv010pluginId(), reqMdl);

        paramMdl = new Rsv010ParamModel();
        paramMdl.setParam(form);
        biz.get010SisetuImgData(paramMdl, tempDir, getAppRootPath(), sessionUserSid);
        paramMdl.setFormData(form);
      }

      con.setAutoCommit(false);

    } catch (SQLException e) {
      log__.error("SQLException", e);
      throw e;
    }

    return map.getInputForward();
  }
Ejemplo n.º 9
0
 /**
  * 响应页面提交
  *
  * @param actionMapping ActionMapping 这个 Action 的配置信息
  * @param actionForm ActionForm 用户提交的表单数据
  * @param request HttpServletRequest 当前的 HTTP 请求对象
  * @param response HttpServletResponse 当前的 HTTP 响应对象
  * @return ActionForward 请求转发路径
  * @throws Exception
  */
 public ActionForward execute(
     ActionMapping actionMapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   ResponsepersonForm aWebForm = (ResponsepersonForm) actionForm;
   Deal.doResponseperson(aWebForm, request, response); // 查询处理
   return actionMapping.getInputForward(); // 调用配置里input路径下的页面
 }
Ejemplo n.º 10
0
 /**
  * 响应页面提交
  *
  * @param actionMapping ActionMapping 这个 Action 的配置信息
  * @param actionForm ActionForm 用户提交的表单数据
  * @param request HttpServletRequest 当前的 HTTP 请求对象
  * @param response HttpServletResponse 当前的 HTTP 响应对象
  * @return ActionForward 请求转发路径
  * @throws Exception
  */
 public ActionForward execute(
     ActionMapping actionMapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   QueryForm aWebForm = (QueryForm) actionForm;
   Deal.doQuery(aWebForm, request, response); // 查询处理
   return actionMapping.getInputForward();
 }
Ejemplo n.º 11
0
 /**
  * 响应页面提交
  *
  * @param mapping ActionMapping 这个 Action 的配置信息
  * @param form ActionForm 用户提交的表单数据
  * @param request HttpServletRequest 当前的 HTTP 请求对象
  * @param response HttpServletResponse 当前的 HTTP 响应对象
  * @return ActionForward 请求转发路径
  * @throws Exception
  */
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   CDocErrInfo aForm = (CDocErrInfo) form;
   DocErrDeal.doDocInfoQuery(aForm, request, response);
   return mapping.getInputForward();
 }
Ejemplo n.º 12
0
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   mForm = (PowerForm) form;
   if (mForm.getId() != null && !mForm.getId().equals("")) getDepartData();
   getOtherData(request);
   return (mapping.getInputForward());
 }
Ejemplo n.º 13
0
  /**
   * 响应页面提交
   *
   * @param actionMapping ActionMapping 这个 Action 的配置信息
   * @param actionForm ActionForm 用户提交的表单数据
   * @param request HttpServletRequest 当前的 HTTP 请求对象
   * @param response HttpServletResponse 当前的 HTTP 响应对象
   * @return ActionForward 请求转发路径
   * @throws Exception
   */
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    AddForm aWebForm = (AddForm) actionForm;

    if (aWebForm.getMethod() == null) { // 初次进行页面,需要取初始值
      Deal.setAddDefault(aWebForm, request, response); // 设置进入增加页面的初始值
      return actionMapping.getInputForward();
    } else {
      String sMessage = "未能找到 " + aWebForm.getMethod() + " 对应的处理方法";
      String[] button; // 按钮数组
      String[] onclick; // 按钮响应事件
      if (aWebForm.getMethod().equals("do_save")) { // 增加
        String EVENTID = Deal.doAdd(aWebForm, request, response); // 处理增加
        int EVENTBIGTYPE = aWebForm.getTYWyjyasendevent().getEVENTBIGTYPE();
        int EVENTSMALLTYPE = aWebForm.getTYWyjyasendevent().getEVENTSMALLTYPE();
        sMessage = "增加" + mModuleName + "处理成功";
        button = new String[] {"返回", "关闭"}; // 按钮数组
        onclick =
            new String[] {
              "window.location='/lh/business/yjya/ywyabs/edit.TJ?BS=YES&EVENTID="
                  + EVENTID
                  + "&EVENTBIGTYPE="
                  + EVENTBIGTYPE
                  + "&EVENTSMALLTYPE="
                  + EVENTSMALLTYPE
                  + "'",
              "parent.window.close()"
            }; // 按钮响应事件

      } else if (aWebForm.getMethod().equals("do_submit")) { // 提交
        Deal.doAdd_submit(aWebForm, request, response); // 处理提交
        sMessage = "提交到接收成功";
        button = new String[] {"关闭"}; // 按钮数组
        onclick = new String[] {"parent.window.close()"}; // 按钮响应事件
      } else { // 未能找到 " + aWebForm.getMethod() + " 对应的处理方法
        button = new String[] {"关闭"}; // 按钮数组
        onclick = new String[] {"parent.window.close()"}; // 按钮响应事件
      }

      CCommonMessage mMessage = new CCommonMessage(); // 统一提示页面
      mMessage.setMessage(sMessage); // 默认为"处理成功!"
      //      String[] button = {"关闭"};  // 按钮数组
      //      String[] onclick = {"parent.window.close()"};  // 按钮响应事件
      mMessage.setButtonName(button);
      mMessage.setOnClickFunc(onclick);
      request.setAttribute(CConstants.MESSAGE_OBJECT, mMessage);
      // 在处理页面最后调用(事先要配置名字为success的forward,在全局配置里有 message)
      return actionMapping.findForward("message");
    }
  }
Ejemplo n.º 14
0
 /**
  * 响应页面提交
  *
  * @param actionMapping ActionMapping 这个 Action 的配置信息
  * @param actionForm ActionForm 用户提交的表单数据
  * @param request HttpServletRequest 当前的 HTTP 请求对象
  * @param response HttpServletResponse 当前的 HTTP 响应对象
  * @return ActionForward 请求转发路径
  * @throws Exception
  */
 public ActionForward execute(
     ActionMapping actionMapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   UrgerBookForm aWebForm = (UrgerBookForm) actionForm;
   String uid = request.getParameter("ID");
   aWebForm.setId(uid);
   Deal.doUrgerBook(aWebForm, request, response); // 查询处理
   return actionMapping.getInputForward(); // 调用配置里input路径下的页面
 }
Ejemplo n.º 15
0
  /**
   * <br>
   * [機 能] 再表示を行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map マップ
   * @param form フォーム
   * @param con コネクション
   * @return ActionForward フォワード
   * @throws SQLException SQL実行例外
   */
  private ActionForward __doInitAg(ActionMapping map, Ipk100Form form, Connection con)
      throws SQLException {

    Ipk100ParamModel paramMdl = new Ipk100ParamModel();
    paramMdl.setParam(form);
    Ipk100Biz biz = new Ipk100Biz();

    // 初期表示情報を設定する。
    biz.setInitDataAg(paramMdl, con);
    paramMdl.setFormData(form);
    return map.getInputForward();
  }
Ejemplo n.º 16
0
  /**
   * 添加或修改会议主题
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  protected ActionForward doAddOrModify(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    SubjectForm sub = (SubjectForm) form;
    ActionMessages msgs = new ActionMessages();

    // 判断用户是否登录
    UserBean loginUser = super.getLoginUser(request, response);
    if (loginUser == null) msgs.add("err", new ActionMessage("error.need_login"));
    else if (loginUser.getIsAdmin() != UserBean.TRUE)
      msgs.add("err", new ActionMessage("error.can_not_access"));
    else if (StringUtils.isEmpty(sub.getSubject()))
      msgs.add("err", new ActionMessage("error.suject.not.null"));
    else {
      try {
        SubjectBean sbean = null;
        Timestamp ts = new Timestamp(System.currentTimeMillis());
        if (sub.getId() > 0) {
          // 从数据库中读取主题信息
          sbean = SubjectDAO.getSubject(sub.getId());
          if (sbean == null) msgs.add("err", new ActionMessage("error.unknow"));
          else {
            sbean.setSubject(sub.getSubject());
            sbean.setUpdateTime(ts);
            SubjectDAO.update(sbean);
          }
        } else {
          sbean = new SubjectBean();
          sbean.setSubject(sub.getSubject());
          sbean.setUpdateTime(ts);
          sbean.setRegTime(ts);

          SubjectDAO.save(sbean);
        }

      } catch (Exception e) {
        msgs.add("err", new ActionMessage("error.db"));
        log.error("database error when add or modify subject", e);
      }
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("error");
    }

    return mapping.getInputForward();
  }
  /**
   * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping,
   *     org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse)
   */
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    SimpleAuthLoginForm simpleAuthLoginForm = (SimpleAuthLoginForm) form;

    String redirectTo = simpleAuthLoginForm.getRedirectTo();
    String username = simpleAuthLoginForm.getUsername();
    String password = simpleAuthLoginForm.getPassword();
    logger.debug("Authenticating user: "******"Setting user principal in session...");
      AuthEnvironment authEnv = new AuthEnvironment(request);
      UserPrincipal userPrincipal = new UserPrincipal(person.getUsername());

      List<RolePrincipal> roles = new ArrayList<RolePrincipal>();
      if (person.isActive()) {
        if (person.isAnonymous()) {
          roles.add(new RolePrincipal(RolePrincipal.ROLE_ANONYMUS));
        } else {
          roles.add(new RolePrincipal(RolePrincipal.ROLE_MEMBER));
          // XXX Only members can be administrators
          if (person.isAdministrator()) {
            roles.add(new RolePrincipal(RolePrincipal.ROLE_ADMINISTRATOR));
          }
        }
      }
      userPrincipal.setRoles(roles);

      authEnv.setPrincipal(userPrincipal);
      if (redirectTo != null && redirectTo.length() > 0) {
        PathForwardFactory forwardFactory = new PathForwardFactory();
        forward = forwardFactory.getRedirectForward(redirectTo);
      } else {
        forward = mapping.findForward("principalPath");
      }
    } else {
      logger.debug("No person with the name [" + username + "] was found...");
      forward = mapping.getInputForward();
    }

    return forward;
  }
Ejemplo n.º 18
0
 /**
  * 响应页面提交
  *
  * @param actionMapping ActionMapping这个 Action 的配置信息
  * @param actionForm ActionForm 用户提交的表单数据
  * @param request HttpServletRequest当前的 HTTP 请求对象
  * @param response HttpServletResponse当前的 HTTP 响应对象
  * @return ActionForward 提交到查询页面
  * @throws Exception
  */
 public ActionForward execute(
     ActionMapping actionMapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   EditForm aWebForm = (EditForm) actionForm;
   Deal.setEditDefault(aWebForm, request, response); // 设置进入增加页面的初始值
   if (request.getParameter("print") == null) {
     return actionMapping.getInputForward();
   } else {
     return actionMapping.findForward("print");
   }
 }
Ejemplo n.º 19
0
  /**
   * アクション実行
   *
   * @param map アクションマッピング
   * @param form アクションフォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @throws Exception 実行例外
   * @return アクションフォーム
   */
  public ActionForward executeAction(
      ActionMapping map,
      ActionForm form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws Exception {

    log__.debug("-- MAIN FOOT START --");
    ActionForward forward = null;
    forward = map.getInputForward();
    log__.debug("-- MAIN FOOT END --");
    return forward;
  }
Ejemplo n.º 20
0
  /**
   * 响应页面提交
   *
   * @param actionMapping ActionMapping 这个 Action 的配置信息
   * @param actionForm ActionForm 用户提交的表单数据
   * @param request HttpServletRequest 当前的 HTTP 请求对象
   * @param response HttpServletResponse 当前的 HTTP 响应对象
   * @return ActionForward 请求转发路径
   * @throws Exception
   */
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    CautionForm aWebForm = (CautionForm) actionForm;
    CautionDeal.doQuery(aWebForm, request, response);
    if (aWebForm.getMethod() != null && aWebForm.getMethod().equals("excel")) {
      return actionMapping.findForward("excel");
    }
    return actionMapping.getInputForward();
  }
Ejemplo n.º 21
0
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    JczdDao.doQuery((JczdForm) form);

    /**
     * if(AAUtils.isAjaxRequest(request)) { AAUtils.addZonesToRefreh(request,"jczdList");
     * System.out.println("call ajax......."); }*
     */
    return mapping.getInputForward();
  }
Ejemplo n.º 22
0
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    EditForm aWebForm = (EditForm) actionForm;
    if (aWebForm.getMethod() == null) { // 初次进行页面,需要取初始值
      Deal.setEditDefault(aWebForm, request, response); // 设置进入修改页面的初始值
      return actionMapping.getInputForward();
    } else {
      String sMessage = "未能找到 " + aWebForm.getMethod() + " 对应的处理方法";
      String[] button; // 按钮数组
      String[] onclick; // 按钮响应事件
      if (aWebForm.getMethod().equals("agree")) { //
        Deal.doAgreeEdit(aWebForm, request, response); // 处理提交
        sMessage = "提交成功,转入建设单位由其决定后续步骤!";
        button = new String[] {"关闭"}; // 按钮数组
        onclick = new String[] {"parent.window.close()"}; // 按钮响应事件

      } else if (aWebForm.getMethod().equals("save")) { //
        Deal.doEditSave(aWebForm, request, response); // 处理保存
        sMessage = "勘测标底审计信息保存成功!";

        button = new String[] {"返回", "关闭"}; // 按钮数组
        onclick =
            new String[] {
              "window.location='/lh/business/jsgc/sjj/bdsj/kcbdsj/edit.TJ?projectID="
                  + aWebForm.getProjectID()
                  + "'",
              "parent.window.close()"
            }; // 按钮响应事件

      } else { // 未能找到 " + aWebForm.getMethod() + " 对应的处理方法
        button = new String[] {"关闭"}; // 按钮数组
        onclick = new String[] {"parent.window.close()"}; // 按钮响应事件
      }

      CCommonMessage mMessage = new CCommonMessage(); // 统一提示页面
      mMessage.setMessage(sMessage); // 默认为"处理成功!"
      //        String[] button = {"关闭"}; // 按钮数组
      //        String[] onclick = {"parent.window.close()"}; // 按钮响应事件
      mMessage.setButtonName(button);
      mMessage.setOnClickFunc(onclick);
      request.setAttribute(CConstants.MESSAGE_OBJECT, mMessage);
      // 在处理页面最后调用(事先要配置名字为success的forward,在全局配置里有 message)
      return actionMapping.findForward("message");
    }
  }
Ejemplo n.º 23
0
  /**
   * 响应页面提交
   *
   * @param actionMapping ActionMapping 这个 Action 的配置信息
   * @param actionForm ActionForm 用户提交的表单数据
   * @param request HttpServletRequest 当前的 HTTP 请求对象
   * @param response HttpServletResponse 当前的 HTTP 响应对象
   * @return ActionForward 请求转发路径
   * @throws Exception
   */
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    EditForm aWebForm = (EditForm) actionForm;
    String[] button = new String[] {}; // 按钮数组
    String[] onclick = new String[] {}; // 按钮响应事件
    if (aWebForm.getMethod() == null) { // 初次进行页面,需要取初始值
      Deal.setEditDefault(aWebForm, request, response); // 设置进入修改页面的初始值
      return actionMapping.getInputForward();
    } else {
      String sMessage = "未能找到 " + aWebForm.getMethod() + " 对应的处理方法";
      if (aWebForm.getMethod().equals("edit")) { // 修改
        String mid = aWebForm.getTYwJsgcPermitSupervise().getId();
        Deal.doEdit(aWebForm, request, response); // 处理修改
        button = new String[] {"返回", "关闭"}; // 按钮数组
        onclick =
            new String[] {
              "window.location='/lh/business/jsgc/jsj/sgxkzdb/edit.TJ?BS=YES&id=" + mid + "'",
              "parent.window.close()"
            };
        sMessage = "施工许可证督办函修改成功";
      }
      if (aWebForm.getMethod().equals("send")) { // 修改
        Deal.doEditSend(aWebForm, request, response); // 处理修改
        button = new String[] {"关闭"}; // 按钮数组
        onclick = new String[] {"parent.window.close()"}; // 按钮响应事件
        sMessage = "施工许可证督办函发送成功";
      }

      if (aWebForm.getMethod().equals("del")) { // 删除
        Deal.doDel(aWebForm, request, response); // 处理删除
        button = new String[] {"关闭"}; // 按钮数组
        onclick = new String[] {"parent.window.close()"}; // 按钮响应事件
        sMessage = "施工许可证督办函删除成功";
      }

      CCommonMessage mMessage = new CCommonMessage(); // 统一提示页面
      mMessage.setMessage(sMessage); // 默认为"处理成功!"
      mMessage.setButtonName(button);
      mMessage.setOnClickFunc(onclick);
      request.setAttribute(CConstants.MESSAGE_OBJECT, mMessage);
      // 在处理页面最后调用(事先要配置名字为success的forward,在全局配置里有 message)
      return actionMapping.findForward("message");
    }
  }
Ejemplo n.º 24
0
 /**
  * @param mapping ActionMapping mapping
  * @param form ActionForm form
  * @param request HttpServletRequest request
  * @param response HttpServletResponse response
  * @return ActionForward forward to next action
  * @throws DynamicExtensionsApplicationException
  */
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws DynamicExtensionsApplicationException {
   String returnXML = null;
   try {
     String operation = request.getParameter("ajaxOperation");
     if (operation != null) {
       if (operation.trim().equals("selectFormNameFromTree")) {
         String selectedFormName = request.getParameter("selectedFormName");
         selectedFormName = rectifySelectedName(selectedFormName);
         if (selectedFormName != null) {
           returnXML = getSelectedFormDetails(request, selectedFormName);
         }
       } else if (operation.trim().equals("selectFormNameFromAssociationTree")) {
         String selectedFormId = request.getParameter("selectedFormId");
         if (selectedFormId != null) {
           returnXML = getSelectedFormDetailsById(request, selectedFormId);
         }
       } else if (operation.trim().equals("selectGroup")) {
         String selectedGroupName = request.getParameter("selectedGroupName");
         if (selectedGroupName != null) {
           returnXML = getSelectedGroupDetails(request, selectedGroupName);
         }
       } else if (operation.trim().equals("deleteRowsForContainment")) {
         String deletedRowIds = request.getParameter("deletedRowIds");
         String containerId = request.getParameter("containerId");
         returnXML = deleteRowsForContainment(request, deletedRowIds, containerId);
       } else if (operation.trim().equals("updateControlsSequence")) {
         String gridControlsIds = request.getParameter("gridControlIds");
         returnXML = updateControlsSequence(request, gridControlsIds);
       } else if (operation.trim().equals("changeGroup")) {
         returnXML = changeGroup(request, response);
       } else if (operation.trim().equals("changeForm")) {
         returnXML = changeForm(request, response);
       }
     }
     sendResponse(returnXML, response);
     return null;
   } catch (Exception e) {
     String actionForwardString = catchException(e, request);
     if ((actionForwardString == null) || (actionForwardString.equals(""))) {
       return mapping.getInputForward();
     }
     return (mapping.findForward(actionForwardString));
   }
 }
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   if (!this.isCancelled(request)) {
     try {
       LicensedObjectSWForm OSForm = (LicensedObjectSWForm) form;
       Context context = new InitialContext();
       LicenseKeeper licenseKeeper =
           (LicenseKeeper) context.lookup("LicenseKeeper/LicenseKeeperBean/local");
       LicensedObject licensedObject =
           new LicensedObjectSoftware(
               OSForm.getId(),
               OSForm.getPublisher(),
               OSForm.getName(),
               OSForm.getDescription(),
               OSForm.getActivationsLimit(),
               licenseKeeper.getCategory(OSForm.getCategory()));
       licenseKeeper.saveLicensedObject(licensedObject);
     } catch (PersistException ex) {
       ActionMessages messages = new ActionMessages();
       messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("bd.probleme"));
       saveErrors(request, messages);
       System.out.println(ex.getMessage());
       return mapping.getInputForward();
     } catch (NamingException ex) {
       ActionMessages messages = new ActionMessages();
       messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("bd.probleme"));
       saveErrors(request, messages);
       System.out.println(ex.getMessage());
       return mapping.getInputForward();
     }
   }
   return mapping.findForward("licensesList");
 }
Ejemplo n.º 26
0
  /**
   * This is the action called from the Struts framework.
   *
   * @param mapping The ActionMapping used to select this instance.
   * @param form The optional ActionForm bean for this request.
   * @param request The HTTP Request we are processing.
   * @param response The HTTP Response we are processing.
   * @throws java.lang.Exception
   * @return
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    UserForm registerationForm = (UserForm) form;
    ActionMessages errors = new ActionMessages();

    String username = registerationForm.getUsername();
    String password = registerationForm.getPassword();
    String confirmPasswod = registerationForm.getConfirmPassword();
    String email = registerationForm.getEmail();
    if (!password.equals(confirmPasswod)) {
      errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.password.mismatch"));
      saveErrors(request, errors);
      return mapping.getInputForward();
    }

    UserManager mgr = new DummyUserManagerImpl();
    User user = new User();
    user.setEmail(email);
    user.setUsername(username);
    user.setPassword(password);
    try {
      mgr.registerUser(user);
    } catch (Exception e) {
      errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.register.failed"));
      saveErrors(request, errors);
      return mapping.getInputForward();
    }

    request.setAttribute("username", username);
    request.setAttribute("password", password);
    return mapping.findForward(SUCCESS);
  }
Ejemplo n.º 27
0
  /**
   * Process the specified HTTP request, and create the corresponding HTTP response (or forward to
   * another web component that will create it). Return an <code>ActionForward</code> instance
   * describing where and how control should be forwarded, or <code>null</code> if the response has
   * already been completed.
   *
   * @param mapping The ActionMapping used to select this instance
   * @param form The optional ActionForm bean for this request (if any)
   * @param request The HTTP request we are processing
   * @param response The HTTP response we are creating
   * @exception Exception if business logic throws an exception
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    // Extract attributes we will need
    User user = null;

    // Validate the request parameters specified by the user
    ActionMessages errors = new ActionMessages();
    String username = (String) PropertyUtils.getSimpleProperty(form, "username");
    String password = (String) PropertyUtils.getSimpleProperty(form, "password");
    UserDatabase database =
        (UserDatabase) servlet.getServletContext().getAttribute(Constants.DATABASE_KEY);
    if (database == null)
      errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.database.missing"));
    else {
      user = getUser(database, username);
      if ((user != null) && !user.getPassword().equals(password)) user = null;
      if (user == null)
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.password.mismatch"));
    }

    // Report any errors we have discovered back to the original form
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return (mapping.getInputForward());
    }

    // Save our logged-in user in the session
    HttpSession session = request.getSession();
    session.setAttribute(Constants.USER_KEY, user);
    if (log.isDebugEnabled()) {
      log.debug(
          "LogonAction: User '" + user.getUsername() + "' logged on in session " + session.getId());
    }

    // Remove the obsolete form bean
    if (mapping.getAttribute() != null) {
      if ("request".equals(mapping.getScope())) request.removeAttribute(mapping.getAttribute());
      else session.removeAttribute(mapping.getAttribute());
    }

    // Forward control to the specified success URI
    return (mapping.findForward("success"));
  }
Ejemplo n.º 28
0
  /**
   * <br>
   * [機 能] 初期表示処理 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map マップ
   * @param form フォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @return ActionForward フォワード
   * @throws Exception 実行時例外
   */
  private ActionForward __doInit(
      ActionMapping map,
      Adr200Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws Exception {
    Adr200Biz biz = new Adr200Biz(getRequestModel(req));

    Adr200ParamModel paramMdl = new Adr200ParamModel();
    paramMdl.setParam(form);
    biz.setInitData(con, paramMdl);
    paramMdl.setFormData(form);

    return map.getInputForward();
  }
Ejemplo n.º 29
0
  /**
   * <br>
   * [機 能] 初期表示を行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map マップ
   * @param form フォーム
   * @param req リクエスト
   * @param con コネクション
   * @return ActionForward フォワード
   * @throws SQLException SQL実行例外
   */
  private ActionForward __doInit(
      ActionMapping map, Ipk100Form form, HttpServletRequest req, Connection con)
      throws SQLException {

    con.setAutoCommit(true);
    Ipk100ParamModel paramMdl = new Ipk100ParamModel();
    paramMdl.setParam(form);
    Ipk100Biz biz = new Ipk100Biz();

    // 初期表示情報を設定する。
    biz.setInitData(paramMdl, con);
    paramMdl.setFormData(form);

    // ヘルプパラメータを設定する。
    __setHelpMode(form);
    return map.getInputForward();
  }
Ejemplo n.º 30
0
  /**
   * 响应页面提交
   *
   * @param actionMapping ActionMapping这个 Action 的配置信息
   * @param actionForm ActionForm 用户提交的表单数据
   * @param request HttpServletRequest当前的 HTTP 请求对象
   * @param response HttpServletResponse当前的 HTTP 响应对象
   * @return ActionForward 提交到修改页面
   * @throws Exception
   */
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    EditdepartForm aWebForm = (EditdepartForm) actionForm;
    if (aWebForm.getMethod() == null) { // 初次进行页面,需要取初始值
      Deal.setEditdepartDefault(aWebForm, request, response); // 置进入修改页面的初始值
      return actionMapping.getInputForward(); // 返回到修改页面
    } else {
      String sMessage = "未能找到 " + aWebForm.getMethod() + " 对应的处理方法";
      String[] button; // 按钮数组
      String[] onclick; // 按钮响应事件
      if (aWebForm.getMethod().equals("edit")) { // 修改
        Deal.doEditdepart(aWebForm, request, response); // 处理修改
        String TASKBREAKID = aWebForm.getTYwWorkdutyDepartlation().getID();
        sMessage = "修改处理成功";
        button = new String[] {"返回", "关闭"}; // 按钮数组
        onclick =
            new String[] {
              "window.location='/lh/supervise/zdsx/workduty/project/editdepart.TJ?BS=YES&ID="
                  + TASKBREAKID
                  + "'",
              "parent.window.close()"
            }; // 按钮响应事件

      } else if (aWebForm.getMethod().equals("del")) { // 删除
        Deal.doDeldepart(aWebForm, request, response); // 处理删除
        sMessage = "删除处理成功";
        button = new String[] {"关闭"}; // 按钮数组
        onclick = new String[] {"parent.window.close()"}; // 按钮响应事件
      } else {
        button = new String[] {"关闭"}; // 按钮数组
        onclick = new String[] {"parent.window.close()"}; // 按钮响应事件
      }

      CCommonMessage mMessage = new CCommonMessage(); // 统一提示页面
      mMessage.setMessage(sMessage); // 默认为"处理成功!"
      mMessage.setButtonName(button);
      mMessage.setOnClickFunc(onclick);
      request.setAttribute(CConstants.MESSAGE_OBJECT, mMessage);
      // 在处理页面最后调用(事先要配置名字为success的forward,在全局配置里有 message)
      return actionMapping.findForward("message");
    }
  }