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

484 lines
25 KiB
Java

package wenrgise.workflow.ejb.business;
import java.sql.Timestamp;
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.WflDtlDocActivityMapDtlBean;
import wenrgise.workflow.bean.WflDtlDocActivityMapHdrBean;
import wenrgise.workflow.vo.WflDtlDocActivityMapQVO;
public class WFLDtlDocActivityMapBO extends BaseBO {
public WFLDtlDocActivityMapBO() {}
public WFLDtlDocActivityMapBO(UserInfo oUserInfo) {
super(oUserInfo);
}
public RecordMetaInfo getWFLDtlDocActivityHdrMetaInfo(WflDtlDocActivityMapQVO oWflDtlDocActivityMapQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstParameters = new ArrayList();
DBUtilitiesBean objBean = new DBUtilitiesBean();
arylstParameters = new ArrayList();
arylstParameters.add(new DBObject(1, 1, 12, oWflDtlDocActivityMapQVO.getHeaderPrimaryKey()));
arylstParameters.add(new DBObject(2, 1, 12, oWflDtlDocActivityMapQVO.getDtlDocId()));
arylstParameters.add(new DBObject(3, 2, -5));
arylstParameters.add(new DBObject(4, 2, 93));
arylstParameters.add(new DBObject(5, 2, 12));
arylstParameters.add(new DBObject(6, 2, 12));
arylstParameters.add(new DBObject(7, 2, 4));
ArrayList arylstOutArray = objBean.callProc(arylstParameters, "WFLDOCACTIVITYMAP.proc_GetWFlDocActHdrMetaInfo(?,?,?,?,?,?,?)");
RecordMetaInfo objRecordMetaInfo = new RecordMetaInfo();
DBObject objTotalRecord = arylstOutArray.get(0);
objRecordMetaInfo.setRecordCount(((Long)objTotalRecord.getObject()).longValue());
DBObject oTimeObject = arylstOutArray.get(1);
objRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
return objRecordMetaInfo;
}
public ArrayList getWFLDtlDocActivityHdrInfo(WflDtlDocActivityMapQVO oWflDtlDocActivityMapQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstParameters = new ArrayList();
DBUtilitiesBean objBean = new DBUtilitiesBean();
Timestamp tmstWhenPicked = null;
int count = 0;
ArrayList arylstDetailList = null;
arylstParameters = new ArrayList();
arylstParameters.add(new DBObject(1, 1, -5, new Long(lStartPosition)));
arylstParameters.add(new DBObject(2, 1, -5, new Long(lLastPosition)));
arylstParameters.add(new DBObject(3, 1, 12, oWflDtlDocActivityMapQVO.getHeaderPrimaryKey()));
arylstParameters.add(new DBObject(4, 1, 12, oWflDtlDocActivityMapQVO.getDtlDocId()));
arylstParameters.add(new DBObject(5, 2, -10));
arylstParameters.add(new DBObject(6, 2, 12));
arylstParameters.add(new DBObject(7, 2, 12));
arylstParameters.add(new DBObject(8, 2, 4));
ArrayList arylstOutArray = objBean.callProc(arylstParameters, "WFLDOCACTIVITYMAP.proc_GetWFlDocActHdrInfo(?,?,?,?,?,?,?,?)");
DBObject objOutObject = arylstOutArray.get(0);
ArrayList arylstList = (ArrayList)objOutObject.getObject();
if (arylstList.size() == 0)
throw new EnrgiseApplicationException("wenrgise.workflow.norecordfound", "M");
QueryRow objRow = null;
Iterator itrIt = arylstList.iterator();
while (itrIt.hasNext()) {
if (count == 0)
arylstDetailList = new ArrayList();
count++;
objRow = itrIt.next();
WflDtlDocActivityMapHdrBean oWflDtlDocActivityMapHdrBean = new WflDtlDocActivityMapHdrBean();
oWflDtlDocActivityMapHdrBean.setHeaderPrimaryKey(objRow.get("ID").getString());
oWflDtlDocActivityMapHdrBean.setDtlDocActCode(objRow.get("docActHdrCode").getString());
oWflDtlDocActivityMapHdrBean.setDtlDocActDesc(objRow.get("docActHdrDesc").getString());
oWflDtlDocActivityMapHdrBean.setDtlDocCode(objRow.get("docDtlCode").getString());
oWflDtlDocActivityMapHdrBean.setDtlDocId(objRow.get("docTypeDtlId").getString());
oWflDtlDocActivityMapHdrBean.setDtlDocDesc(objRow.get("docDtlDesc").getString());
arylstDetailList.add(oWflDtlDocActivityMapHdrBean);
}
return arylstDetailList;
}
public RecordMetaInfo getWFLDtlDocActivityDtlMetaInfo(String sPrimaryKey) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, new String(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, "WFLDOCACTIVITYMAP.proc_GetWFlDocActDtlMetaInfo(?,?,?,?,?,?)");
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 getWFLDtlDocActivityDtlInfo(String lPrimaryKey, 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, 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, "WFLDOCACTIVITYMAP.proc_GetWFlDocActDtlInfo(?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
WflDtlDocActivityMapDtlBean oWflDtlDocActivityMapDtlBean = new WflDtlDocActivityMapDtlBean();
oWflDtlDocActivityMapDtlBean.setDetailId(oRow.get("Id").getString());
oWflDtlDocActivityMapDtlBean.setActivityCode(oRow.get("activityCode").getString());
oWflDtlDocActivityMapDtlBean.setActivityDesc(oRow.get("activityDesc").getString());
oWflDtlDocActivityMapDtlBean.setActivityId(oRow.get("activityId").getString());
oWflDtlDocActivityMapDtlBean.setActivityFlag(oRow.get("activityFlag").getString());
oDtlList.add(oWflDtlDocActivityMapDtlBean);
}
return oDtlList;
}
public void initializeBOImpl() {
this.headerTable = "wfl_doc_activity_hdr";
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
String returnString = null;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
WflDtlDocActivityMapHdrBean oWflDtlDocActivityMapHdrBean = new WflDtlDocActivityMapHdrBean();
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, oWflDtlDocActivityMapHdrBean.getDtlDocActCode()));
oParameters.add(new DBObject(4, 1, 12, oWflDtlDocActivityMapHdrBean.getDtlDocActDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDtlDocActivityMapHdrBean.getDtlDocId()));
oParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
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, 12));
ArrayList oOutArray = oBean.callProc(oParameters, "WFLDOCACTIVITYMAP.proc_UpsertWflDtlDocActMapHdr(?,?,?,?,?,?,?,?,?,?,?,?)");
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, oWflDtlDocActivityMapHdrBean.getHeaderPrimaryKey()));
oParameters.add(new DBObject(3, 1, 12, oWflDtlDocActivityMapHdrBean.getDtlDocActCode()));
oParameters.add(new DBObject(4, 1, 12, oWflDtlDocActivityMapHdrBean.getDtlDocActDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDtlDocActivityMapHdrBean.getDtlDocId()));
oParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
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, 12));
ArrayList oOutArray = oBean.callProc(oParameters, "WFLDOCACTIVITYMAP.proc_UpsertWflDtlDocActMapHdr(?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
} else if (ScreenMode.equalsIgnoreCase("D")) {
oParameters.add(new DBObject(1, 1, 12, oWflDtlDocActivityMapHdrBean.getHeaderPrimaryKey()));
ArrayList oOutArray = oBean.callProc(oParameters, "WFLDOCACTIVITYMAP.proc_DeleteWflDtlDocActMapHdr(?)");
}
return returnString;
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
saveDtlDocActivityDtls(sHeaderPrimaryKey, oDetailBeanArray);
}
private void saveDtlDocActivityDtls(String sHeaderPrimaryKey, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
boolean bUpsert = false;
boolean bDelete = false;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = null;
DBUtilitiesBean oBean1 = null;
Iterator oIt = oDetailBeanArray.iterator();
while (oIt.hasNext()) {
WflDtlDocActivityMapDtlBean oWflDtlDocActivityMapDtlBean = oIt.next();
if (oWflDtlDocActivityMapDtlBean.getStatus().equals("N")) {
if (!bUpsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WFLDOCACTIVITYMAP.proc_UpsertWflDtlDocActMapDtl(?,?,?,?,?,?,?,?)");
bUpsert = 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, oWflDtlDocActivityMapDtlBean.getActivityId()));
oParameters.add(new DBObject(5, 1, 12, oWflDtlDocActivityMapDtlBean.getActivityFlag()));
oParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDtlDocActivityMapDtlBean.getStatus().equals("U")) {
if (!bUpsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WFLDOCACTIVITYMAP.proc_UpsertWflDtlDocActMapDtl(?,?,?,?,?,?,?,?)");
bUpsert = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWflDtlDocActivityMapDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
oParameters.add(new DBObject(4, 1, 12, oWflDtlDocActivityMapDtlBean.getActivityId()));
oParameters.add(new DBObject(5, 1, 12, oWflDtlDocActivityMapDtlBean.getActivityFlag()));
oParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDtlDocActivityMapDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("WFLDOCACTIVITYMAP.proc_DeleteWflDtlDocActMapDtl(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflDtlDocActivityMapDtlBean.getDetailId()));
oBean1.addToBatch(oParameters);
}
}
if (bUpsert)
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();
if (bHeaderDataChanged)
if (!sScreenMode.equalsIgnoreCase("D"))
checkMandatoryHdr((WflDtlDocActivityMapHdrBean)oBaseHeaderBean);
if (bDetailDataChanged)
if (sScreenName.equalsIgnoreCase("WflDtlDocActivityMap")) {
Iterator oIt = oDetailBeanArray.iterator();
int count = 1;
while (oIt.hasNext()) {
WflDtlDocActivityMapDtlBean oWflDtlDocActivityMapDtlBean = oIt.next();
if (!oWflDtlDocActivityMapDtlBean.getStatus().equalsIgnoreCase("D"))
checkMandatoryDtls(oWflDtlDocActivityMapDtlBean, count, oDetailBeanArray);
count++;
}
}
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();
if (bHeaderDataChanged)
if (!sScreenMode.equalsIgnoreCase("D"))
checkUniqueHeader((WflDtlDocActivityMapHdrBean)oBaseHeaderBean);
if (bDetailDataChanged)
if (!sScreenMode.equalsIgnoreCase("D"))
if (sScreenName.equalsIgnoreCase("WflDtlDocActivityMap")) {
Iterator oIt1 = oDetailBeanArray.iterator();
checkUniqueMaterialDtl(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oErrorList);
}
reportError(oErrorList);
}
public LovVO getWflMapCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "Select distinct wdah.id,wdah.activity_hdr_code from wfl_doc_activity_hdr wdah where 1=1";
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wdah.activity_hdr_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.WFLDtlDocActMap.dtlDocActCode");
oLovVO.setHeaderList(oHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
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("activity_hdr_code").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public LovVO getWflDocCodeDtlLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "Select distinct wdtd.id,wdtd.doc_dtl_code,wdtd.doc_dtl_desc from wfl_doc_type_dtl wdtd where 1=1 ";
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wdtd.doc_dtl_code) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wdtd.doc_dtl_desc) 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.WFLDtlDocActMap.dtlDocCode");
oHeaderList.add("WFL.WFLDtlDocActMap.dtlDocDesc");
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 LovVO getWflActCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "Select distinct wam.id,wam.ACTIVITY_CODE,wam.ACTIVITY_DESC from wfl_activity_mst wam where 1=1 ";
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wam.ACTIVITY_CODE) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wam.ACTIVITY_DESC) 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.WFLDtlDocActMap.activityCode");
oHeaderList.add("WFL.WFLDtlDocActMap.activityDesc");
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;
}
private void checkMandatoryHdr(WflDtlDocActivityMapHdrBean oWflDtlDocActivityMapHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDtlDocActivityMapHdrBean.getDtlDocActCode())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocActMap.dtlDocActCode");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryfieldmissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDtlDocActivityMapHdrBean.getDtlDocCode())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocActMap.dtlDocCode");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryfieldmissing", oParam, "E"));
}
reportError(oList);
}
private void checkMandatoryDtls(WflDtlDocActivityMapDtlBean oWflDtlDocActivityMapDtlBean, int count, ArrayList oDetailBeanArray) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDtlDocActivityMapDtlBean.getActivityCode())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocActMap.activityCode");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDtlDocActivityMapDtlBean.getActivityDesc())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocActMap.activityDesc");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
reportError(oList);
}
private void checkUniqueMaterialDtl(String sHeaderPrimaryKey, ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
Iterator oIt1 = oDetailBeanArray.iterator();
int rowCount = 1;
while (oIt1.hasNext()) {
WflDtlDocActivityMapDtlBean oWflDtlDocActivityMapDtlBean = oIt1.next();
if (!EnrgiseUtil.checkString(oWflDtlDocActivityMapDtlBean.getDetailId())) {
String sQuery = String.valueOf(" Select id as ID from WFL_DOC_ACTIVITY_DTL where ACTIVITY_ID= ").concat(String.valueOf(oWflDtlDocActivityMapDtlBean.getActivityCode()));
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
Iterator oIt = oList.iterator();
if (oIt.hasNext()) {
ArrayList oParams = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocActMap.activityCode");
oParams.add(oMessageKey);
oParams.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.workflow.detail.UniqueKeyConstraint", oParams));
}
}
rowCount++;
}
}
private void checkUniqueHeader(WflDtlDocActivityMapHdrBean oWflDtlDocActivityMapHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
String sQuery = String.valueOf(String.valueOf(String.valueOf(" Select ID as ID from wfl_doc_activity_hdr where ACTIVITY_HDR_CODE= '").concat(String.valueOf(oWflDtlDocActivityMapHdrBean.getDtlDocActCode()))).concat(String.valueOf("' and DOC_TYPE_DTL_ID="))).concat(String.valueOf(oWflDtlDocActivityMapHdrBean.getDtlDocCode()));
System.out.println(sQuery);
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(oWflDtlDocActivityMapHdrBean.getHeaderPrimaryKey())) {
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocActMap.dtlDocActCode");
MessageKey oMessageKey1 = new MessageKey("WFL.WFLDtlDocActMap.dtlDocCode");
ArrayList oParams = new ArrayList();
oParams.add(oMessageKey);
oParams.add(oMessageKey1);
throw new EnrgiseMessageKeyException("wenrgise.workflow.header.UniqueKeyConstraint", oParams, "E");
}
}
}
}