private String getDateOfDeath(long personNin) throws Exception { String deathDate = ""; try { IranianInfo info = (IranianInfo) Person.getIranianDetails(personNin); if (info != null && !Utils.isEmpty(info.getDeathStatus()) && info.getDeathStatus().equalsIgnoreCase(Constants.DeathStatus.DEAD)) { String deathKey = Person.getDeathKey(personNin); if (!Utils.isEmpty(deathKey)) { DeathExtInfo deathInfo = Person.getDeathDetails( Long.parseLong(deathKey.split(Constants.DATA_SEPARATOR_SPLIT)[0]), Short.parseShort(deathKey.split(Constants.DATA_SEPARATOR_SPLIT)[1])); if (deathInfo != null) deathDate = deathInfo.getDateOfDeath(); } } if (!Utils.isEmpty(deathDate) && !deathDate.equalsIgnoreCase("نامعلوم")) return DateUtils.unformatSpaceToZeroDate(deathDate); else return ""; } catch (Exception ex) { Utils.log4j(ex); return ""; } }
public ActionMessages validDetails( LazyValidatorForm frm, Vector chngInfVect, boolean[] rowChanged, DeathExtInfo infCurr) throws Exception { ActionMessages msgs = new ActionMessages(); boolean hasSexCodeChange = false; int sexCodeChangeIndex = 0; int sexCodeChangeIndexAtVec = 0; boolean hasDeadZipCodeChange = false; int deadZipCodeChangeIndex = 0; int deadZipCodeChangeIndexAtVec = 0; for (int j = 0; j < chngInfVect.size(); j++) { switch (((GatherChangeComDeathFieldInfo) chngInfVect.elementAt(j)) .getGatherChngComFieldCode()) { case Constants.GatherChangeComFieldCode.SEX_CODE: hasSexCodeChange = true; for (int row = 0; row < 15; row++) { if (rowChanged[row] && !Utils.isEmpty((String) frm.get("gatherChngFieldCodeD" + String.valueOf(row))) && Integer.parseInt((String) frm.get("gatherChngFieldCodeD" + String.valueOf(row))) == ((GatherChangeComDeathFieldInfo) chngInfVect.elementAt(j)) .getGatherChngComFieldCode()) sexCodeChangeIndex = row; } sexCodeChangeIndexAtVec = j; break; case Constants.GatherChangeComFieldCode.DEAD_ZIP_CODE: hasDeadZipCodeChange = true; for (int row = 0; row < 15; row++) { if (rowChanged[row] && !Utils.isEmpty((String) frm.get("gatherChngFieldCodeD" + String.valueOf(row))) && Integer.parseInt((String) frm.get("gatherChngFieldCodeD" + String.valueOf(row))) == ((GatherChangeComDeathFieldInfo) chngInfVect.elementAt(j)) .getGatherChngComFieldCode()) deadZipCodeChangeIndex = row; } deadZipCodeChangeIndexAtVec = j; break; } } if (hasSexCodeChange) { String newPersonSexCode = ""; if (!((GatherChangeComDeathFieldInfo) chngInfVect.elementAt(sexCodeChangeIndexAtVec)) .getNewValue() .equalsIgnoreCase("-")) { newPersonSexCode = ((GatherChangeComDeathFieldInfo) chngInfVect.elementAt(sexCodeChangeIndexAtVec)) .getNewValue(); String personSexCode = ""; long personNin = infCurr.getPersonNin(); PersonInfo deadPersonInfoForCompare = (new Person()).getPersonBrief(personNin); if (deadPersonInfoForCompare != null) { personSexCode = deadPersonInfoForCompare.getSexCode(); } if (!Utils.isEmpty(personSexCode) && !Utils.charVal(newPersonSexCode.trim()).equalsIgnoreCase(personSexCode)) { addError( msgs, UNKILE_3F, "جنسيت متوفي " + "در رديف " + Integer.toString(sexCodeChangeIndex + 1)); setFocusControl(frm, NEW_VALUE_DEATH + Integer.toString(sexCodeChangeIndex)); } } } return msgs; }