first commit

This commit is contained in:
2025-07-28 13:56:49 +05:30
commit e9eb805edb
3438 changed files with 520990 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
package wenrgise.workflow.ejb.business;
import java.util.ArrayList;
import java.util.Iterator;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
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.workflow.bean.DocHistoryDtlBean;
public class DocHistoryDtlBO extends WorkFlowBaseBO {
public ArrayList getDocHistDtl(String sDocID, String sDocType, String sModuleID) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
String sActivity = "";
ArrayList arylstOutArray = new ArrayList();
DocHistoryDtlBean oDocHistoryDtlBean = null;
ArrayList oDocHistDtl = null;
QueryRow oRow = null;
QueryValue oValue = null;
ArrayList oList = null;
oBean = new DBUtilitiesBean();
arylstParameters = new ArrayList();
arylstParameters = new ArrayList();
arylstParameters.add(new DBObject(1, 1, 12, sDocID));
arylstParameters.add(new DBObject(2, 1, 12, sDocType));
arylstParameters.add(new DBObject(3, 1, 12, sModuleID));
arylstParameters.add(new DBObject(4, 2, -10));
arylstParameters.add(new DBObject(5, 2, 12));
arylstParameters.add(new DBObject(6, 2, 12));
arylstParameters.add(new DBObject(7, 2, 4));
arylstOutArray = oBean.callProc(arylstParameters, "WFLDOCUMENTHISTORY.proc_WflDocHistDtl(?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)arylstOutArray.get(0)).getObject();
if (oList.size() == 0)
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
if (oDocHistDtl == null)
oDocHistDtl = new ArrayList();
count++;
oRow = oIt.next();
oDocHistoryDtlBean = new DocHistoryDtlBean();
oDocHistoryDtlBean.setTxtSrlNo(String.valueOf(count));
oDocHistoryDtlBean.setTxtEmpNum(oRow.get("empName").getString());
oDocHistoryDtlBean.setTxtDocType(oRow.get("doc_type_desc").getString());
oDocHistoryDtlBean.setTxtStartTime(oRow.get("stDate").getString());
oDocHistoryDtlBean.setTxtDuration(oRow.get("duration").getString());
sActivity = oRow.get("status").getString();
if (sActivity.equalsIgnoreCase("A")) {
oDocHistoryDtlBean.setTxtActivity("Approved");
} else {
oDocHistoryDtlBean.setTxtActivity("Pending");
}
oDocHistDtl.add(oDocHistoryDtlBean);
}
return oDocHistDtl;
}
}

View File

@@ -0,0 +1,483 @@
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");
}
}
}
}

View File

@@ -0,0 +1,237 @@
package wenrgise.workflow.ejb.business;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import wenrgise.common.bean.BaseHeaderBean;
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.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.WflActMstDtlBean;
public class WflActivityMstBO extends BaseBO {
public WflActivityMstBO() {}
public WflActivityMstBO(UserInfo oUserInfo) {
super(oUserInfo);
}
public RecordMetaInfo getWflActivityDtlMetaInfo() throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstParameters = new ArrayList();
DBUtilitiesBean objBean = new DBUtilitiesBean();
arylstParameters = new ArrayList();
arylstParameters.add(new DBObject(1, 2, -5));
arylstParameters.add(new DBObject(2, 2, 93));
arylstParameters.add(new DBObject(3, 2, 12));
arylstParameters.add(new DBObject(4, 2, 12));
arylstParameters.add(new DBObject(5, 2, 4));
ArrayList arylstOutArray = objBean.callProc(arylstParameters, "WflActivityMst.proc_GetActMstDtlMetaInfo(?,?,?,?,?)");
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 getWflActivityDtlInfo(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, 2, -10));
arylstParameters.add(new DBObject(4, 2, 12));
arylstParameters.add(new DBObject(5, 2, 12));
arylstParameters.add(new DBObject(6, 2, 4));
ArrayList arylstOutArray = objBean.callProc(arylstParameters, "WflActivityMst.proc_GetActMstDtlInfo(?,?,?,?,?,?)");
DBObject objOutObject = arylstOutArray.get(0);
ArrayList arylstList = (ArrayList)objOutObject.getObject();
if (arylstList.size() == 0)
throw new EnrgiseApplicationException("wenrgise.workflow.norecordfound", "M");
QueryRow objRow = null;
HashMap objColumns = null;
Iterator itrIt = arylstList.iterator();
while (itrIt.hasNext()) {
if (count == 0)
arylstDetailList = new ArrayList();
count++;
objRow = itrIt.next();
WflActMstDtlBean oWflActMstDtlBean = new WflActMstDtlBean();
oWflActMstDtlBean.setDetailId(objRow.get("id").getString());
oWflActMstDtlBean.setTxtAttrCode(objRow.get("activity_code").getString());
oWflActMstDtlBean.setTxtAttrDesc(objRow.get("activity_desc").getString());
arylstDetailList.add(oWflActMstDtlBean);
}
return arylstDetailList;
}
private void saveWflActivityDtls(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()) {
WflActMstDtlBean oWflActMstDtlBean = oIt.next();
if (oWflActMstDtlBean.getStatus().equals("N")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflActivityMst.proc_UpsertWflActivityMstDtl(?,?,?,?,?,?,?)");
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, oWflActMstDtlBean.getTxtAttrCode()));
oParameters.add(new DBObject(4, 1, 12, oWflActMstDtlBean.getTxtAttrDesc()));
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 (oWflActMstDtlBean.getStatus().equals("U")) {
if (!bUpdate) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflActivityMst.proc_UpsertWflActivityMstDtl(?,?,?,?,?,?,?)");
bUpdate = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWflActMstDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, oWflActMstDtlBean.getTxtAttrCode()));
oParameters.add(new DBObject(4, 1, 12, oWflActMstDtlBean.getTxtAttrDesc()));
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 (oWflActMstDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("WflActivityMst.proc_DeleteWflActivityMstDtl(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflActMstDtlBean.getDetailId()));
oBean1.addToBatch(oParameters);
}
}
if (bInsert)
oBean.executeBatch();
if (bUpdate)
oBean.executeBatch();
if (bDelete)
oBean1.executeBatch();
}
public void initializeBOImpl() {
this.headerTable = "WFL_ACTIVITY_MST";
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
String returnString = null;
return returnString;
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
if (sScreenName.equalsIgnoreCase("WflActivityMst"))
saveWflActivityDtls(sHeaderPrimaryKey, oDetailBeanArray);
}
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 (bDetailDataChanged)
if (sScreenName.equalsIgnoreCase("WflActivityMst")) {
Iterator oIt = oDetailBeanArray.iterator();
int count = 1;
while (oIt.hasNext()) {
WflActMstDtlBean oWflActMstDtlBean = oIt.next();
if (!oWflActMstDtlBean.getStatus().equalsIgnoreCase("D"))
checkMandatoryDtls(oWflActMstDtlBean, count, oDetailBeanArray);
count++;
}
}
reportError(oErrorList);
}
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 (bDetailDataChanged) {
if (!sScreenMode.equalsIgnoreCase("D"))
if (sScreenName.equalsIgnoreCase("WflActivityMst")) {
Iterator oIt1 = oDetailBeanArray.iterator();
checkUniqueMaterialDtl(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oErrorList);
EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtAttrCode", "wfl.WflActivityMst.attrCode", oErrorList, true);
}
reportError(oErrorList);
}
}
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
private void checkMandatoryDtls(WflActMstDtlBean oWflActMstDtlBean, int count, ArrayList oDetailBeanArray) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflActMstDtlBean.getTxtAttrCode())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("wfl.WflActivityMst.attrCode");
oParam.add(oMessageKey);
oParam.add(new Integer(count));
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflActMstDtlBean.getTxtAttrDesc())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("wfl.WflActivityMst.attrDesc");
oParam.add(oMessageKey);
oParam.add(new Integer(count));
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()) {
WflActMstDtlBean oWflActMstDtlBean = oIt1.next();
if (!EnrgiseUtil.checkString(oWflActMstDtlBean.getDetailId())) {
String sQuery = String.valueOf(String.valueOf(" Select id as ID from WFL_ACTIVITY_MST where activity_code='").concat(String.valueOf(oWflActMstDtlBean.getTxtAttrCode()))).concat(String.valueOf("' "));
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.WflActivityMst.attrCode");
oParams.add(oMessageKey);
oParams.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.workflow.detail.UniqueKeyConstraint", oParams));
}
}
rowCount++;
}
}
}

View File

@@ -0,0 +1,452 @@
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.BaseHeaderVO;
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.WflDOPGrpDtlBean;
import wenrgise.workflow.bean.WflDOPGrpHdrBean;
import wenrgise.workflow.vo.WflDOPGrpQVO;
public class WflDOPGrpBO extends BaseBO {
public WflDOPGrpBO() {}
public WflDOPGrpBO(UserInfo oUserInfo) {
super(oUserInfo);
}
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
return "saveNewHeaderImpl ille!";
}
public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
WflDOPGrpHdrBean oWflDOPGrpHdrBean = (WflDOPGrpHdrBean)oBaseHeaderBean;
ArrayList oErrorList = new ArrayList();
if (bHeaderDataChanged)
if (!sScreenMode.equalsIgnoreCase("D"))
checkMandatoryHeader(oWflDOPGrpHdrBean);
if (bDetailDataChanged)
if (sScreenName.equalsIgnoreCase("WflDOPGrp")) {
Iterator oIt = oDetailBeanArray.iterator();
int count = 1;
while (oIt.hasNext()) {
WflDOPGrpDtlBean oWflDOPGrpDtlBean = oIt.next();
if (!oWflDOPGrpDtlBean.getStatus().equalsIgnoreCase("D"))
checkMandatoryDtls(oWflDOPGrpDtlBean, count, oDetailBeanArray);
count++;
}
}
reportError(oErrorList);
}
private void checkMandatoryHeader(WflDOPGrpHdrBean oWflDOPGrpHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDOPGrpHdrBean.getGrpCode())) {
MessageKey oMessageKey = new MessageKey("WFL.WflDOPGrp.grpCode");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.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 {
ArrayList oList = new ArrayList();
if (bHeaderDataChanged)
checkUniqueHeader((WflDOPGrpHdrBean)oBaseHeaderBean);
if (bDetailDataChanged)
if (!sScreenMode.equalsIgnoreCase("D"))
if (sScreenName.equalsIgnoreCase("WflDOPGrp")) {
Iterator oIt1 = oDetailBeanArray.iterator();
EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtempNo", "WFL.WflDOPGrp.empNo", oList, true);
checkUniqueDOPGrpDtl(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oList);
checkDefaultMember(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oList);
}
reportError(oList);
}
public void initializeBOImpl() {
this.headerTable = "wfl_dop_groups";
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
if (sScreenName.equalsIgnoreCase("WflDOPGrp"))
saveWflDOPGrpDtls(sHeaderPrimaryKey, oDetailBeanArray);
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
String returnString = null;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
WflDOPGrpHdrBean oWflDOPGrpHdrBean = (WflDOPGrpHdrBean)oBaseHeaderBean;
String sGrpFlag = String.valueOf(oWflDOPGrpHdrBean.getGrpFlag()).equalsIgnoreCase("on") ? "Y" : "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, oWflDOPGrpHdrBean.getGrpCode()));
oParameters.add(new DBObject(4, 1, 12, oWflDOPGrpHdrBean.getGrpDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDOPGrpHdrBean.getRemarks()));
oParameters.add(new DBObject(6, 1, 12, sGrpFlag));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(10, 2, 12));
oParameters.add(new DBObject(11, 2, 12));
oParameters.add(new DBObject(12, 2, 12));
oParameters.add(new DBObject(13, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "WflDOPGroupMst.proc_UpsertWflDopGrpHdr(?,?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
} else if (ScreenMode.equalsIgnoreCase("U")) {
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, oWflDOPGrpHdrBean.getGrpCode()));
oParameters.add(new DBObject(4, 1, 12, oWflDOPGrpHdrBean.getGrpDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDOPGrpHdrBean.getRemarks()));
oParameters.add(new DBObject(6, 1, 12, sGrpFlag));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(10, 2, 12));
oParameters.add(new DBObject(11, 2, 12));
oParameters.add(new DBObject(12, 2, 12));
oParameters.add(new DBObject(13, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "WflDOPGroupMst.proc_UpsertWflDopGrpHdr(?,?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
} else if (ScreenMode.equalsIgnoreCase("D")) {
oParameters.add(new DBObject(1, 1, 12, oWflDOPGrpHdrBean.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, "WflDOPGroupMst.proc_DeleteWflDopGrpHdr(?,?,?,?)");
}
return returnString;
}
public void saveWflDOPGrpDtls(String sHeaderPrimaryKey, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
boolean bInsert = false;
boolean bDelete = false;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = null;
DBUtilitiesBean oBean1 = null;
Iterator oIt = oDetailBeanArray.iterator();
while (oIt.hasNext()) {
WflDOPGrpDtlBean oWflDOPGrpDtlBean = oIt.next();
String sDfliMem = String.valueOf(oWflDOPGrpDtlBean.getDfltMembr()).equalsIgnoreCase("on") ? "Y" : "N";
if (oWflDOPGrpDtlBean.getStatus().equals("N")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflDOPGroupMst.proc_UpsertWflDopGrpMembers(?,?,?,?,?,?,?,?,?)");
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, oWflDOPGrpDtlBean.getEmpId()));
oParameters.add(new DBObject(5, 1, 12, oWflDOPGrpDtlBean.getTxtHiLevel()));
oParameters.add(new DBObject(6, 1, 12, sDfliMem));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDOPGrpDtlBean.getStatus().equals("U")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflDOPGroupMst.proc_UpsertWflDopGrpMembers(?,?,?,?,?,?,?,?,?)");
bInsert = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWflDOPGrpDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
oParameters.add(new DBObject(4, 1, 12, oWflDOPGrpDtlBean.getEmpId()));
oParameters.add(new DBObject(5, 1, 12, oWflDOPGrpDtlBean.getTxtHiLevel()));
oParameters.add(new DBObject(6, 1, 12, sDfliMem));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDOPGrpDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("WflDOPGroupMst.proc_DeleteWflDopGrpMembers(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflDOPGrpDtlBean.getDetailId()));
oBean1.addToBatch(oParameters);
}
}
if (bInsert)
oBean.executeBatch();
if (bDelete)
oBean1.executeBatch();
}
public RecordMetaInfo getWflDOPGrpHdrMetaInfo(WflDOPGrpQVO oWflDOPGrpQVO) 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, oWflDOPGrpQVO.getHeaderPrimaryKey()));
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, "WflDOPGroupMst.proc_GetWFlDOPHdrMetaInfo(?,?,?,?,?,?)");
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 getWflDOPGrpHdrInfo(WflDOPGrpQVO oWflDOPGrpQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
ArrayList oHeaderList = null;
if (oWflDOPGrpQVO == null)
oWflDOPGrpQVO = new WflDOPGrpQVO();
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, oWflDOPGrpQVO.getHeaderPrimaryKey()));
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, "WflDOPGroupMst.proc_GetWFlDOPHdrInfo(?,?,?,?,?,?,?)");
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();
WflDOPGrpHdrBean oWflDOPGrpHdrBean = new WflDOPGrpHdrBean();
oWflDOPGrpHdrBean.setHeaderPrimaryKey(oRow.get("ID").getString());
oWflDOPGrpHdrBean.setGrpCode(oRow.get("GrCode").getString());
oWflDOPGrpHdrBean.setGrpDesc(oRow.get("GrType").getString());
oWflDOPGrpHdrBean.setRemarks(oRow.get("Remarks").getString());
oWflDOPGrpHdrBean.setGrpFlag(String.valueOf(oRow.get("ValFlag").getString()).equalsIgnoreCase("Y") ? "on" : "off");
oHeaderList.add(oWflDOPGrpHdrBean);
}
return oHeaderList;
}
public RecordMetaInfo getWflDOPGrpDtlMetaInfo(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, "WflDOPGroupMst.proc_GetWFlDOPGrpDtlMetaInfo(?,?,?,?,?,?)");
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 getWflDOPGrpDtlInfo(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, "WflDOPGroupMst.proc_GetWFlDOPGrpDtlInfo(?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
WflDOPGrpDtlBean oWflDOPGrpDtlBean = new WflDOPGrpDtlBean();
oWflDOPGrpDtlBean.setDetailId(oRow.get("Id").getString());
oWflDOPGrpDtlBean.setTxtempNo(oRow.get("EmpNo").getString());
oWflDOPGrpDtlBean.setEmpId(oRow.get("e_per_dtl_id").getString());
oWflDOPGrpDtlBean.setTxtEmpName(oRow.get("MEMNAME").getString());
oWflDOPGrpDtlBean.setTxtHiLevel(oRow.get("Hlevel").getString());
oWflDOPGrpDtlBean.setDfltMembr(String.valueOf(oRow.get("DfltMem").getString()).equalsIgnoreCase("Y") ? "on" : "off");
oDtlList.add(oWflDOPGrpDtlBean);
}
return oDtlList;
}
public LovVO getWflDOPGrpCodeQLOV(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "select distinct wdg.id as id,wdg.group_code as GrCode from wfl_dop_groups wdg";
if (oLovQueryVO.getSearchField1() != null)
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" where upper(wdg.group_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.WflDOPGrp.grpCode");
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("GrCode").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
private void checkDefaultMember(String sHeaderPrimKey, ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = null;
ArrayList oOutArray = null;
Iterator oDetailBeanIterator = oDetailBeanArray.iterator();
String oBeanUpdate = new String();
boolean flag = false;
while (oDetailBeanIterator.hasNext()) {
WflDOPGrpDtlBean oWflDOPGrpDtlBean = oDetailBeanIterator.next();
if (oWflDOPGrpDtlBean.getStatus().equalsIgnoreCase("U") || oWflDOPGrpDtlBean.getStatus().equalsIgnoreCase("D")) {
if (flag == true)
oBeanUpdate = String.valueOf(oBeanUpdate).concat(String.valueOf(","));
oBeanUpdate = String.valueOf(oBeanUpdate).concat(String.valueOf(oWflDOPGrpDtlBean.getDetailId()));
flag = true;
}
}
String sQuery = new String();
if (!oBeanUpdate.equalsIgnoreCase("")) {
sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" select t.id from wfl_dop_group_members t where t.dop_group_id=").concat(String.valueOf(sHeaderPrimKey))).concat(String.valueOf(" and t.id not in ("))).concat(String.valueOf(oBeanUpdate))).concat(String.valueOf(") and t.default_member='Y' "));
} else {
sQuery = String.valueOf(String.valueOf(" select t.id from wfl_dop_group_members t where t.dop_group_id=").concat(String.valueOf(sHeaderPrimKey))).concat(String.valueOf(" and t.default_member='Y' "));
}
System.out.println(sQuery);
DBUtilitiesBean oBean1 = new DBUtilitiesBean();
ArrayList arylstDefaultMemberNo = oBean1.executeQuery(sQuery);
ArrayList arylstCombMatIds = new ArrayList();
if (arylstDefaultMemberNo.size() > 1)
throw new EnrgiseApplicationException("WFL.WflDOPGrp.noExceedingOne", "E");
int iPersons = arylstDefaultMemberNo.size();
Iterator oIt = oDetailBeanArray.iterator();
while (oIt.hasNext()) {
WflDOPGrpDtlBean oWflDOPGrpDtlBean = oIt.next();
if (oWflDOPGrpDtlBean.getStatus().equalsIgnoreCase("U"))
if (oWflDOPGrpDtlBean.getDfltMembr().equalsIgnoreCase("on"))
iPersons++;
if (oWflDOPGrpDtlBean.getStatus().equalsIgnoreCase("D"))
if (oWflDOPGrpDtlBean.getDfltMembr().equalsIgnoreCase("off"))
iPersons--;
if (oWflDOPGrpDtlBean.getStatus().equalsIgnoreCase("N"))
if (oWflDOPGrpDtlBean.getDfltMembr().equalsIgnoreCase("on"))
iPersons++;
}
if (iPersons > 1)
throw new EnrgiseApplicationException("WFL.WflDOPGrp.noExceedingOne", "E");
if (iPersons < 1)
throw new EnrgiseApplicationException("WFL.WflDOPGrp.noLessthanOne", "E");
}
private void checkUniqueDOPGrpDtl(String sHeaderPrimaryKey, ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
Iterator oIt1 = oDetailBeanArray.iterator();
int rowCount = 1;
while (oIt1.hasNext()) {
WflDOPGrpDtlBean oWflDOPGrpDtlBean = oIt1.next();
if (!EnrgiseUtil.checkString(oWflDOPGrpDtlBean.getEmpId())) {
String sQuery = String.valueOf(" Select id as ID from wfl_dop_group_members a where a.dop_group_id= ").concat(String.valueOf(sHeaderPrimaryKey));
sQuery = String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and a.e_per_dtl_id= "))).concat(String.valueOf(oWflDOPGrpDtlBean.getEmpId()));
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.WflDOPGrp.empNo");
oParams.add(oMessageKey);
oParams.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.workflow.detail.UniqueKeyConstraint", oParams));
}
}
rowCount++;
}
}
private void checkMandatoryDtls(WflDOPGrpDtlBean oWflDOPGrpDtlBean, int count, ArrayList oDetailBeanArray) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDOPGrpDtlBean.getTxtempNo())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WflDOPGrp.empNo");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
reportError(oList);
}
private void checkUniqueHeader(WflDOPGrpHdrBean oWflDOPGrpHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
String sQuery = String.valueOf(String.valueOf(" select t.id from wfl_dop_groups t where t.group_code='").concat(String.valueOf(oWflDOPGrpHdrBean.getGrpCode()))).concat(String.valueOf("'"));
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(oWflDOPGrpHdrBean.getHeaderPrimaryKey()))
throw new EnrgiseApplicationException("wenrgise.common.header.uniqueConstraintViolated", "E");
}
}
}

View File

@@ -0,0 +1,453 @@
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"));
}
}
}

View File

@@ -0,0 +1,824 @@
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.BaseHeaderVO;
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.WflDocMstAttrDtlBean;
import wenrgise.workflow.bean.WflDocMstConditionsDtlBean;
import wenrgise.workflow.bean.WflDocMstHdrBean;
import wenrgise.workflow.bean.WflDtlDocTypeDtlBean;
import wenrgise.workflow.vo.WflDocMstQVO;
public class WflDocMstBO extends BaseBO {
public WflDocMstBO() {}
public WflDocMstBO(UserInfo oUserInfo) {
super(oUserInfo);
}
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
return "saveNewHeaderImpl ille!";
}
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((WflDocMstHdrBean)oBaseHeaderBean);
checkNumericFields((WflDocMstHdrBean)oBaseHeaderBean, oErrorList);
}
if (bDetailDataChanged)
if (sScreenName.equalsIgnoreCase("WflWorkflowConditions")) {
Iterator oIt = oDetailBeanArray.iterator();
int count = 1;
while (oIt.hasNext()) {
WflDocMstConditionsDtlBean oWflDocMstConditionsDtlBean = oIt.next();
if (!oWflDocMstConditionsDtlBean.getStatus().equalsIgnoreCase("D"))
checkMandatoryDtls(oWflDocMstConditionsDtlBean, count, oDetailBeanArray);
count++;
}
} else if (sScreenName.equalsIgnoreCase("WFLDoctAttrDetail")) {
Iterator oIt1 = oDetailBeanArray.iterator();
int count = 1;
while (oIt1.hasNext()) {
WflDocMstAttrDtlBean oWflDocMstAttrDtlBean = oIt1.next();
if (!oWflDocMstAttrDtlBean.getStatus().equalsIgnoreCase("D"))
checkMandatoryDtls(oWflDocMstAttrDtlBean, count, oErrorList);
count++;
}
} else if (sScreenName.equalsIgnoreCase("WflDtlDocType")) {
Iterator oIt1 = oDetailBeanArray.iterator();
int count = 1;
while (oIt1.hasNext()) {
WflDtlDocTypeDtlBean oWflDtlDocTypeDtlBean = oIt1.next();
if (!oWflDtlDocTypeDtlBean.getStatus().equalsIgnoreCase("D"))
checkMandatoryDtlsDocType(oWflDtlDocTypeDtlBean, count, oErrorList);
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 (sScreenName.equalsIgnoreCase("WFLDoctAttrDetail"))
checkUniqueHeader((WflDocMstHdrBean)oBaseHeaderBean);
if (bDetailDataChanged)
if (!sScreenMode.equalsIgnoreCase("D")) {
if (sScreenName.equalsIgnoreCase("WflWorkflowConditions")) {
Iterator oIt1 = oDetailBeanArray.iterator();
checkUniqueMaterialDtl(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oErrorList);
}
if (sScreenName.equalsIgnoreCase("WflDtlDocType")) {
Iterator oIt1 = oDetailBeanArray.iterator();
EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtDtlDocCode", "WFL.WFLDtlDocType.dtlDocCode", oErrorList, true);
checkUniqueDocDtl(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oErrorList);
}
if (sScreenName.equalsIgnoreCase("WFLDoctAttrDetail")) {
EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtAttrName", "WFL.WFLDocAttrDtl.attbName", oErrorList, true);
checkUniqueDocAttrDtl(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailBeanArray, oErrorList);
}
}
reportError(oErrorList);
}
public void initializeBOImpl() {
this.headerTable = "WFL_DOC_TYPE_MST";
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
if (sScreenName.equalsIgnoreCase("WFLDoctAttrDetail")) {
saveWflDocAttrDtls(sHeaderPrimaryKey, oDetailBeanArray);
} else if (sScreenName.equalsIgnoreCase("WflWorkflowConditions")) {
saveWflDocConditionsDtls(sHeaderPrimaryKey, oDetailBeanArray);
} else if (sScreenName.equalsIgnoreCase("WflDtlDocType")) {
saveWflDtlDocTypeDtls(sHeaderPrimaryKey, oDetailBeanArray);
}
}
public RecordMetaInfo getWflDocTypeHdrMetaInfo(WflDocMstQVO oWflDocMstQVO) 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, oWflDocMstQVO.getHeaderPrimaryKey()));
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, "WflDocumentMst.proc_GetWFlDocTypeHdrMetaInfo(?,?,?,?,?,?)");
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 getWflDocTypeHdrInfo(WflDocMstQVO oWflDocMstQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
ArrayList oHeaderList = null;
if (oWflDocMstQVO == null)
oWflDocMstQVO = new WflDocMstQVO();
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, oWflDocMstQVO.getHeaderPrimaryKey()));
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, "WflDocumentMst.proc_GetWFlDocTypeHdrInfo(?,?,?,?,?,?,?)");
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();
WflDocMstHdrBean oWflDocMstHdrBean = new WflDocMstHdrBean();
oWflDocMstHdrBean.setHeaderPrimaryKey(oRow.get("ID").getString());
oWflDocMstHdrBean.setDocumentCode(oRow.get("doc_type_code").getString());
oWflDocMstHdrBean.setDocumentDesc(oRow.get("doc_type_desc").getString());
oWflDocMstHdrBean.setMaxAppLevel(oRow.get("max_aprooval_level").getString());
oHeaderList.add(oWflDocMstHdrBean);
}
return oHeaderList;
}
public RecordMetaInfo getWflDocTypeAttrDtlMetaInfo(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, "WflDocumentMst.proc_GetWFlDocTypeDtlMetaInfo(?,?,?,?,?,?)");
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 getWflDocTypeAttrDtlInfo(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, "WflDocumentMst.proc_GetWFlDocTypeDtlInfo(?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
WflDocMstAttrDtlBean oWflDocMstAttrDtlBean = new WflDocMstAttrDtlBean();
oWflDocMstAttrDtlBean.setDetailId(oRow.get("Id").getString());
oWflDocMstAttrDtlBean.setTxtAttrName(oRow.get("attr_name").getString());
oWflDocMstAttrDtlBean.setTxtType(oRow.get("attr_type").getString());
oWflDocMstAttrDtlBean.setTxtDesc(oRow.get("attr_desc").getString());
oWflDocMstAttrDtlBean.setTxtLovKey(oRow.get("attr_lov_key").getString());
oDtlList.add(oWflDocMstAttrDtlBean);
}
return oDtlList;
}
public RecordMetaInfo getWflDocTypeConditionsDtlMetaInfo(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, "WflDocumentMst.proc_GetWFlDocCondDtlMetaInfo(?,?,?,?,?,?)");
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 getWflDocTypeConditionsDtlInfo(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, "WflDocumentMst.proc_GetWFlDocCondDtlInfo(?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
WflDocMstConditionsDtlBean oWflDocMstConditionsDtlBean = new WflDocMstConditionsDtlBean();
oWflDocMstConditionsDtlBean.setDetailId(oRow.get("Id").getString());
oWflDocMstConditionsDtlBean.setDocTypeDtlDesc(oRow.get("condition_desc").getString());
oWflDocMstConditionsDtlBean.setConditionExpression(oRow.get("condition_expression").getString());
oDtlList.add(oWflDocMstConditionsDtlBean);
}
return oDtlList;
}
public RecordMetaInfo getDtlDocTypeMetaInfo(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, "WflDocumentMst.proc_GetDtlDocTypeMetaInfo(?,?,?,?,?,?)");
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 getDtlDocTypeInfo(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, "WflDocumentMst.proc_DtlDocTypeInfo(?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
WflDtlDocTypeDtlBean oWflDtlDocTypeDtlBean = new WflDtlDocTypeDtlBean();
oWflDtlDocTypeDtlBean.setDetailId(oRow.get("Id").getString());
oWflDtlDocTypeDtlBean.setTxtDtlDocCode(oRow.get("doc_dtl_code").getString());
oWflDtlDocTypeDtlBean.setTxtDtlDocDesc(oRow.get("doc_dtl_desc").getString());
oWflDtlDocTypeDtlBean.setTxtConditionId(oRow.get("condition_id").getString());
oWflDtlDocTypeDtlBean.setTxtPriority(oRow.get("priority").getString());
oWflDtlDocTypeDtlBean.setTxtExp(oRow.get("condition_expression").getString());
oWflDtlDocTypeDtlBean.setTxtConDesc(oRow.get("condition_desc").getString());
oWflDtlDocTypeDtlBean.setDisabbutCondDesc("true");
oDtlList.add(oWflDtlDocTypeDtlBean);
}
return oDtlList;
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
String returnString = null;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
WflDocMstHdrBean oWflDocMstHdrBean = (WflDocMstHdrBean)oBaseHeaderBean;
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, oWflDocMstHdrBean.getDocumentCode()));
oParameters.add(new DBObject(4, 1, 12, oWflDocMstHdrBean.getDocumentDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDocMstHdrBean.getMaxAppLevel()));
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()));
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, "WflDocumentMst.proc_UpsertWflDocTypeMstHdr(?,?,?,?,?,?,?,?,?,?,?,?)");
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, oWflDocMstHdrBean.getHeaderPrimaryKey()));
oParameters.add(new DBObject(3, 1, 12, oWflDocMstHdrBean.getDocumentCode()));
oParameters.add(new DBObject(4, 1, 12, oWflDocMstHdrBean.getDocumentDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDocMstHdrBean.getMaxAppLevel()));
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, "WflDocumentMst.proc_UpsertWflDocTypeMstHdr(?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
} else if (ScreenMode.equalsIgnoreCase("D")) {
oParameters.add(new DBObject(1, 1, 12, oWflDocMstHdrBean.getHeaderPrimaryKey()));
ArrayList oOutArray = oBean.callProc(oParameters, "WflDocumentMst.proc_DeleteWflDocTypeMstHdr(?)");
}
return returnString;
}
private void saveWflDocAttrDtls(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()) {
WflDocMstAttrDtlBean oWflDocMstAttrDtlBean = oIt.next();
if (oWflDocMstAttrDtlBean.getStatus().equals("N")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflDocumentMst.proc_UpsertWflDocMstAttrDtl(?,?,?,?,?,?,?,?,?,?)");
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, oWflDocMstAttrDtlBean.getTxtAttrName()));
oParameters.add(new DBObject(5, 1, 12, oWflDocMstAttrDtlBean.getTxtDesc()));
oParameters.add(new DBObject(6, 1, 12, oWflDocMstAttrDtlBean.getTxtType()));
oParameters.add(new DBObject(7, 1, 12, oWflDocMstAttrDtlBean.getTxtLovKey()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDocMstAttrDtlBean.getStatus().equals("U")) {
if (!bUpdate) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflDocumentMst.proc_UpsertWflDocMstAttrDtl(?,?,?,?,?,?,?,?,?,?)");
bUpdate = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWflDocMstAttrDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
oParameters.add(new DBObject(4, 1, 12, oWflDocMstAttrDtlBean.getTxtAttrName()));
oParameters.add(new DBObject(5, 1, 12, oWflDocMstAttrDtlBean.getTxtDesc()));
oParameters.add(new DBObject(6, 1, 12, oWflDocMstAttrDtlBean.getTxtType()));
oParameters.add(new DBObject(7, 1, 12, oWflDocMstAttrDtlBean.getTxtLovKey()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDocMstAttrDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("WflDocumentMst.proc_DeleteWflDocMstAttrDtl(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflDocMstAttrDtlBean.getDetailId()));
oBean1.addToBatch(oParameters);
}
}
if (bInsert)
oBean.executeBatch();
if (bUpdate)
oBean.executeBatch();
if (bDelete)
oBean1.executeBatch();
}
private void saveWflDocConditionsDtls(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()) {
WflDocMstConditionsDtlBean oWflDocMstConditionsDtlBean = oIt.next();
if (oWflDocMstConditionsDtlBean.getStatus().equals("N")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflDocumentMst.proc_UpsertWflDocMstCondDtl(?,?,?,?,?,?,?,?)");
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, oWflDocMstConditionsDtlBean.getDocTypeDtlDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDocMstConditionsDtlBean.getConditionExpression()));
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 (oWflDocMstConditionsDtlBean.getStatus().equals("U")) {
if (!bUpdate) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflDocumentMst.proc_UpsertWflDocMstCondDtl(?,?,?,?,?,?,?,?)");
bUpdate = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWflDocMstConditionsDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
oParameters.add(new DBObject(4, 1, 12, oWflDocMstConditionsDtlBean.getDocTypeDtlDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDocMstConditionsDtlBean.getConditionExpression()));
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 (oWflDocMstConditionsDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("WflDocumentMst.proc_DeleteWflDocMstCondDtl(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflDocMstConditionsDtlBean.getDetailId()));
oBean1.addToBatch(oParameters);
}
}
if (bInsert)
oBean.executeBatch();
if (bUpdate)
oBean.executeBatch();
if (bDelete)
oBean1.executeBatch();
}
private void saveWflDtlDocTypeDtls(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()) {
WflDtlDocTypeDtlBean oWflDtlDocTypeDtlBean = oIt.next();
if (oWflDtlDocTypeDtlBean.getStatus().equals("N")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflDocumentMst.proc_UpsertWflDtlDocTypeDtls(?,?,?,?,?,?,?,?,?)");
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, oWflDtlDocTypeDtlBean.getTxtDtlDocCode()));
oParameters.add(new DBObject(4, 1, 12, oWflDtlDocTypeDtlBean.getTxtDtlDocDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDtlDocTypeDtlBean.getTxtConditionId()));
oParameters.add(new DBObject(6, 1, 12, oWflDtlDocTypeDtlBean.getTxtPriority()));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDtlDocTypeDtlBean.getStatus().equals("U")) {
if (!bUpdate) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflDocumentMst.proc_UpsertWflDtlDocTypeDtls(?,?,?,?,?,?,?,?,?)");
bUpdate = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWflDtlDocTypeDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, oWflDtlDocTypeDtlBean.getTxtDtlDocCode()));
oParameters.add(new DBObject(4, 1, 12, oWflDtlDocTypeDtlBean.getTxtDtlDocDesc()));
oParameters.add(new DBObject(5, 1, 12, oWflDtlDocTypeDtlBean.getTxtConditionId()));
oParameters.add(new DBObject(6, 1, 12, oWflDtlDocTypeDtlBean.getTxtPriority()));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWflDtlDocTypeDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("WflDocumentMst.proc_DeleteWflDtlDocTypeDtls(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflDtlDocTypeDtlBean.getDetailId()));
oBean1.addToBatch(oParameters);
}
}
if (bInsert)
oBean.executeBatch();
if (bUpdate)
oBean.executeBatch();
if (bDelete)
oBean1.executeBatch();
}
public LovVO getWflDocCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "Select distinct wdtm.id as Id,wdtm.doc_type_code as doc_type_code,wdtm.DOC_TYPE_DESC as DOC_TYPE_DESC,wdtm.max_aprooval_level as max_aprooval_level from wfl_doc_type_mst wdtm";
if (oLovQueryVO.getSearchField1() != null)
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" where upper(wdtm.doc_type_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.WFLDocAttrDtl.documentCode");
oHeaderList.add("WFL.WFLDocAttrDtl.documentDesc");
oHeaderList.add("WFL.WFLDocAttrDtl.maxAppLevel");
oLovVO.setHeaderList(oHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("V");
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_type_code").getString());
oLOVBean.setDetailField3(oRow.get("DOC_TYPE_DESC").getString());
oLOVBean.setDetailField4(oRow.get("max_aprooval_level").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public LovVO getWflDtlDocCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = String.valueOf("select wc.id,wc.condition_desc,wc.condition_expression from wfl_condition wc where wc.doc_type_hdr_id=").concat(String.valueOf(oLovQueryVO.getProperty("documentId")));
if (oLovQueryVO.getSearchField1() != null)
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wc.condition_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.WFLDtlDocType.conditionDesc");
oHeaderList.add("WFL.WFLDtlDocType.exp");
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("condition_desc").getString());
oLOVBean.setDetailField3(oRow.get("condition_expression").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
private void checkMandatoryDtls(WflDocMstConditionsDtlBean oWflDocMstConditionsDtlBean, int count, ArrayList oDetailBeanArray) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDocMstConditionsDtlBean.getDocTypeDtlDesc())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("wfl.WorkFlowConditions.docDtlDesc");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDocMstConditionsDtlBean.getConditionExpression())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("wfl.WorkFlowConditions.condExp");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
reportError(oList);
}
private void checkMandatoryHdr(WflDocMstHdrBean oWflDocMstHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDocMstHdrBean.getDocumentCode())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDocAttrDtl.documentCode");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryfieldmissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDocMstHdrBean.getDocumentDesc())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDocAttrDtl.documentDesc");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryfieldmissing", oParam, "E"));
}
reportError(oList);
}
private void checkMandatoryDtls(WflDocMstAttrDtlBean oWflDocMstAttrDtlBean, int count, ArrayList oDetailBeanArray) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDocMstAttrDtlBean.getTxtAttrName())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDocAttrDtl.attbName");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDocMstAttrDtlBean.getTxtType())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDocAttrDtl.type");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
reportError(oList);
}
private void checkNumericFields(WflDocMstHdrBean oWflDocMstHdrBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
if (!EnrgiseUtil.checkNumber(oWflDocMstHdrBean.getMaxAppLevel(), 10, 4, "P")) {
MessageKey oMessageKey = new MessageKey("WFL.WFLDocAttrDtl.maxAppLevel");
ArrayList oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.invalidNumber", oParams));
}
}
private void checkUniqueMaterialDtl(String sHeaderPrimaryKey, ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
Iterator oIt1 = oDetailBeanArray.iterator();
int rowCount = 1;
while (oIt1.hasNext()) {
WflDocMstConditionsDtlBean oWflDocMstConditionsDtlBean = oIt1.next();
if (!EnrgiseUtil.checkString(oWflDocMstConditionsDtlBean.getDetailId())) {
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select ID as ID from wfl_condition where CONDITION_DESC= '").concat(String.valueOf(oWflDocMstConditionsDtlBean.getDocTypeDtlDesc()))).concat(String.valueOf("' and CONDITION_EXPRESSION='"))).concat(String.valueOf(oWflDocMstConditionsDtlBean.getConditionExpression()))).concat(String.valueOf("' "));
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.WorkFlowConditions.docDtlDesc");
MessageKey oMessageKey1 = new MessageKey("wfl.WorkFlowConditions.condExp");
oParams.add(oMessageKey);
oParams.add(oMessageKey1);
oParams.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.workflow.detail.UniqueKeyConstraint", oParams));
}
}
rowCount++;
}
}
private void checkMandatoryDtlsDocType(WflDtlDocTypeDtlBean oWflDtlDocTypeDtlBean, int count, ArrayList oDetailBeanArray) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWflDtlDocTypeDtlBean.getTxtDtlDocCode())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocType.dtlDocCode");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDtlDocTypeDtlBean.getTxtDtlDocDesc())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocType.dtlDocDesc");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDtlDocTypeDtlBean.getTxtConDesc())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocType.conditionDesc");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWflDtlDocTypeDtlBean.getTxtExp())) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocType.exp");
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryfieldmissing", oParam, "E"));
}
reportError(oList);
}
private void checkUniqueDocDtl(String sHeaderPrimaryKey, ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
Iterator oIt1 = oDetailBeanArray.iterator();
int rowCount = 1;
while (oIt1.hasNext()) {
WflDtlDocTypeDtlBean oWflDtlDocTypeDtlBean = oIt1.next();
if (!EnrgiseUtil.checkString(oWflDtlDocTypeDtlBean.getTxtDtlDocCode())) {
String sQuery = String.valueOf(String.valueOf(String.valueOf(" select a.id as Id from wfl_doc_type_dtl a where a.id= ").concat(String.valueOf(sHeaderPrimaryKey))).concat(String.valueOf(" and a.doc_dtl_code="))).concat(String.valueOf(oWflDtlDocTypeDtlBean.getTxtDtlDocCode()));
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.WFLDtlDocType.dtlDocCode");
oParams.add(oMessageKey);
oParams.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.workflow.detail.UniqueKeyConstraint", oParams));
}
}
rowCount++;
}
}
private void checkUniqueDocAttrDtl(String sHeaderPrimaryKey, ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
int rowCount = 1;
Iterator oIt1 = oDetailBeanArray.iterator();
while (oIt1.hasNext()) {
WflDocMstAttrDtlBean oWflDocMstAttrDtlBean = oIt1.next();
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf("select t.id from wfl_doc_attributes t where t.doc_type_hdr_id=").concat(String.valueOf(sHeaderPrimaryKey))).concat(String.valueOf(" and t.attr_name='"))).concat(String.valueOf(oWflDocMstAttrDtlBean.getTxtAttrName()))).concat(String.valueOf("'"));
System.out.println(sQuery);
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(oWflDocMstAttrDtlBean.getDetailId())) {
ArrayList oParams = new ArrayList();
MessageKey oMessageKey = new MessageKey("WFL.WFLDtlDocType.dtlDocCode");
oParams.add(oMessageKey);
oParams.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.workflow.detail.UniqueKeyConstraint", oParams));
}
}
rowCount++;
}
}
private void checkUniqueHeader(WflDocMstHdrBean oWflDocMstHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
String sQuery = String.valueOf(String.valueOf(" select t.id from wfl_doc_type_mst t where t.doc_type_code='").concat(String.valueOf(oWflDocMstHdrBean.getDocumentCode()))).concat(String.valueOf("'"));
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(oWflDocMstHdrBean.getHeaderPrimaryKey()))
throw new EnrgiseApplicationException("wenrgise.common.header.uniqueConstraintViolated", "E");
}
}
}

View File

@@ -0,0 +1,706 @@
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.WFLRouteDtlBean;
import wenrgise.workflow.bean.WFLRouteHdrBean;
import wenrgise.workflow.bean.WFLTransDtlBean;
import wenrgise.workflow.vo.WflRouteDtlQVO;
public class WflRouteDtlBO extends BaseBO {
public WflRouteDtlBO() {}
public WflRouteDtlBO(UserInfo oUserInfo) {
super(oUserInfo);
}
public RecordMetaInfo getWFLRouteDtlMetaInfo(WflRouteDtlQVO oWflRouteDtlQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflRouteDtlQVO.getDtlDocId()));
oParameters.add(new DBObject(2, 1, 12, oWflRouteDtlQVO.getActivityId()));
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, "WflRouteInfo.proc_GetRouteDtlMetaInfo(?,?,?,?,?,?,?)");
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 getWFLRouteDtlInfo(WflRouteDtlQVO oWflRouteDtlQVO, 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, oWflRouteDtlQVO.getDtlDocId()));
oParameters.add(new DBObject(4, 1, 12, oWflRouteDtlQVO.getActivityId()));
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, "WflRouteInfo.proc_GetRouteDtlInfo(?,?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
WFLRouteDtlBean oWFLRouteDtlBean = new WFLRouteDtlBean();
oWFLRouteDtlBean.setDetailId(oRow.get("id").getString());
oWFLRouteDtlBean.setTxtEmpId(oRow.get("e_per_dtl_id").getString());
oWFLRouteDtlBean.setTxtReptHead(oRow.get("rept_head").getString());
oWFLRouteDtlBean.setTxtEmp(oRow.get("emp_no").getString());
oWFLRouteDtlBean.setTxtClassId(oRow.get("class_id").getString());
oWFLRouteDtlBean.setTxtClassCode(oRow.get("class_code").getString());
oWFLRouteDtlBean.setTxtDeptId(oRow.get("deptId").getString());
oWFLRouteDtlBean.setTxtDept(oRow.get("deptCode").getString());
oWFLRouteDtlBean.setTxtGrpId(oRow.get("wfl_group_id").getString());
oWFLRouteDtlBean.setTxtGroup(oRow.get("group_code").getString());
oWFLRouteDtlBean.setTxtLane(oRow.get("lane").getString());
oWFLRouteDtlBean.setTxtLevel(oRow.get("level_number").getString());
oWFLRouteDtlBean.setTxtFlag(oRow.get("split_join_flg").getString());
oWFLRouteDtlBean.setTxtHlevel(oRow.get("hierarchy_level").getString());
oWFLRouteDtlBean.setTxtNotifFlag(oRow.get("notification_flag").getString());
oDtlList.add(oWFLRouteDtlBean);
}
return oDtlList;
}
public RecordMetaInfo getWFLTransDtlMetaInfo(WflRouteDtlQVO oWflRouteDtlQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWflRouteDtlQVO.getDtlDocId()));
oParameters.add(new DBObject(2, 1, 12, oWflRouteDtlQVO.getActivityId()));
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, "WflRouteInfo.proc_GetRouteTransMetaInfo(?,?,?,?,?,?,?)");
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 getWFLTransDtlInfo(WflRouteDtlQVO oWflRouteDtlQVO, 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, oWflRouteDtlQVO.getDtlDocId()));
oParameters.add(new DBObject(4, 1, 12, oWflRouteDtlQVO.getActivityId()));
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, "WflRouteInfo.proc_GetRouteTransInfo(?,?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
WFLTransDtlBean oWFLTransDtlBean = new WFLTransDtlBean();
oWFLTransDtlBean.setDetailId(oRow.get("Id").getString());
oWFLTransDtlBean.setTxtFromRootDtlId(oRow.get("routeFromId").getString());
oWFLTransDtlBean.setTxtToRootDtlId(oRow.get("routeToId").getString());
oWFLTransDtlBean.setTxtFLevel(oRow.get("fromLevel").getString());
oWFLTransDtlBean.setTxtTLevel(oRow.get("toLevel").getString());
oWFLTransDtlBean.setTxtFlane(oRow.get("fromLane").getString());
oWFLTransDtlBean.setTxtTLane(oRow.get("toLane").getString());
oWFLTransDtlBean.setTxtConditionId(oRow.get("wfl_condition_hdr_id").getString());
oWFLTransDtlBean.setTxtCDesc(oRow.get("condition_desc").getString());
oWFLTransDtlBean.setTxtCValue(oRow.get("wfl_condition_value").getString());
oDtlList.add(oWFLTransDtlBean);
}
return oDtlList;
}
public void initializeBOImpl() {
this.headerTable = "WFL_ROUTE_DTL";
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
return null;
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {}
public void saveDetailImpl(BaseHeaderBean oBaseHeaderBean, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
if (sScreenName.equalsIgnoreCase("WFLRouteCodeDtl"))
saveRouteDtls(oBaseHeaderBean, oDetailBeanArray);
if (sScreenName.equalsIgnoreCase("WFLRouteTransDtl"))
saveRouteTransDtls(oBaseHeaderBean, oDetailBeanArray);
}
public void saveRouteDtls(BaseHeaderBean oBaseHeaderBean, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
WFLRouteHdrBean oWFLRouteHdrBean = (WFLRouteHdrBean)oBaseHeaderBean;
boolean bUpsert = false;
boolean bDelete = false;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = null;
DBUtilitiesBean oBean1 = null;
Iterator oIt = oDetailBeanArray.iterator();
while (oIt.hasNext()) {
WFLRouteDtlBean oWFLRouteDtlBean = oIt.next();
if (oWFLRouteDtlBean.getStatus().equals("N")) {
if (!bUpsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflRouteInfo.proc_UpsertWflRouteDtl(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
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, oWFLRouteHdrBean.getActivityId()));
oParameters.add(new DBObject(4, 1, 12, oWFLRouteHdrBean.getDtlDocId()));
oParameters.add(new DBObject(5, 1, 12, oWFLRouteDtlBean.getTxtLane()));
oParameters.add(new DBObject(6, 1, 12, oWFLRouteDtlBean.getTxtLevel()));
oParameters.add(new DBObject(7, 1, 12, oWFLRouteDtlBean.getTxtEmpId()));
oParameters.add(new DBObject(8, 1, 12, oWFLRouteDtlBean.getTxtGrpId()));
oParameters.add(new DBObject(9, 1, 12, oWFLRouteDtlBean.getTxtClassId()));
oParameters.add(new DBObject(10, 1, 12, oWFLRouteDtlBean.getTxtHlevel()));
oParameters.add(new DBObject(11, 1, 12, oWFLRouteDtlBean.getTxtDeptId()));
oParameters.add(new DBObject(12, 1, 12, oWFLRouteDtlBean.getTxtFlag()));
oParameters.add(new DBObject(13, 1, 12, oWFLRouteDtlBean.getTxtNotifFlag()));
oParameters.add(new DBObject(14, 1, 12, oWFLRouteDtlBean.getTxtReptHead()));
oParameters.add(new DBObject(15, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(16, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(17, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWFLRouteDtlBean.getStatus().equals("U")) {
if (!bUpsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflRouteInfo.proc_UpsertWflRouteDtl(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
bUpsert = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWFLRouteDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, oWFLRouteHdrBean.getActivityId()));
oParameters.add(new DBObject(4, 1, 12, oWFLRouteHdrBean.getDtlDocId()));
oParameters.add(new DBObject(5, 1, 12, oWFLRouteDtlBean.getTxtLane()));
oParameters.add(new DBObject(6, 1, 12, oWFLRouteDtlBean.getTxtLevel()));
oParameters.add(new DBObject(7, 1, 12, oWFLRouteDtlBean.getTxtEmpId()));
oParameters.add(new DBObject(8, 1, 12, oWFLRouteDtlBean.getTxtGrpId()));
oParameters.add(new DBObject(9, 1, 12, oWFLRouteDtlBean.getTxtClassId()));
oParameters.add(new DBObject(10, 1, 12, oWFLRouteDtlBean.getTxtHlevel()));
oParameters.add(new DBObject(11, 1, 12, oWFLRouteDtlBean.getTxtDeptId()));
oParameters.add(new DBObject(12, 1, 12, oWFLRouteDtlBean.getTxtFlag()));
oParameters.add(new DBObject(13, 1, 12, oWFLRouteDtlBean.getTxtNotifFlag()));
oParameters.add(new DBObject(14, 1, 12, oWFLRouteDtlBean.getTxtReptHead()));
oParameters.add(new DBObject(15, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(16, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(17, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWFLRouteDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("WflRouteInfo.proc_DeleteWflRouteDtl(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWFLRouteDtlBean.getDetailId()));
oBean1.addToBatch(oParameters);
}
}
if (bUpsert)
oBean.executeBatch();
if (bDelete)
oBean1.executeBatch();
}
public void saveRouteTransDtls(BaseHeaderBean oBaseHeaderBean, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
WFLRouteHdrBean oWFLRouteHdrBean = (WFLRouteHdrBean)oBaseHeaderBean;
boolean bUpsert = false;
boolean bDelete = false;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = null;
DBUtilitiesBean oBean1 = null;
Iterator oIt = oDetailBeanArray.iterator();
while (oIt.hasNext()) {
WFLTransDtlBean oWFLTransDtlBean = oIt.next();
if (oWFLTransDtlBean.getStatus().equals("N")) {
if (!bUpsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflRouteInfo.proc_UpsertWflTransDtl(?,?,?,?,?,?,?,?,?,?)");
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, oWFLRouteHdrBean.getActivityId()));
oParameters.add(new DBObject(4, 1, 12, oWFLTransDtlBean.getTxtFromRootDtlId()));
oParameters.add(new DBObject(5, 1, 12, oWFLTransDtlBean.getTxtToRootDtlId()));
oParameters.add(new DBObject(6, 1, 12, oWFLTransDtlBean.getTxtConditionId()));
oParameters.add(new DBObject(7, 1, 12, oWFLTransDtlBean.getTxtCValue()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWFLTransDtlBean.getStatus().equals("U")) {
if (!bUpsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("WflRouteInfo.proc_UpsertWflTransDtl(?,?,?,?,?,?,?,?,?,?)");
bUpsert = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWFLTransDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, oWFLRouteHdrBean.getActivityId()));
oParameters.add(new DBObject(4, 1, 12, oWFLTransDtlBean.getTxtFromRootDtlId()));
oParameters.add(new DBObject(5, 1, 12, oWFLTransDtlBean.getTxtToRootDtlId()));
oParameters.add(new DBObject(6, 1, 12, oWFLTransDtlBean.getTxtConditionId()));
oParameters.add(new DBObject(7, 1, 12, oWFLTransDtlBean.getTxtCValue()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oWFLTransDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("WflRouteInfo.proc_DeleteWflTransDtl(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oWFLTransDtlBean.getDetailId()));
oBean1.addToBatch(oParameters);
}
}
if (bUpsert)
oBean.executeBatch();
if (bDelete)
oBean1.executeBatch();
}
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();
WFLRouteHdrBean oWFLRouteHdrBean = (WFLRouteHdrBean)oBaseHeaderBean;
if (bDetailDataChanged) {
if (sScreenName.equalsIgnoreCase("WFLRouteCodeDtl")) {
String sCompositeKey = "txtLane".concat(",").concat("txtLevel");
String[] sFieldName = sCompositeKey.split(",");
Iterator oIt1 = oDetailBeanArray.iterator();
while (oIt1.hasNext()) {
WFLRouteDtlBean oWFLRouteDtlBean = oIt1.next();
if (!oWFLRouteDtlBean.getStatus().equalsIgnoreCase("D"));
reportError(oErrorList);
}
}
if (sScreenName.equalsIgnoreCase("WFLRouteTransDtl")) {
String sCompositeKey = "txtFlane".concat(",").concat("txtTLane");
String[] sFieldName = sCompositeKey.split(",");
Iterator oIt1 = oDetailBeanArray.iterator();
while (oIt1.hasNext()) {
WFLTransDtlBean oWFLTransDtlBean = oIt1.next();
if (!oWFLTransDtlBean.getStatus().equalsIgnoreCase("D"));
reportError(oErrorList);
}
}
}
}
private void checkUniqueTransDtl(WFLRouteHdrBean oWFLRouteHdrBean, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
int count = 0;
Iterator oIt1 = oDetailBeanArray.iterator();
while (oIt1.hasNext()) {
WFLTransDtlBean oWFLTransDtlBean = oIt1.next();
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select wt.id from wfl_transitions wt where wt.route_from_id='").concat(String.valueOf(oWFLTransDtlBean.getTxtFromRootDtlId()))).concat(String.valueOf("' and wt.route_to_id ='"))).concat(String.valueOf(oWFLTransDtlBean.getTxtToRootDtlId()))).concat(String.valueOf("' "));
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(oWFLTransDtlBean.getDetailId()))
throw new EnrgiseApplicationException("wenrgise.common.detail.uniqueConstraintViolated");
}
}
}
private void checkUniqueRouteDtl(WFLRouteHdrBean oWFLRouteHdrBean, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
int count = 0;
Iterator oIt1 = oDetailBeanArray.iterator();
while (oIt1.hasNext()) {
WFLRouteDtlBean oWFLRouteDtlBean = oIt1.next();
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select wrd.id from wfl_route_dtl wrd where wrd.lane='").concat(String.valueOf(oWFLRouteDtlBean.getTxtLane()))).concat(String.valueOf("' and wrd.level_number='"))).concat(String.valueOf(oWFLRouteDtlBean.getTxtLevel()))).concat(String.valueOf("' and wrd.dtl_doc_id='"))).concat(String.valueOf(oWFLRouteHdrBean.getDtlDocId()))).concat(String.valueOf("' and wrd.activity_id='"))).concat(String.valueOf(oWFLRouteHdrBean.getActivityId()))).concat(String.valueOf("' "));
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(oWFLRouteDtlBean.getDetailId()))
throw new EnrgiseApplicationException("wenrgise.common.detail.uniqueConstraintViolated");
}
}
}
public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
WFLRouteHdrBean oWFLRouteHdrBean = (WFLRouteHdrBean)oBaseHeaderBean;
ArrayList oErrorList = new ArrayList();
if (bHeaderDataChanged)
if (!sScreenMode.equalsIgnoreCase("D"))
checkMandatoryHeader(oWFLRouteHdrBean);
if (bDetailDataChanged) {
if (sScreenName.equalsIgnoreCase("WFLRouteTransDtl")) {
Iterator oIt1 = oDetailBeanArray.iterator();
int rowCount = 1;
while (oIt1.hasNext()) {
WFLTransDtlBean oWFLTransDtlBean = oIt1.next();
if (!oWFLTransDtlBean.getStatus().equalsIgnoreCase("D")) {
checkMandatoryTransDtls(oWFLTransDtlBean, rowCount);
checkforNumericfields(oWFLTransDtlBean, rowCount);
rowCount++;
}
}
}
if (sScreenName.equalsIgnoreCase("WFLRouteCodeDtl")) {
Iterator oIt1 = oDetailBeanArray.iterator();
int rowCount = 1;
while (oIt1.hasNext()) {
WFLRouteDtlBean oWFLRouteDtlBean = oIt1.next();
if (!oWFLRouteDtlBean.getStatus().equalsIgnoreCase("D")) {
checkMandatoryRouteDtls(oWFLRouteDtlBean, rowCount);
checkforNumericfields(oWFLRouteDtlBean, rowCount);
rowCount++;
}
}
}
}
}
private void checkMandatoryHeader(WFLRouteHdrBean oWFLRouteHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oList = new ArrayList();
if (!EnrgiseUtil.checkString(oWFLRouteHdrBean.getDtlDocId())) {
MessageKey oMessageKey = new MessageKey("WFL.TransDtl.dtlDocCode");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWFLRouteHdrBean.getActivityId())) {
MessageKey oMessageKey = new MessageKey("WFL.TransDtl.actCode");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParam, "E"));
}
reportError(oList);
}
private void checkMandatoryTransDtls(WFLTransDtlBean oWFLTransDtlBean, int rowCount) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oErrorList = new ArrayList();
if (!EnrgiseUtil.checkString(oWFLTransDtlBean.getTxtFromRootDtlId())) {
MessageKey oMessageKey = new MessageKey("WFL.TransDtl.fLane");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWFLTransDtlBean.getTxtToRootDtlId())) {
ArrayList oParams = new ArrayList();
oParams.add("WFL.TransDtl.tLane");
MessageKey oMessageKey = new MessageKey("ivm.IVMMaterialReturnNote.materialCode");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
reportError(oErrorList);
}
private void checkMandatoryRouteDtls(WFLRouteDtlBean oWFLRouteDtlBean, int rowCount) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oErrorList = new ArrayList();
if (!EnrgiseUtil.checkString(oWFLRouteDtlBean.getTxtLane())) {
MessageKey oMessageKey = new MessageKey("WFL.RouteDtl.lane");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oWFLRouteDtlBean.getTxtLevel())) {
MessageKey oMessageKey = new MessageKey("WFL.RouteDtl.level");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
reportError(oErrorList);
}
private void checkforNumericfields(WFLRouteDtlBean oWFLRouteDtlBean, int rowCount) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oErrList = new ArrayList();
if (!EnrgiseUtil.checkNumber(oWFLRouteDtlBean.getTxtLane(), 3, 0, "NN")) {
MessageKey oMessageKey = new MessageKey("WFL.RouteDtl.lane");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.nonnumeric", oParam));
}
if (!EnrgiseUtil.checkNumber(oWFLRouteDtlBean.getTxtLevel(), 3, 0, "NN")) {
MessageKey oMessageKey = new MessageKey("WFL.RouteDtl.level");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.nonnumeric", oParam));
}
reportError(oErrList);
}
private void checkforNumericfields(WFLTransDtlBean oWFLTransDtlBean, int rowCount) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oErrList = new ArrayList();
if (!EnrgiseUtil.checkNumber(oWFLTransDtlBean.getTxtCValue(), 3, 0, "NN")) {
MessageKey oMessageKey = new MessageKey("WFL.TransDtl.cValue");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.nonnumeric", oParam));
}
reportError(oErrList);
}
public LovVO getWflDocDtlQLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "select distinct wt.activity_id,wdtd.id as dtl_doc_id,wdtd.doc_dtl_code,wdtd.doc_dtl_desc,wam.activity_code,wam.activity_desc from wfl_transitions wt,wfl_activity_mst wam,wfl_route_dtl wrd,wfl_doc_type_dtl wdtd where wam.id = wt.activity_id and wt.route_from_id = wrd.id and wrd.dtl_doc_id=wdtd.id ";
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(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.TransDtl.actCode");
oHeaderList.add("WFL.TransDtl.actCodeDesc");
oHeaderList.add("");
oHeaderList.add("WFL.TransDtl.dtlDocCode");
oHeaderList.add("WFL.TransDtl.dtlDocDesc");
oLovVO.setHeaderList(oHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("V");
arylstVisibility.add("V");
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("activity_id").getString());
oLOVBean.setDetailField2(oRow.get("activity_code").getString());
oLOVBean.setDetailField3(oRow.get("activity_desc").getString());
oLOVBean.setDetailField4(oRow.get("dtl_doc_id").getString());
oLOVBean.setDetailField5(oRow.get("doc_dtl_code").getString());
oLOVBean.setDetailField6(oRow.get("doc_dtl_desc").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public LovVO getWflDocDtlIdNLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "select wdtd.id,wdtd.doc_dtl_code,wdtd.doc_dtl_desc from wfl_doc_type_dtl wdtd ";
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.TransDtl.dtlDocCode");
oHeaderList.add("WFL.TransDtl.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 getWflActIdNLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "select wam.id,wam.activity_code,wam.activity_desc from Wfl_Activity_Mst wam ";
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.getSearchField2()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wam.activity_desc) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField2()))).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.TransDtl.actCode");
oHeaderList.add("WFL.TransDtl.actCodeDesc");
oLovVO.setHeaderList(oHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("H");
arylstVisibility.add("V");
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_code").getString());
oLOVBean.setDetailField3(oRow.get("activity_desc").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public LovVO getWflRouteDtlLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = String.valueOf(String.valueOf("select wrd.id,wrd.lane,wrd.level_number,wam.activity_code from wfl_route_dtl wrd,wfl_activity_mst wam where wrd.dtl_doc_id='").concat(String.valueOf(oLovQueryVO.getProperty("dtlDocId")))).concat(String.valueOf("' and wrd.activity_id=wam.id "));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wrd.lane) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField2()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wrd.level_number) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField2()))).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.TransDtl.fLane");
oHeaderList.add("WFL.TransDtl.fLevel");
oHeaderList.add("WFL.TransDtl.actCode");
oLovVO.setHeaderList(oHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("V");
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("lane").getString());
oLOVBean.setDetailField3(oRow.get("level_number").getString());
oLOVBean.setDetailField4(oRow.get("activity_code").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public LovVO getWflConditionLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
String sQuery = "select distinct wc.id, wc.condition_expression,wc.condition_desc from wfl_condition wc, wfl_doc_type_dtl wdtd, wfl_condition wc2 ";
sQuery = String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" where wc.doc_type_hdr_id = wc2.doc_type_hdr_id and wdtd.condition_id = wc2.id and wdtd.id ="))).concat(String.valueOf(oLovQueryVO.getProperty("dtlDocId")));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(wc.condition_expression) 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.TransDtl.cDesc");
oHeaderList.add("WFL.TransDtl.cValue");
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("condition_desc").getString());
oLOVBean.setDetailField3(oRow.get("condition_expression").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
}

View File

@@ -0,0 +1,3 @@
package wenrgise.workflow.ejb.business;
public class WorkFlowBaseBO {}

View File

@@ -0,0 +1,285 @@
package wenrgise.workflow.ejb.business;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.logging.Logger;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.EnrgiseUtil;
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.workflow.bean.WflDtlsHdrBean;
import wenrgise.workflow.bean.WflWorkListBean;
import wenrgise.workflow.core.WflDocumentInfo;
import wenrgise.workflow.core.WflResource;
public class WorkFlowCommonBO extends WorkFlowBaseBO {
public static final Logger log = Logger.getLogger("wenrgise.workflow.ejb.business.WorkFlowCommonBO");
public String getMailAddress(String sEmpId) {
String sMail = "kolkata.confroom@tcs.com";
DBUtilitiesBean oBean = new DBUtilitiesBean();
try {
if (EnrgiseUtil.checkString(sEmpId) == false) {
log.severe("Employee Id is null");
return sMail;
}
ArrayList oList = oBean.executeQuery(String.valueOf("SELECT email FROM HRM_EMP_PERS WHERE id = ").concat(String.valueOf(sEmpId)));
if (null != oList && oList.size() > 0) {
QueryRow oRow = oList.get(0);
sMail = oRow.get("EMAIL").getString();
log.severe(String.valueOf("E mail id is ").concat(String.valueOf(sMail)));
}
return sMail;
} catch (EnrgiseSystemException oSx) {
log.severe(String.valueOf(String.valueOf(oSx.getClass().getName()).concat(String.valueOf(" "))).concat(String.valueOf(oSx.getMessage())));
return sMail;
}
}
public UserInfo getLoginUserInfo(String sEmpNo, String sSiteId) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
ArrayList arylstOutArray = new ArrayList();
UserInfo oUserInfo = null;
QueryRow oRow = null;
QueryValue oValue = null;
ArrayList oList = null;
oBean = new DBUtilitiesBean();
arylstParameters = new ArrayList();
arylstParameters = new ArrayList();
arylstParameters.add(new DBObject(1, 1, 12, sEmpNo));
arylstParameters.add(new DBObject(2, 1, 12, sSiteId));
arylstParameters.add(new DBObject(3, 2, -10));
arylstParameters.add(new DBObject(4, 2, 12));
arylstParameters.add(new DBObject(5, 2, 12));
arylstParameters.add(new DBObject(6, 2, 4));
arylstOutArray = oBean.callProc(arylstParameters, "HRMUSERINFO.procGetUserInfo(?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)arylstOutArray.get(0)).getObject();
if (oList.size() == 0)
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
oUserInfo = new UserInfo();
System.out.println(oRow.get("CURRENT_YEAR").getString());
oUserInfo.setCurrentYear(oRow.get("CURRENT_YEAR").getString());
System.out.println(oRow.get("SITE_ID").getString());
oUserInfo.setSiteId(oRow.get("SITE_ID").getString());
oUserInfo.setSiteName(oRow.get("SITE_NAME").getString());
oUserInfo.setUserActiveFlag(oRow.get("USER_ACTIVE_FLAG").getString());
oUserInfo.setUserId(oRow.get("USER_ID").getString());
oUserInfo.setUserLocked(oRow.get("USER_LOCKED").getString());
oUserInfo.setUserName(oRow.get("USER_NAME").getString());
oUserInfo.setUserSystemId(oRow.get("USER_SYSTEM_ID").getString());
oUserInfo.setUserType(oRow.get("USER_TYPE").getString());
oUserInfo.setUserTypeId(oRow.get("USER_TYPE_ID").getString());
}
return oUserInfo;
}
public String updateWorkList(String sUpsertFlag, WflResource wflResource, WflDocumentInfo docInfo) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oParameters = null;
ArrayList oOutArray = null;
String returnString = null;
if (wflResource.getEmployeeId() == wflResource.getDelegatedBy())
wflResource.setDelegatedBy("");
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sUpsertFlag));
oParameters.add(new DBObject(2, 1, 12, docInfo.getWorkListId()));
oParameters.add(new DBObject(3, 1, 12, wflResource.getRouteDtlId()));
oParameters.add(new DBObject(4, 1, 12, docInfo.getDocumentId()));
oParameters.add(new DBObject(5, 1, 12, docInfo.getDocumentTypeId()));
oParameters.add(new DBObject(6, 1, 12, docInfo.getDocumentNumber()));
oParameters.add(new DBObject(7, 1, 12, docInfo.getDocDesc()));
oParameters.add(new DBObject(8, 1, 12, wflResource.getEmployeeId()));
oParameters.add(new DBObject(9, 1, 12, docInfo.getRequester().getEmployeeId()));
oParameters.add(new DBObject(10, 1, 12, wflResource.getDelegatedBy()));
oParameters.add(new DBObject(11, 1, 12, null));
oParameters.add(new DBObject(12, 1, 12, docInfo.getCreator().getEmployeeId()));
oParameters.add(new DBObject(13, 1, 12, docInfo.getModuleId()));
oParameters.add(new DBObject(14, 1, 12, docInfo.getRequesterAction()));
oParameters.add(new DBObject(15, 1, 12, docInfo.getCreator().getEmployeeId()));
oParameters.add(new DBObject(16, 1, 12, docInfo.getCreator().getLoginSite().getSiteId()));
oParameters.add(new DBObject(17, 2, 12));
oParameters.add(new DBObject(18, 2, 12));
oParameters.add(new DBObject(19, 2, 12));
oParameters.add(new DBObject(20, 2, 4));
oOutArray = oBean.callProc(oParameters, "WFLWORKLIST.proc_UpsertWorkItem(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
return returnString;
}
public ArrayList getWorkListInfo(String sEmpId) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
Timestamp oWhenPicked = null;
int count = 0;
ArrayList oHeaderList = new ArrayList();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sEmpId));
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, "WFLWORKLIST.proc_GetWorkFlowList(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() == 0)
return oHeaderList;
QueryRow oRow = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
count++;
oRow = oIt.next();
WflWorkListBean oWrkFlowCommonBean = new WflWorkListBean();
oWrkFlowCommonBean.setTxtAssignedOn(oRow.get("LAST_ASSIGNED_DATE").getString());
oWrkFlowCommonBean.setRouteDtlId(oRow.get("route_dtl_id").getString());
oWrkFlowCommonBean.setTxtDocNo(oRow.get("doc_number").getString());
oWrkFlowCommonBean.setTxtDocTypeId(oRow.get("doc_type_id").getString());
oWrkFlowCommonBean.setTxtDocId(oRow.get("DOC_ID").getString());
oWrkFlowCommonBean.setTxtHiddenId(oRow.get("ID").getString());
oWrkFlowCommonBean.setTxtEmpNo(oRow.get("pending_for_emp_id").getString());
oWrkFlowCommonBean.setTxtModuleId(oRow.get("MODULE_ID").getString());
oWrkFlowCommonBean.setTxtModuleCode(oRow.get("MODULE_CODE").getString());
oWrkFlowCommonBean.setTxtDocTypeCode(oRow.get("doc_type_code").getString());
oHeaderList.add(oWrkFlowCommonBean);
}
return oHeaderList;
}
public String getDocumentTypeId(String documentType) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, documentType));
oParameters.add(new DBObject(2, 2, 12));
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, "WFLWORKLIST.proc_GetDocumentTypeId(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
if (null != oOutObject)
return (String)oOutObject.getObject();
return null;
}
public String getActivityId(String activity) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, activity));
oParameters.add(new DBObject(2, 2, 12));
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, "WFLWORKLIST.proc_GetActivityId(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
if (null != oOutObject)
return (String)oOutObject.getObject();
return null;
}
public String getActivityCode(String activityId) throws EnrgiseApplicationException, EnrgiseSystemException {
try {
log.severe(activityId);
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, activityId));
oParameters.add(new DBObject(2, 2, 12));
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, "WFLWORKLIST.proc_GetActivityCode(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
if (null != oOutObject)
return (String)oOutObject.getObject();
return null;
} catch (Exception oEx) {
log.severe(String.valueOf(String.valueOf(oEx.getClass().getName()).concat(String.valueOf(" "))).concat(String.valueOf(oEx.getMessage())));
return null;
}
}
public String getRouteDtlId(WflDocumentInfo docInfo) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, docInfo.getWorkListId()));
oParameters.add(new DBObject(2, 2, 12));
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, "WFLWORKLIST.proc_GetRouteDtl(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
if (null != oOutObject)
return (String)oOutObject.getObject();
return null;
}
public WflDtlsHdrBean getWorkFlowDtlsInfo(String sWorkListId) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
WflDtlsHdrBean oWflDtlsHdrBean = new WflDtlsHdrBean();
Timestamp oWhenPicked = null;
int count = 0;
ArrayList oHeaderList = new ArrayList();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sWorkListId));
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, "WFLWORKLIST.proc_GetWorkFlowListDesc(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() == 0)
new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
QueryRow oRow = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
count++;
oRow = oIt.next();
oWflDtlsHdrBean = new WflDtlsHdrBean();
oWflDtlsHdrBean.setToDtls(oRow.get("EmpName").getString());
oWflDtlsHdrBean.setFromDtls(oRow.get("From_EmpName").getString());
oWflDtlsHdrBean.setSubjectDtls(oRow.get("subject").getString());
oWflDtlsHdrBean.setDescDtls(oRow.get("docDesc").getString());
oWflDtlsHdrBean.setNotifFlag(oRow.get("notificationFlag").getString());
oWflDtlsHdrBean.setModuleId(oRow.get("moduleId").getString());
oWflDtlsHdrBean.setModuleName(oRow.get("ModuleName").getString());
oHeaderList.add(oWflDtlsHdrBean);
}
return oWflDtlsHdrBean;
}
public String closeNotification(WflDtlsHdrBean oWflDtlsHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oParameters = null;
ArrayList oOutArray = null;
String returnString = null;
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oWflDtlsHdrBean.getWorkListId()));
oParameters.add(new DBObject(3, 1, 12, "Close"));
oParameters.add(new DBObject(4, 2, 12));
oParameters.add(new DBObject(5, 2, 12));
oParameters.add(new DBObject(6, 2, 12));
oParameters.add(new DBObject(7, 2, 4));
oOutArray = oBean.callProc(oParameters, "WFLWORKLIST.proc_closeWorkList(?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
return returnString;
}
}