481 lines
24 KiB
Java
481 lines
24 KiB
Java
package wenrgise.hrms.ejb.business;
|
|
|
|
import java.sql.Timestamp;
|
|
import java.text.DateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import wenrgise.common.bean.BaseHeaderBean;
|
|
import wenrgise.common.bean.LOVBean;
|
|
import wenrgise.common.ejb.business.HrmCommonBO;
|
|
import wenrgise.common.exception.EnrgiseApplicationException;
|
|
import wenrgise.common.exception.EnrgiseMessageKeyException;
|
|
import wenrgise.common.exception.EnrgiseSystemException;
|
|
import wenrgise.common.utility.DateUtility;
|
|
import wenrgise.common.utility.EnrgiseUtil;
|
|
import wenrgise.common.utility.MessageKey;
|
|
import wenrgise.common.utility.RecordMetaInfo;
|
|
import wenrgise.common.utility.UserInfo;
|
|
import wenrgise.common.vo.BaseDetailVO;
|
|
import wenrgise.common.vo.BaseHeaderVO;
|
|
import wenrgise.common.vo.LovQueryVO;
|
|
import wenrgise.common.vo.LovVO;
|
|
import wenrgise.ejb.common.helper.DBObject;
|
|
import wenrgise.ejb.common.helper.QueryRow;
|
|
import wenrgise.ejb.common.helper.QueryValue;
|
|
import wenrgise.ejb.common.utility.DBUtilitiesBean;
|
|
import wenrgise.hrms.bean.HrmLnChartDtlBean;
|
|
import wenrgise.hrms.bean.HrmLnChartHdrBean;
|
|
import wenrgise.hrms.vo.HrmLnChartQVO;
|
|
|
|
public class HrmLnChartBO extends HrmBaseBO {
|
|
public HrmLnChartBO() {}
|
|
|
|
public HrmLnChartBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo getHrmLoanChartHdrMetaInfo(HrmLnChartQVO oHrmLnChartQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, oHrmLnChartQVO.getHeaderPrimaryKey()));
|
|
oParameters.add(new DBObject(2, 1, 12, oHrmLnChartQVO.getChartName()));
|
|
oParameters.add(new DBObject(3, 2, -5));
|
|
oParameters.add(new DBObject(4, 2, 93));
|
|
oParameters.add(new DBObject(5, 2, 12));
|
|
oParameters.add(new DBObject(6, 2, 12));
|
|
oParameters.add(new DBObject(7, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMLNCHART.proc_HrLoanChartHdrCount(?,?,?,?,?,?,?)");
|
|
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject oTimeObject = oOutArray.get(1);
|
|
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
|
|
DBObject oTotalRecord = oOutArray.get(0);
|
|
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
|
|
return oRecordMetaInfo;
|
|
}
|
|
|
|
public ArrayList getHrmLoanChartHdrInfo(HrmLnChartQVO oHrmLnChartQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
ArrayList oHeaderList = null;
|
|
if (oHrmLnChartQVO == null)
|
|
oHrmLnChartQVO = new HrmLnChartQVO();
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, -5, new Long(lStartPosition)));
|
|
oParameters.add(new DBObject(2, 1, -5, new Long(lLastPosition)));
|
|
oParameters.add(new DBObject(3, 1, 12, oHrmLnChartQVO.getHeaderPrimaryKey()));
|
|
oParameters.add(new DBObject(4, 1, 12, oHrmLnChartQVO.getChartName()));
|
|
oParameters.add(new DBObject(5, 2, -10));
|
|
oParameters.add(new DBObject(6, 2, 12));
|
|
oParameters.add(new DBObject(7, 2, 12));
|
|
oParameters.add(new DBObject(8, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMLNCHART.proc_HrLoanChartHdrInfo(?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
if (oList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
HashMap oColumns = null;
|
|
Iterator oIt = oList.iterator();
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
oHeaderList = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
HrmLnChartHdrBean oLoanChartHeader = new HrmLnChartHdrBean();
|
|
oLoanChartHeader.setHeaderPrimaryKey(oRow.get("ID").getString());
|
|
oLoanChartHeader.setChartName(oRow.get("CHART_NAME").getString());
|
|
oLoanChartHeader.setInterestRate(oRow.get("INTEREST_RATE").getString());
|
|
oLoanChartHeader.setEffectiveFromDate(EnrgiseUtil.convertToString(oRow.get("EFFECTIVE_FROM").getDate()));
|
|
oLoanChartHeader.setEffectiveToDate(EnrgiseUtil.convertToString(oRow.get("EFFECTIVE_TO").getDate()));
|
|
oHeaderList.add(oLoanChartHeader);
|
|
}
|
|
return oHeaderList;
|
|
}
|
|
|
|
public RecordMetaInfo getHrmLoanChartDetailMetaInfo(String lPrimaryKey) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, lPrimaryKey));
|
|
oParameters.add(new DBObject(2, 2, -5));
|
|
oParameters.add(new DBObject(3, 2, 93));
|
|
oParameters.add(new DBObject(4, 2, 12));
|
|
oParameters.add(new DBObject(5, 2, 12));
|
|
oParameters.add(new DBObject(6, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMLNCHART.proc_HrLoanChartDtlCount(?,?,?,?,?,?)");
|
|
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject oTotalRecord = oOutArray.get(0);
|
|
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
|
|
DBObject oTimeObject = oOutArray.get(1);
|
|
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
|
|
return oRecordMetaInfo;
|
|
}
|
|
|
|
public ArrayList getHrmLoanChartDetailInfo(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
BaseDetailVO oBaseDetailVO = null;
|
|
ArrayList oHrmLoanChartDetail = null;
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, -5, new Long(lDetailFirstPosition)));
|
|
oParameters.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
|
|
oParameters.add(new DBObject(3, 1, 12, lPrimaryKey));
|
|
oParameters.add(new DBObject(4, 2, -10));
|
|
oParameters.add(new DBObject(5, 2, 12));
|
|
oParameters.add(new DBObject(6, 2, 12));
|
|
oParameters.add(new DBObject(7, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMLNCHART.proc_HrLoanChartDtlInfo(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
if (oList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
oHrmLoanChartDetail = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
HrmLnChartDtlBean oLoanChartDetailBean = new HrmLnChartDtlBean();
|
|
oLoanChartDetailBean.setDetailId(oRow.get("ID").getString());
|
|
oLoanChartDetailBean.setTxtLoanAmt(oRow.get("LOAN_AMOUNT").getString());
|
|
oLoanChartDetailBean.setTxtNumberOfInstallments(oRow.get("NO_OF_INSTALMENTS").getString());
|
|
oLoanChartDetailBean.setTxtPrincipal(oRow.get("PRINCIPAL").getString());
|
|
oLoanChartDetailBean.setTxtInterest(oRow.get("INTEREST").getString());
|
|
oLoanChartDetailBean.setTxtEqualMonthlyInstallment(oRow.get("EMI").getString());
|
|
oHrmLoanChartDetail.add(oLoanChartDetailBean);
|
|
}
|
|
return oHrmLoanChartDetail;
|
|
}
|
|
|
|
public LovVO getHrmLoanChartNameLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderNames = new ArrayList();
|
|
arylstHeaderNames.add("Id");
|
|
arylstHeaderNames.add("hrm.HrmLC.chartName");
|
|
oLovVO.setHeaderList(arylstHeaderNames);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
LOVBean oLOVBean = new LOVBean();
|
|
String sTest = new String();
|
|
int count = 0;
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
oParameters = new ArrayList();
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sTest = oLovQueryVO.getSearchField1();
|
|
oParameters.add(new DBObject(1, 1, 12, sTest));
|
|
oParameters.add(new DBObject(2, 2, -10));
|
|
oParameters.add(new DBObject(3, 2, 12));
|
|
oParameters.add(new DBObject(4, 2, 12));
|
|
oParameters.add(new DBObject(5, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMLNLOV.proc_GetLoanChartNameLOV(?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = oList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = iter.next();
|
|
oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CHART_NAME").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "HRM_LOAN_CHART_HDR";
|
|
}
|
|
|
|
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
|
|
if (sScreenName.equalsIgnoreCase("HrmLnChart"))
|
|
saveHrmLoanChartDetail(sHeaderPrimaryKey, oDetailBeanArray);
|
|
}
|
|
|
|
private void saveHrmLoanChartDetail(String sHeaderPrimaryKey, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
|
|
boolean bInsert = false;
|
|
boolean bUpdate = false;
|
|
boolean bDelete = false;
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = null;
|
|
DBUtilitiesBean oBean1 = null;
|
|
Iterator oIt = oDetailBeanArray.iterator();
|
|
while (oIt.hasNext()) {
|
|
HrmLnChartDtlBean oHrmLnChartDtlBean = oIt.next();
|
|
if (oHrmLnChartDtlBean.getStatus().equals("N")) {
|
|
if (!bInsert) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMLNCHART.proc_UpsertHrLoanChartDtl(?,?,?,?,?,?,?,?,?,?)");
|
|
bInsert = true;
|
|
}
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "I"));
|
|
oParameters.add(new DBObject(2, 1, 12, null));
|
|
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
oParameters.add(new DBObject(4, 1, 12, oHrmLnChartDtlBean.getTxtLoanAmt()));
|
|
oParameters.add(new DBObject(5, 1, 12, oHrmLnChartDtlBean.getTxtNumberOfInstallments()));
|
|
oParameters.add(new DBObject(6, 1, 12, oHrmLnChartDtlBean.getTxtPrincipal()));
|
|
oParameters.add(new DBObject(7, 1, 12, oHrmLnChartDtlBean.getTxtInterest()));
|
|
int iPrincipal = Integer.parseInt(oHrmLnChartDtlBean.getTxtPrincipal());
|
|
int iInterest = Integer.parseInt(oHrmLnChartDtlBean.getTxtInterest());
|
|
int iEMI = iPrincipal + iInterest;
|
|
System.out.println(iEMI);
|
|
oParameters.add(new DBObject(8, 1, 12, String.valueOf(iEMI)));
|
|
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(oParameters);
|
|
continue;
|
|
}
|
|
if (oHrmLnChartDtlBean.getStatus().equals("U")) {
|
|
if (!bUpdate) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMLNCHART.proc_UpsertHrLoanChartDtl(?,?,?,?,?,?,?,?,?,?)");
|
|
bUpdate = true;
|
|
}
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "U"));
|
|
oParameters.add(new DBObject(2, 1, 12, oHrmLnChartDtlBean.getDetailId()));
|
|
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
oParameters.add(new DBObject(4, 1, 12, oHrmLnChartDtlBean.getTxtLoanAmt()));
|
|
oParameters.add(new DBObject(5, 1, 12, oHrmLnChartDtlBean.getTxtNumberOfInstallments()));
|
|
oParameters.add(new DBObject(6, 1, 12, oHrmLnChartDtlBean.getTxtPrincipal()));
|
|
oParameters.add(new DBObject(7, 1, 12, oHrmLnChartDtlBean.getTxtInterest()));
|
|
int iPrincipal = Integer.parseInt(oHrmLnChartDtlBean.getTxtPrincipal());
|
|
int iInterest = Integer.parseInt(oHrmLnChartDtlBean.getTxtInterest());
|
|
int iEMI = iPrincipal + iInterest;
|
|
System.out.println(iEMI);
|
|
oParameters.add(new DBObject(8, 1, 12, String.valueOf(iEMI)));
|
|
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(oParameters);
|
|
continue;
|
|
}
|
|
if (oHrmLnChartDtlBean.getStatus().equals("D")) {
|
|
if (!bDelete) {
|
|
oBean1 = new DBUtilitiesBean();
|
|
oBean1.createBatch("HRMLNCHART.proc_DeleteLoanChartDtl(?)");
|
|
bDelete = true;
|
|
}
|
|
oParameters = new ArrayList();
|
|
System.out.println(oHrmLnChartDtlBean.getDetailId());
|
|
oParameters.add(new DBObject(1, 1, 12, oHrmLnChartDtlBean.getDetailId()));
|
|
oBean1.addToBatch(oParameters);
|
|
}
|
|
}
|
|
if (bInsert)
|
|
oBean.executeBatch();
|
|
if (bUpdate)
|
|
oBean.executeBatch();
|
|
if (bDelete)
|
|
oBean1.executeBatch();
|
|
}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
System.out.println("Update ille!");
|
|
}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
return "saveNewHeaderImpl ille!";
|
|
}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
|
|
String returnString = null;
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
DateUtility d = new DateUtility();
|
|
HrmLnChartHdrBean oHrmLnChartHdrBean = (HrmLnChartHdrBean)oBaseHeaderBean;
|
|
if (ScreenMode.equalsIgnoreCase("N")) {
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "i"));
|
|
oParameters.add(new DBObject(2, 1, 12, oHrmLnChartHdrBean.getChartName()));
|
|
oParameters.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLnChartHdrBean.getEffectiveFromDate())));
|
|
oParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLnChartHdrBean.getEffectiveToDate())));
|
|
oParameters.add(new DBObject(5, 1, 12, oHrmLnChartHdrBean.getInterestRate()));
|
|
oParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
|
|
oParameters.add(new DBObject(8, 1, 12, null));
|
|
oParameters.add(new DBObject(9, 2, 12));
|
|
oParameters.add(new DBObject(10, 2, 12));
|
|
oParameters.add(new DBObject(11, 2, 12));
|
|
oParameters.add(new DBObject(12, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMLNCHART.proc_UpsertHrLoanChartHdr(?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
System.out.println(returnString);
|
|
} else if (ScreenMode.equalsIgnoreCase("U")) {
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "u"));
|
|
oParameters.add(new DBObject(2, 1, 12, oHrmLnChartHdrBean.getChartName()));
|
|
oParameters.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLnChartHdrBean.getEffectiveFromDate())));
|
|
oParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLnChartHdrBean.getEffectiveToDate())));
|
|
oParameters.add(new DBObject(5, 1, 12, oHrmLnChartHdrBean.getInterestRate()));
|
|
oParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
|
|
oParameters.add(new DBObject(8, 1, 12, oHrmLnChartHdrBean.getHeaderPrimaryKey()));
|
|
oParameters.add(new DBObject(9, 2, 12));
|
|
oParameters.add(new DBObject(10, 2, 12));
|
|
oParameters.add(new DBObject(11, 2, 12));
|
|
oParameters.add(new DBObject(12, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMLNCHART.proc_UpsertHrLoanChartHdr(?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
System.out.println(returnString);
|
|
}
|
|
return returnString;
|
|
}
|
|
|
|
public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
if (bHeaderDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
checkMandatoryHeader((HrmLnChartHdrBean)oBaseHeaderBean);
|
|
if (bDetailDataChanged)
|
|
if (sScreenName.equalsIgnoreCase("HrmLnChart")) {
|
|
Iterator itrBean1 = oDetailBeanArray.iterator();
|
|
int iCount = 1;
|
|
while (itrBean1.hasNext()) {
|
|
HrmLnChartDtlBean oHrmLnChartDtlBean = itrBean1.next();
|
|
if (!oHrmLnChartDtlBean.getStatus().equalsIgnoreCase("D"))
|
|
checkMandatoryLnChartDtl(oHrmLnChartDtlBean, iCount, oErrorList);
|
|
iCount++;
|
|
}
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
public void additionalBusinessValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
ArrayList oList = new ArrayList();
|
|
HrmLnChartHdrBean oHrmLnChartHdrBean = (HrmLnChartHdrBean)oBaseHeaderBean;
|
|
if (bHeaderDataChanged) {
|
|
if (!sScreenMode.equalsIgnoreCase("D")) {
|
|
checkUniqueHeader((HrmLnChartHdrBean)oBaseHeaderBean);
|
|
checkDatesConstraintHdr((HrmLnChartHdrBean)oBaseHeaderBean, oErrorList);
|
|
}
|
|
if (sScreenMode.equalsIgnoreCase("D")) {
|
|
HrmCommonBO oCommonBO = new HrmCommonBO();
|
|
String sRefId = oCommonBO.getRefList("hrm_loan_chart_dtl", "lon_chrthd_id ", oHrmLnChartHdrBean.getHeaderPrimaryKey(), "ID");
|
|
if (EnrgiseUtil.checkString(sRefId))
|
|
if (oList.isEmpty())
|
|
oList.add(new EnrgiseApplicationException("wenrgise.common.deletion"));
|
|
}
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
private void checkMandatoryHeader(HrmLnChartHdrBean oHrmLnChartHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
ArrayList oParams = new ArrayList();
|
|
if (!EnrgiseUtil.checkString(oHrmLnChartHdrBean.getChartName())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLC.chartName");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmLnChartHdrBean.getEffectiveFromDate())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLC.effectiveFromDate");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
private void checkMandatoryLnChartDtl(HrmLnChartDtlBean oHrmLnChartDtlBean, int iCount, ArrayList arylstErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
if (!EnrgiseUtil.checkString(oHrmLnChartDtlBean.getTxtNumberOfInstallments())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLC.txtNumberOfInstallments");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmLnChartDtlBean.getTxtLoanAmt())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLC.txtLoanAmt");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmLnChartDtlBean.getTxtPrincipal())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLC.txtPrincipal");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmLnChartDtlBean.getTxtInterest())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmLC.txtInterest");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkDatesConstraintHdr(HrmLnChartHdrBean oHrmLnChartHdrBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
if (EnrgiseUtil.checkString(oHrmLnChartHdrBean.getEffectiveToDate())) {
|
|
int dateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmLnChartHdrBean.getEffectiveFromDate(), oHrmLnChartHdrBean.getEffectiveToDate());
|
|
if (dateFlag == 1 && dateFlag != -2)
|
|
if (oErrorList.isEmpty())
|
|
oErrorList.add(new EnrgiseApplicationException("wenrgise.LoanChart.LoanChartDateConstraintViolated"));
|
|
}
|
|
}
|
|
|
|
private void checkInterest(HrmLnChartHdrBean oHrmLnChartHdrBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstList1 = new ArrayList();
|
|
ArrayList arylstParam = new ArrayList();
|
|
if (EnrgiseUtil.checkString(oHrmLnChartHdrBean.getInterestRate()))
|
|
if (Float.parseFloat(oHrmLnChartHdrBean.getInterestRate()) > 100.0D) {
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add("");
|
|
arylstParam.add(new Integer(0));
|
|
arylstList1.add(new EnrgiseMessageKeyException("hrm.HrmLC.checkInterest", arylstParam));
|
|
}
|
|
reportError(arylstList1);
|
|
}
|
|
|
|
private void checkUniqueHeader(HrmLnChartHdrBean oHrmLnChartHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstList1 = new ArrayList();
|
|
ArrayList arylstParam = new ArrayList();
|
|
String sQuery = String.valueOf(String.valueOf(" Select ID as ID from HRM_LOAN_CHART_HDR where CHART_NAME='").concat(String.valueOf(oHrmLnChartHdrBean.getChartName()))).concat(String.valueOf("'"));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstList = oBean.executeQuery(sQuery);
|
|
Iterator itrBean = arylstList.iterator();
|
|
if (itrBean.hasNext()) {
|
|
QueryRow oRow = itrBean.next();
|
|
if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmLnChartHdrBean.getHeaderPrimaryKey())) {
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add("");
|
|
arylstParam.add(new Integer(0));
|
|
arylstList1.add(new EnrgiseMessageKeyException("wenrgise.common.uniqueConstraintViolated", arylstParam));
|
|
}
|
|
}
|
|
reportError(arylstList1);
|
|
}
|
|
}
|