Esempio n. 1
0
  public ActionMessages[] validMrgRecord(
      LazyValidatorForm frm, HttpServletRequest request, String action, boolean isOfficeManager)
      throws Exception {
    ActionMessages msgs[] = new ActionMessages[2];
    ActionMessages msgsErrors = new ActionMessages();
    ActionMessages msgsWarnings = new ActionMessages();
    MarriageInfo mrgInf = null;
    InactiveMarriageInfo inactiveMrgInf = null;

    mrgInf = new MarriageInfo();
    inactiveMrgInf = new InactiveMarriageInfo();
    LoginInfo loginInfo = getLoginInfo(request);
    try {
      if (action.equalsIgnoreCase(Constants.ActionType.ADD)
          || action.equalsIgnoreCase(Constants.ActionType.MODIFY)) {
        reapetAjaxSideServer(frm, request);

        String regstLable = "";
        String regstAuLabel = "";
        String regstRegstGeoLabel = "";
        boolean isConsul = false;
        mrgInf.setForeignStatusCode(Short.toString(Constants.ForeignStatusCode.FOREIGN));
        String marConfirm = frm.get(MARRIAGE_CONFIRM_AUT_CODE).toString().trim();
        if (!Utils.isEmpty(marConfirm)) {
          mrgInf.setMarriageConfirmAutCode(marConfirm);
          switch (Short.parseShort(frm.get(MARRIAGE_CONFIRM_AUT_CODE).toString())) {
            case Constants.MarriageConfirmAut.DECLARATION:
              frm.set(
                  MARRIAGE_REGST_REF, String.valueOf(Constants.MarriageRegstRef.MARRIAGE_OFFICE));
              regstLable = " ثبت ازدواج";
              regstAuLabel = "شماره دفترخانه ازدواج ";
              regstRegstGeoLabel = "محل دفترخانه ازدواج ";

              break;
            case Constants.MarriageConfirmAut.PROFESSION:
              frm.set(
                  MARRIAGE_REGST_REF,
                  String.valueOf(Constants.MarriageRegstRef.FORMAL_DOCUMENT_OFFICE));
              regstLable = " اقرارنامه";
              regstAuLabel = "شماره دفترخانه اسناد رسمي ";
              regstRegstGeoLabel = "محل دفترخانه اسناد رسمي ";

              break;
            case Constants.MarriageConfirmAut.PETITION:
              frm.set(MARRIAGE_REGST_REF, String.valueOf(Constants.MarriageRegstRef.COURT));
              regstLable = " دادنامه";
              regstAuLabel = "شماره شعبه ";
              regstRegstGeoLabel = "محل شعبه ";

              break;
            case Constants.MarriageConfirmAut.CONSULE:
              frm.set(
                  MARRIAGE_REGST_REF, String.valueOf(Constants.MarriageRegstRef.MARRIAGE_OFFICE));
              isConsul = true;
              regstLable = " ثبت ازدواج";
              regstAuLabel = "حوزه کنسولي تابعه ";
              regstRegstGeoLabel = "نام کشور ";

              break;
          }
        }
        boolean isDouplicateMarriageRecord = false;
        boolean isDouplicateMarriageHsb = false;
        boolean isDouplicateMarriageWf = false;

        if (action.equalsIgnoreCase(Constants.ActionType.ADD)
            && !Utils.isEmpty(frm.get(HSB_NO).toString().trim())
            && Utils.isValidFoPersonalityNo(frm.get(HSB_NO).toString().trim())
            && !Utils.isEmpty(frm.get(WF_NIN).toString().trim())
            && Utils.isValidNin(frm.get(WF_NIN).toString().trim())
            && !Utils.isEmpty(frm.get(MARRIAGE_DATE).toString().trim())
            && ((!isOfficeManager
                    && DateUtils.isValidRevFormattedFDate(((String) frm.get(MARRIAGE_DATE)).trim()))
                || (isOfficeManager
                    && DateUtils.isValidNaghesOrCompDate(
                        ((String) frm.get(MARRIAGE_DATE)).trim())))) {
          String hsbNo = frm.get(HSB_NO).toString().trim();
          long wfNin = Long.parseLong(frm.get(WF_NIN).toString().trim());
          String marriageDate = DateUtils.getCompleteDate(((String) frm.get(MARRIAGE_DATE)).trim());

          isDouplicateMarriageRecord = Person.isDouplicateMarriage(hsbNo, wfNin, marriageDate);
          isDouplicateMarriageWf = Person.isDouplicateMarriageWife(wfNin, marriageDate);

          if (isDouplicateMarriageRecord) {
            addError(msgsErrors, "errIsDouplicateMarriage_3F");
            setFocusControl(frm, HSB_NO);
          } else {
            if (isDouplicateMarriageWf) {
              addError(msgsWarnings, "errIsDouplicateMarriageWf_3F");
              setFocusControl(frm, HSB_NO);
            }
          }
        }

        if (msgsErrors.isEmpty()) {
          String mrgType = frm.get(MARRIAGE_TYPE).toString().trim();
          if (Utils.isEmpty(mrgType)) {
            addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "نوع ازدواج");
            setFocusControl(frm, MARRIAGE_TYPE);
          } else if (mrgType.length() > 1) {
            addError(msgsErrors, FIELD_INVALID, "نوع ازدواج");
            setFocusControl(frm, MARRIAGE_TYPE);
          } else {
            mrgInf.setMarriageTypeCode(mrgType);
          }
          String marRegstRef = frm.get(MARRIAGE_REGST_REF).toString().trim();
          if (Utils.isEmpty(marRegstRef)) {
            addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "مرجع ثبت");
            setFocusControl(frm, MARRIAGE_REGST_REF);
          } else if (marRegstRef.length() > 2) {
            addError(msgsErrors, FIELD_INVALID, "مرجع ثبت");
            setFocusControl(frm, MARRIAGE_REGST_REF);
          } else {
            mrgInf.setMarriageRegstRefCode(marRegstRef);
          }
          String marriageDate = "";
          String husbandNo = "";
          long wifeNin = 0;
          String hsbDeathDate = "";
          String wfDeathDate = "";
          String lastBeforHsbDateOfDeath = "";
          String lastAfterDateOfMarriage = "";

          if (!Utils.isEmpty(frm.get(HSB_NO).toString().trim())) {
            husbandNo = frm.get(HSB_NO).toString().trim();
          }
          if (!Utils.isEmpty(frm.get(WF_NIN).toString().trim())
              && Utils.isValidNin(frm.get(WF_NIN).toString().trim())) {
            wifeNin = Long.parseLong(frm.get(WF_NIN).toString().trim());
            String wifeDateOfDeath = getDateOfDeath(wifeNin);
            if (!Utils.isEmpty(wifeDateOfDeath))
              wfDeathDate = DateUtils.unformatSpaceToZeroDate(wifeDateOfDeath);
            IranianInfo wfInfo = (IranianInfo) Person.getIranianDetails(wifeNin);
            if (wfInfo != null) {
              if (!Utils.isEmpty(frm.get(MARRIAGE_DATE).toString().trim())
                  && ((!isOfficeManager
                          && DateUtils.isValidRevFormattedFDate(
                              ((String) frm.get(MARRIAGE_DATE)).trim()))
                      || (isOfficeManager
                          && DateUtils.isValidNaghesOrCompDate(
                              ((String) frm.get(MARRIAGE_DATE)).trim())))) {
                MarriageInfo lastBeforMarriage =
                    Person.getLastBeforMarriageDetails(
                        wifeNin,
                        DateUtils.getCompleteDate(((String) frm.get(MARRIAGE_DATE)).trim()));

                MarriageInfo lastAfterMarriage =
                    Person.getLastAfterMarriageDetails(
                        wifeNin,
                        DateUtils.getCompleteDate(((String) frm.get(MARRIAGE_DATE)).trim()));

                long hsbBeforNin = 0;

                if (lastBeforMarriage != null) {
                  hsbBeforNin = lastBeforMarriage.getHusbandNin();
                  lastBeforHsbDateOfDeath = getDateOfDeath(hsbBeforNin);
                }
                if (lastAfterMarriage != null) {
                  lastAfterDateOfMarriage = lastAfterMarriage.getMarriageDate();
                }
              }
            }
          }
          boolean marriageDateIsTrue = true;
          if (Utils.isEmpty(frm.get(MARRIAGE_DATE).toString().trim())) {
            addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "تاريخ ازدواج");
            setFocusControl(frm, MARRIAGE_DATE);
            marriageDateIsTrue = false;
          } else if ((!isOfficeManager
                  && !DateUtils.isValidRevFormattedFDate(((String) frm.get(MARRIAGE_DATE)).trim()))
              || isOfficeManager
                  && !DateUtils.isValidNaghesOrCompDate(((String) frm.get(MARRIAGE_DATE)).trim())) {
            addError(msgsErrors, FIELD_INVALID, "تاريخ ازدواج");
            setFocusControl(frm, MARRIAGE_DATE);
            marriageDateIsTrue = false;
          } else if (DateUtils.getCompleteDate(((String) frm.get(MARRIAGE_DATE)).trim())
                  .compareTo(DateUtils.fDate())
              > 0) {
            addError(msgsErrors, SHOULD_BE_LESS_EQUAL, "تاريخ ازدواج", "تاريخ روز ");
            setFocusControl(frm, MARRIAGE_DATE);
            marriageDateIsTrue = false;
          } else if (!Utils.isEmpty(frm.get(MARRIAGE_DATE).toString().trim())
              && ((!isOfficeManager
                      && DateUtils.isValidRevFormattedFDate(
                          ((String) frm.get(MARRIAGE_DATE)).trim()))
                  || isOfficeManager
                      && DateUtils.isValidNaghesOrCompDate(
                          ((String) frm.get(MARRIAGE_DATE)).trim()))
              && DateUtils.getCompleteDate(((String) frm.get(MARRIAGE_DATE)).trim())
                      .compareTo(DateUtils.fDate())
                  <= 0) {
            marriageDate = DateUtils.getCompleteDate(((String) frm.get(MARRIAGE_DATE)).trim());

            if (action.equalsIgnoreCase(Constants.ActionType.ADD)
                && !Utils.isEmpty(wfDeathDate)
                && !wfDeathDate.equalsIgnoreCase("نامعلوم")
                && Integer.parseInt(wfDeathDate) < Integer.parseInt(marriageDate)) {
              addError(msgsErrors, "errMrgDateIsGreaterWfDeathDate_3F");
              setFocusControl(frm, MARRIAGE_DATE);
              marriageDateIsTrue = false;
            }
          }
          if (marriageDateIsTrue) {
            mrgInf.setMarriageDate(DateUtils.unformatZeroToSpaceDate(marriageDate));
            if ((!Utils.isEmpty(lastBeforHsbDateOfDeath)
                    && marriageDate.compareTo(lastBeforHsbDateOfDeath) >= 0
                    && (marriageDate.compareTo(
                            Utils_3F.threeOrFourAndTenAfter(lastBeforHsbDateOfDeath, 4))
                        < 0))
                || (!Utils.isEmpty(hsbDeathDate)
                    && !Utils.isEmpty(lastAfterDateOfMarriage)
                    && lastAfterDateOfMarriage.compareTo(hsbDeathDate) >= 0
                    && (lastAfterDateOfMarriage.compareTo(
                            Utils_3F.threeOrFourAndTenAfter(hsbDeathDate, 4))
                        < 0))) {
              addError(msgsWarnings, "errHusbandDead130Day_3F");
              setFocusControl(frm, MARRIAGE_DATE);
            }
            DivorceInfo lastBeforDivorce =
                Person.getLastBeforDivorcesDetails(wifeNin, marriageDate);
            String lastBeforDivorceDate = "";
            if (lastBeforDivorce != null)
              lastBeforDivorceDate =
                  DateUtils.unformatSpaceToZeroDate(lastBeforDivorce.getDivorceDate());

            if (lastBeforDivorce != null
                && !lastBeforDivorce
                    .getDivorceTypeCode()
                    .equalsIgnoreCase(Constants.DivorceType.BAEN_GHEIR_MADKHULEH)
                && !lastBeforDivorce
                    .getDivorceTypeCode()
                    .equalsIgnoreCase(Constants.DivorceType.BAEN_SAER)
                && !Utils.isEmpty(lastBeforDivorceDate)
                && marriageDate.compareTo(lastBeforDivorceDate) >= 0
                && (lastBeforDivorceDate.compareTo(
                        Utils_3F.xMonthBefore(DateUtils.unformatSpaceToZeroDate(marriageDate), 3))
                    > 0)) {
              addError(msgsWarnings, "errLastDivorce90Day_3F");
              setFocusControl(frm, MARRIAGE_DATE);
            }
          }
          Vector allMarriage = Person.getAllMarriage(husbandNo, wifeNin);
          Vector allCorrespondingDivorce = new Vector();

          DivorceInfo correspondingDivorce = new DivorceInfo();
          for (int i = 0; i < allMarriage.size(); i++) {
            String correspondingMrgDate =
                ((MarriageInfo) allMarriage.elementAt(i)).getMarriageDate();
            correspondingDivorce =
                Person.getCorrespondingDivorce(husbandNo, wifeNin, correspondingMrgDate);
            if (correspondingDivorce != null) allCorrespondingDivorce.add(correspondingDivorce);
          }
          if (allMarriage.size() >= 3 && allCorrespondingDivorce.size() >= 3) {
            addError(msgsWarnings, "err3HusbandWifeMarriage_3F");
            setFocusControl(frm, HSB_NO);
          }

          int countAllDivorce = Person.getCountAllDivorce(husbandNo, wifeNin);
          if (countAllDivorce >= 9) {
            addError(msgsWarnings, "err9HusbandWifeDivorce_3F");
            setFocusControl(frm, HSB_NO);
          }

          if (mrgInf.getMarriageTypeCode().equalsIgnoreCase(Constants.MarriageType.BROKEN)) {
            String expDate = "";
            if (!Utils.isEmpty(frm.get(EXPIRY_DATE).toString().trim())) {
              if (((!isOfficeManager
                      && !DateUtils.isValidRevFormattedFDate(
                          ((String) frm.get(EXPIRY_DATE)).trim()))
                  || isOfficeManager
                      && !DateUtils.isValidNaghesOrCompDate(
                          ((String) frm.get(EXPIRY_DATE)).trim()))) {
                addError(msgsErrors, FIELD_INVALID, "تاريخ انقضاء");
                setFocusControl(frm, EXPIRY_DATE);
              } else if (!Utils.isEmpty(frm.get(EXPIRY_DATE).toString().trim())
                  && !Utils.isEmpty(marriageDate)
                  && marriageDate.compareTo(
                          DateUtils.getCompleteDate(((String) frm.get(EXPIRY_DATE)).trim()))
                      > 0) {
                addError(msgsErrors, SHOULD_BE_GREATER_EQUAL, "تاريخ انقضاء", "تاريخ ازدواج");
                setFocusControl(frm, EXPIRY_DATE);
              } else {
                expDate = DateUtils.getCompleteDate(((String) frm.get(EXPIRY_DATE)).trim());
                mrgInf.setExpiryDate(DateUtils.unformatZeroToSpaceDate(expDate));
              }
            }
          } else if (mrgInf.getMarriageTypeCode().equalsIgnoreCase(Constants.MarriageType.BROKEN)) {
            mrgInf.setExpiryDate("");
          }
          String regstDate = frm.get(REGST_DATE).toString().trim();

          if (Utils.isEmpty(regstDate)) {
            addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "تاريخ " + regstLable);
            setFocusControl(frm, REGST_DATE);
          } else if ((!isOfficeManager
                  && !DateUtils.isValidRevFormattedFDate(((String) frm.get(REGST_DATE)).trim()))
              || isOfficeManager
                  && !DateUtils.isValidNaghesOrCompDate(((String) frm.get(REGST_DATE)).trim())) {
            addError(msgsErrors, FIELD_INVALID, "تاريخ " + regstLable);
            setFocusControl(frm, REGST_DATE);
          } else if (DateUtils.getCompleteDate(regstDate).compareTo(DateUtils.fDate()) > 0) {
            addError(msgsErrors, SHOULD_BE_LESS_EQUAL, "تاريخ " + regstLable, "تاريخ روز ");
            setFocusControl(frm, REGST_DATE);
          } else {
            boolean regstDateIsTrue = true;
            regstDate = DateUtils.getCompleteDate(((String) frm.get(REGST_DATE)).trim());
            if (!Utils.isEmpty(frm.get(HSB_DATE_OF_BIRTH_SUN).toString().trim())
                && (DateUtils.getCompleteDate(((String) frm.get(HSB_DATE_OF_BIRTH_SUN)).trim()))
                        .compareTo(regstDate)
                    >= 0) {
              addError(msgsErrors, SHOULD_BE_GREATER, "تاريخ " + regstLable, "تاريخ تولد زوج");
              setFocusControl(frm, REGST_DATE);
              regstDateIsTrue = false;
            }
            if (!Utils.isEmpty(frm.get(WF_DATE_OF_BIRTH_SUN).toString().trim())
                && (DateUtils.getCompleteDate(((String) frm.get(WF_DATE_OF_BIRTH_SUN)).trim()))
                        .compareTo(regstDate)
                    >= 0) {
              addError(msgsErrors, SHOULD_BE_GREATER, "تاريخ " + regstLable, "تاريخ تولد زوجه");
              setFocusControl(frm, REGST_DATE);
              regstDateIsTrue = false;
            }
            if (!Utils.isEmpty(marriageDate) && marriageDate.compareTo(regstDate) > 0) {
              addError(msgsErrors, SHOULD_BE_GREATER_EQUAL, "تاريخ " + regstLable, "تاريخ ازدواج");
              setFocusControl(frm, REGST_DATE);
              regstDateIsTrue = false;
            }
            if (regstDateIsTrue) {
              mrgInf.setRegstDate(
                  DateUtils.unformatZeroToSpaceDate(
                      DateUtils.getCompleteDate(frm.get(REGST_DATE).toString().trim())));
            }
          }
          String regstNo = Utils.charVal2((String) frm.get(REGST_NO));
          if (Utils.isEmpty(regstNo)) {
            addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره " + regstLable);
            setFocusControl(frm, REGST_NO);
          } else if (regstNo.length() > 20 || regstNo.matches("[0]*")) {
            addError(msgsErrors, FIELD_INVALID, "شماره " + regstLable);
            setFocusControl(frm, REGST_NO);
          } else {
            mrgInf.setRegstNo(regstNo);
          }

          String regstAu = "";
          if (!isConsul) regstAu = Utils.charVal2((String) frm.get(REGST_AU));
          else if (isConsul) regstAu = Utils.charVal2((String) frm.get(CONSUL_NO));
          if (Utils.isEmpty(regstAu)) {
            addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, regstAuLabel);
            setFocusControl(frm, REGST_AU);
          } else if ((!isConsul && !Utils.isValidNumber(regstAu, 10) || regstAu.matches("[0]*"))
              || (isConsul && regstAu.length() > 10)) {
            addError(msgsErrors, FIELD_INVALID, regstAuLabel);
            setFocusControl(frm, REGST_AU);
          } else {
            mrgInf.setRegstAu(regstAu);
          }
          String regstGeo = "";
          if (!isConsul) regstGeo = ((String) frm.get(REGST_GEO));
          else if (isConsul) regstGeo = ((String) frm.get(CONSUL_GEO));
          if (Utils.isEmpty(regstGeo)) {
            addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, regstRegstGeoLabel);
            setFocusControl(frm, REGST_GEO);
          } else if (!isConsul && searchOfficeGeoSerial(frm) == false) {
            addError(msgsErrors, FIELD_INVALID, regstRegstGeoLabel);
            setFocusControl(frm, REGST_GEO);
          } else {

            mrgInf.setRegstGeoSerial(regstGeo);
          }

          if (action.equalsIgnoreCase(Constants.ActionType.ADD)) {
            mrgInf.setMamoorId((new Security()).getMamoorIdByUserId(loginInfo.getUserId()));
            mrgInf.setUserId(loginInfo.getUserId());
            mrgInf.setOfficeCode(loginInfo.getOfficeCode());
          }
          mrgInf.setCodeActiveFlag(Constants.CodeActiveFlag.ACTIVE);
        }
      } else if (action.equalsIgnoreCase(Constants.ActionType.DELETE)) {
        String marriageDate =
            DateUtils.unformatZeroToSpaceDate(
                DateUtils.getCompleteDate(frm.get(MARRIAGE_DATE).toString().trim()));

        mrgInf =
            Person.getMarriageDetails(
                frm.get(HSB_NO).toString().trim(),
                Long.parseLong(frm.get(WF_NIN).toString().trim()),
                marriageDate);

        mrgInf.setInactiveMarriageReasonCode(Constants.InactiveMrgReasonCode.DELETE);

        String opinionNo = Utils.charVal2(frm.get(OPINION_NO).toString().trim());
        frm.set(OPINION_NO, opinionNo);
        if (Utils.isEmpty(opinionNo)) {
          addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره رأي هيأت ");
          setFocusControl(frm, OPINION_NO);
        } else if (opinionNo.length() > 20) {
          addError(msgsErrors, FIELD_INVALID, "شماره رأي هيأت ");
          setFocusControl(frm, OPINION_NO);
        } else {
          inactiveMrgInf.setOpinionNo(opinionNo);
        }
        String opinionDate = "";
        if (Utils.isEmpty(frm.get(OPINION_DATE).toString().trim())) {
          addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "تاريخ رأي هيأت ");
          setFocusControl(frm, OPINION_DATE);
        } else if ((!isOfficeManager
                && !DateUtils.isValidRevFormattedFDate(((String) frm.get(OPINION_DATE)).trim()))
            || isOfficeManager
                && !DateUtils.isValidNaghesOrCompDate(((String) frm.get(OPINION_DATE)).trim())) {
          addError(msgsErrors, FIELD_INVALID, "تاريخ رأي هيأت ");
          setFocusControl(frm, OPINION_DATE);
        } else if (DateUtils.getCompleteDate(((String) frm.get(OPINION_DATE)).trim())
                .compareTo(DateUtils.fDate())
            > 0) {
          addError(msgsErrors, SHOULD_BE_LESS_EQUAL, "تاريخ رأي هيأت ", "تاريخ روز ");
          setFocusControl(frm, OPINION_DATE);
        } else if (DateUtils.getCompleteDate(((String) frm.get(OPINION_DATE)).trim())
                .compareTo(DateUtils.getCompleteDate(((String) frm.get(MARRIAGE_DATE)).trim()))
            < 0) {
          addError(msgsErrors, SHOULD_BE_GREATER_EQUAL, "تاريخ رأي هيأت ", "تاريخ ازدواج");
          setFocusControl(frm, OPINION_DATE);
        } else {
          opinionDate = DateUtils.getCompleteDate(((String) frm.get(OPINION_DATE)).trim());
          inactiveMrgInf.setOpinionDate(DateUtils.unformatZeroToSpaceDate(opinionDate));
        }
        mrgInf.setInactiveMarriageReasonCode(Constants.InactiveMrgReasonCode.DELETE);
        mrgInf.setCodeActiveFlag(Constants.CodeActiveFlag.INACTIVE);
        inactiveMrgInf.setMamoorId((new Security()).getMamoorIdByUserId(loginInfo.getUserId()));

        inactiveMrgInf.setUserId(loginInfo.getUserId());

        inactiveMrgInf.setOfficeCode(loginInfo.getOfficeCode());
      }

      request.getSession().setAttribute("marriageInf", mrgInf);
      request.getSession().setAttribute("inactiveMarriageInf", inactiveMrgInf);
      msgs[0] = msgsErrors;
      msgs[1] = msgsWarnings;
    } catch (Exception ex) {
      Utils.log4j(ex);
    }
    return msgs;
  }
Esempio n. 2
0
  protected ActionMessages[] validate(
      HttpServletRequest httpServletRequest, LazyValidatorForm frm) {
    IranianInfo infMaster =
        (IranianInfo) httpServletRequest.getSession().getAttribute("personData");
    String fatherContradictionErrors = "";
    String motherContradictionErrors = "";
    ActionMessages[] msgs = new ActionMessages[2];
    ActionMessages msgsErrors = new ActionMessages();
    ActionMessages msgsWarnings = new ActionMessages();
    PersonInfo fatherInfo = null;
    boolean fatherFoundInDb = false;
    PersonInfo motherInfo = null;
    boolean motherFoundInDb = false;

    try {

      String fatherNin = ((String) frm.get(FATHER_NIN)).trim();
      if (Utils.isEmpty(fatherNin)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره ملي پدر");
        setFocusControl(frm, FATHER_NIN);
      } else if (!Utils.isValidNin(fatherNin)) {
        addError(msgsErrors, FIELD_INVALID, "شماره ملي پدر");
        setFocusControl(frm, FATHER_NIN);
      } else {
        fatherInfo = (new Person()).getPersonBrief(Long.parseLong(fatherNin));

        if ((fatherInfo == null)
            || (fatherInfo != null
                && !(fatherInfo.getSexCode().equalsIgnoreCase(Constants.Sex.MALE)))) {

          addError(msgsErrors, NOT_EXISTS, "شماره ملي پدر");
          setFocusControl(frm, FATHER_NIN);
        }
        // else {
        /*StoppedServiceRules.StopServiceCheckResult result = StoppedServiceRules.doStopService(DCUServices.Iranian_Birth_Registration, DCUActors.Father, Long.parseLong(fatherNin));
        if (result.doStop
        */
        /* (new Person()).existStopServices(Long.parseLong(fatherNin))*/
        /*) {
          addError(msgsErrors, STOPED_SERVICES, "شماره ملي پدر");
          setFocusControl(frm, FATHER_NIN);
        }*/
        else {
          infMaster.setFatherNin(Long.parseLong(fatherNin));
          fatherFoundInDb = true;

          if (fatherInfo.isDead()
              && !Utils.isEmpty((String) frm.get(ANNOUNCER_RELATION_CODE))
              && (Short.parseShort((String) frm.get(ANNOUNCER_RELATION_CODE))
                      == Constants.RelationCode.FATHER
                  || Short.parseShort((String) frm.get(ANNOUNCER_RELATION_CODE))
                      == Constants.RelationCode.PARENTS
                  || Short.parseShort((String) frm.get(ANNOUNCER_RELATION_CODE))
                      == Constants.RelationCode.MOTHER_ATTORNEY_AND_FATHER)) {
            addError(msgsErrors, SHOULD_BE_ALIVE, "پدر به عنوان اعلام كننده");
            setFocusControl(frm, FATHER_NIN);
          }
          // 13920312
          if (Utils.nvl(fatherInfo.getIsExcepted())
                  .equalsIgnoreCase(Constants.ExceptionStatus.IS_EXCEPTED)
              && Utils_3F.isErrorStagnant(
                  Person.getExceptionCode(
                      fatherInfo.getPersonNin(), Constants.StagnantCode.STAGNANT_PARENT))
          /*&&
          (getFormMode(frm).equalsIgnoreCase(Constants.ActionType.ADD) ||
                  (getFormMode(frm).equalsIgnoreCase(Constants.ActionType.MODIFY) &&
                          !Utils.isEmpty((String) frm.get(FATHER_NIN)) &&
                          fatherInfo.getPersonNin() != infMaster.getFatherNin()))*/
          ) {
            addError(msgsErrors, "errStagnant_3F", "شماره ملي پدر");
            setFocusControl(frm, FATHER_NIN);
          }
          // 13920312
          if (fatherInfo != null
              && !Utils.isEmpty(fatherNin)
              && Utils.isValidNin(fatherNin)
              && fatherInfo.isDead()
              && Person.getLiveStatus(Long.parseLong(fatherNin))
              && !Utils.isEmpty((String) frm.get(DATE_OF_BIRTH_SUN))) {
            String fatherDeathDate = Utils.nvl(Person.getDeathDateByNin(Long.parseLong(fatherNin)));
            if (!Utils.isEmpty(fatherDeathDate)
                && Utils_3F.tenMonthBefore(
                            DateUtils.unformatRevFormattedFdate(
                                (String) frm.get(DATE_OF_BIRTH_SUN)))
                        .compareTo(fatherDeathDate)
                    > 0) {
              addError(msgsErrors, "errTenMonthFatherDeathDate_3F");
              setFocusControl(frm, FATHER_NIN);
            }
          }
          if (fatherInfo != null
              && !Utils.isEmpty(fatherNin)
              && Utils.isValidNin(fatherNin)
              && fatherInfo.isDead()
              && !Person.getLiveStatus(Long.parseLong(fatherNin))) {
            addError(msgsWarnings, "errFatherIsDead_3F");
            setFocusControl(frm, FATHER_NIN);
            fatherContradictionErrors =
                fatherContradictionErrors
                    + Constants.ContradictionErrors.ERR_FATHER_IS_DEAD
                    + Constants.DATA_SEPARATOR;
          }
        }
      }

      String fatherShenasNo = ((String) frm.get(FATHER_SHENAS_NO)).trim();
      if (Utils.isEmpty(fatherShenasNo)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره شناسنامه پدر");
        setFocusControl(frm, FATHER_SHENAS_NO);
      } else if (!Utils.isValidNumber(fatherShenasNo, 6)) {
        addError(msgsErrors, FIELD_INVALID, "شماره شناسنامه پدر");
        setFocusControl(frm, FATHER_SHENAS_NO);
      } else {
        infMaster.setFatherShenasNo(Integer.parseInt(fatherShenasNo));
        if (!Utils.isEmpty(fatherShenasNo)
            && fatherFoundInDb
            && !fatherShenasNo.equalsIgnoreCase(fatherInfo.getShenasnameNo())) {
          addError(msgsWarnings, HAS_CONTRADICTION, "شماره شناسنامه پدر");
          setFocusControl(frm, FATHER_SHENAS_NO);
          fatherContradictionErrors =
              fatherContradictionErrors
                  + Constants.ContradictionErrors.ERR_FATHER_SHENAS_NO
                  + Constants.DATA_SEPARATOR;
        }
      }

      String fatherName = (String) frm.get(FATHER_NAME);
      fatherName = Utils.charVal(fatherName);
      frm.set(FATHER_NAME, fatherName);
      String sexCodeM = (String) frm.get(SEX_CODE_M);
      String sexCodeF = (String) frm.get(SEX_CODE_F);
      String sex = null;
      String checkSiadat = null;
      if (!Utils.isEmpty(sexCodeM)) {
        sex = Constants.Sex.MALE;
      } else if (!Utils.isEmpty(sexCodeF)) {
        sex = Constants.Sex.FEMALE;
      }
      if (!(!Utils.isEmpty(sexCodeM) && !Utils.isEmpty(sexCodeF)) && !Utils.isEmpty(sex)) {

        checkSiadat =
            Utils_3F.siadat(fatherName, Utils.charVal((String) frm.get(PERSON_NAME)), sex);
        if (Utils.isEmpty(checkSiadat) && fatherInfo != null) {
          checkSiadat =
              Utils_3F.siadat(
                  fatherName,
                  fatherInfo.getFatherName(),
                  Utils.charVal((String) frm.get(PERSON_NAME)),
                  sex);
        }
      }
      if (Utils.isEmpty(fatherName)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "نام پدر");
        setFocusControl(frm, FATHER_NAME);
      } else if (fatherName.length() > 50) {
        addError(msgsErrors, FIELD_INVALID, "نام پدر");
        setFocusControl(frm, FATHER_NAME);
      }

      if (!Utils.isEmpty(checkSiadat)) {
        addError(msgsErrors, checkSiadat, "");
        setFocusControl(frm, FATHER_NAME);
      } else {
        infMaster.setFatherName(fatherName);
        if (!Utils.isEmpty(fatherName)
            && fatherFoundInDb
            && !fatherName.equalsIgnoreCase(Utils.charVal(fatherInfo.getPersonName()))) {
          addError(msgsWarnings, HAS_CONTRADICTION, "نام پدر");
          setFocusControl(frm, FATHER_NAME);
          fatherContradictionErrors =
              fatherContradictionErrors
                  + Constants.ContradictionErrors.ERR_FATHER_NAME
                  + Constants.DATA_SEPARATOR;
        }
      }

      String fatherFname = (String) frm.get(FATHER_FNAME);
      fatherFname = Utils.charVal(fatherFname);
      frm.set(FATHER_FNAME, fatherFname);
      if (Utils.isEmpty(fatherFname)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "نام خانوادگي پدر");
        setFocusControl(frm, FATHER_FNAME);
      } else if (fatherFname.length() > 50) {
        addError(msgsErrors, FIELD_INVALID, "نام خانوادگي پدر");
        setFocusControl(frm, FATHER_FNAME);
      } else {
        infMaster.setFatherFname(fatherFname);

        if (!Utils.isEmpty(fatherFname)
            && fatherFoundInDb
            && !fatherFname.equalsIgnoreCase(Utils.charVal(fatherInfo.getPersonFname()))) {
          addError(msgsWarnings, HAS_CONTRADICTION, "نام خانوادگي پدر");

          setFocusControl(frm, FATHER_FNAME);

          fatherContradictionErrors =
              fatherContradictionErrors
                  + Constants.ContradictionErrors.ERR_FATHER_FNAME
                  + Constants.DATA_SEPARATOR;
        }
        String personFname = (String) frm.get(PERSON_FNAME);
        if (!fatherFname.equals(personFname) && !Utils.isEmpty(personFname)) {
          addError(msgsWarnings, HAS_CONTRADICTION, "نام خانوادگي پدر و فرزند ");
          fatherContradictionErrors =
              fatherContradictionErrors
                  + Constants.ContradictionErrors.ERR_MATCH_FATHER_FAME_PERSON_FNAME
                  + Constants.DATA_SEPARATOR;
        }
      }

      String fatherShenasSeri = (String) frm.get(FATHER_SHENAS_SERI);
      fatherShenasSeri = Utils.charVal2(fatherShenasSeri);
      frm.set(FATHER_SHENAS_SERI, fatherShenasSeri);
      if (Utils.isEmpty(fatherShenasSeri)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "سري شناسنامه پدر");
        setFocusControl(frm, FATHER_SHENAS_SERI);
      } else if (fatherShenasSeri.length() > 3) {
        addError(msgsErrors, FIELD_INVALID, "سري شناسنامه پدر");
        setFocusControl(frm, FATHER_SHENAS_SERI);
      } else {
        infMaster.setFatherShenasSeri(fatherShenasSeri);
        if (!Utils.isEmpty(fatherShenasSeri)
            && fatherFoundInDb
            && !fatherShenasSeri.equalsIgnoreCase(Utils.charVal2(fatherInfo.getShenasnameSeri()))) {
          addError(msgsWarnings, HAS_CONTRADICTION, "سري شناسنامه پدر");
          setFocusControl(frm, FATHER_SHENAS_SERI);
          fatherContradictionErrors =
              fatherContradictionErrors
                  + Constants.ContradictionErrors.ERR_FATHER_SHENAS_SERI
                  + Constants.DATA_SEPARATOR;
        }
      }

      String fatherShenasSrno = ((String) frm.get(FATHER_SHENAS_SRNO)).trim();
      if (Utils.isEmpty(fatherShenasSrno)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره مسلسل شناسنامه پدر");
        setFocusControl(frm, FATHER_SHENAS_SRNO);
      } else if (!Utils.isValidNumber(fatherShenasSrno, 6)) {
        addError(msgsErrors, FIELD_INVALID, "شماره مسلسل شناسنامه پدر");
        setFocusControl(frm, FATHER_SHENAS_SRNO);
      } else {
        infMaster.setFatherShenasSrno(Integer.parseInt(fatherShenasSrno));
        if (!Utils.isEmpty(fatherShenasSrno)
            && fatherFoundInDb
            && !fatherShenasSrno.equalsIgnoreCase(fatherInfo.getShenasnameSrno())) {
          addError(msgsWarnings, HAS_CONTRADICTION, "شماره مسلسل شناسنامه پدر");
          setFocusControl(frm, FATHER_SHENAS_SRNO);
          fatherContradictionErrors =
              fatherContradictionErrors
                  + Constants.ContradictionErrors.ERR_FATHER_SHENAS_SRNO
                  + Constants.DATA_SEPARATOR;
        }
      }

      String fatherDateOfBirth = ((String) frm.get(FATHER_DATE_OF_BIRTH)).trim();
      boolean fatherDateOfBirthIsFull = true;
      String fatherDateOfBirthNaghes = "";
      if (!Utils.isEmpty(fatherDateOfBirth)) {
        String date[] = fatherDateOfBirth.split(Constants.DATE_SEPARATOR);

        if (date.length != 3 && fatherDateOfBirth.length() < 8) {
          fatherDateOfBirthIsFull = false;
          for (int i = date.length; i > 0; --i) {
            fatherDateOfBirthNaghes = fatherDateOfBirthNaghes + date[i - 1];
          }
        }
      }
      if (Utils.isEmpty(fatherDateOfBirth)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "تاريخ تولد پدر");
        setFocusControl(frm, FATHER_DATE_OF_BIRTH);
      } else if (fatherDateOfBirthIsFull
          && !DateUtils.isValidRevFormattedFDate(fatherDateOfBirth)) {
        addError(msgsErrors, FIELD_INVALID, "تاريخ تولد پدر");
        setFocusControl(frm, FATHER_DATE_OF_BIRTH);
      } else if (fatherDateOfBirthIsFull
          && DateUtils.unformatRevFormattedFdate(fatherDateOfBirth).compareTo(DateUtils.fDate())
              > 0) {
        addError(msgsErrors, SHOULD_BE_LESS_EQUAL, "تاريخ تولد پدر", "تاريخ روز");
        setFocusControl(frm, FATHER_DATE_OF_BIRTH);
      } else if (!fatherDateOfBirthIsFull
          && !Utils.isValidNotZeroNumber(fatherDateOfBirthNaghes, 8)) {
        addError(msgsErrors, FIELD_INVALID, "تاريخ تولد پدر");
        setFocusControl(frm, FATHER_DATE_OF_BIRTH);
      } else {
        if (fatherDateOfBirthIsFull) {
          infMaster.setFatherDateOfBirth(DateUtils.unformatRevFormattedFdate(fatherDateOfBirth));
        } else {
          infMaster.setFatherDateOfBirth(fatherDateOfBirthNaghes);
        }
        if (!Utils.isEmpty(fatherFname)
            && fatherFoundInDb
            && !(infMaster.getFatherDateOfBirth())
                .equalsIgnoreCase(fatherInfo.getDateOfBirthSun())) {
          addError(msgsWarnings, HAS_CONTRADICTION, "تاريخ تولد پدر");
          setFocusControl(frm, FATHER_DATE_OF_BIRTH);
          fatherContradictionErrors =
              fatherContradictionErrors
                  + Constants.ContradictionErrors.ERR_FATHER_DATE_OF_BIRTH
                  + Constants.DATA_SEPARATOR;
        }
      }

      /*  if (!Utils.isEmpty(fatherDateOfBirth)) {
         if (!DateUtils.isValidRevFormattedFDate(fatherDateOfBirth)) {
           addError(msgsErrors, FIELD_INVALID, "تاريخ تولد پدر");
           setFocusControl(frm, FATHER_DATE_OF_BIRTH);
         }
         else if (DateUtils.unformatRevFormattedFdate(
             fatherDateOfBirth).compareTo(DateUtils.fDate()) >= 0) {
      addError(msgsErrors, SHOULD_BE_LESS, "تاريخ تولد پدر", "تاريخ روز");
           setFocusControl(frm, FATHER_DATE_OF_BIRTH);
         }
         else {
           infMaster.setFatherDateOfBirth(DateUtils.unformatRevFormattedFdate(
               fatherDateOfBirth));
           //              if (!Utils.isEmpty(fatherDateOfBirth) && fatherFoundInDb &&
           //       !fatherDateOfBirth.equalsIgnoreCase(fatherInfo.getDateOfBirthSun())) {
           //       addError(msgsWarnings, HAS_CONTRADICTION, "تاريخ تولد پدر");
           //                setFocusControl(frm, FATHER_DATE_OF_BIRTH);
           //                 fatherContradiction = true;
           //             }
         }
       }
       else {
         infMaster.setFatherDateOfBirth("");

       }*/

      /*    String fatherShenasIssuePlace = (String) frm.get(
          FATHER_SHENAS_ISSUE_PLACE);
       if (Utils.isEmpty(fatherShenasIssuePlace)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "اداره محل صدور پدر");
        setFocusControl(frm, FATHER_SHENAS_ISSUE_PLACE);
      }
      else if (fatherShenasIssuePlace.length() > 50) {
        addError(msgsErrors, FIELD_INVALID, "اداره محل صدور پدر");
        setFocusControl(frm, FATHER_SHENAS_ISSUE_PLACE);
      }
      else {
        infMaster.setFatherShenasIssuePlace(fatherShenasIssuePlace);
       }*/
      String fatherOfficeCode = ((String) frm.get(FATHER_OFFICE_CODE)).trim();
      if (Utils.isEmpty(fatherOfficeCode)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "اداره محل صدور پدر");
        setFocusControl(frm, FATHER_OFFICE_CODE);
      } else if (fatherOfficeCode.length() > 3) {
        addError(msgsErrors, FIELD_INVALID, "اداره محل صدور پدر");
        setFocusControl(frm, FATHER_OFFICE_CODE);
      } else {
        infMaster.setFatherOfficeCode(Short.parseShort(fatherOfficeCode));
      }

      /*  String fatherHozeh = (String) frm.get(FATHER_HOZEH);
      fatherHozeh = Utils.charVal2(fatherHozeh);
      frm.set(FATHER_HOZEH, fatherHozeh);
      if (fatherHozeh.length() > 50) {
        addError(msgsErrors, FIELD_INVALID, "حوزه پدر");
        setFocusControl(frm, FATHER_HOZEH);
      }
      else {
        infMaster.setFatherHozeh(fatherHozeh);
      }*/

      String fatherHozehCodeKind = ((String) frm.get(FATHER_HOZEH_CODE_KIND)).trim();
      if (!Utils.isEmpty(fatherHozehCodeKind) && !fatherHozehCodeKind.startsWith("irth")) {
        String key[] = fatherHozehCodeKind.split(Constants.DATA_SEPARATOR_SPLIT);
        String fatherHozehCode = key[0];

        if (Utils.isEmpty(fatherHozehCode)) {
          addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "كد حوزه پدر");
          setFocusControl(frm, FATHER_HOZEH_CODE_KIND);
        } else if (fatherHozehCode.length() > 3) {
          addError(msgsErrors, FIELD_INVALID, "كد حوزه پدر");
          setFocusControl(frm, FATHER_HOZEH_CODE_KIND);
        } else {
          infMaster.setFatherHozehCode(Short.parseShort(fatherHozehCode));
        }

        String fatherHozehKind = key[1];
        if (Utils.isEmpty(fatherHozehKind)) {
          addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "نوع حوزه پدر");
          setFocusControl(frm, FATHER_HOZEH_CODE_KIND);
        } else if (fatherHozehKind.length() > 1) {
          addError(msgsErrors, FIELD_INVALID, "نوع حوزه پدر");
          setFocusControl(frm, FATHER_HOZEH_CODE_KIND);
        } else {
          infMaster.setFatherHozehKind(fatherHozehKind);
        }
      } else {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "حوزه پدر");
        setFocusControl(frm, FATHER_HOZEH_CODE_KIND);
      }

      String fatherZipCode = ((String) frm.get(FATHER_ZIP_CODE)).trim();
      if (!Utils.isEmpty(fatherZipCode)) {
        if (!Utils.isValidZipCode(fatherZipCode)) {
          addError(msgsErrors, FIELD_INVALID, "كد پستي پدر");
          setFocusControl(frm, FATHER_ZIP_CODE);
        } else {
          infMaster.setFatherZipCode(Long.parseLong(fatherZipCode));
        }
      } else {
        infMaster.setFatherZipCode(0);
      }

      /* String fatherAddressGeoSerial = ( (String) frm.get(
          FATHER_ADDRESS_GEO_SERIAL)).
          trim();
      if (!Utils.isEmpty(fatherAddressGeoSerial)) {
        if (searchFatherAddressGeoSerial(frm) == false) {
          addError(msgsErrors, FIELD_INVALID, "سريال محل اقامت");
          setFocusControl(frm, FATHER_ADDRESS_GEO_SERIAL);
        }
        else {
          infMaster.setFatherAddressGeoSerial(Integer.parseInt(
              fatherAddressGeoSerial));
        }
      }
      else {*/
      infMaster.setFatherAddressGeoSerial(0);
      //  }

      String fatherAddress = (String) frm.get(FATHER_ADDRESS);
      fatherAddress = Utils.charVal2(fatherAddress);
      if (Utils.isEmpty(fatherAddress)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "آدرس محل اقامت پدر");
        setFocusControl(frm, FATHER_ADDRESS);
      } else if (fatherAddress.length() > 255) {
        addError(msgsErrors, SHOULD_BE_LESS, "طول آدرس محل اقامت پدر", "255 كاراكتر");
        setFocusControl(frm, FATHER_ADDRESS);
      } else {
        infMaster.setFatherAddress(fatherAddress);
      }

      if (fatherFoundInDb
          && !Utils.isEmpty(fatherInfo.getFamilyNameChangeFlag())
          && fatherInfo.getFamilyNameChangeFlag().equalsIgnoreCase(Constants.ChangeFlag.NOT_READ)) {
        addError(msgsWarnings, HAS_MIM, "ركورد پدر");
        setFocusControl(frm, FATHER_NIN);
        fatherContradictionErrors =
            fatherContradictionErrors
                + Constants.ContradictionErrors.ERR_FATHER_HAS_MIM
                + Constants.DATA_SEPARATOR;
      }

      String motherNin = ((String) frm.get(MOTHER_NIN)).trim();
      if (Utils.isEmpty(motherNin)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره ملي مادر");
        setFocusControl(frm, MOTHER_NIN);
      } else if (!Utils.isValidNin(motherNin)) {
        addError(msgsErrors, FIELD_INVALID, "شماره ملي مادر");
        setFocusControl(frm, MOTHER_NIN);
      } else {
        motherInfo = (new Person()).getPersonBrief(Long.parseLong(motherNin));

        if (motherInfo == null
            || (motherInfo != null
                && !motherInfo.getSexCode().equalsIgnoreCase(Constants.Sex.FEMALE))) {
          addError(msgsErrors, NOT_EXISTS, "شماره ملي مادر");
          setFocusControl(frm, MOTHER_NIN);
        } else {
          if ((new Person()).existStopServices(Long.parseLong(motherNin))) {
            addError(msgsErrors, STOPED_SERVICES, "شماره ملي مادر");
            setFocusControl(frm, MOTHER_NIN);
          } else {
            infMaster.setMotherNin(Long.parseLong(motherNin));
            motherFoundInDb = true;

            if (motherInfo.isDead()
                && !Utils.isEmpty((String) frm.get(ANNOUNCER_RELATION_CODE))
                && (Short.parseShort((String) frm.get(ANNOUNCER_RELATION_CODE))
                        == Constants.RelationCode.MOTHER
                    || Short.parseShort((String) frm.get(ANNOUNCER_RELATION_CODE))
                        == Constants.RelationCode.PARENTS
                    || Short.parseShort((String) frm.get(ANNOUNCER_RELATION_CODE))
                        == Constants.RelationCode.ANCESTOR_AND_MOTHER
                    || Short.parseShort((String) frm.get(ANNOUNCER_RELATION_CODE))
                        == Constants.RelationCode.FATHER_ATTORNEY_AND_MOTHER)) {
              addError(msgsErrors, SHOULD_BE_ALIVE, "مادر به عنوان اعلام كننده");
              setFocusControl(frm, MOTHER_NIN);
            }
          }
          // 13920312
          if (Utils.nvl(motherInfo.getIsExcepted())
                  .equalsIgnoreCase(Constants.ExceptionStatus.IS_EXCEPTED)
              && Utils_3F.isErrorStagnant(
                  Person.getExceptionCode(
                      motherInfo.getPersonNin(), Constants.StagnantCode.STAGNANT_PARENT))) {
            addError(msgsErrors, "errStagnant_3F", "شماره ملي مادر");
            setFocusControl(frm, FATHER_NIN);
          }
          // 13920312
        }
      }

      String motherShenasNo = ((String) frm.get(MOTHER_SHENAS_NO)).trim();
      if (Utils.isEmpty(motherShenasNo)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره شناسنامه مادر");
        setFocusControl(frm, MOTHER_SHENAS_NO);
      } else if (!Utils.isValidNumber(motherShenasNo, 6)) {
        addError(msgsErrors, FIELD_INVALID, "شماره شناسنامه مادر");
        setFocusControl(frm, MOTHER_SHENAS_NO);
      } else {
        infMaster.setMotherShenasNo(Integer.parseInt(motherShenasNo));

        if (!Utils.isEmpty(motherShenasNo)
            && motherFoundInDb
            && !(motherShenasNo.equalsIgnoreCase(motherInfo.getShenasnameNo()))) {
          addError(msgsWarnings, HAS_CONTRADICTION, "شماره شناسنامه مادر");
          setFocusControl(frm, MOTHER_SHENAS_NO);
          motherContradictionErrors =
              motherContradictionErrors
                  + Constants.ContradictionErrors.ERR_MOTHER_SHENAS_NO
                  + Constants.DATA_SEPARATOR;
        }
      }

      String motherName = (String) frm.get(MOTHER_NAME);
      motherName = Utils.charVal(motherName);
      frm.set(MOTHER_NAME, motherName);
      if (Utils.isEmpty(motherName)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "نام مادر");
        setFocusControl(frm, MOTHER_NAME);
      } else if (motherName.length() > 50) {
        addError(msgsErrors, FIELD_INVALID, "نام مادر");
        setFocusControl(frm, MOTHER_NAME);
      } else {
        infMaster.setMotherName(motherName);
        if (!Utils.isEmpty(motherName)
            && motherFoundInDb
            && !motherName.equalsIgnoreCase(Utils.charVal(motherInfo.getPersonName()))) {
          addError(msgsWarnings, HAS_CONTRADICTION, "نام مادر");
          setFocusControl(frm, MOTHER_NAME);
          motherContradictionErrors =
              motherContradictionErrors
                  + Constants.ContradictionErrors.ERR_MOTHER_NAME
                  + Constants.DATA_SEPARATOR;
        }
      }

      String motherFname = (String) frm.get(MOTHER_FNAME);
      motherFname = Utils.charVal(motherFname);
      frm.set(MOTHER_FNAME, motherFname);
      if (Utils.isEmpty(motherFname)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "نام خانوادگي مادر");
        setFocusControl(frm, MOTHER_FNAME);
      } else if (motherFname.length() > 50) {
        addError(msgsErrors, FIELD_INVALID, "نام خانوادگي مادر");
        setFocusControl(frm, MOTHER_FNAME);
      } else {
        infMaster.setMotherFname(motherFname);
        if (!Utils.isEmpty(motherFname)
            && motherFoundInDb
            && !motherFname.equalsIgnoreCase(Utils.charVal(motherInfo.getPersonFname()))) {
          addError(msgsWarnings, HAS_CONTRADICTION, "نام خانوادگي مادر");
          setFocusControl(frm, MOTHER_FNAME);
          motherContradictionErrors =
              motherContradictionErrors
                  + Constants.ContradictionErrors.ERR_MOTHER_FNAME
                  + Constants.DATA_SEPARATOR;
        }
      }

      String motherShenasSeri = (String) frm.get(MOTHER_SHENAS_SERI);
      motherShenasSeri = Utils.charVal2(motherShenasSeri);
      frm.set(MOTHER_SHENAS_SERI, motherShenasSeri);
      if (Utils.isEmpty(motherShenasSeri)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "سري شناسنامه مادر");
        setFocusControl(frm, MOTHER_SHENAS_SERI);
      } else if (motherShenasSeri.length() > 3) {
        addError(msgsErrors, FIELD_INVALID, "سري شناسنامه مادر");
        setFocusControl(frm, MOTHER_SHENAS_SERI);
      } else {
        infMaster.setMotherShenasSeri(motherShenasSeri);
        if (!Utils.isEmpty(motherShenasSeri)
            && motherFoundInDb
            && !motherShenasSeri.equalsIgnoreCase(Utils.charVal2(motherInfo.getShenasnameSeri()))) {
          addError(msgsWarnings, HAS_CONTRADICTION, "سري شناسنامه مادر");
          setFocusControl(frm, MOTHER_SHENAS_SERI);
          motherContradictionErrors =
              motherContradictionErrors
                  + Constants.ContradictionErrors.ERR_MOTHER_SHENAS_SERI
                  + Constants.DATA_SEPARATOR;
        }
      }

      String motherShenasSrno = ((String) frm.get(MOTHER_SHENAS_SRNO)).trim();
      if (Utils.isEmpty(motherShenasSrno)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره مسلسل شناسنامه مادر");
        setFocusControl(frm, MOTHER_SHENAS_SRNO);
      } else if (!Utils.isValidNumber(motherShenasSrno, 6)) {
        addError(msgsErrors, FIELD_INVALID, "شماره مسلسل شناسنامه مادر");
        setFocusControl(frm, MOTHER_SHENAS_SRNO);
      } else {
        infMaster.setMotherShenasSrno(Integer.parseInt(motherShenasSrno));
        if (!Utils.isEmpty(motherShenasSrno)
            && motherFoundInDb
            && !motherShenasSrno.equalsIgnoreCase(motherInfo.getShenasnameSrno())) {
          addError(msgsWarnings, HAS_CONTRADICTION, "شماره مسلسل شناسنامه مادر");
          setFocusControl(frm, MOTHER_SHENAS_SRNO);
          motherContradictionErrors =
              motherContradictionErrors
                  + Constants.ContradictionErrors.ERR_MOTHER_SHENAS_SRNO
                  + Constants.DATA_SEPARATOR;
        }
      }

      String motherDateOfBirth = ((String) frm.get(MOTHER_DATE_OF_BIRTH)).trim();
      boolean motherDateOfBirthIsFull = true;
      String motherDateOfBirthNaghes = "";
      if (!Utils.isEmpty(motherDateOfBirth)) {
        String date[] = motherDateOfBirth.split(Constants.DATE_SEPARATOR);

        if (date.length != 3 && motherDateOfBirth.length() < 8) {
          motherDateOfBirthIsFull = false;
          for (int i = date.length; i > 0; --i) {
            motherDateOfBirthNaghes = motherDateOfBirthNaghes + date[i - 1];
          }
        }
      }
      if (Utils.isEmpty(motherDateOfBirth)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "تاريخ تولد مادر");
        setFocusControl(frm, MOTHER_DATE_OF_BIRTH);
      } else if (motherDateOfBirthIsFull
          && !DateUtils.isValidRevFormattedFDate(motherDateOfBirth)) {
        addError(msgsErrors, FIELD_INVALID, "تاريخ تولد مادر");
        setFocusControl(frm, MOTHER_DATE_OF_BIRTH);
      } else if (motherDateOfBirthIsFull
          && DateUtils.unformatRevFormattedFdate(motherDateOfBirth).compareTo(DateUtils.fDate())
              > 0) {
        addError(msgsErrors, SHOULD_BE_LESS_EQUAL, "تاريخ تولد مادر", "تاريخ روز");
        setFocusControl(frm, MOTHER_DATE_OF_BIRTH);
      } else if (!motherDateOfBirthIsFull
          && !Utils.isValidNotZeroNumber(motherDateOfBirthNaghes, 8)) {
        addError(msgsErrors, FIELD_INVALID, "تاريخ تولد مادر");
        setFocusControl(frm, MOTHER_DATE_OF_BIRTH);

      } else {
        if (motherDateOfBirthIsFull) {
          infMaster.setMotherDateOfBirth(DateUtils.unformatRevFormattedFdate(motherDateOfBirth));
        } else {
          infMaster.setMotherDateOfBirth(motherDateOfBirthNaghes);
        }
        if (!Utils.isEmpty(motherFname)
            && motherFoundInDb
            && !(infMaster.getMotherDateOfBirth())
                .equalsIgnoreCase(motherInfo.getDateOfBirthSun())) {
          addError(msgsWarnings, HAS_CONTRADICTION, "تاريخ تولد مادر");
          setFocusControl(frm, MOTHER_DATE_OF_BIRTH);
          motherContradictionErrors =
              motherContradictionErrors
                  + Constants.ContradictionErrors.ERR_MOTHER_DATE_OF_BIRTH
                  + Constants.DATA_SEPARATOR;
        }
      }

      /* String motherDateOfBirth = ( (String) frm.get(MOTHER_DATE_OF_BIRTH)).
          trim();
      if (!Utils.isEmpty(motherDateOfBirth)) {
        if (!DateUtils.isValidRevFormattedFDate(motherDateOfBirth)) {
          addError(msgsErrors, FIELD_INVALID, "تاريخ تولد مادر");
          setFocusControl(frm, MOTHER_DATE_OF_BIRTH);
        }
        else if (DateUtils.unformatRevFormattedFdate(
            motherDateOfBirth).compareTo(DateUtils.fDate()) >= 0) {
      addError(msgsErrors, SHOULD_BE_LESS, "تاريخ تولد مادر", "تاريخ روز");
          setFocusControl(frm, MOTHER_DATE_OF_BIRTH);
        }
        else {
          infMaster.setMotherDateOfBirth(DateUtils.unformatRevFormattedFdate(
              motherDateOfBirth));
          //           if (!Utils.isEmpty(motherDateOfBirth) && motherFoundInDb &&
          //        !motherDateOfBirth.equalsIgnoreCase(motherInfo.getDateOfBirthSun())) {
          //            addError(msgsWarnings, HAS_CONTRADICTION, "تاريخ تولد مادر");
          //           setFocusControl(frm, MOTHER_DATE_OF_BIRTH);
          //           motherContradiction = true;
          //         }
        }
      }
      else {
        infMaster.setMotherDateOfBirth("");
      }*/

      /*    String motherShenasIssuePlace = (String) frm.get(
             MOTHER_SHENAS_ISSUE_PLACE);

             if (Utils.isEmpty(motherShenasIssuePlace)) {
      addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "اداره محل صدور مادر");
           setFocusControl(frm, MOTHER_SHENAS_ISSUE_PLACE);
         }
         else if (motherShenasIssuePlace.length() > 50) {
           addError(msgsErrors, FIELD_INVALID, "اداره محل صدور مادر");
           setFocusControl(frm, MOTHER_SHENAS_ISSUE_PLACE);
         }
         else {
           infMaster.setMotherShenasIssuePlace(motherShenasIssuePlace);
         }*/

      String motherOfficeCode = ((String) frm.get(MOTHER_OFFICE_CODE)).trim();
      if (Utils.isEmpty(motherOfficeCode)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "اداره محل صدور مادر");
        setFocusControl(frm, MOTHER_OFFICE_CODE);
      } else if (motherOfficeCode.length() > 3) {
        addError(msgsErrors, FIELD_INVALID, "اداره محل صدور مادر");
        setFocusControl(frm, MOTHER_OFFICE_CODE);
      } else {
        infMaster.setMotherOfficeCode(Short.parseShort(motherOfficeCode));
      }

      /*String motherHozeh = (String) frm.get(MOTHER_HOZEH);
           motherHozeh = Utils.charVal2(motherHozeh);
           frm.set(MOTHER_HOZEH, motherHozeh);
           if (motherHozeh.length() > 50) {
      addError(msgsErrors, FIELD_INVALID, "حوزه مادر");
      setFocusControl(frm, MOTHER_HOZEH);
           }
           else {
      infMaster.setMotherHozeh(motherHozeh);
           }*/

      String motherHozehCodeKind = ((String) frm.get(MOTHER_HOZEH_CODE_KIND)).trim();
      if (!Utils.isEmpty(motherHozehCodeKind) && !motherHozehCodeKind.startsWith("irth")) {
        String key[] = motherHozehCodeKind.split(Constants.DATA_SEPARATOR_SPLIT);
        String motherHozehCode = key[0];

        if (Utils.isEmpty(motherHozehCode)) {
          addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "كد حوزه مادر");
          setFocusControl(frm, MOTHER_HOZEH_CODE_KIND);
        } else if (motherHozehCode.length() > 3) {
          addError(msgsErrors, FIELD_INVALID, "كد حوزه مادر");
          setFocusControl(frm, MOTHER_HOZEH_CODE_KIND);
        } else {
          infMaster.setMotherHozehCode(Short.parseShort(motherHozehCode));
        }

        String motherHozehKind = key[1];
        if (Utils.isEmpty(motherHozehKind)) {
          addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "نوع حوزه مادر");
          setFocusControl(frm, MOTHER_HOZEH_CODE_KIND);
        } else if (motherHozehKind.length() > 1) {
          addError(msgsErrors, FIELD_INVALID, "نوع حوزه مادر");
          setFocusControl(frm, MOTHER_HOZEH_CODE_KIND);
        } else {
          infMaster.setMotherHozehKind(motherHozehKind);
        }
      } else {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "حوزه مادر");
        setFocusControl(frm, MOTHER_HOZEH_CODE_KIND);
      }

      String motherZipCode = ((String) frm.get(MOTHER_ZIP_CODE)).trim();
      if (!Utils.isEmpty(motherZipCode)) {
        if (!Utils.isValidZipCode(motherZipCode)) {
          addError(msgsErrors, FIELD_INVALID, "كد پستي مادر");
          setFocusControl(frm, MOTHER_ZIP_CODE);
        } else {
          infMaster.setMotherZipCode(Long.parseLong(motherZipCode));
        }
      } else {
        infMaster.setMotherZipCode(0);
      }

      String motherAddressGeoSerial = ((String) frm.get(MOTHER_ADDRESS_GEO_SERIAL)).trim();

      if (Utils.isEmpty(motherAddressGeoSerial)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "کد محل سکونت مادر");
        setFocusControl(frm, MOTHER_ADDRESS_GEO_SERIAL);
      } else if (!Utils.isEmpty(motherAddressGeoSerial)) {
        if (searchMotherAddressGeoSerial(frm) == false) {
          addError(msgsErrors, FIELD_INVALID, "کد محل سکونت مادر");
          setFocusControl(frm, MOTHER_ADDRESS_GEO_SERIAL);
        } else {
          infMaster.setMotherAddressGeoSerial(Integer.parseInt(motherAddressGeoSerial));
        }
      } else {
        infMaster.setMotherAddressGeoSerial(0);
      }

      String motherAddress = (String) frm.get(MOTHER_ADDRESS);
      motherAddress = Utils.charVal2(motherAddress);
      if (Utils.isEmpty(motherAddress)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "آدرس محل اقامت مادر");
        setFocusControl(frm, FATHER_ADDRESS);
      } else if (motherAddress.length() > 255) {
        addError(msgsErrors, SHOULD_BE_LESS, "طول آدرس محل اقامت مادر", "255 كاراكتر");
        setFocusControl(frm, MOTHER_ADDRESS);
      } else {
        infMaster.setMotherAddress(motherAddress);
      }

      if (motherFoundInDb
          && !Utils.isEmpty(motherInfo.getFamilyNameChangeFlag())
          && motherInfo.getFamilyNameChangeFlag().equalsIgnoreCase(Constants.ChangeFlag.NOT_READ)) {
        addError(msgsWarnings, HAS_MIM, "ركورد مادر");
        setFocusControl(frm, MOTHER_NIN);
        motherContradictionErrors =
            motherContradictionErrors
                + Constants.ContradictionErrors.ERR_MOTHER_HAS_MIM
                + Constants.DATA_SEPARATOR;
      }

      String parentDateOfMarriage = ((String) frm.get(PARENT_DATE_OF_MARRIAGE)).trim();
      if (((String) frm.get(MARR_REG)).equalsIgnoreCase(Constants.MarriageRegisteration.REGISTERED)
          && Utils.isEmpty(parentDateOfMarriage)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "تاريخ ازدواج والدين");
        setFocusControl(frm, PARENT_DATE_OF_MARRIAGE);
      } else if (!Utils.isEmpty(parentDateOfMarriage)) {
        if (!DateUtils.isValidRevFormattedFDate(parentDateOfMarriage)) {
          addError(msgsErrors, FIELD_INVALID, "تاريخ ازدواج والدين");
          setFocusControl(frm, PARENT_DATE_OF_MARRIAGE);
        } else if (DateUtils.unformatRevFormattedFdate(parentDateOfMarriage)
                .compareTo(DateUtils.fDate())
            >= 0) {
          addError(msgsErrors, SHOULD_BE_LESS, "تاريخ ازدواج والدين", "تاريخ روز");
          setFocusControl(frm, PARENT_DATE_OF_MARRIAGE);
        } else if (!Utils.isEmpty(fatherDateOfBirth) || !Utils.isEmpty(motherDateOfBirth)) {
          boolean noError = true;
          if (!Utils.isEmpty(fatherDateOfBirth)
              && fatherDateOfBirthIsFull
              && DateUtils.isValidRevFormattedFDate(fatherDateOfBirth)
              && DateUtils.unformatRevFormattedFdate(fatherDateOfBirth)
                      .compareTo(DateUtils.unformatRevFormattedFdate(parentDateOfMarriage))
                  >= 0) {
            addError(msgsErrors, SHOULD_BE_LESS, "تاريخ تولد پدر", "تاريخ ازدواج والدين");
            setFocusControl(frm, PARENT_DATE_OF_MARRIAGE);
            noError = false;
          }

          if (!Utils.isEmpty(motherDateOfBirth)
              && motherDateOfBirthIsFull
              && DateUtils.isValidRevFormattedFDate(motherDateOfBirth)
              && DateUtils.unformatRevFormattedFdate(motherDateOfBirth)
                      .compareTo(DateUtils.unformatRevFormattedFdate(parentDateOfMarriage))
                  >= 0) {
            addError(msgsErrors, SHOULD_BE_LESS, "تاريخ تولد مادر", "تاريخ ازدواج والدين");
            setFocusControl(frm, PARENT_DATE_OF_MARRIAGE);
            noError = false;
          }
          if (noError) {
            infMaster.setParentDateOfMarriage(
                DateUtils.unformatRevFormattedFdate(parentDateOfMarriage));
          }
        } else {
          infMaster.setParentDateOfMarriage(
              DateUtils.unformatRevFormattedFdate(parentDateOfMarriage));
        }
      } else {
        infMaster.setParentDateOfMarriage(parentDateOfMarriage);
      }

      String parentMarrRegstNo = (String) frm.get(PARENT_MARR_REGST_NO);
      parentMarrRegstNo = Utils.charVal2(parentMarrRegstNo);
      if (((String) frm.get(MARR_REG)).equalsIgnoreCase(Constants.MarriageRegisteration.REGISTERED)
          && Utils.isEmpty(parentMarrRegstNo)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره ثبت ازدواج والدين");
        setFocusControl(frm, PARENT_MARR_REGST_NO);
      } else if (parentMarrRegstNo.length() > 10) {
        addError(msgsErrors, FIELD_INVALID, "شماره ثبت ازدواج والدين");
        setFocusControl(frm, PARENT_MARR_REGST_NO);
      } else {
        infMaster.setParentMarrRegstNo(parentMarrRegstNo);
      }

      String parentRegstOfficeNo = (String) frm.get(PARENT_REGST_OFFICE_NO);
      parentRegstOfficeNo = Utils.charVal2(parentRegstOfficeNo);
      if (((String) frm.get(MARR_REG)).equalsIgnoreCase(Constants.MarriageRegisteration.REGISTERED)
          && Utils.isEmpty(parentRegstOfficeNo)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "شماره دفترخانه والدين");
        setFocusControl(frm, PARENT_REGST_OFFICE_NO);
      } else if (parentRegstOfficeNo.length() > 10) {
        addError(msgsErrors, FIELD_INVALID, "شماره دفترخانه والدين");
        setFocusControl(frm, PARENT_REGST_OFFICE_NO);
      } else {
        infMaster.setParentRegstOfficeNo(parentRegstOfficeNo);
      }

      String parentRegstOfficeGeo = (String) frm.get(PARENT_REGST_OFFICE_GEO);
      parentRegstOfficeGeo = Utils.charVal(parentRegstOfficeGeo);
      frm.set(PARENT_REGST_OFFICE_GEO, parentRegstOfficeGeo);
      if (((String) frm.get(MARR_REG)).equalsIgnoreCase(Constants.MarriageRegisteration.REGISTERED)
          && Utils.isEmpty(parentRegstOfficeGeo)) {
        addError(msgsErrors, FIELD_CAN_NOT_BE_EMPTY, "محل دفترخانه والدين");
        setFocusControl(frm, PARENT_REGST_OFFICE_GEO);
      } else if (parentRegstOfficeGeo.length() > 50) {
        addError(msgsErrors, FIELD_INVALID, "محل دفترخانه والدين");
        setFocusControl(frm, PARENT_REGST_OFFICE_GEO);
      } else {
        infMaster.setParentRegstOfficeGeo(parentRegstOfficeGeo);
      }

      msgs[0] = msgsErrors;
      msgs[1] = msgsWarnings;
      httpServletRequest.getSession().setAttribute("personData", infMaster);
      httpServletRequest
          .getSession()
          .setAttribute("fatherContradictionData", fatherContradictionErrors);
      httpServletRequest
          .getSession()
          .setAttribute("motherContradictionData", motherContradictionErrors);

    } catch (Exception ex) {
      addError(msgs[0], ex.getMessage());
    }

    return msgs;
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    LazyValidatorForm frm = (LazyValidatorForm) form;

    long nin = 0;
    String name = "";
    String fname = "";
    String birthDate = "";
    String shenasNo = "";
    IranianInfo inf = null;
    String office = "";
    String hozehCode = "";
    String hozehKind = "";
    try {
      if (Utils.isEmpty(request.getParameter("spouseNin"))) {
        frm.set(SPOUSE_PERSON_NIN, "");
        frm.set(PERSONALITY_NO, request.getParameter("spPerNo").trim());
      } else {
        frm.set(SPOUSE_PERSON_NIN, request.getParameter("spouseNin").trim());
        frm.set(PERSONALITY_NO, "");
      }
      if (!Utils.isEmpty(request.getParameter("spouseNin"))
          && Utils.isEmpty(request.getParameter("spPerNo"))
          && !Utils.isEmpty(request.getParameter("spouseName"))
          && !request.getParameter("spouseNin").equals("")
          && request.getParameter("spouseNin") != null
          && !request.getParameter("spouseName").equals("")
          && request.getParameter("spouseName") != null
          && request.getParameter("spouseNin").matches("[0-9]*")
          && Utils.charVal((String) request.getParameter("spouseNin")).length() <= 50) {
        nin = Long.parseLong(request.getParameter("spouseNin").trim());
        name = Utils.charVal((String) request.getParameter("spouseName"));

        if (Utils.isValidNin(String.valueOf(nin)))
          inf = (IranianInfo) Person.getIranianDetails(nin);

        if (inf == null) {
          frm.set(SHENASNAME_ISSUE_PLACE, "");
          frm.set(HOZEH, "");
          frm.set(PERSON_FNAME, "");
          frm.set(DATE_OF_BIRTH_SUN, "");
          frm.set(SHENASNAME_NO, "");

          office = "";
          hozehCode = "";
          hozehKind = "";
          fname = "";
          birthDate = "";
          shenasNo = "";
        } else {
          if (!Utils.isEmpty(inf.getPersonName())
              && Utils.charVal(inf.getPersonName()).equalsIgnoreCase(name)) {
            if (!Utils.isEmpty(inf.getOfficeCode())) {
              office = inf.getOfficeCode();
              frm.set(SHENASNAME_ISSUE_PLACE, office);
            } else {
              office = "";
              frm.set(SHENASNAME_ISSUE_PLACE, office);
            }
            if (!Utils.isEmpty(inf.getHozehCode())) hozehCode = inf.getHozehCode();
            else hozehCode = "";
            if (!Utils.isEmpty(inf.getHozehKind())) hozehKind = inf.getHozehKind();
            else hozehKind = "";
            if (!Utils.isEmpty(inf.getHozehCode()) && !Utils.isEmpty(inf.getHozehKind())) {
              frm.set(HOZEH, hozehCode + "|" + hozehKind);
            } else {
              frm.set(HOZEH, "");
            }
            if (!Utils.isEmpty(inf.getPersonFname())) {
              fname = inf.getPersonFname();
              frm.set(PERSON_FNAME, fname);
            } else fname = "";
            if (!Utils.isEmpty(inf.getDateOfBirthSun())) {
              birthDate = DateUtils.revFormatDate(inf.getDateOfBirthSun());
              frm.set(DATE_OF_BIRTH_SUN, birthDate);
            } else birthDate = "";
            if (!Utils.isEmpty(inf.getShenasnameNo())) {
              shenasNo = inf.getShenasnameNo();
              frm.set(SHENASNAME_NO, shenasNo);
            } else shenasNo = "";

            Vector vHozeh = new Vector();
            if (!Utils.isEmpty(office))
              vHozeh = Place.listHozehWithAllData(Short.parseShort(office));
            vHozeh.add(0, new CodeDesc("", ""));

            Utils_3F.write(
                response,
                vHozeh,
                office + "|" + hozehCode + "|" + hozehKind + "|" + fname + "|" + birthDate + "|"
                    + shenasNo);
          } else {
            frm.set(SHENASNAME_ISSUE_PLACE, "");
            frm.set(HOZEH, "");
            frm.set(PERSON_FNAME, "");
            frm.set(DATE_OF_BIRTH_SUN, "");
            frm.set(SHENASNAME_NO, "");
            Utils_3F.writeNin(response, "errNotEqualName");
          }
        }
      } else if (Utils.isEmpty(request.getParameter("spouseNin"))
          && Utils.isEmpty(request.getParameter("spPerNo"))) {
        frm.set(SHENASNAME_ISSUE_PLACE, "");
        frm.set(HOZEH, "");
        frm.set(PERSON_FNAME, "");
        frm.set(DATE_OF_BIRTH_SUN, "");
        frm.set(SHENASNAME_NO, "");
        Utils_3F.writeNin(response, "errEmptyBothNinPersonality");
      } else if (Utils.isEmpty(request.getParameter("spouseNin"))
          && !Utils.isEmpty(request.getParameter("spPerNo")))
        Utils_3F.writeNin(response, "errEmptyNinNotEmptyPersonality");
      else if (!Utils.isEmpty(request.getParameter("spouseNin")) && Utils.isEmpty(name)) {
        frm.set(SHENASNAME_ISSUE_PLACE, "");
        frm.set(HOZEH, "");
        frm.set(PERSON_FNAME, "");
        frm.set(DATE_OF_BIRTH_SUN, "");
        frm.set(SHENASNAME_NO, "");
        Utils_3F.writeNin(response, "errEmptyName");
      }

    } catch (Exception ex) {
      System.out.println(ex.getMessage());
    }
    return null;
  }