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; } }