Files
HRMS/hrmsEjb/wenrgise/workflow/ejb/business/WflDelegationMstBO.java
2025-07-28 13:56:49 +05:30

454 lines
24 KiB
Java

package wenrgise.workflow.ejb.business;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Iterator;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.bean.LOVBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseMessageKeyException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.EnrgiseUtil;
import wenrgise.common.utility.MessageKey;
import wenrgise.common.utility.RecordMetaInfo;
import wenrgise.common.utility.UserInfo;
import wenrgise.common.vo.LovQueryVO;
import wenrgise.common.vo.LovVO;
import wenrgise.ejb.common.business.BaseBO;
import wenrgise.ejb.common.helper.DBObject;
import wenrgise.ejb.common.helper.QueryRow;
import wenrgise.ejb.common.utility.DBUtilitiesBean;
import wenrgise.workflow.bean.WflDelegateMstDtlBean;
import wenrgise.workflow.bean.WflDelegateMstHdrBean;
import wenrgise.workflow.vo.WflDelegationQVO;
public class WflDelegationMstBO extends BaseBO {
public WflDelegationMstBO() {}
public WflDelegationMstBO(UserInfo oUserInfo) {
super(oUserInfo);
}
public RecordMetaInfo getWflDelegationHdrMetaInfo(WflDelegationQVO oWflDelegationQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
Timestamp oWhenPicked = null;
int count = 0;
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflDelegationQVO.getHeaderPrimaryKey()));
oParameters.add(new DBObject(2, 1, 12, oWflDelegationQVO.getEmpId()));
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, "WFLDELEGATIONMST.proc_GetWFlDelegationMetaInfo(?,?,?,?,?,?,?)");
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 getWflDelegationHdrInfo(WflDelegationQVO oWflDelegationQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
ArrayList oHeaderList = null;
if (oWflDelegationQVO == null)
oWflDelegationQVO = new WflDelegationQVO();
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, oWflDelegationQVO.getHeaderPrimaryKey()));
oParameters.add(new DBObject(4, 1, 12, oWflDelegationQVO.getEmpId()));
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, "WFLDELEGATIONMST.proc_GetWFlDelegationHdrInfo(?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() == 0)
throw new EnrgiseApplicationException("wenrgise.workflow.norecordfound", "M");
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
if (count == 0)
oHeaderList = new ArrayList();
count++;
oRow = oIt.next();
WflDelegateMstHdrBean oWflDelegateMstHdrBean = new WflDelegateMstHdrBean();
oWflDelegateMstHdrBean.setHeaderPrimaryKey(oRow.get("ID").getString());
oWflDelegateMstHdrBean.setFromDate(EnrgiseUtil.convertToString(oRow.get("FROM_DATE").getDate()));
oWflDelegateMstHdrBean.setToDate(EnrgiseUtil.convertToString(oRow.get("TO_DATE").getDate()));
oWflDelegateMstHdrBean.setDelegateAll(oRow.get("ALL_DOC").getString().equalsIgnoreCase("Y") ? "on" : "off");
oWflDelegateMstHdrBean.setEmpId(oRow.get("DELEGATED_ID").getString());
oWflDelegateMstHdrBean.setEmpNo(oRow.get("EMP_NO").getString());
oWflDelegateMstHdrBean.setEmpName(oRow.get("EMP_NAME").getString());
oWflDelegateMstHdrBean.setRemarks(oRow.get("REMARKS").getString());
oHeaderList.add(oWflDelegateMstHdrBean);
}
return oHeaderList;
}
public RecordMetaInfo getWflDelegationDtlMetaInfo(String sPrimaryKey) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sPrimaryKey));
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, "WFLDELEGATIONMST.proc_GetWFlDelegDtlMetaInfo(?,?,?,?,?,?)");
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());
System.out.println(oRecordMetaInfo);
return oRecordMetaInfo;
}
public ArrayList getWflDelegationDtlInfo(String sPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = new DBUtilitiesBean();
QueryRow oRow = null;
ArrayList oList = null;
Iterator oIt = null;
ArrayList oDtlList = new ArrayList();
ArrayList oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, new Long(lDetailFirstPosition)));
oParameters.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
oParameters.add(new DBObject(3, 1, 12, sPrimaryKey));
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, "WFLDELEGATIONMST.proc_GetWFlDelegationDtlInfo(?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
WflDelegateMstDtlBean oWflDelegateMstDtlBean = new WflDelegateMstDtlBean();
oWflDelegateMstDtlBean.setDetailId(oRow.get("Id").getString());
oWflDelegateMstDtlBean.setTxtDocTypeId(oRow.get("doc_type_id").getString());
oWflDelegateMstDtlBean.setTxtDocType(oRow.get("doc_dtl_code").getString());
oWflDelegateMstDtlBean.setTxtDesc(oRow.get("doc_dtl_desc").getString());
oWflDelegateMstDtlBean.setDisabbutDocType("true");
oDtlList.add(oWflDelegateMstDtlBean);
}
return oDtlList;
}
public void initializeBOImpl() {
this.headerTable = "wfl_delegation_hdr";
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
String returnString = null;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
WflDelegateMstHdrBean oWflDelegateMstHdrBean = (WflDelegateMstHdrBean)oBaseHeaderBean;
if (oWflDelegateMstHdrBean.getDelegateAll().equalsIgnoreCase("off") || oWflDelegateMstHdrBean.getDelegateAll().equalsIgnoreCase(""))
oWflDelegateMstHdrBean.setDelegateAllDoc("N");
if (ScreenMode.equalsIgnoreCase("N")) {
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "N"));
oParameters.add(new DBObject(2, 1, 12, null));
oParameters.add(new DBObject(3, 1, 12, this.oUserInfo.getUserTypeId()));
oParameters.add(new DBObject(4, 1, 12, oWflDelegateMstHdrBean.getEmpId()));
oParameters.add(new DBObject(5, 1, 12, oWflDelegateMstHdrBean.getFromDate()));
oParameters.add(new DBObject(6, 1, 12, oWflDelegateMstHdrBean.getToDate()));
oParameters.add(new DBObject(7, 1, 12, oWflDelegateMstHdrBean.getDelegateAllDoc()));
oParameters.add(new DBObject(8, 1, 12, oWflDelegateMstHdrBean.getRemarks()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(11, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(12, 2, 12));
oParameters.add(new DBObject(13, 2, 12));
oParameters.add(new DBObject(14, 2, 12));
oParameters.add(new DBObject(15, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "WFLDELEGATIONMST.proc_UpsertWflDelegationHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
} else if (ScreenMode.equalsIgnoreCase("U")) {
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWflDelegateMstHdrBean.getHeaderPrimaryKey()));
oParameters.add(new DBObject(3, 1, 12, this.oUserInfo.getUserTypeId()));
oParameters.add(new DBObject(4, 1, 12, oWflDelegateMstHdrBean.getEmpId()));
oParameters.add(new DBObject(5, 1, 12, oWflDelegateMstHdrBean.getFromDate()));
oParameters.add(new DBObject(6, 1, 12, oWflDelegateMstHdrBean.getToDate()));
oParameters.add(new DBObject(7, 1, 12, oWflDelegateMstHdrBean.getDelegateAllDoc()));
oParameters.add(new DBObject(8, 1, 12, oWflDelegateMstHdrBean.getRemarks()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(11, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(12, 2, 12));
oParameters.add(new DBObject(13, 2, 12));
oParameters.add(new DBObject(14, 2, 12));
oParameters.add(new DBObject(15, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "WFLDELEGATIONMST.proc_UpsertWflDelegationHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
} else if (ScreenMode.equalsIgnoreCase("D")) {
oParameters.add(new DBObject(1, 1, 12, oWflDelegateMstHdrBean.getHeaderPrimaryKey()));
oParameters.add(new DBObject(2, 2, 12));
oParameters.add(new DBObject(3, 2, 12));
oParameters.add(new DBObject(4, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "WFLDELEGATIONMST.proc_DeleteWflDelegationHdr(?,?,?,?)");
}
return returnString;
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
if (sScreenName.equalsIgnoreCase("WflDelegationMst"))
saveWflDelegationDtls(sHeaderPrimaryKey, oDetailBeanArray);
}
public void saveWflDelegationDtls(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()) {
WflDelegateMstDtlBean oWflDelegateMstDtlBean = oIt.next();
if (oWflDelegateMstDtlBean.getStatus().equals("N")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WFLDELEGATIONMST.proc_UpsertWflDelegationDtl(?,?,?,?,?,?,?)");
bInsert = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "N"));
oParameters.add(new DBObject(2, 1, 12, null));
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
oParameters.add(new DBObject(4, 1, 12, oWflDelegateMstDtlBean.getTxtDocTypeId()));
oParameters.add(new DBObject(5, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDelegateMstDtlBean.getStatus().equals("U")) {
if (!bUpdate) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WFLDELEGATIONMST.proc_UpsertWflDelegationDtl(?,?,?,?,?,?,?)");
bUpdate = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWflDelegateMstDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
oParameters.add(new DBObject(4, 1, 12, oWflDelegateMstDtlBean.getTxtDocTypeId()));
oParameters.add(new DBObject(5, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDelegateMstDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("WFLDELEGATIONMST.proc_DeleteWflDelegationDtl(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflDelegateMstDtlBean.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 Nischt!");
}
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
return "saveNewHeaderImpl Nischt!";
}
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();
WflDelegateMstHdrBean oWflDelegateMstHdrBean = (WflDelegateMstHdrBean)oBaseHeaderBean;
if (bHeaderDataChanged)
if (!sScreenMode.equalsIgnoreCase("D"))
checkMandatoryHeader(oWflDelegateMstHdrBean);
if (bDetailDataChanged)
if (sScreenName.equalsIgnoreCase("WflDelegationMst")) {
Iterator oIt = oDetailBeanArray.iterator();
int count = 1;
while (oIt.hasNext()) {
WflDelegateMstDtlBean oWflDelegateMstDtlBean = oIt.next();
if (!oWflDelegateMstDtlBean.getStatus().equalsIgnoreCase("D"))
checkMandatoryDtls(oWflDelegateMstDtlBean, count, oDetailBeanArray);
count++;
}
}
reportError(oErrorList);
}
private void checkMandatoryHeader(WflDelegateMstHdrBean oWflDelegateMstHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDelegateMstHdrBean.getEmpNo())) {
MessageKey oMessageKey = new MessageKey("WFL.WflDelegateMst.empNo");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDelegateMstHdrBean.getFromDate())) {
MessageKey oMessageKey = new MessageKey("WFL.WflDelegateMst.fromDate");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDelegateMstHdrBean.getToDate())) {
MessageKey oMessageKey = new MessageKey("WFL.WflDelegateMst.toDate");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParam, "E"));
}
reportError(oList);
}
private void checkMandatoryDtls(WflDelegateMstDtlBean oWflDelegateMstDtlBean, int count, ArrayList oDetailBeanArray) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDelegateMstDtlBean.getTxtDocType())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WflDelegateMst.docType");
oParam.add(oMessageKey);
oParam.add(new Integer(count));
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDelegateMstDtlBean.getTxtDesc())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WflDelegateMst.desc");
oParam.add(oMessageKey);
oParam.add(new Integer(count));
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
reportError(oList);
}
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 {
WflDelegateMstHdrBean oWflDelegateMstHdrBean = (WflDelegateMstHdrBean)oBaseHeaderBean;
ArrayList oErrorList = new ArrayList();
checkDatesConstraint(oWflDelegateMstHdrBean, oErrorList);
checkDuplicateHeader(oWflDelegateMstHdrBean, oErrorList);
checkDelegationFlag(oWflDelegateMstHdrBean, oErrorList);
if (bDetailDataChanged)
if (!sScreenMode.equalsIgnoreCase("D"))
if (sScreenName.equalsIgnoreCase("WflDelegationMst")) {
checkUniqueMaterialDtl(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oErrorList);
EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtDocType", "WFL.WflDelegateMst.docType", oErrorList, true);
}
reportError(oErrorList);
}
private void checkUniqueMaterialDtl(String sHeaderPrimaryKey, ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
Iterator oIt1 = oDetailBeanArray.iterator();
int rowCount = 1;
while (oIt1.hasNext()) {
WflDelegateMstDtlBean oWflDelegateMstDtlBean = oIt1.next();
if (!EnrgiseUtil.checkString(oWflDelegateMstDtlBean.getDetailId())) {
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select id as ID from wfl_delegation_dtl where doc_type_id='").concat(String.valueOf(oWflDelegateMstDtlBean.getTxtDocTypeId()))).concat(String.valueOf("' and hdr_id = '"))).concat(String.valueOf(sHeaderPrimaryKey))).concat(String.valueOf("' "));
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
QueryRow oRow = oIt.next();
if (!oRow.get("ID").getString().equalsIgnoreCase(oWflDelegateMstDtlBean.getDetailId())) {
ArrayList oParams = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WflDelegateMst.docType");
oParams.add(oMessageKey);
oParams.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.workflow.detail.UniqueKeyConstraint", oParams));
}
}
rowCount++;
}
rowCount++;
}
reportError(oErrorList);
}
private void checkDatesConstraint(WflDelegateMstHdrBean oWflDelegateMstHdrBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
int dateFlag = EnrgiseUtil.compareDates(dateFormat, oWflDelegateMstHdrBean.getFromDate(), oWflDelegateMstHdrBean.getToDate());
if (dateFlag == 1 && dateFlag != -2)
oErrorList.add(new EnrgiseApplicationException("WFL.WflDelegateMst.dateConstraint"));
}
public void checkDelegationFlag(WflDelegateMstHdrBean oWflDelegateMstHdrBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oList = new ArrayList();
long sArraySize = getWflDelegationDtlMetaInfo(oWflDelegateMstHdrBean.getHeaderPrimaryKey()).getRecordCount();
if (EnrgiseUtil.checkString(oWflDelegateMstHdrBean.getDelegateAllDoc()))
if (oWflDelegateMstHdrBean.getDelegateAllDoc().equalsIgnoreCase("Y") && sArraySize != 0L)
oErrorList.add(new EnrgiseApplicationException("WFL.WflDelegateMst.deleteDetailRec"));
}
public LovVO getWflDtlDocTypeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "select wdtd.id,wdtd.doc_dtl_code,wdtd.doc_dtl_desc from wfl_doc_type_dtl wdtd ";
if (oLovQueryVO.getSearchField1() != null)
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" where upper(wdtd.doc_dtl_code) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
System.out.println(sQuery);
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
LovVO oLovVO = new LovVO();
ArrayList oHeaderList = new ArrayList();
oHeaderList.add("");
oHeaderList.add("WFL.WflDelegateMst.docType");
oHeaderList.add("WFL.WflDelegateMst.desc");
oLovVO.setHeaderList(oHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("V");
arylstVisibility.add("V");
oLovVO.setVisibilityList(arylstVisibility);
int count = 0;
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
if (count == 0)
oList = new ArrayList();
count++;
oRow = oIt.next();
LOVBean oLOVBean = new LOVBean();
oLOVBean.setDetailField1(oRow.get("id").getString());
oLOVBean.setDetailField2(oRow.get("doc_dtl_code").getString());
oLOVBean.setDetailField3(oRow.get("doc_dtl_desc").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public void checkDuplicateHeader(WflDelegateMstHdrBean oWflDelegateMstHdrBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("select t.id from wfl_delegation_hdr t, (select '").concat(String.valueOf(oWflDelegateMstHdrBean.getFromDate()))).concat(String.valueOf("' a, '"))).concat(String.valueOf(oWflDelegateMstHdrBean.getToDate()))).concat(String.valueOf("' b from dual) x where x.a between t.from_dt and t.to_dt and x.b between t.from_dt and t.to_dt and t.delegator_id = "))).concat(String.valueOf(this.oUserInfo.getUserId()))).concat(String.valueOf(" and t.delegated_id='"))).concat(String.valueOf(oWflDelegateMstHdrBean.getEmpId()))).concat(String.valueOf("' and t.all_doc = '"))).concat(String.valueOf(oWflDelegateMstHdrBean.getDelegateAllDoc()))).concat(String.valueOf("' "));
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
Iterator oIt = oList.iterator();
if (oIt.hasNext()) {
QueryRow oRow = oIt.next();
if (!oRow.get("ID").getString().equalsIgnoreCase(oWflDelegateMstHdrBean.getHeaderPrimaryKey()))
oErrorList.add(new EnrgiseApplicationException("WFL.WflDelegateMst.alreadyDelegated"));
}
}
}