148 lines
7.3 KiB
Java
148 lines
7.3 KiB
Java
package wenrgise.hrms.ejb.business;
|
|
|
|
import java.sql.Timestamp;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import wenrgise.common.bean.BaseHeaderBean;
|
|
import wenrgise.common.exception.EnrgiseApplicationException;
|
|
import wenrgise.common.exception.EnrgiseSystemException;
|
|
import wenrgise.common.utility.EnrgiseUtil;
|
|
import wenrgise.common.utility.RecordMetaInfo;
|
|
import wenrgise.common.utility.UserInfo;
|
|
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.HrmRetireForecastHdrBean;
|
|
import wenrgise.hrms.vo.HrmRetireForecastQVO;
|
|
|
|
public class HrmRetireForecastBO extends HrmBaseBO {
|
|
public HrmRetireForecastBO() {}
|
|
|
|
public HrmRetireForecastBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo procGetRetireDataCount(HrmRetireForecastQVO oHrmRetireForecastQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 2, -5));
|
|
arylstParam.add(new DBObject(2, 2, 93));
|
|
arylstParam.add(new DBObject(3, 2, 12));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMRTMTFORECASTREP.procGetRetireDataCount(?,?,?,?,?)");
|
|
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject oTotalRecord = arylstOutArray.get(0);
|
|
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
|
|
DBObject oTimeObject = arylstOutArray.get(1);
|
|
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
|
|
return oRecordMetaInfo;
|
|
}
|
|
|
|
public ArrayList procGetRetireDataInfo(HrmRetireForecastQVO oHrmRetireForecastQVO, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
ArrayList oList = null;
|
|
Iterator oIt = null;
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
ArrayList arylstList = null;
|
|
Iterator itrBean = null;
|
|
ArrayList oEmpRetireDetail = new ArrayList();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, -5, new Long(lDetailFirstPosition)));
|
|
arylstParam.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
|
|
arylstParam.add(new DBObject(3, 2, -10));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMRTMTFORECASTREP.procGetRetireDataInfo(?,?,?,?,?,?)");
|
|
oList = (ArrayList)((DBObject)arylstOutArray.get(0)).getObject();
|
|
if (oList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
count = 0;
|
|
oIt = oList.iterator();
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
while (oIt.hasNext()) {
|
|
count++;
|
|
oRow = oIt.next();
|
|
HrmRetireForecastHdrBean oHrmRetireForecastHdrBean = new HrmRetireForecastHdrBean();
|
|
oHrmRetireForecastHdrBean.setFromDate(oRow.get("fromDate").getString());
|
|
oHrmRetireForecastHdrBean.setToDate(oRow.get("toDate").getString());
|
|
oHrmRetireForecastHdrBean.setFlag1("1");
|
|
oEmpRetireDetail.add(oHrmRetireForecastHdrBean);
|
|
}
|
|
return oEmpRetireDetail;
|
|
}
|
|
|
|
public void saveDetailImpl(BaseHeaderBean oBaseHeaderBean, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {}
|
|
|
|
public void initializeBOImpl() {}
|
|
|
|
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
return "saveNewHeaderImpl";
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstErrorList = new ArrayList();
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
public void additionalBusinessValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstErrorList = new ArrayList();
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String param1) throws EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
HrmRetireForecastHdrBean oHrmRetireForecastHdrBean = (HrmRetireForecastHdrBean)oBaseHeaderBean;
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
ArrayList arylstList = null;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, oHrmRetireForecastHdrBean.getFromDate()));
|
|
arylstParam.add(new DBObject(2, 1, 12, oHrmRetireForecastHdrBean.getToDate()));
|
|
arylstParam.add(new DBObject(3, 2, 12));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 4));
|
|
oBean.callProc(arylstParam, "HRMRTMTFORECASTREP.proc_insertdata(?,?,?,?,?)");
|
|
return oHrmRetireForecastHdrBean.getFromDate();
|
|
}
|
|
|
|
public String InsertData(BaseHeaderBean oBaseHeaderBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
HrmRetireForecastHdrBean oHrmRetireForecastHdrBean = (HrmRetireForecastHdrBean)oBaseHeaderBean;
|
|
checkDates(oHrmRetireForecastHdrBean);
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
ArrayList arylstList = null;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmRetireForecastHdrBean.getFromDate())));
|
|
arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmRetireForecastHdrBean.getToDate())));
|
|
arylstParam.add(new DBObject(3, 2, 12));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 4));
|
|
oBean.callProc(arylstParam, "HRMRTMTFORECASTREP.insertdata(?,?,?,?,?)");
|
|
return oHrmRetireForecastHdrBean.getFromDate();
|
|
}
|
|
|
|
public void checkDates(HrmRetireForecastHdrBean oHrmRetireForecastHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
if (!EnrgiseUtil.checkString(oHrmRetireForecastHdrBean.getFromDate()) || !EnrgiseUtil.checkString(oHrmRetireForecastHdrBean.getToDate())) {
|
|
ArrayList oParams = new ArrayList();
|
|
throw new EnrgiseApplicationException("hrm.HrmRetFrcst.DateException", "E");
|
|
}
|
|
}
|
|
}
|