コード例 #1
0
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    LazyValidatorForm frm = (LazyValidatorForm) form;
    LoginInfo loginInfo = getLoginInfo(request);
    DivorceIranianSpouseInfo hsbInf = null;
    DivorceIranianSpouseInfo wfInf = null;
    DivorceInfo divInf = null;
    MarriageInfo mrgInf = null;
    InactiveDivorceInfo inactiveDivInf = null;
    frm.set(VIRTUAL_MODIFY_SAVE, "");

    ActionMessages msgsWarning = new ActionMessages();
    if (frm.get(VIRTUAL_WARNING_CONFIRM) == null
        || frm.get(VIRTUAL_WARNING_CONFIRM).toString().equalsIgnoreCase("")
        || !frm.get(VIRTUAL_WARNING_CONFIRM)
            .toString()
            .equalsIgnoreCase(Value_True_False_Is.TRUE)) {
      msgsWarning = (ActionMessages) request.getSession().getAttribute("warnings");
      saveErrors(request, msgsWarning);
    } else {
      if (request.getSession().getAttribute("hsbInf_2") != null)
        hsbInf = (DivorceIranianSpouseInfo) request.getSession().getAttribute("hsbInf_2");
      if (request.getSession().getAttribute("wfInf_2") != null)
        wfInf = (DivorceIranianSpouseInfo) request.getSession().getAttribute("wfInf_2");
      if (request.getSession().getAttribute("divInf_2") != null)
        divInf = (DivorceInfo) request.getSession().getAttribute("divInf_2");
      if (request.getSession().getAttribute("mrgInf_2") != null)
        mrgInf = (MarriageInfo) request.getSession().getAttribute("mrgInf_2");
      if (request.getSession().getAttribute("inactiveDivorceInf_2") != null)
        inactiveDivInf =
            (InactiveDivorceInfo) request.getSession().getAttribute("inactiveDivorceInf_2");

      if (isFormInAddMode(frm)) {
        Person.saveDivIrn(getFormMode(frm), wfInf, hsbInf, divInf, null, null, null, mrgInf, null);
      }
      if (isFormInModifyMode(frm)) {
        DivorceIranianSpouseInfo husbandInf =
            (DivorceIranianSpouseInfo) request.getSession().getAttribute("modifyDivorceHusbandInf");
        DivorceIranianSpouseInfo wifeInf =
            (DivorceIranianSpouseInfo) request.getSession().getAttribute("modifyDivorceWifeInf");
        DivorceInfo divorceInf =
            (DivorceInfo) request.getSession().getAttribute("modifyDivorceInf");

        divInf.setDivorceId(divorceInf.getDivorceId());
        Vector changeVct =
            Common.gatherUpdateFields(divorceInf, husbandInf, wifeInf, divInf, hsbInf, wfInf);

        DivorceUpdateLogInfo changeInf = new DivorceUpdateLogInfo();
        changeInf.setDivorceId(divorceInf.getDivorceId());
        changeInf.setUserId(loginInfo.getUserId());
        changeInf.setMamoorId((new Security()).getMamoorIdByUserId(loginInfo.getUserId()));
        changeInf.setOfficeCode(loginInfo.getOfficeCode());

        /**/
        MarriageInfo preMrgInf = null;
        if (changeVct.size() > 0) {
          for (int i = 0; i < changeVct.size(); i++) {
            if (changeVct
                .elementAt(i)
                .toString()
                .split(Constants.FIELD_SEPARATOR)[0]
                .equalsIgnoreCase(Short.toString(Constants.DivorceUpdateLogCode.MRG_DATE))) {
              preMrgInf =
                  Person.getMarriageDetails(
                      hsbInf.getPersonNin(),
                      wfInf.getPersonNin(),
                      changeVct.elementAt(i).toString().split(Constants.FIELD_SEPARATOR)[1]);
              if (preMrgInf != null) {
                preMrgInf.setCodeActiveFlag(Constants.CodeActiveFlag.ACTIVE);
              }
            }
          }
        }
        /**/
        resetFocusControl(frm, CANCEL);
        if (changeVct.size() > 0) {
          Person.saveDivIrn(
              getFormMode(frm),
              wfInf,
              hsbInf,
              divInf,
              null,
              changeInf,
              changeVct,
              mrgInf,
              preMrgInf);
          frm.set(VIRTUAL_MODIFY_SAVE, Value_True_False_Is.TRUE);
        }
      }
      if (isFormInDeleteMode(frm)) {
        inactiveDivInf.setDivorceId(divInf.getDivorceId());
        Person.saveDivIrn(
            getFormMode(frm), wfInf, hsbInf, divInf, inactiveDivInf, null, null, mrgInf, null);
      }
    }
    return mapping.findForward("ok");
  }