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,295 @@
package wenrgise.ejb.common.business;
import java.rmi.RemoteException;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import java.util.logging.Logger;
import javax.ejb.CreateException;
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.UserInfo;
import wenrgise.ejb.common.helper.DBObject;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.session.UserSessionHome;
import wenrgise.ejb.common.utility.DBUtilitiesBean;
import wenrgise.ejb.common.utility.ServiceLocator;
public abstract class BaseBO {
public static Logger log = Logger.getLogger("wenrgise.ejb.common.business.BaseBO");
protected String headerTable = null;
private String headerPKColumnName = null;
private String detailTable = null;
private String detailPKColumnName = null;
protected DateFormat userDateFormat;
protected DateFormat defaultDateFormat;
protected Locale userLocale;
protected Locale defaultLocale;
protected UserInfo oUserInfo;
public BaseBO() {}
public BaseBO(UserInfo oUserInfo) {
this.oUserInfo = oUserInfo;
}
private void setDateFormatAndLocale() throws EnrgiseSystemException {
this.userDateFormat = new SimpleDateFormat("dd/MM/yyyy");
this.defaultDateFormat = new SimpleDateFormat("dd/MM/yyyy");
try {
UserSessionHome oHome = (UserSessionHome)ServiceLocator.getLocator().getService("UserSession");
UserSession oUser = oHome.create();
this.userDateFormat = oUser.getUserDateFormat();
this.defaultDateFormat = oUser.getDefaultDateFormat();
this.userLocale = oUser.getUserLocale();
this.defaultLocale = oUser.getDefaultLocale();
this.oUserInfo = oUser.getUserInfo();
} catch (RemoteException oEx) {
log.severe(oEx.getMessage());
throw new EnrgiseSystemException();
} catch (CreateException oCrt) {
log.severe(oCrt.getMessage());
throw new EnrgiseSystemException();
}
}
public String saveData(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
String sScreenHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
String sHeaderPrimaryKey = sScreenHeaderPrimaryKey;
if (sScreenMode.equals("U"))
initializeBOImpl();
if (sScreenMode.equals("U"))
if (bHeaderDataChanged || bDetailDataChanged)
if (oWhenPicked != null) {
if (!checkHeaderTimeStamp(oBaseHeaderBean.getHeaderPrimaryKey(), oDetailPicked))
throw new EnrgiseApplicationException("wenrgise.common.changed", "M");
} else if (!checkHeaderTimeStamp(null, oDetailPicked)) {
throw new EnrgiseApplicationException("wenrgise.common.changed", "M");
}
additionalFieldValidationImpl(oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked);
additionalTimestampValidationImpl(oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked);
additionalBusinessValidationImpl(oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked);
if (bHeaderDataChanged) {
sHeaderPrimaryKey = saveHeaderImpl(oBaseHeaderBean, sScreenMode);
if (sHeaderPrimaryKey == null && !sScreenMode.equalsIgnoreCase("D"))
sHeaderPrimaryKey = sScreenHeaderPrimaryKey;
}
if (bDetailDataChanged && !sScreenMode.equalsIgnoreCase("D"))
if (oBaseHeaderBean == null) {
saveDetailImpl(sHeaderPrimaryKey, sScreenName, oDetailBeanArray);
if (oWhenPicked != null)
updateHeaderTimeStamp(sHeaderPrimaryKey);
} else if (!EnrgiseUtil.checkString(oBaseHeaderBean.getPseudoHeader())) {
saveDetailImpl(sHeaderPrimaryKey, sScreenName, oDetailBeanArray);
if (oWhenPicked != null)
updateHeaderTimeStamp(sHeaderPrimaryKey);
} else {
saveDetailImpl(oBaseHeaderBean, sScreenName, oDetailBeanArray);
}
return sHeaderPrimaryKey;
}
private boolean updateHeaderTimeStamp(String sPrimaryKey) throws EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, this.headerTable));
oParameters.add(new DBObject(2, 1, 12, sPrimaryKey));
oParameters.add(new DBObject(3, 2, 12));
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, "COMMONPROCEDURES.proc_UpdateHeaderTimeStamp(?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
String sSuccessFlag = (String)oOutObject.getObject();
if (!sSuccessFlag.trim().equals("Y"))
return false;
return true;
}
public void initializeBO(String sHeaderTable, String sDetailTable) {
this.headerTable = sHeaderTable;
}
public void initializeBO(String sHeaderTable) {
this.headerTable = sHeaderTable;
}
private boolean checkHeaderTimeStamp(String sPrimaryKey, Timestamp oWhenPicked) throws EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, this.headerTable));
oParameters.add(new DBObject(2, 1, 12, sPrimaryKey));
oParameters.add(new DBObject(3, 1, 93, oWhenPicked));
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));
ArrayList oOutArray = oBean.callProc(oParameters, "COMMONPROCEDURES.proc_CheckHeaderTimeStamp(?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
String sSuccessFlag = (String)oOutObject.getObject();
if (!sSuccessFlag.trim().equals("Y"))
return false;
return true;
}
private boolean checkDetailTimeStamp(String sPrimaryKey, Timestamp oWhenDetailPicked) throws EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, this.headerTable));
oParameters.add(new DBObject(2, 1, 12, this.detailTable));
oParameters.add(new DBObject(3, 1, 12, sPrimaryKey));
oParameters.add(new DBObject(4, 1, 93, oWhenDetailPicked));
oParameters.add(new DBObject(5, 2, 12));
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, "COMMONPROCEDURES.proc_CheckDetailTimeStamp(?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
String sSuccessFlag = (String)oOutObject.getObject();
if (!sSuccessFlag.trim().equals("Y"))
return false;
return true;
}
public void reportError(ArrayList oList) throws EnrgiseSystemException, EnrgiseApplicationException {
if (oList.size() > 0) {
boolean bFirstTime = true;
EnrgiseApplicationException oApp = null;
EnrgiseSystemException oSys = null;
Object obj = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
obj = oIt.next();
if (obj instanceof EnrgiseApplicationException || obj instanceof EnrgiseMessageKeyException) {
if (!bFirstTime) {
oApp.addToList((EnrgiseApplicationException)obj);
continue;
}
bFirstTime = false;
oApp = (EnrgiseApplicationException)obj;
continue;
}
oSys = (EnrgiseSystemException)obj;
throw oSys;
}
throw oApp;
}
}
public abstract String saveHeaderImpl(BaseHeaderBean paramBaseHeaderBean, String paramString) throws EnrgiseMessageKeyException, EnrgiseApplicationException, EnrgiseSystemException;
public abstract void saveDetailImpl(String paramString1, String paramString2, ArrayList paramArrayList) throws EnrgiseApplicationException, EnrgiseSystemException;
public void saveDetailImpl(BaseHeaderBean oBaseHeaderBean, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {}
public abstract void initializeBOImpl();
public abstract void additionalFieldValidationImpl(BaseHeaderBean paramBaseHeaderBean, Timestamp paramTimestamp1, String paramString1, String paramString2, boolean paramBoolean1, ArrayList paramArrayList, boolean paramBoolean2, Timestamp paramTimestamp2) throws EnrgiseApplicationException, EnrgiseSystemException;
public abstract void additionalTimestampValidationImpl(BaseHeaderBean paramBaseHeaderBean, Timestamp paramTimestamp1, String paramString1, String paramString2, boolean paramBoolean1, ArrayList paramArrayList, boolean paramBoolean2, Timestamp paramTimestamp2) throws EnrgiseApplicationException, EnrgiseSystemException;
public abstract void additionalBusinessValidationImpl(BaseHeaderBean paramBaseHeaderBean, Timestamp paramTimestamp1, String paramString1, String paramString2, boolean paramBoolean1, ArrayList paramArrayList, boolean paramBoolean2, Timestamp paramTimestamp2) throws EnrgiseApplicationException, EnrgiseSystemException;
public UserInfo getOUserInfo() {
return this.oUserInfo;
}
public void setOUserInfo(UserInfo newOUserInfo) {
this.oUserInfo = newOUserInfo;
}
public String approve(String sTableName, BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, ArrayList oDetailBeanArray, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
initializeBOImpl();
if (sHeaderPrimaryKey != null) {
if (oWhenPicked != null &&
!checkHeaderTimeStamp(sHeaderPrimaryKey, oWhenPicked))
throw new EnrgiseApplicationException("wenrgise.common.changed", "M");
validateApprove(sHeaderPrimaryKey);
if (EnrgiseUtil.checkString(sTableName)) {
DBUtilitiesBean oBean = new DBUtilitiesBean();
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("update ").concat(String.valueOf(sTableName))).concat(String.valueOf(" set status_flag='"))).concat(String.valueOf("A"))).concat(String.valueOf("',modified_site_id = 100, user_id_modified = 100, modified_time_stamp = sysdate where id="))).concat(String.valueOf(sHeaderPrimaryKey));
int i = oBean.executeUpsert(sQuery);
}
} else {
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
}
return sHeaderPrimaryKey;
}
public String callWorkFlow(BaseHeaderBean oBaseHeaderBean, ArrayList arylstDetailBeanArray, String activity) throws EnrgiseApplicationException, EnrgiseSystemException {
if (activity.equals("A"))
return "FinallyApproved";
if (activity.equals("R"))
return "R";
return "success";
}
public void validateApprove(String sHeaderPrimaryKey) {}
public void validateReject(String sHeaderPrimaryKey) {}
public void validateRevise(String sHeaderPrimaryKey) {}
public String submit(String sTableName, BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, ArrayList oDetailBeanArray, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
initializeBOImpl();
if (sHeaderPrimaryKey != null)
if (oWhenPicked != null)
if (!checkHeaderTimeStamp(sHeaderPrimaryKey, oWhenPicked))
throw new EnrgiseApplicationException("wenrgise.common.changed", "M");
return oBaseHeaderBean.getHeaderPrimaryKey();
}
public String reject(String sTableName, BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, ArrayList oDetailBeanArray, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
if (sHeaderPrimaryKey != null) {
initializeBOImpl();
if (!checkHeaderTimeStamp(sHeaderPrimaryKey, oWhenPicked))
throw new EnrgiseApplicationException("wenrgise.common.changed", "M");
validateReject(sHeaderPrimaryKey);
if (EnrgiseUtil.checkString(sTableName)) {
DBUtilitiesBean oBean = new DBUtilitiesBean();
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("update ").concat(String.valueOf(sTableName))).concat(String.valueOf(" set status_flag='"))).concat(String.valueOf("R"))).concat(String.valueOf("',modified_site_id = 100, user_id_modified = 100, modified_time_stamp = sysdate where id="))).concat(String.valueOf(sHeaderPrimaryKey));
int i = oBean.executeUpsert(sQuery);
}
} else {
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
}
return sHeaderPrimaryKey;
}
public String revise(String sTableName, BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, ArrayList oDetailBeanArray, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
if (sHeaderPrimaryKey != null) {
initializeBOImpl();
if (!checkHeaderTimeStamp(sHeaderPrimaryKey, oWhenPicked))
throw new EnrgiseApplicationException("wenrgise.common.changed", "M");
validateRevise(sHeaderPrimaryKey);
DBUtilitiesBean oBean = new DBUtilitiesBean();
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("update ").concat(String.valueOf(sTableName))).concat(String.valueOf(" sTablename set sTablename.status_flag = '"))).concat(String.valueOf("V"))).concat(String.valueOf("', sTablename.rev_no=sTablename.rev_no+1,sTablename.modified_site_id = 200, sTablename.user_id_modified = 200, sTablename.modified_time_stamp = sysdate where sTablename.code in (select code from "))).concat(String.valueOf(sTableName))).concat(String.valueOf(" where id="))).concat(String.valueOf(sHeaderPrimaryKey))).concat(String.valueOf(")"));
int i = oBean.executeUpsert(sQuery);
} else {
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
}
return sHeaderPrimaryKey;
}
}

View File

@@ -0,0 +1,365 @@
package wenrgise.ejb.common.business;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import wenrgise.common.bean.AccessBean;
import wenrgise.common.bean.DynamicMenuBean;
import wenrgise.common.bean.EmpInfoBean;
import wenrgise.common.bean.MenuBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.ejb.common.helper.DBObject;
import wenrgise.ejb.common.helper.QueryRow;
import wenrgise.ejb.common.utility.DBUtilitiesBean;
public class SecurityBO {
public HashMap getDisabledFields(String sScreenName, String sHdrDtlFlag, String sScreenMode, String sPageStatus) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
Timestamp oWhenPicked = null;
int count = 0;
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
HashMap oMap = new HashMap();
if (sHdrDtlFlag.equalsIgnoreCase("Header")) {
oParameters.add(new DBObject(1, 1, 12, sScreenName));
oParameters.add(new DBObject(2, 1, 12, sHdrDtlFlag));
oParameters.add(new DBObject(3, 1, 12, sScreenMode));
oParameters.add(new DBObject(4, 1, 12, sPageStatus));
oParameters.add(new DBObject(5, 1, 12, "D"));
oParameters.add(new DBObject(6, 2, -10));
oParameters.add(new DBObject(7, 2, 12));
oParameters.add(new DBObject(8, 2, 12));
oParameters.add(new DBObject(9, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "commonprocedures.proc_getfielddisableinfo(?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
ArrayList arylstFields = new ArrayList();
while (oIt.hasNext()) {
oRow = oIt.next();
arylstFields.add(oRow.get("disabled_field").getString());
}
oMap.put("D", arylstFields);
}
} else if (sHdrDtlFlag.equalsIgnoreCase("Detail")) {
oParameters.add(new DBObject(1, 1, 12, sScreenName));
oParameters.add(new DBObject(2, 1, 12, sHdrDtlFlag));
oParameters.add(new DBObject(3, 1, 12, sScreenMode));
oParameters.add(new DBObject(4, 1, 12, sPageStatus));
oParameters.add(new DBObject(5, 1, 12, "D"));
oParameters.add(new DBObject(6, 2, -10));
oParameters.add(new DBObject(7, 2, 12));
oParameters.add(new DBObject(8, 2, 12));
oParameters.add(new DBObject(9, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "commonprocedures.proc_getfielddisableinfo(?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
ArrayList disableList = new ArrayList();
while (oIt.hasNext()) {
oRow = oIt.next();
disableList.add(oRow.get("disabled_field").getString());
}
oMap.put("D", disableList);
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sScreenName));
oParameters.add(new DBObject(2, 1, 12, sHdrDtlFlag));
oParameters.add(new DBObject(3, 1, 12, sScreenMode));
oParameters.add(new DBObject(4, 1, 12, sPageStatus));
oParameters.add(new DBObject(5, 1, 12, "E"));
oParameters.add(new DBObject(6, 2, -10));
oParameters.add(new DBObject(7, 2, 12));
oParameters.add(new DBObject(8, 2, 12));
oParameters.add(new DBObject(9, 2, 4));
oOutArray = oBean.callProc(oParameters, "commonprocedures.proc_getfielddisableinfo(?,?,?,?,?,?,?,?,?)");
oOutObject = oOutArray.get(0);
oList = (ArrayList)oOutObject.getObject();
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
ArrayList enableList = new ArrayList();
while (oIt.hasNext()) {
oRow = oIt.next();
enableList.add(oRow.get("disabled_field").getString());
}
oMap.put("E", enableList);
}
} else if (sHdrDtlFlag.equalsIgnoreCase("all")) {
oParameters.add(new DBObject(1, 1, 12, sScreenName));
oParameters.add(new DBObject(2, 1, 12, sHdrDtlFlag));
oParameters.add(new DBObject(3, 1, 12, sScreenMode));
oParameters.add(new DBObject(4, 1, 12, sPageStatus));
oParameters.add(new DBObject(5, 1, 12, "D"));
oParameters.add(new DBObject(6, 2, -10));
oParameters.add(new DBObject(7, 2, 12));
oParameters.add(new DBObject(8, 2, 12));
oParameters.add(new DBObject(9, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "commonprocedures.proc_getfielddisableinfo(?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
ArrayList arylstFields = new ArrayList();
while (oIt.hasNext()) {
oRow = oIt.next();
arylstFields.add(oRow.get("disabled_field").getString());
}
oMap.put("D", arylstFields);
}
}
return oMap;
}
private String getGroupIdForUser(String sUserId) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
ArrayList oList = null;
String sGroupId = null;
DBUtilitiesBean oBean = new DBUtilitiesBean();
boolean returnFlag = true;
boolean tempFlag = true;
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sUserId));
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, "DYNAMIC_MENU.PROC_GetGroupId(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
sGroupId = (String)oOutObject.getObject();
return sGroupId;
}
public ArrayList addMenuList(EmpInfoBean oEmpInfoBean) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList menuList = new ArrayList();
ArrayList finalList = new ArrayList();
MenuBean oMenuBean = new MenuBean();
oEmpInfoBean = getGroupId(oEmpInfoBean);
oMenuBean = getComponentIds(oEmpInfoBean, menuList);
Iterator oIt = menuList.iterator();
while (oIt.hasNext()) {
DynamicMenuBean dynamicMenuBean = oIt.next();
finalList.add(new DynamicMenuBean(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("MyMenu.makeMenu('").concat(String.valueOf(dynamicMenuBean.getCompId()))).concat(String.valueOf("','"))).concat(String.valueOf(dynamicMenuBean.getModuleId()))).concat(String.valueOf("','"))).concat(String.valueOf(dynamicMenuBean.getCompDesc()))).concat(String.valueOf("','"))).concat(String.valueOf(dynamicMenuBean.getActionName()))).concat(String.valueOf("?screenName="))).concat(String.valueOf(dynamicMenuBean.getScreenName()))).concat(String.valueOf("')"))));
}
if (oMenuBean.getModuleId() == null)
return null;
DynamicMenuBean oBean = new DynamicMenuBean();
do {
oMenuBean = getModuleIds(oMenuBean, oBean, menuList);
Iterator oIt1 = menuList.iterator();
while (oIt1.hasNext()) {
oBean = oIt1.next();
if (oBean.getModuleId() == oEmpInfoBean.getModuleId())
continue;
finalList.add(new DynamicMenuBean(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("MyMenu.makeMenu('").concat(String.valueOf(oBean.getModuleId()))).concat(String.valueOf("','"))).concat(String.valueOf(oBean.getParentModuleId()))).concat(String.valueOf("','"))).concat(String.valueOf(oBean.getModuleDesc()))).concat(String.valueOf("')"))));
}
} while (oMenuBean != null);
return finalList;
}
public EmpInfoBean getGroupId(EmpInfoBean oEmpInfoBean) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oEmpInfoBean.getEmpId()));
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, "DYNAMIC_MENU.PROC_GetGroupId(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
int count = 0;
QueryRow oRow = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
StringBuffer concatList = new StringBuffer();
int c = 0;
while (oIt.hasNext()) {
if (count == 0)
oList = new ArrayList();
count++;
oRow = oIt.next();
oEmpInfoBean.setGrpId(oRow.get("GROUP_ID").getString());
if (c == 0) {
concatList = concatList.append(oEmpInfoBean.getGrpId());
c++;
continue;
}
concatList = concatList.append(String.valueOf(",").concat(String.valueOf(oEmpInfoBean.getGrpId())));
}
String sGrpIds = null;
if (c != 0)
sGrpIds = concatList.toString();
oEmpInfoBean.setGrpId(sGrpIds);
return oEmpInfoBean;
}
public MenuBean getModuleIds(MenuBean oBean, DynamicMenuBean oMenuBean, ArrayList oMenuList) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oDBBean = new DBUtilitiesBean();
oMenuList.clear();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oBean.getModuleId()));
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 = oDBBean.callProc(oParameters, "DYNAMIC_MENU.PROC_ModuleInfo(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() == 0)
return null;
int count = 0;
QueryRow oRow = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
StringBuffer concatList = new StringBuffer();
int c = 0;
while (oIt.hasNext()) {
oMenuBean = new DynamicMenuBean();
if (count == 0)
oList = new ArrayList();
count++;
oRow = oIt.next();
oMenuBean.setModuleId(oRow.get("module_id").getString());
oMenuBean.setParentModuleId(oRow.get("parent_module_id").getString());
oMenuBean.setModuleCode(oRow.get("module_code").getString());
oMenuBean.setModuleDesc(oRow.get("module_description").getString());
oMenuBean.setHierchyLevel(oRow.get("hierarchy_lvl").getString());
oMenuList.add(oMenuBean);
if (c == 0) {
concatList = concatList.append(oMenuBean.getModuleId());
c++;
continue;
}
concatList = concatList.append(String.valueOf(",").concat(String.valueOf(oMenuBean.getModuleId())));
}
String sModuleId = null;
if (c != 0)
sModuleId = concatList.toString();
oBean.setModuleId(sModuleId);
return oBean;
}
public MenuBean getComponentIds(EmpInfoBean oEmpInfoBean, ArrayList oMenuList) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oEmpInfoBean.getEmpId()));
oParameters.add(new DBObject(2, 1, 12, oEmpInfoBean.getGrpId()));
oParameters.add(new DBObject(3, 1, 12, oEmpInfoBean.getModuleId()));
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, "DYNAMIC_MENU.PROC_GetCompInfo(?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
int count = 0;
QueryRow oRow = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
StringBuffer concatList = new StringBuffer();
int c = 0;
while (oIt.hasNext()) {
DynamicMenuBean oMenuBean = new DynamicMenuBean();
if (count == 0)
oList = new ArrayList();
count++;
oRow = oIt.next();
oMenuBean.setCompId(oRow.get("component_id").getString());
oMenuBean.setCompCode(oRow.get("component_code").getString());
oMenuBean.setCompDesc(oRow.get("description").getString());
oMenuBean.setActionName(oRow.get("action_name").getString());
oMenuBean.setScreenName(oRow.get("screen_name").getString());
oMenuBean.setModuleId(oRow.get("module_id").getString());
oMenuList.add(oMenuBean);
if (c == 0) {
concatList = concatList.append(oMenuBean.getCompId());
c++;
continue;
}
concatList = concatList.append(String.valueOf(",").concat(String.valueOf(oMenuBean.getCompId())));
}
String sCompId = null;
if (c != 0)
sCompId = concatList.toString();
MenuBean oBean1 = new MenuBean();
oBean1.setModuleId(sCompId);
return oBean1;
}
public HashMap getAccessInfo(EmpInfoBean oEmpInfoBean) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
HashMap mapInfo = new HashMap();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oEmpInfoBean.getEmpId()));
oParameters.add(new DBObject(2, 1, 12, "null"));
oParameters.add(new DBObject(3, 1, 12, oEmpInfoBean.getModuleId()));
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, "DYNAMIC_MENU.PROC_GetCompInfo(?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
QueryRow oRow = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
String sComponentName = oRow.get("Component_Code").getString();
AccessBean oAccessBean = new AccessBean();
oAccessBean.setApproveFlag(oRow.get("APPROVFLAG").getString());
oAccessBean.setDeleteFlag(oRow.get("DELFLAG").getString());
oAccessBean.setInsertFlag(oRow.get("INSERTFLAG").getString());
oAccessBean.setQueryFlag(oRow.get("QRYFLAG").getString());
oAccessBean.setUpdateFlag(oRow.get("UPDATEFLAG").getString());
mapInfo.put(sComponentName.trim(), oAccessBean);
}
oEmpInfoBean = getGroupId(oEmpInfoBean);
HashMap oHshMap = getAccessInfoFromGroup(oEmpInfoBean, mapInfo);
return oHshMap;
}
private HashMap getAccessInfoFromGroup(EmpInfoBean oEmpInfoBean, HashMap oMap) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, null));
oParameters.add(new DBObject(2, 1, 12, oEmpInfoBean.getGrpId()));
oParameters.add(new DBObject(3, 1, 12, oEmpInfoBean.getModuleId()));
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, "DYNAMIC_MENU.PROC_GetCompInfo(?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
QueryRow oRow = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
String sComponentName = oRow.get("Component_Code").getString();
AccessBean oAccessBean = new AccessBean();
oAccessBean.setApproveFlag(oRow.get("APPROVFLAG").getString());
oAccessBean.setDeleteFlag(oRow.get("DELFLAG").getString());
oAccessBean.setInsertFlag(oRow.get("INSERTFLAG").getString());
oAccessBean.setQueryFlag(oRow.get("QRYFLAG").getString());
oAccessBean.setUpdateFlag(oRow.get("UPDATEFLAG").getString());
oMap.put(sComponentName.trim(), oAccessBean);
}
return oMap;
}
}