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,55 @@
package wenrgise.common.bean;
import java.io.Serializable;
public class AccessBean implements Serializable {
private String queryFlag;
private String insertFlag;
private String updateFlag;
private String deleteFlag;
private String approveFlag;
public String getQueryFlag() {
return this.queryFlag;
}
public void setQueryFlag(String newQueryFlag) {
this.queryFlag = newQueryFlag;
}
public String getInsertFlag() {
return this.insertFlag;
}
public void setInsertFlag(String newInsertFlag) {
this.insertFlag = newInsertFlag;
}
public String getUpdateFlag() {
return this.updateFlag;
}
public void setUpdateFlag(String newUpdateFlag) {
this.updateFlag = newUpdateFlag;
}
public String getDeleteFlag() {
return this.deleteFlag;
}
public void setDeleteFlag(String newDeleteFlag) {
this.deleteFlag = newDeleteFlag;
}
public String getApproveFlag() {
return this.approveFlag;
}
public void setApproveFlag(String newApproveFlag) {
this.approveFlag = newApproveFlag;
}
}

View File

@@ -0,0 +1,15 @@
package wenrgise.common.bean;
import java.io.Serializable;
public class AuthorizationBean implements Serializable {
private boolean hasAccessFlag;
public boolean isHasAccessFlag() {
return this.hasAccessFlag;
}
public void setHasAccessFlag(boolean newHasAccessFlag) {
this.hasAccessFlag = newHasAccessFlag;
}
}

View File

@@ -0,0 +1,13 @@
package wenrgise.common.bean;
public class BaseBean {
private CommonAttributes oCommonAttributes = null;
public CommonAttributes getOCommonAttributes() {
return this.oCommonAttributes;
}
public void setOCommonAttributes(CommonAttributes newOCommonAttributes) {
this.oCommonAttributes = newOCommonAttributes;
}
}

View File

@@ -0,0 +1,35 @@
package wenrgise.common.bean;
import java.io.Serializable;
public class BaseDetailBean extends BaseBean implements Serializable {
String detailId = null;
String itemChecked = "N";
String status = "Q";
public String getDetailId() {
return this.detailId;
}
public void setDetailId(String newDetailId) {
this.detailId = newDetailId;
}
public String getItemChecked() {
return this.itemChecked;
}
public void setItemChecked(String newItemChecked) {
this.itemChecked = newItemChecked;
}
public String getStatus() {
return this.status;
}
public void setStatus(String newStatus) {
this.status = newStatus;
}
}

View File

@@ -0,0 +1,45 @@
package wenrgise.common.bean;
import java.io.Serializable;
public class BaseHeaderBean extends BaseBean implements Serializable {
private String headerPrimaryKey = null;
private String headerStatus = null;
private String pseudoHeader;
private String workListId;
public String getHeaderPrimaryKey() {
return this.headerPrimaryKey;
}
public void setHeaderPrimaryKey(String newHeaderPrimaryKey) {
this.headerPrimaryKey = newHeaderPrimaryKey;
}
public String getHeaderStatus() {
return this.headerStatus;
}
public void setHeaderStatus(String newHeaderStatus) {
this.headerStatus = newHeaderStatus;
}
public String getPseudoHeader() {
return this.pseudoHeader;
}
public void setPseudoHeader(String newPseudoHeader) {
this.pseudoHeader = newPseudoHeader;
}
public String getWorkListId() {
return this.workListId;
}
public void setWorkListId(String newWorkListId) {
this.workListId = newWorkListId;
}
}

View File

@@ -0,0 +1,53 @@
package wenrgise.common.bean;
public class CommonAttributes {
private String userIdModiFied = null;
private String userIdCreated = null;
private String createdSiteId = null;
private String modifiedSiteId = null;
private String arcFlag = "N";
public String getArcFlag() {
return this.arcFlag;
}
public void setArcFlag(String newArcFlag) {
this.arcFlag = newArcFlag;
}
public String getCreatedSiteId() {
return this.createdSiteId;
}
public void setCreatedSiteId(String newCreatedSiteId) {
this.createdSiteId = newCreatedSiteId;
}
public String getModifiedSiteId() {
return this.modifiedSiteId;
}
public void setModifiedSiteId(String newModifiedSiteId) {
this.modifiedSiteId = newModifiedSiteId;
}
public String getUserIdCreated() {
return this.userIdCreated;
}
public void setUserIdCreated(String newUserIdCreated) {
this.userIdCreated = newUserIdCreated;
}
public String getUserIdModiFied() {
return this.userIdModiFied;
}
public void setUserIdModiFied(String newUserIdModiFied) {
this.userIdModiFied = newUserIdModiFied;
}
}

View File

@@ -0,0 +1,151 @@
package wenrgise.common.bean;
import java.io.Serializable;
public class DynamicMenuBean implements Serializable {
String moduleId;
String moduleCode;
String moduleDesc;
String compId;
String compCode;
String queryFlg;
String insertFlg;
String updateFlg;
String dynamicMenu;
String hierchyLevel;
String compDesc;
String parentModuleId;
String screenName;
String actionName;
public DynamicMenuBean() {}
public DynamicMenuBean(String pDynamicMenu) {
this.dynamicMenu = pDynamicMenu;
}
public String getModuleId() {
return this.moduleId;
}
public void setModuleId(String newModuleId) {
this.moduleId = newModuleId;
}
public String getModuleCode() {
return this.moduleCode;
}
public void setModuleCode(String newModuleCode) {
this.moduleCode = newModuleCode;
}
public String getModuleDesc() {
return this.moduleDesc;
}
public void setModuleDesc(String newModuleDesc) {
this.moduleDesc = newModuleDesc;
}
public String getCompId() {
return this.compId;
}
public void setCompId(String newCompId) {
this.compId = newCompId;
}
public String getCompCode() {
return this.compCode;
}
public void setCompCode(String newCompCode) {
this.compCode = newCompCode;
}
public String getQueryFlg() {
return this.queryFlg;
}
public void setQueryFlg(String newQueryFlg) {
this.queryFlg = newQueryFlg;
}
public String getInsertFlg() {
return this.insertFlg;
}
public void setInsertFlg(String newInsertFlg) {
this.insertFlg = newInsertFlg;
}
public String getUpdateFlg() {
return this.updateFlg;
}
public void setUpdateFlg(String newUpdateFlg) {
this.updateFlg = newUpdateFlg;
}
public String getDynamicMenu() {
return this.dynamicMenu;
}
public void setDynamicMenu(String newDynamicMenu) {
this.dynamicMenu = newDynamicMenu;
}
public String getHierchyLevel() {
return this.hierchyLevel;
}
public void setHierchyLevel(String newHierchyLevel) {
this.hierchyLevel = newHierchyLevel;
}
public String getCompDesc() {
return this.compDesc;
}
public void setCompDesc(String newCompDesc) {
this.compDesc = newCompDesc;
}
public String getParentModuleId() {
return this.parentModuleId;
}
public void setParentModuleId(String newParentModuleId) {
this.parentModuleId = newParentModuleId;
}
public String getScreenName() {
return this.screenName;
}
public void setScreenName(String newScreenName) {
this.screenName = newScreenName;
}
public String getActionName() {
return this.actionName;
}
public void setActionName(String newActionName) {
this.actionName = newActionName;
}
}

View File

@@ -0,0 +1,35 @@
package wenrgise.common.bean;
import java.io.Serializable;
public class EmpInfoBean implements Serializable {
String grpId;
String empId;
String moduleId;
public String getGrpId() {
return this.grpId;
}
public void setGrpId(String newGrpId) {
this.grpId = newGrpId;
}
public String getEmpId() {
return this.empId;
}
public void setEmpId(String newEmpId) {
this.empId = newEmpId;
}
public String getModuleId() {
return this.moduleId;
}
public void setModuleId(String newModuleId) {
this.moduleId = newModuleId;
}
}

View File

@@ -0,0 +1,205 @@
package wenrgise.common.bean;
import java.io.Serializable;
public class LOVBean implements Serializable {
private String detailField1;
private String detailField2;
private String detailField3;
private String detailField4;
private String detailField5;
private String detailField6;
private String detailField7;
private String detailField8;
private String detailField9;
private String detailField10;
private String detailField11;
private String detailField12;
private String detailField13;
private String detailField14;
private String detailField15;
private String detailField16;
private String detailField17;
private String detailField18;
private String detailField19;
private String detailField20;
public String getDetailField1() {
return this.detailField1;
}
public void setDetailField1(String newDetailField1) {
this.detailField1 = newDetailField1;
}
public String getDetailField2() {
return this.detailField2;
}
public void setDetailField2(String newDetailField2) {
this.detailField2 = newDetailField2;
}
public String getDetailField3() {
return this.detailField3;
}
public void setDetailField3(String newDetailField3) {
this.detailField3 = newDetailField3;
}
public String getDetailField4() {
return this.detailField4;
}
public void setDetailField4(String newDetailField4) {
this.detailField4 = newDetailField4;
}
public String getDetailField5() {
return this.detailField5;
}
public void setDetailField5(String newDetailField5) {
this.detailField5 = newDetailField5;
}
public String getDetailField6() {
return this.detailField6;
}
public void setDetailField6(String newDetailField6) {
this.detailField6 = newDetailField6;
}
public String getDetailField7() {
return this.detailField7;
}
public void setDetailField7(String newDetailField7) {
this.detailField7 = newDetailField7;
}
public String getDetailField8() {
return this.detailField8;
}
public void setDetailField8(String newDetailField8) {
this.detailField8 = newDetailField8;
}
public String getDetailField9() {
return this.detailField9;
}
public void setDetailField9(String newDetailField9) {
this.detailField9 = newDetailField9;
}
public String getDetailField10() {
return this.detailField10;
}
public void setDetailField10(String newDetailField10) {
this.detailField10 = newDetailField10;
}
public String getDetailField11() {
return this.detailField11;
}
public void setDetailField11(String newDetailField11) {
this.detailField11 = newDetailField11;
}
public String getDetailField12() {
return this.detailField12;
}
public void setDetailField12(String newDetailField12) {
this.detailField12 = newDetailField12;
}
public String getDetailField13() {
return this.detailField13;
}
public void setDetailField13(String newDetailField13) {
this.detailField13 = newDetailField13;
}
public String getDetailField14() {
return this.detailField14;
}
public void setDetailField14(String newDetailField14) {
this.detailField14 = newDetailField14;
}
public String getDetailField15() {
return this.detailField15;
}
public void setDetailField15(String newDetailField15) {
this.detailField15 = newDetailField15;
}
public String getDetailField16() {
return this.detailField16;
}
public void setDetailField16(String newDetailField16) {
this.detailField16 = newDetailField16;
}
public String getDetailField17() {
return this.detailField17;
}
public void setDetailField17(String newDetailField17) {
this.detailField17 = newDetailField17;
}
public String getDetailField18() {
return this.detailField18;
}
public void setDetailField18(String newDetailField18) {
this.detailField18 = newDetailField18;
}
public String getDetailField19() {
return this.detailField19;
}
public void setDetailField19(String newDetailField19) {
this.detailField19 = newDetailField19;
}
public String getDetailField20() {
return this.detailField20;
}
public void setDetailField20(String newDetailField20) {
this.detailField20 = newDetailField20;
}
}

View File

@@ -0,0 +1,15 @@
package wenrgise.common.bean;
import java.io.Serializable;
public class MenuBean implements Serializable {
String moduleId;
public String getModuleId() {
return this.moduleId;
}
public void setModuleId(String newModuleId) {
this.moduleId = newModuleId;
}
}

View File

@@ -0,0 +1,313 @@
package wenrgise.common.businessdelegate;
import java.rmi.RemoteException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.ejb.EJBObject;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.EnrgiseUtil;
import wenrgise.common.utility.RecordMetaInfo;
import wenrgise.common.utility.UserInfo;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.DetailSizeValues;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.ejb.common.session.UserSession;
public abstract class BaseBD {
protected Timestamp oWhenDetailPicked = null;
protected long lTotalRecordCount = 0L;
protected long lStartPosition = 0L;
protected long lLastPosition = 0L;
protected long lDetailFirstPosition = 0L;
protected long lDetailLastPosition = 0L;
protected long lTotalDetailRecordCount = 0L;
protected UserInfo oUserInfo = null;
protected HashMap oMap = new HashMap();
protected String moduleName = null;
public long getLTotalRecordCount() {
return this.lTotalRecordCount;
}
public void setLTotalRecordCount(long newLTotalRecordCount) {
this.lTotalRecordCount = newLTotalRecordCount;
}
public long getLDetailFirstPosition() {
return this.lDetailFirstPosition;
}
public void setLDetailFirstPosition(long newLDetailFirstPosition) {
this.lDetailFirstPosition = newLDetailFirstPosition;
}
public long getLDetailLastPosition() {
return this.lDetailLastPosition;
}
public void setLDetailLastPosition(long newLDetailLastPosition) {
this.lDetailLastPosition = newLDetailLastPosition;
}
public long getLTotalDetailRecordCount() {
return this.lTotalDetailRecordCount;
}
public void setLTotalDetailRecordCount(long newLTotalDetailRecordCount) {
this.lTotalDetailRecordCount = newLTotalDetailRecordCount;
}
public BaseHeaderVO getHeaderRecord(BaseQueryVO oQueryVO, String sFormName, UserSession oUser) throws EnrgiseApplicationException, EnrgiseSystemException {
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
try {
RecordMetaInfo oHeaderMetaInfo = getHeaderMetaImpl(oQueryVO);
if (oHeaderMetaInfo != null) {
oBaseHeaderVO.setOWhenPicked(oHeaderMetaInfo.getOWhenPicked());
oBaseHeaderVO.setTotalCount(oHeaderMetaInfo.getRecordCount());
} else {
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
}
oBaseHeaderVO.setMaxHeaderSize(oQueryVO.getMaxHeaderSize());
if (oHeaderMetaInfo.getRecordCount() == 0L)
return oBaseHeaderVO;
oBaseHeaderVO.setPositionRequested(1L);
oBaseHeaderVO.setCurrentSlot(oBaseHeaderVO.getSlot());
ArrayList oHeaderList = getHeaderRecordImpl(oQueryVO, oBaseHeaderVO.getHeaderStartPosition(), oBaseHeaderVO.getHeaderLastPosition());
if (oHeaderList == null)
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
if (oUser == null)
throw new EnrgiseApplicationException("wenrgise.common.sessiontimedout", "M");
oBaseHeaderVO.setOHeaderVOTable(oHeaderList);
oUser.putBaseHeaderVO(sFormName, oBaseHeaderVO);
oUser.putBaseQueryVO(sFormName, oQueryVO);
} catch (RemoteException oEx) {
System.out.println(oEx.getMessage());
throw new EnrgiseSystemException();
}
return oBaseHeaderVO;
}
public BaseHeaderVO getNextHeaderRecord(BaseQueryVO oQueryVO, long lPositionRequested, String sFormName, boolean bForce, UserSession oUser) throws EnrgiseApplicationException, EnrgiseSystemException {
try {
BaseHeaderVO oBaseHeaderVO = oUser.getBaseHeaderVO(sFormName);
oBaseHeaderVO.setPositionRequested(lPositionRequested);
if (oBaseHeaderVO.getCurrentSlot() == oBaseHeaderVO.getSlot() && !bForce)
return oBaseHeaderVO;
ArrayList oHeaderList = getHeaderRecordImpl(oQueryVO, oBaseHeaderVO.getHeaderStartPosition(), oBaseHeaderVO.getHeaderLastPosition());
oBaseHeaderVO.setCurrentSlot(oBaseHeaderVO.getSlot());
oBaseHeaderVO.setOHeaderVOTable(oHeaderList);
oUser.putBaseHeaderVO(sFormName, oBaseHeaderVO);
return oBaseHeaderVO;
} catch (RemoteException oEx) {
System.out.println(oEx.getMessage());
throw new EnrgiseSystemException();
}
}
public BaseDetailVO getDetailRecord(String sFormName, String sScreenName, String sPrimaryKey, long lPageRequested, DetailSizeValues oDetailSizeValues, BaseDetailVO oBaseDetailVO, boolean bForce, UserSession oUser) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oDetailList = null;
try {
if (oBaseDetailVO == null || bForce) {
oBaseDetailVO = new BaseDetailVO();
oBaseDetailVO.setMaxPage(oDetailSizeValues.getMaxPages());
oBaseDetailVO.setRecordsPerPage(oDetailSizeValues.getDetailRecordPerPage());
RecordMetaInfo oRecordMetaInfo = getTotalDetailRecordCountImpl(sPrimaryKey, sScreenName);
oBaseDetailVO.setTotalDetailRecord(oRecordMetaInfo.getRecordCount());
oBaseDetailVO.setOWhenPicked(oRecordMetaInfo.getOWhenPicked());
if (oRecordMetaInfo.getRecordCount() == 0L)
return oBaseDetailVO;
}
long lSlotRequested = oBaseDetailVO.getSlot(lPageRequested);
if (!bForce) {
if (oBaseDetailVO.getCurrentPage() == lPageRequested)
return oBaseDetailVO;
if (lSlotRequested == oBaseDetailVO.getCurrentSlot()) {
int iRelativeStartIndex = oBaseDetailVO.getRelativeStart(lPageRequested);
int iRelativeEndIndex = oBaseDetailVO.getRelativeEnd(lPageRequested);
EnrgiseUtil.pageArrayCopier(oBaseDetailVO.getOAllPageData(), oBaseDetailVO.getOThisPageData(), iRelativeStartIndex, iRelativeEndIndex - iRelativeStartIndex + 1);
} else if (oBaseDetailVO.getTotalDetailRecord() % (oDetailSizeValues.getMaxPages() * oDetailSizeValues.getDetailRecordPerPage()) == 0L && oBaseDetailVO.getRowAdded() == 1) {
oBaseDetailVO.setOAllPageData(new ArrayList());
oBaseDetailVO.setOThisPageData(new ArrayList());
} else {
oBaseDetailVO.setCurrentSlot(lSlotRequested);
oDetailList = getDetailRecordImpl(sPrimaryKey, sScreenName, oBaseDetailVO.getSlotStartPosition(), oBaseDetailVO.getSlotLastPosition());
oBaseDetailVO.setOAllPageData(oDetailList);
int iRelativeStartIndex = oBaseDetailVO.getRelativeStart(lPageRequested);
int iRelativeEndIndex = oBaseDetailVO.getRelativeEnd(lPageRequested);
EnrgiseUtil.pageArrayCopier(oBaseDetailVO.getOAllPageData(), oBaseDetailVO.getOThisPageData(), iRelativeStartIndex, iRelativeEndIndex - iRelativeStartIndex + 1);
}
} else {
oBaseDetailVO.setCurrentSlot(lSlotRequested);
oDetailList = getDetailRecordImpl(sPrimaryKey, sScreenName, oBaseDetailVO.getSlotStartPosition(), oBaseDetailVO.getSlotLastPosition());
oBaseDetailVO.setOAllPageData(oDetailList);
int iRelativeStartIndex = oBaseDetailVO.getRelativeStart(lPageRequested);
int iRelativeEndIndex = oBaseDetailVO.getRelativeEnd(lPageRequested);
EnrgiseUtil.pageArrayCopier(oBaseDetailVO.getOAllPageData(), oBaseDetailVO.getOThisPageData(), iRelativeStartIndex, iRelativeEndIndex - iRelativeStartIndex + 1);
}
oBaseDetailVO.setCurrentPage(lPageRequested);
oBaseDetailVO.setCurrentSlot(lSlotRequested);
oUser.putBaseDetailVO(sFormName, sScreenName, oBaseDetailVO);
return oBaseDetailVO;
} catch (RemoteException oEx) {
System.out.println(oEx.getMessage());
throw new EnrgiseSystemException();
}
}
public BaseDetailVO getDetailRecord(String sFormName, String sScreenName, BaseQueryVO oBaseQueryVO, long lPageRequested, DetailSizeValues oDetailSizeValues, BaseDetailVO oBaseDetailVO, boolean bForce, UserSession oUser) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oDetailList = null;
try {
if (oBaseDetailVO == null || bForce) {
oBaseDetailVO = new BaseDetailVO();
oBaseDetailVO.setMaxPage(oDetailSizeValues.getMaxPages());
oBaseDetailVO.setRecordsPerPage(oDetailSizeValues.getDetailRecordPerPage());
RecordMetaInfo oRecordMetaInfo = getTotalDetailRecordCountImpl(oBaseQueryVO, sScreenName);
oBaseDetailVO.setTotalDetailRecord(oRecordMetaInfo.getRecordCount());
oBaseDetailVO.setOWhenPicked(oRecordMetaInfo.getOWhenPicked());
if (oRecordMetaInfo.getRecordCount() == 0L)
return oBaseDetailVO;
}
long lSlotRequested = oBaseDetailVO.getSlot(lPageRequested);
if (!bForce) {
if (oBaseDetailVO.getCurrentPage() == lPageRequested)
return oBaseDetailVO;
if (lSlotRequested == oBaseDetailVO.getCurrentSlot()) {
int iRelativeStartIndex = oBaseDetailVO.getRelativeStart(lPageRequested);
int iRelativeEndIndex = oBaseDetailVO.getRelativeEnd(lPageRequested);
EnrgiseUtil.pageArrayCopier(oBaseDetailVO.getOAllPageData(), oBaseDetailVO.getOThisPageData(), iRelativeStartIndex, iRelativeEndIndex - iRelativeStartIndex + 1);
} else if (oBaseDetailVO.getTotalDetailRecord() % (oDetailSizeValues.getMaxPages() * oDetailSizeValues.getDetailRecordPerPage()) == 0L && oBaseDetailVO.getRowAdded() == 1) {
oBaseDetailVO.setOAllPageData(new ArrayList());
oBaseDetailVO.setOThisPageData(new ArrayList());
} else {
oBaseDetailVO.setCurrentSlot(lSlotRequested);
oDetailList = getDetailRecordImpl(oBaseQueryVO, sScreenName, oBaseDetailVO.getSlotStartPosition(), oBaseDetailVO.getSlotLastPosition());
oBaseDetailVO.setOAllPageData(oDetailList);
int iRelativeStartIndex = oBaseDetailVO.getRelativeStart(lPageRequested);
int iRelativeEndIndex = oBaseDetailVO.getRelativeEnd(lPageRequested);
EnrgiseUtil.pageArrayCopier(oBaseDetailVO.getOAllPageData(), oBaseDetailVO.getOThisPageData(), iRelativeStartIndex, iRelativeEndIndex - iRelativeStartIndex + 1);
}
} else {
oBaseDetailVO.setCurrentSlot(lSlotRequested);
oDetailList = getDetailRecordImpl(oBaseQueryVO, sScreenName, oBaseDetailVO.getSlotStartPosition(), oBaseDetailVO.getSlotLastPosition());
oBaseDetailVO.setOAllPageData(oDetailList);
int iRelativeStartIndex = oBaseDetailVO.getRelativeStart(lPageRequested);
int iRelativeEndIndex = oBaseDetailVO.getRelativeEnd(lPageRequested);
EnrgiseUtil.pageArrayCopier(oBaseDetailVO.getOAllPageData(), oBaseDetailVO.getOThisPageData(), iRelativeStartIndex, iRelativeEndIndex - iRelativeStartIndex + 1);
}
oBaseDetailVO.setCurrentPage(lPageRequested);
oBaseDetailVO.setCurrentSlot(lSlotRequested);
oUser.putBaseDetailVO(sFormName, sScreenName, oBaseDetailVO);
return oBaseDetailVO;
} catch (RemoteException oEx) {
System.out.println(oEx.getMessage());
throw new EnrgiseSystemException();
}
}
public Map getDisabledFields(ThisPageVO oThisPageVO) throws EnrgiseApplicationException, EnrgiseSystemException {
return getDisabledFieldsImpl(oThisPageVO);
}
public void onLoadAction(ThisPageVO oThisPageVO) throws EnrgiseApplicationException, EnrgiseSystemException {}
public String saveRecord(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
return saveImpl(oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked);
}
public abstract ArrayList getHeaderRecordImpl(BaseQueryVO paramBaseQueryVO, long paramLong1, long paramLong2) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException;
public abstract Map getDisabledFieldsImpl(ThisPageVO paramThisPageVO) throws EnrgiseApplicationException, EnrgiseSystemException;
public abstract RecordMetaInfo getHeaderMetaImpl(BaseQueryVO paramBaseQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException;
public abstract RecordMetaInfo getTotalDetailRecordCountImpl(String paramString1, String paramString2) throws EnrgiseApplicationException, EnrgiseSystemException;
public abstract ArrayList getDetailRecordImpl(String paramString1, String paramString2, long paramLong1, long paramLong2) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException;
public RecordMetaInfo getTotalDetailRecordCountImpl(BaseQueryVO oBaseQueryVO, String sScreenName) throws EnrgiseApplicationException, EnrgiseSystemException {
return null;
}
public ArrayList getDetailRecordImpl(BaseQueryVO oBaseQueryVO, String sScreenName, long lAbsoluteStart, long lAbsoluteEnd) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
return null;
}
public abstract boolean updateHeaderRecordImpl(BaseHeaderBean paramBaseHeaderBean) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException;
public abstract String saveImpl(BaseHeaderBean paramBaseHeaderBean, Timestamp paramTimestamp1, String paramString1, String paramString2, boolean paramBoolean1, ArrayList paramArrayList, boolean paramBoolean2, Timestamp paramTimestamp2) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException;
public abstract String getInsertDataImpl(BaseQueryVO paramBaseQueryVO) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException;
public long getLStartPosition() {
return this.lStartPosition;
}
public void setLStartPosition(long newLStartPosition) {
this.lStartPosition = newLStartPosition;
}
public long getLLastPosition() {
return this.lLastPosition;
}
public void setLLastPosition(long newLLastPosition) {
this.lLastPosition = newLLastPosition;
}
public UserInfo getOUserInfo() {
return this.oUserInfo;
}
public void setOUserInfo(UserInfo newOUserInfo) {
this.oUserInfo = newOUserInfo;
}
public EJBObject getModuleFacade() {
return (EJBObject)this.oMap.get(this.moduleName);
}
public EJBObject getModuleFacade(String key) {
return (EJBObject)this.oMap.get(key);
}
public void setModuleFacade(HashMap oMap) {
this.oMap = oMap;
}
public HashMap getComboDetails() throws EnrgiseApplicationException, EnrgiseSystemException {
return null;
}
public HashMap getDetailComboDetails() throws EnrgiseApplicationException, EnrgiseSystemException {
return null;
}
public String submit(String sButtonName, BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
return submitImpl(sButtonName, oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked);
}
public abstract String submitImpl(String paramString1, BaseHeaderBean paramBaseHeaderBean, Timestamp paramTimestamp1, String paramString2, String paramString3, boolean paramBoolean1, ArrayList paramArrayList, boolean paramBoolean2, Timestamp paramTimestamp2) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException;
public String getModuleName() {
return this.moduleName;
}
public void setModuleName(String newModuleName) {
this.moduleName = newModuleName;
}
}

View File

@@ -0,0 +1,32 @@
package wenrgise.common.businessdelegate;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.ServiceLocator;
import wenrgise.common.vo.LovQueryVO;
import wenrgise.common.vo.LovVO;
import wenrgise.common.xml.vo.LOVInfo;
public class LOVBD {
public LovVO getLOVData(LOVInfo oLOVInfo, LovQueryVO oLOVQueryVO) throws EnrgiseSystemException {
try {
String sFacadeName = oLOVInfo.getFacadeName();
System.out.println(sFacadeName);
Object obj = ServiceLocator.getLocator().getService(sFacadeName);
Method oMethod = obj.getClass().getDeclaredMethod("create", null);
Object oFacadeObj = oMethod.invoke(obj, null);
Class[] oCls = { oLOVQueryVO.getClass() };
Method oFnMethod = oFacadeObj.getClass().getDeclaredMethod(oLOVInfo.getFunctionName(), oCls);
Object[] oParams = { oLOVQueryVO };
LovVO oLovVO = (LovVO)oFnMethod.invoke(oFacadeObj, oParams);
return oLovVO;
} catch (InvocationTargetException oInv) {
throw new EnrgiseSystemException(oInv);
} catch (IllegalAccessException oIll) {
throw new EnrgiseSystemException(oIll);
} catch (NoSuchMethodException oMet) {
throw new EnrgiseSystemException(oMet);
}
}
}

View File

@@ -0,0 +1,44 @@
package wenrgise.common.businessdelegate;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import javax.ejb.CreateException;
import wenrgise.common.bean.EmpInfoBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.ejb.common.facade.SecurityFacade;
import wenrgise.ejb.common.facade.SecurityFacadeHome;
import wenrgise.ejb.common.utility.ServiceLocator;
public class SecurityBD {
public HashMap getDisabledFields(String sScreenName, String sHdrDtlFlag, String sSreenMode, String sPageStatus) throws RemoteException, EnrgiseSystemException, EnrgiseApplicationException {
try {
SecurityFacadeHome oHome = (SecurityFacadeHome)ServiceLocator.getLocator().getService("HrmSecurityFacade");
SecurityFacade oSecFacade = oHome.create();
return oSecFacade.getDisabledFields(sScreenName, sHdrDtlFlag, sSreenMode, sPageStatus);
} catch (CreateException oCex) {
throw new EnrgiseApplicationException("wenrgise.common.internal");
}
}
public ArrayList getTreeSet(EmpInfoBean oEmpInfoBean) throws RemoteException, EnrgiseSystemException, EnrgiseApplicationException {
try {
SecurityFacadeHome oHome = (SecurityFacadeHome)ServiceLocator.getLocator().getService("HrmSecurityFacade");
SecurityFacade oSecFacade = oHome.create();
return oSecFacade.addMenuList(oEmpInfoBean);
} catch (CreateException oCex) {
throw new EnrgiseApplicationException("wenrgise.common.internal");
}
}
public HashMap getAccessInfo(EmpInfoBean oEmpInfoBean) throws RemoteException, EnrgiseSystemException, EnrgiseApplicationException {
try {
SecurityFacadeHome oHome = (SecurityFacadeHome)ServiceLocator.getLocator().getService("HrmSecurityFacade");
SecurityFacade oSecFacade = oHome.create();
return oSecFacade.getAccessInfo(oEmpInfoBean);
} catch (CreateException oCex) {
throw new EnrgiseApplicationException("wenrgise.common.internal");
}
}
}

View File

@@ -0,0 +1,475 @@
package wenrgise.common.ejb.business;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.DateUtility;
import wenrgise.common.utility.EnrgiseUtil;
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.helper.QueryValue;
import wenrgise.ejb.common.utility.DBUtilitiesBean;
public class HrmCommonBO extends BaseBO {
public static final int AFTER_TIME = 1;
public static final int TIME_ERROR = -2;
public static final int EQUAL_TIME = 0;
public static final int BEFORE_TIME = -1;
public HrmCommonBO() {}
public HrmCommonBO(UserInfo oUserInfo) {
super(oUserInfo);
}
public String getRefList(String sTabName, String sRefKey, String sRefValue, String sPrmKey) throws EnrgiseSystemException {
String sRefList = new String();
String sQuery = null;
sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("SELECT distinct ").concat(String.valueOf(sPrmKey))).concat(String.valueOf(" as keyId from "))).concat(String.valueOf(sTabName))).concat(String.valueOf(" where "))).concat(String.valueOf(sRefKey))).concat(String.valueOf(" = "))).concat(String.valueOf(sRefValue));
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
sRefList = String.valueOf(sRefList).concat(String.valueOf(oRow.get("keyId").getString()));
sRefList = String.valueOf(sRefList).concat(String.valueOf(","));
}
}
return sRefList;
}
public String getRefList1(String sTabName, String sRefKey, String sRefValue, String sPrmKey) throws EnrgiseSystemException {
String sRefList = new String();
String sQuery = null;
sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("SELECT distinct ").concat(String.valueOf(sPrmKey))).concat(String.valueOf(" as keyId from "))).concat(String.valueOf(sTabName))).concat(String.valueOf(" where "))).concat(String.valueOf(sRefKey))).concat(String.valueOf(" ='"))).concat(String.valueOf(sRefValue))).concat(String.valueOf("'"));
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
sRefList = String.valueOf(sRefList).concat(String.valueOf(oRow.get("keyId").getString()));
}
}
return sRefList;
}
public void deleteChildDetailRec(String sChildTabName, String sRefKey, String sRefValue, String sRefIdList) throws EnrgiseSystemException {
String sQuery = null;
DBUtilitiesBean oBean = new DBUtilitiesBean();
if (sRefIdList != null) {
sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("Delete from ").concat(String.valueOf(sChildTabName))).concat(String.valueOf(" where "))).concat(String.valueOf(sRefKey))).concat(String.valueOf(" in ( "))).concat(String.valueOf(sRefIdList))).concat(String.valueOf(" )"));
} else {
sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("Delete from ").concat(String.valueOf(sChildTabName))).concat(String.valueOf(" where "))).concat(String.valueOf(sRefKey))).concat(String.valueOf(" ="))).concat(String.valueOf(sRefValue));
}
int flag = oBean.executeUpsert(sQuery);
}
public String getNextCnclDtlToDate(String sDate, String sTxnId) throws EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
String sNextDate = null;
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
oParameters.add(new DBObject(2, 1, 12, sTxnId));
oParameters.add(new DBObject(3, 2, -10));
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, "HRMLVCANQUERY.proc_GetNextCnclDtlToDate(?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
QueryRow oRow = null;
QueryValue oValue = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
sNextDate = EnrgiseUtil.convertToString(oRow.get("NEXTCNCLDTLTODATE").getDate());
}
return sNextDate;
}
public String getPrevCnclDtlFromDate(String sDate, String sTxnId) throws EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
String sPrevDate = null;
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
oParameters.add(new DBObject(2, 1, 12, sTxnId));
oParameters.add(new DBObject(3, 2, -10));
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, "HRMLVCANQUERY.proc_GetPrevCnclDtlFromDate(?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
QueryRow oRow = null;
QueryValue oValue = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
sPrevDate = EnrgiseUtil.convertToString(oRow.get("PREVCNCLDTLTODATE").getDate());
}
return sPrevDate;
}
public String getStartDate(String sCalId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
sDate = getddmmyyyyDateFormat(sDate);
DateUtility d = new DateUtility();
ArrayList oParameters = new ArrayList();
String startDate = null;
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sCalId));
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, "HRMORGCALENDARMST.proc_GetHrCalHdrInfoById(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() == 0);
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
String beginMonth = oRow.get("BEGIN_MONTH").getString();
String durationMonth = oRow.get("DURATION_MONTH").getString();
int beMon = Integer.parseInt(beginMonth);
String monOfDate = sDate.substring(3, 5);
String yearOfDate = sDate.substring(6, 10);
int monDate = Integer.parseInt(monOfDate);
int yrDate = Integer.parseInt(yearOfDate);
if (beMon <= monDate) {
if (beMon < 10)
beginMonth = String.valueOf("0").concat(String.valueOf(beginMonth));
startDate = String.valueOf(String.valueOf(String.valueOf("01/").concat(String.valueOf(beginMonth))).concat(String.valueOf("/"))).concat(String.valueOf(yearOfDate));
continue;
}
if (beMon > monDate) {
if (beMon < 10)
beginMonth = String.valueOf("0").concat(String.valueOf(beginMonth));
startDate = String.valueOf(String.valueOf(String.valueOf("01/").concat(String.valueOf(beginMonth))).concat(String.valueOf("/"))).concat(String.valueOf(yrDate - 1));
}
}
startDate = getddmmmyyyyDateFormat(startDate);
return startDate;
}
public String getEndDate(String sCalId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
String sStartDate = getStartDate(sCalId, sDate);
sStartDate = getddmmyyyyDateFormat(sStartDate);
String sEndDate = null;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sCalId));
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, "HRMORGCALENDARMST.proc_GetHrCalHdrInfoById(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() == 0);
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
int yrEndDate, ddEndDate;
oRow = oIt.next();
String durationMonth = oRow.get("DURATION_MONTH").getString();
int durMon = Integer.parseInt(durationMonth);
String monOfStartDate = sStartDate.substring(3, 5);
String yearOfStartDate = sStartDate.substring(6, 10);
int monStartDate = Integer.parseInt(monOfStartDate);
int yrStartDate = Integer.parseInt(yearOfStartDate);
int monEndDate = monStartDate + durMon - 1;
if (monEndDate > 12) {
monEndDate -= 12;
yrEndDate = yrStartDate + 1;
} else {
yrEndDate = yrStartDate;
}
if (monEndDate == 2) {
int quo = yrEndDate / 4;
int rem = yrEndDate - 4 * quo;
if (rem == 0) {
ddEndDate = 29;
} else {
ddEndDate = 28;
}
} else if (monEndDate == 4 || monEndDate == 6 || monEndDate == 9 || monEndDate == 11) {
ddEndDate = 30;
} else {
ddEndDate = 31;
}
if (monEndDate < 10) {
sEndDate = String.valueOf(String.valueOf(String.valueOf(String.valueOf(ddEndDate).concat(String.valueOf("/0"))).concat(String.valueOf(monEndDate))).concat(String.valueOf("/"))).concat(String.valueOf(yrEndDate));
continue;
}
sEndDate = String.valueOf(String.valueOf(String.valueOf(String.valueOf(ddEndDate).concat(String.valueOf("/"))).concat(String.valueOf(monEndDate))).concat(String.valueOf("/"))).concat(String.valueOf(yrEndDate));
}
sEndDate = getddmmmyyyyDateFormat(sEndDate);
return sEndDate;
}
public String getddmmyyyyDateFormat(String sDate) throws EnrgiseSystemException {
String sRetDate = null;
String monOfDate = sDate.substring(3, 6);
String yrOfdate = sDate.substring(7, 11);
String ddOfDate = sDate.substring(0, 2);
String[] e = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
"Nov", "Dec" };
for (int i = 1; i < e.length + 1; i++) {
if (e[i - 1].equalsIgnoreCase(monOfDate))
monOfDate = (i <= 9) ? String.valueOf("0").concat(String.valueOf(String.valueOf(i))) : String.valueOf(i);
}
sRetDate = String.valueOf(String.valueOf(String.valueOf(String.valueOf(ddOfDate).concat(String.valueOf("/"))).concat(String.valueOf(monOfDate))).concat(String.valueOf("/"))).concat(String.valueOf(yrOfdate));
return sRetDate;
}
public String getddmmmyyyyDateFormat(String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
String sRetDate = null;
String monOfDate = sDate.substring(3, 5);
int monDate = Integer.parseInt(monOfDate);
String yrOfdate = sDate.substring(6, 10);
String ddOfDate = sDate.substring(0, 2);
String[] e = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
"Nov", "Dec" };
for (int i = 1; i < e.length + 1; i++) {
if (i == monDate)
monOfDate = e[i - 1];
}
sRetDate = String.valueOf(String.valueOf(String.valueOf(String.valueOf(ddOfDate).concat(String.valueOf("-"))).concat(String.valueOf(monOfDate))).concat(String.valueOf("-"))).concat(String.valueOf(yrOfdate));
return sRetDate;
}
public int getDayOfWeek(String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
HrmCommonBO oBO = new HrmCommonBO();
String sDdmmyyyy = oBO.getddmmyyyyDateFormat(sDate);
int iDay = Integer.parseInt(sDdmmyyyy.substring(0, 2));
int iMonth = Integer.parseInt(sDdmmyyyy.substring(3, 5));
int iYear = Integer.parseInt(sDdmmyyyy.substring(6, 10));
iMonth--;
GregorianCalendar c = new GregorianCalendar(iYear, iMonth, iDay);
int iDayOfWeek = c.get(7);
iDayOfWeek = (iDayOfWeek == 1) ? 7 : (iDayOfWeek - 1);
return iDayOfWeek;
}
public int getWeekOfMonth(String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
HrmCommonBO oBO = new HrmCommonBO();
String sDdmmyyyy = oBO.getddmmyyyyDateFormat(sDate);
int iDay = Integer.parseInt(sDdmmyyyy.substring(0, 2));
int iMonth = Integer.parseInt(sDdmmyyyy.substring(3, 5));
int iYear = Integer.parseInt(sDdmmyyyy.substring(6, 10));
iMonth--;
GregorianCalendar c = new GregorianCalendar(iYear, iMonth, iDay);
int iWeekOfMonth = c.get(4);
return iWeekOfMonth;
}
public Date getNextDay(String sDate, int iDays) throws EnrgiseSystemException {
HrmCommonBO oBO = new HrmCommonBO();
String sDdmmyyyy = oBO.getddmmyyyyDateFormat(sDate);
int iDay = Integer.parseInt(sDdmmyyyy.substring(0, 2));
int iMonth = Integer.parseInt(sDdmmyyyy.substring(3, 5));
int iYear = Integer.parseInt(sDdmmyyyy.substring(6, 10));
iMonth--;
GregorianCalendar c = new GregorianCalendar(iYear, iMonth, iDay);
while (iDays-- > 0) {
if (iMonth == 3 || iMonth == 5 || iMonth == 8 || iMonth == 10) {
if (iDay == 30) {
iDay = 1;
iMonth++;
} else {
iDay++;
}
} else if (iMonth == 1) {
if (iDay == 28) {
if (c.isLeapYear(iYear)) {
iDay++;
} else {
iDay = 1;
iMonth++;
}
} else if (iDay == 29) {
iDay = 1;
iMonth++;
} else {
iDay++;
}
} else if (iDay == 31) {
iDay = 1;
if (iMonth == 11) {
iMonth = 0;
iYear++;
} else {
iMonth++;
}
} else {
iDay++;
}
c.set(iYear, iMonth, iDay);
}
Date dDate = new Date(c.getTimeInMillis());
return dDate;
}
public Date getPreviousDay(String sDate, int iDays) throws EnrgiseSystemException {
HrmCommonBO oBO = new HrmCommonBO();
String ddmmyyyy = oBO.getddmmyyyyDateFormat(sDate);
int iDay = Integer.parseInt(ddmmyyyy.substring(0, 2));
int iMonth = Integer.parseInt(ddmmyyyy.substring(3, 5));
int iYear = Integer.parseInt(ddmmyyyy.substring(6, 10));
iMonth--;
GregorianCalendar c = new GregorianCalendar(iYear, iMonth, iDay);
while (iDays-- > 0) {
if (iMonth == 1 || iMonth == 3 || iMonth == 5 || iMonth == 8 || iMonth == 10) {
if (iDay == 1) {
iDay = 31;
iMonth--;
} else {
iDay--;
}
} else if (iMonth == 3) {
if (iDay == 1) {
if (c.isLeapYear(iYear)) {
iDay = 29;
iMonth--;
} else {
iDay = 28;
iMonth--;
}
} else {
iDay--;
}
} else if (iDay == 1) {
iDay = 30;
if (iMonth == 1) {
iMonth = 12;
iYear--;
} else {
iMonth--;
}
} else {
iDay--;
}
c.set(iYear, iMonth, iDay);
}
Date dDate = new Date(c.getTimeInMillis());
return dDate;
}
public boolean checkTimeFormat(String sTime) throws EnrgiseSystemException {
boolean sFlag = true;
if (sTime.length() != 5 || !sTime.substring(2, 3).equalsIgnoreCase(":"))
sFlag = false;
return sFlag;
}
public boolean checkTimeValue(String sTime) throws EnrgiseSystemException {
boolean returnVal = true;
String sHour = sTime.substring(0, 2);
String sMin = sTime.substring(3, 5);
int stHour = Integer.parseInt(sHour);
int stMin = Integer.parseInt(sMin);
if (stHour >= 24 || stHour < 0)
returnVal = false;
if (stMin >= 60 || stMin < 0)
returnVal = false;
return returnVal;
}
public int compareTime(String sRefTime, String sOrigTime) throws EnrgiseSystemException {
if (null == sOrigTime || null == sRefTime)
return -2;
String sRefHour = sRefTime.substring(0, 2);
String sRefMin = sRefTime.substring(3, 5);
String refTime = String.valueOf(sRefHour).concat(String.valueOf(sRefMin));
String sOrigHour = sOrigTime.substring(0, 2);
String sOrigMin = sOrigTime.substring(3, 5);
String origTime = String.valueOf(sOrigHour).concat(String.valueOf(sOrigMin));
int iRefTime = Integer.parseInt(refTime);
int iOrigTime = Integer.parseInt(origTime);
if (iRefTime == iOrigTime)
return 0;
if (iOrigTime < iRefTime)
return -1;
return 1;
}
public String getSysDate() throws EnrgiseSystemException {
HrmCommonBO oBO = new HrmCommonBO();
String sSysdate = EnrgiseUtil.convertToString(Calendar.getInstance().getTime());
String ddmmyyyy = oBO.getddmmyyyyDateFormat(sSysdate);
return ddmmyyyy;
}
public void checkMMYYYY(String yymm, ArrayList oErrorList) {
if (yymm.length() != 6) {
oErrorList.add(new EnrgiseApplicationException("hrms.common.yyyymm"));
return;
}
if (yymm.substring(2, 3).equals("0")) {
oErrorList.add(new EnrgiseApplicationException("hrms.common.yyyymm"));
return;
}
int mon = Integer.parseInt(yymm.substring(0, 2));
if (mon > 12 || mon < 1) {
oErrorList.add(new EnrgiseApplicationException("hrms.common.yyyymm"));
return;
}
}
public String getTimeDiff(String sRefTime, String sOrigTime) throws EnrgiseApplicationException, EnrgiseSystemException {
HrmCommonBO oBO = new HrmCommonBO();
return new String();
}
public void initializeBOImpl() {
this.headerTable = "PUM_PO_HDR";
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {}
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String sScreenMode) throws EnrgiseSystemException {
return " ";
}
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
return " ";
}
public void additionalFieldValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
public void additionalBusinessValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
}

View File

@@ -0,0 +1,21 @@
package wenrgise.common.exception;
import java.io.Serializable;
public class BaseException extends Exception implements Serializable {
private String sKey;
public BaseException() {}
public BaseException(String sKey) {
this.sKey = sKey;
}
public String getKey() {
return this.sKey;
}
public void setKey(String sMessageKey) {
this.sKey = sMessageKey;
}
}

View File

@@ -0,0 +1,62 @@
package wenrgise.common.exception;
import java.io.Serializable;
import java.util.ArrayList;
public class EnrgiseApplicationException extends BaseException implements Serializable {
private ArrayList oListExceptions;
private ArrayList oArguments;
private String errorType = null;
public EnrgiseApplicationException() {}
public EnrgiseApplicationException(String sMsgKey) {
super(sMsgKey);
this.errorType = "E";
}
public EnrgiseApplicationException(String sMsgKey, String errorType) {
super(sMsgKey);
this.errorType = errorType;
}
public EnrgiseApplicationException(String sMsgKey, ArrayList oArguments) {
super(sMsgKey);
this.oArguments = oArguments;
this.errorType = "E";
}
public EnrgiseApplicationException(String sMsgKey, ArrayList oArguments, String sErrorType) {
super(sMsgKey);
this.oArguments = oArguments;
this.errorType = sErrorType;
}
public ArrayList getList() {
return this.oListExceptions;
}
public void setList(ArrayList oListExceptions) {
this.oListExceptions = oListExceptions;
}
public void addToList(EnrgiseApplicationException oAppExcp) {
if (this.oListExceptions == null)
this.oListExceptions = new ArrayList();
this.oListExceptions.add(oAppExcp);
}
public ArrayList getArguments() {
return this.oArguments;
}
public void setArguments(ArrayList newOArguments) {
this.oArguments = newOArguments;
}
public String getErrorType() {
return this.errorType;
}
}

View File

@@ -0,0 +1,16 @@
package wenrgise.common.exception;
import java.io.Serializable;
import java.util.ArrayList;
public class EnrgiseMessageKeyException extends EnrgiseApplicationException implements Serializable {
public EnrgiseMessageKeyException() {}
public EnrgiseMessageKeyException(String sMsgKey, ArrayList oArguments) {
super(sMsgKey, oArguments);
}
public EnrgiseMessageKeyException(String sMsgKey, ArrayList oArguments, String sErrorType) {
super(sMsgKey, oArguments, sErrorType);
}
}

View File

@@ -0,0 +1,18 @@
package wenrgise.common.exception;
import java.io.Serializable;
public class EnrgiseSystemException extends BaseException implements Serializable {
private Exception oRootCause;
public EnrgiseSystemException() {}
public EnrgiseSystemException(Exception oExcp) {
this.oRootCause = oExcp;
}
public EnrgiseSystemException(String sKey, Exception oExcp) {
super(sKey);
this.oRootCause = oExcp;
}
}

View File

@@ -0,0 +1,3 @@
package wenrgise.common.utility;
public class ArrayListUtil {}

View File

@@ -0,0 +1,39 @@
package wenrgise.common.utility;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class ContextProvider {
private Context ctx = null;
public static InitialContext localContext;
static {
try {
localContext = new InitialContext();
} catch (NamingException oNx) {
oNx.printStackTrace();
}
}
private static ContextProvider objContextProvider = new ContextProvider();
private ContextProvider() {
try {
Hashtable env = new Hashtable();
this.ctx = new InitialContext();
} catch (Throwable e) {
e.printStackTrace();
}
}
public static Context getContext() {
return objContextProvider.ctx;
}
public static InitialContext getLocalContext() {
return localContext;
}
}

View File

@@ -0,0 +1,151 @@
package wenrgise.common.utility;
import java.sql.Date;
import java.util.Calendar;
import java.util.StringTokenizer;
public class DateUtility {
public final int DATE = 1;
public final int MONTH = 2;
public final int YEAR = 3;
public String getSysDate() {
Calendar cal = Calendar.getInstance();
String sysDate = String.valueOf(String.valueOf(String.valueOf(String.valueOf(lPad(String.valueOf(cal.get(5)), 2)).concat(String.valueOf("/"))).concat(String.valueOf(lPad(String.valueOf(cal.get(2) + 1), 2)))).concat(String.valueOf("/"))).concat(String.valueOf(lPad(String.valueOf(cal.get(1)), 4)));
cal = null;
return sysDate;
}
public int dateDiff(String fromDate, String toDate) {
Calendar cal = Calendar.getInstance();
cal.set(Integer.parseInt(get(fromDate, 3)), Integer.parseInt(get(fromDate, 2)) - 1, Integer.parseInt(get(fromDate, 1)));
long fromDateInMilliSec = cal.getTime().getTime();
cal.set(Integer.parseInt(get(toDate, 3)), Integer.parseInt(get(toDate, 2)) - 1, Integer.parseInt(get(toDate, 1)));
long toDateInMilliSec = cal.getTime().getTime();
cal = null;
if (fromDateInMilliSec == toDateInMilliSec)
return 1;
int noOfDays = Math.abs((int)((toDateInMilliSec - fromDateInMilliSec) / 86400000L));
return noOfDays;
}
public int dateDiff1(String fromDate, String toDate) {
Calendar cal = Calendar.getInstance();
cal.set(Integer.parseInt(get(fromDate, 3)), Integer.parseInt(get(fromDate, 2)) - 1, Integer.parseInt(get(fromDate, 1)));
long fromDateInMilliSec = cal.getTime().getTime();
cal.set(Integer.parseInt(get(toDate, 3)), Integer.parseInt(get(toDate, 2)) - 1, Integer.parseInt(get(toDate, 1)));
long toDateInMilliSec = cal.getTime().getTime();
cal = null;
int noOfDays = Math.abs((int)((toDateInMilliSec - fromDateInMilliSec) / 86400000L));
return noOfDays;
}
public long dateDiffLong(String fromDate, String toDate) {
Calendar cal = Calendar.getInstance();
cal.set(Integer.parseInt(get(fromDate, 3)), Integer.parseInt(get(fromDate, 2)) - 1, Integer.parseInt(get(fromDate, 1)));
long fromDateInMilliSec = cal.getTime().getTime();
cal.set(Integer.parseInt(get(toDate, 3)), Integer.parseInt(get(toDate, 2)) - 1, Integer.parseInt(get(toDate, 1)));
long toDateInMilliSec = cal.getTime().getTime();
cal = null;
long noOfDaysInSec = (toDateInMilliSec - fromDateInMilliSec) / 1000L;
return noOfDaysInSec;
}
public int dateGTcurrent(String fromDate, String toDate) {
Calendar cal = Calendar.getInstance();
cal.set(Integer.parseInt(get(fromDate, 3)), Integer.parseInt(get(fromDate, 2)) - 1, Integer.parseInt(get(fromDate, 1)));
long fromDateInMilliSec = cal.getTime().getTime();
cal.set(Integer.parseInt(get(toDate, 3)), Integer.parseInt(get(toDate, 2)) - 1, Integer.parseInt(get(toDate, 1)));
long toDateInMilliSec = cal.getTime().getTime();
cal = null;
int noOfDays = (int)((toDateInMilliSec - fromDateInMilliSec) / 86400000L);
return noOfDays;
}
public String get(String inDate, int Type) {
String[] strArr = new String[4];
String retVal = "";
strArr = getDateArray(inDate);
switch (Type) {
case 3:
retVal = lPad(strArr[2], 4);
break;
case 2:
retVal = lPad(strArr[1], 2);
break;
case 1:
retVal = lPad(strArr[0], 2);
break;
}
return retVal;
}
public String reverseFormat(String tDate) {
String[] strArr = new String[4];
strArr = getDateArray(tDate);
return String.valueOf(String.valueOf(String.valueOf(String.valueOf(lPad(strArr[1], 2)).concat(String.valueOf("/"))).concat(String.valueOf(lPad(strArr[0], 2)))).concat(String.valueOf("/"))).concat(String.valueOf(lPad(strArr[2], 4)));
}
private String lPad(String inStr, int len) {
int count = len - inStr.length();
for (int i = 0; i < count; i++)
inStr = String.valueOf("0").concat(String.valueOf(inStr));
return inStr;
}
private String[] getDateArray(String tDate) {
int j = 0;
StringTokenizer strTok = new StringTokenizer(tDate, "/");
String[] strArr = new String[4];
if (strTok.countTokens() <= 0)
strTok = new StringTokenizer(tDate, "-");
while (strTok.hasMoreTokens()) {
strArr[j] = strTok.nextToken();
j++;
}
return strArr;
}
public long getDateLong(String tDate) {
Calendar cal = Calendar.getInstance();
cal.set(Integer.parseInt(get(tDate, 3)), Integer.parseInt(get(tDate, 2)) - 1, Integer.parseInt(get(tDate, 1)));
return cal.getTime().getTime();
}
public long[] months_between(String fromDate, String toDate) {
long[] retArr = new long[2];
retArr[0] = -1L;
retArr[1] = -1L;
long noOfDaysInSecs = dateDiffLong(fromDate, toDate);
double totNoOfDays = (noOfDaysInSecs / 86400L);
retArr[0] = (long)Math.floor(totNoOfDays / 30);
retArr[1] = Math.round(totNoOfDays % 30);
return retArr;
}
public long[] months_between1(String fromDate, String toDate) {
long[] retArr = new long[2];
retArr[0] = -1L;
retArr[1] = -1L;
long noOfDaysInSecs = dateDiffLong(fromDate, toDate);
double totNoOfDays = (noOfDaysInSecs / 86400L);
retArr[0] = (long)Math.floor(totNoOfDays / 30.4D);
retArr[1] = Math.round(totNoOfDays % 30);
return retArr;
}
public static void main(String[] args) {
DateUtility d = new DateUtility();
System.out.println(d.reverseFormat(d.getSysDate()));
System.out.println(d.dateDiff1("29/11/2003", "2/12/2003"));
System.out.println(d.dateDiff1("29/10/2003", "2/11/2003"));
d.getSysDate();
long[] retIntArr = d.months_between("12/12/2003", "28/12/2003");
System.out.println(String.valueOf(String.valueOf(retIntArr[0]).concat(String.valueOf("*****"))).concat(String.valueOf(retIntArr[1])));
Date d1 = new Date(d.getDateLong("29/11/2003"));
Date d2 = new Date(d.getDateLong("2/12/2003"));
System.out.println(d1.compareTo(d2));
}
}

View File

@@ -0,0 +1,44 @@
package wenrgise.common.utility;
import java.rmi.RemoteException;
import java.util.HashMap;
import javax.ejb.CreateException;
import javax.servlet.http.HttpSession;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.session.UserSessionHome;
import wenrgise.ejb.common.utility.ServiceLocator;
import wenrgise.hrms.ejb.facade.HrmFacade;
import wenrgise.hrms.ejb.facade.HrmFacadeHome;
public class DebugHelper {
public static void createUserEjb(HttpSession session) throws EnrgiseSystemException {
try {
UserSession oUser = (UserSession)session.getAttribute(ParamUtil.getSessionBeanName());
if (oUser == null) {
UserSessionHome oUserHome = (UserSessionHome)ServiceLocator.getLocator().getService("HrmUserSession");
oUser = oUserHome.create();
UserInfo oUserInfo = new UserInfo();
oUserInfo.setSiteId("1");
oUserInfo.setModuleId("4");
oUserInfo.setUserId("8501000");
oUserInfo.setCurrentYear("2011");
oUserInfo.setUserName("HANS RAJ SHARMA");
oUser.setUserInfo(oUserInfo);
HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade");
HrmFacade oHrmFacade = oHome.create();
HashMap oMap = new HashMap();
oMap.put(ParamUtil.getModuleName(), oHrmFacade);
oUser.setModuleFacade(oMap);
session.setAttribute(ParamUtil.getSessionBeanName(), oUser);
}
} catch (RemoteException oRmt) {
throw new EnrgiseSystemException();
} catch (CreateException oCrt) {
throw new EnrgiseSystemException();
} catch (Exception oExCc) {
oExCc.printStackTrace();
throw new EnrgiseSystemException();
}
}
}

View File

@@ -0,0 +1,141 @@
package wenrgise.common.utility;
public final class EnrgiseConstants {
public static final String DATABASE_NAME = ParamUtil.getDBName();
public static final int INFINITE = -999;
public static final int GET_HEADER = 1;
public static final int GET_NEXT_ACTION = 2;
public static final int GET_PREVIOUS_ACTION = 3;
public static final int GET_FIRST_ACTION = 4;
public static final int GET_LAST_ACTION = 5;
public static final int GET_DETAIL_ACTION = 6;
public static final int GET_NEXT_DETAIL_ACTION = 7;
public static final int SAVE_ACTION = 8;
public static final int EXIT_APP = 9;
public static final int NEW_ACTION = 10;
public static final int QUERY_ACTION = 10;
public static final int GET_DETAIL_PAGE_ACTION = 11;
public static final int CLOSE_WINDOW = 12;
public static final int ON_LOAD_ACTION = 13;
public static final int ADD_ROW_ACTION = 14;
public static final int DELETE_ROW_ACTION = 15;
public static final int DECR_ACTION = 16;
public static final int DELETE_ACTION = 17;
public static final int GET_BUTTON_ACTION = 18;
public static final int REFRESH_ACTION = 19;
public static final int LOV_ACTION = 20;
public static final int VALIDATE_ACTION = 21;
public static final int GET_TAB_ACTION = 22;
public static final int GET_INSERT_ACTION = 23;
public static final String SUCCESS = "success";
public static final String ERROR = "E";
public static final String MESSAGE = "M";
public static final String BASE_HEADER_VO = "BaseHeaderVO";
public static final String BASE_QUERY_VO = "BaseQueryVO";
public static final String BASE_DETAIL_VO = "BaseDetailVO";
public static final String COMPONENTS_MAP = "Components";
public static final int HEADER_SIZE = 10;
public static final String NEW_MODE = "N";
public static final String UPDATE_MODE = "U";
public static final String DELETE_MODE = "D";
public static final String QUERY_MODE = "Q";
public static final String FIRST_LOAD = "LoadingFirst";
public static final String SEARCH_RECORD = "SearchRecords";
public static final String HIDDEN = "H";
public static final String VISIBLE = "V";
public static final String ENABLE = "E";
public static final String DISABLE = "D";
public static final String HEADER = "HEADER";
public static final String DETAIL = "DETAIL";
public static final String ALL = "ALL";
public static final String STATUS = "status";
public static final String NEW = "N";
public static final String APPROVED = "A";
public static final String REVISED = "V";
public static final String REJECTED = "R";
public static final String DRAFT = "D";
public static final String CLOSED = "C";
public static final String CANCELLED = "L";
public static final String FINALLY_APPROVED = "FinallyApproved";
public static final String NOTPRICED = "N";
public static final String PRICED = "P";
public static final String ACCOUNTED = "Y";
public static final int AFTER_DATE = 1;
public static final int DATE_ERROR = -2;
public static final int EQUAL_DATE = 0;
public static final int BEFORE_DATE = -1;
public static final String POSITIVE = "P";
public static final String NEGATIVE = "N";
public static final String NOTPOSITIVE = "NP";
public static final String NOTNEGATIVE = "NN";
public static final String USER_NAME = "wenrgise.common.user.name";
public static final String SITE_NAME = "wenrgise.common.site.name";
}

View File

@@ -0,0 +1,24 @@
package wenrgise.common.utility;
import java.rmi.RemoteException;
import javax.ejb.RemoveException;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import wenrgise.ejb.common.session.UserSession;
public class EnrgiseListener implements HttpSessionListener {
public void sessionCreated(HttpSessionEvent sEvent) {}
public void sessionDestroyed(HttpSessionEvent sEvent) {
try {
HttpSession session = sEvent.getSession();
if (session != null) {
UserSession oUser = (UserSession)session.getAttribute(ParamUtil.getSessionBeanName());
oUser.remove();
}
} catch (RemoveException removeException) {
} catch (RemoteException remoteException) {}
}
}

View File

@@ -0,0 +1,64 @@
package wenrgise.common.utility;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import wenrgise.common.xml.vo.DetailScreen;
import wenrgise.common.xml.vo.DetailScreens;
import wenrgise.common.xml.vo.EnrgiseApp;
import wenrgise.common.xml.vo.EnrgiseForms;
import wenrgise.common.xml.vo.HashedEnrgiseForms;
import wenrgise.common.xml.vo.SingleForm;
public class EnrgiseManager {
private static EnrgiseManager me;
private HashMap oEnrgiseMap = new HashMap();
private HashMap appMap = new HashMap();
public static EnrgiseManager getInstance() {
if (me == null)
me = new EnrgiseManager();
return me;
}
public HashedEnrgiseForms getCachedObject(String name_) {
if (name_ == null || name_.trim().length() <= 0)
return null;
return (HashedEnrgiseForms)this.oEnrgiseMap.get(name_);
}
public void init(EnrgiseForms oEnrgiseForms) {
if (oEnrgiseForms == null)
return;
ArrayList oFormsList = oEnrgiseForms.get_SingleForm();
Iterator oIt = oFormsList.iterator();
while (oIt.hasNext()) {
SingleForm oSingleForm = oIt.next();
String sFormName = oSingleForm.get_FormName();
HashedEnrgiseForms oHashedEnrgiseForms = new HashedEnrgiseForms();
oHashedEnrgiseForms.setSingleForm(oSingleForm);
DetailScreens oDetailScreens = oSingleForm.get_DetailScreens();
ArrayList oDetailList = oDetailScreens.get_DetailScreen();
Iterator oDetailIt = oDetailList.iterator();
while (oDetailIt.hasNext()) {
DetailScreen oDetailScreen = oDetailIt.next();
String sDetailName = oDetailScreen.get_DetailScreenName();
if (!oHashedEnrgiseForms.getDetailMap().containsKey(sDetailName))
oHashedEnrgiseForms.getDetailMap().put(sDetailName, oDetailScreen);
}
if (!this.oEnrgiseMap.containsKey(sFormName))
this.oEnrgiseMap.put(sFormName, oHashedEnrgiseForms);
}
}
public void setEnrApp(EnrgiseApp oEnrApp) {
this.appMap.put("DBName", oEnrApp.get_DBName());
this.appMap.put("Module", oEnrApp.get_Module());
}
public HashMap getAppMap() {
return this.appMap;
}
}

View File

@@ -0,0 +1,60 @@
package wenrgise.common.utility;
import com.tcs.wenrgise.util.common.FWXMLUtility;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;
import wenrgise.common.xml.vo.EnrgiseApp;
import wenrgise.common.xml.vo.EnrgiseForms;
import wenrgise.common.xml.vo.INFOClass;
import wenrgise.common.xml.vo.LOVClass;
import wenrgise.workflow.utility.WflDocParamsManager;
import wenrgise.workflow.xml.vo.WflDocParams;
public class EnrgisePlugIn implements PlugIn {
static final Logger log = Logger.getLogger("wenrgise.common.utility.EnrgisePlugIn");
private String formPathName = "/WEB-INF/EnrgiseConfig.xml";
private String pathName = "/WEB-INF/EnrgiseLOV.xml";
private String appPath = "/WEB-INF/EnrgiseApp.xml";
private String reportPathName = "/WEB-INF/EnrgiseReport.xml";
private String wflImplPathName = "/WEB-INF/WflDocParameters.xml";
public void init(ActionServlet servlet, ModuleConfig config) throws ServletException {
try {
EnrgiseForms oEnrgiseForms = (EnrgiseForms)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.EnrgiseForms", calculatePath(servlet, this.formPathName));
EnrgiseManager.getInstance().init(oEnrgiseForms);
LOVClass oLOVClass = (LOVClass)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.LOVClass", calculatePath(servlet, this.pathName));
LOVManager.getInstance().init(oLOVClass);
EnrgiseApp oEnrgiseApp = (EnrgiseApp)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.EnrgiseApp", calculatePath(servlet, this.appPath));
EnrgiseManager.getInstance().setEnrApp(oEnrgiseApp);
WflDocParams oWflDocParams = (WflDocParams)FWXMLUtility.xmlToObject("wenrgise.workflow.xml.vo.WflDocParams", calculatePath(servlet, this.wflImplPathName));
WflDocParamsManager.getInstance().init(oWflDocParams);
INFOClass oINFOClass = (INFOClass)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.INFOClass", calculatePath(servlet, this.reportPathName));
StringBuffer woStringBuffer = new StringBuffer();
woStringBuffer.append(" rwserver server=peerless");
} catch (Exception oEx) {
log.severe(oEx.getMessage());
}
}
public void destroy() {}
private String calculatePath(ActionServlet servlet, String sPath) {
return servlet.getServletContext().getRealPath(sPath);
}
public String getFormPathName() {
return this.formPathName;
}
public void setFormPathName(String newFormPathName) {
this.formPathName = newFormPathName;
}
}

View File

@@ -0,0 +1,342 @@
package wenrgise.common.utility;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseMessageKeyException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.ejb.common.helper.QueryRow;
import wenrgise.ejb.common.helper.QueryValue;
import wenrgise.ejb.common.utility.DBUtilitiesBean;
public class EnrgiseUtil {
public static void pageArrayCopier(ArrayList oSource, ArrayList oDest, int iSourcePos, int iLength) throws EnrgiseSystemException {
if (oSource == null) {
System.out.println("Source array is null");
throw new EnrgiseSystemException();
}
if (oDest == null) {
System.out.println("Destination array is null");
throw new EnrgiseSystemException();
}
if (iLength < 0) {
System.out.println("Length should be positive");
return;
}
if (oSource.size() < iSourcePos + iLength) {
System.out.println("The source array is out of range");
return;
}
oDest.clear();
for (int iIndex = iSourcePos; iIndex < iSourcePos + iLength; iIndex++)
oDest.add(oSource.get(iIndex));
}
public static ArrayList addToList(ArrayList oList, Object[] obj) {
for (int i = 0; i < obj.length; i++)
oList.add(obj[i]);
return oList;
}
public static boolean checkString(String oInputString) {
if (oInputString == null)
return false;
String oString = new String(oInputString);
oString = oString.trim();
if (oString.equals(""))
return false;
return true;
}
public static int compareDates(DateFormat dateFormat, String sOrigDate, String sRefDate) throws EnrgiseSystemException {
if (!checkString(sOrigDate) || !checkString(sRefDate))
return -2;
if (null == dateFormat) {
dateFormat = DateFormat.getDateInstance(2);
dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
}
try {
Date origDate = dateFormat.parse(sOrigDate);
Date refDate = dateFormat.parse(sRefDate);
return compareDates(origDate, refDate);
} catch (ParseException oParEx) {
System.out.println(String.valueOf("Date comparison problem ").concat(String.valueOf(oParEx.getMessage())));
throw new EnrgiseSystemException();
}
}
public static int compareDates(Date origDate, Date refDate) {
if (null == origDate || null == refDate)
return -2;
if (origDate.equals(refDate))
return 0;
if (origDate.before(refDate))
return -1;
return 1;
}
public static int compareWithSysdate(Date origDate) throws EnrgiseSystemException {
return compareDates(origDate, getSysDate());
}
public static int compareWithSysdate(DateFormat dateFormat, String sOrigDate) throws EnrgiseSystemException {
if (!checkString(sOrigDate))
return -2;
if (null == dateFormat)
dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
try {
Date origDate = dateFormat.parse(sOrigDate);
return compareDates(origDate, getSysDate());
} catch (ParseException oParEx) {
System.out.println(String.valueOf("Date comparison problem ").concat(String.valueOf(oParEx.getMessage())));
throw new EnrgiseSystemException();
}
}
public static Date getSysDate() throws EnrgiseSystemException {
Date sysDate = null;
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery("SELECT sysdate FROM dual");
if (null != oList) {
QueryRow oRow = oList.get(0);
QueryValue oValue = oRow.get("sysDate");
return oValue.getDate();
}
return null;
}
public static Object setFieldValue(Object obj, String sItem, String sItemValue) throws EnrgiseSystemException {
try {
Class oClass = obj.getClass();
String sSetterMethod = getSetterMethodName(sItem);
String oStr = new String();
Class[] oCls = { oStr.getClass() };
Method oMethod = oClass.getMethod(sSetterMethod, oCls);
Object[] oParams = { sItemValue };
return oMethod.invoke(obj, oParams);
} catch (NoSuchMethodException oNsEx) {
throw new EnrgiseSystemException(oNsEx);
} catch (IllegalAccessException oIlEx) {
throw new EnrgiseSystemException(oIlEx);
} catch (InvocationTargetException oInEx) {
throw new EnrgiseSystemException(oInEx);
}
}
public static Object getFieldValue(Object obj, String sItem) throws EnrgiseSystemException {
try {
Class oClass = obj.getClass();
String sGetterMethod = getGetterMethodName(sItem);
Method oMethod = oClass.getMethod(sGetterMethod, null);
return oMethod.invoke(obj, null);
} catch (NoSuchMethodException oNsEx) {
throw new EnrgiseSystemException(oNsEx);
} catch (IllegalAccessException oIlEx) {
throw new EnrgiseSystemException(oIlEx);
} catch (InvocationTargetException oInEx) {
throw new EnrgiseSystemException(oInEx);
}
}
public static String getGetterMethodName(String sItem) {
String sFirstString = sItem.substring(0, 1);
String sRestString = sItem.substring(1);
String sFirst = sFirstString.toUpperCase();
return String.valueOf(String.valueOf("get").concat(String.valueOf(sFirst))).concat(String.valueOf(sRestString));
}
public static String getSetterMethodName(String sItem) {
String sFirstString = sItem.substring(0, 1);
String sRestString = sItem.substring(1);
String sFirst = sFirstString.toUpperCase();
return String.valueOf(String.valueOf("set").concat(String.valueOf(sFirst))).concat(String.valueOf(sRestString));
}
public static void checkDuplicate(ArrayList oList, String[] sItems, String sFieldKey, ArrayList oExceptionList) throws EnrgiseSystemException {
int index = 0;
Object[] oItemArray = null;
String[] oStatusArray = null;
ArrayList oRowList = new ArrayList();
int iSize = oList.size();
if (sItems != null) {
oItemArray = (Object[])Array.newInstance(Class.forName("java.lang.String"), iSize);
oStatusArray = (String[])Array.newInstance(Class.forName("java.lang.String"), iSize);
} else {
return;
}
if (null != sItems) {
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
Object obj = oIt.next();
oItemArray[index] = getAllFieldsValue(obj, sItems);
oStatusArray[index++] = (String)getFieldValue(obj, "status");
}
}
for (int iSource = 0; iSource < iSize; iSource++) {
if (null != oItemArray[iSource])
if (null == oStatusArray[iSource] || !oStatusArray[iSource].equals("D"))
for (int iTarget = iSource + 1; iTarget < iSize; iTarget++) {
if (null != oItemArray[iTarget])
if (null == oStatusArray || !oStatusArray[iTarget].equals("D"))
if (compareObject(oItemArray[iSource], oItemArray[iTarget])) {
ArrayList oArgList = new ArrayList();
Integer oRow = new Integer(iSource + 1);
if (null != sFieldKey) {
MessageKey oMessageKey = new MessageKey(sFieldKey);
oArgList.add(oMessageKey);
oArgList.add(oRow);
oExceptionList.add(new EnrgiseMessageKeyException("wenrgise.common.field.combinatonNotUnique", oArgList, "E"));
} else {
oArgList.add(oRow);
oExceptionList.add(new EnrgiseApplicationException("wenrgise.common.duplicatefound", oArgList, "E"));
}
}
}
}
}
public static void checkDuplicate(ArrayList oList, String sItem, String sFieldKey, ArrayList oExceptionList, boolean bCheckStatus) throws EnrgiseSystemException {
int index = 0;
Object[] oItemArray = null;
String[] oStatusArray = null;
if (null == oList)
return;
int iSize = oList.size();
if (null != sItem) {
oItemArray = (Object[])Array.newInstance(sItem.getClass(), iSize);
if (bCheckStatus)
oStatusArray = (String[])Array.newInstance(sItem.getClass(), iSize);
} else {
oItemArray = (Object[])Array.newInstance(oList.get(0).getClass(), iSize);
}
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
Object obj = oIt.next();
if (null != sItem) {
oItemArray[index] = getFieldValue(obj, sItem);
oStatusArray[index++] = (String)getFieldValue(obj, "status");
continue;
}
oItemArray[index++] = obj;
}
for (int iSource = 0; iSource < iSize; iSource++) {
if (null != oItemArray[iSource])
if (null == oStatusArray[iSource] || !oStatusArray[iSource].equals("D"))
for (int iTarget = iSource + 1; iTarget < iSize; iTarget++) {
if (null != oItemArray[iTarget])
if (null == oStatusArray || !oStatusArray[iTarget].equals("D"))
if (compareObject(oItemArray[iSource], oItemArray[iTarget])) {
ArrayList oArgList = new ArrayList();
Integer oRow = new Integer(iSource + 1);
if (null != sFieldKey) {
MessageKey oMessageKey = new MessageKey(sFieldKey);
oArgList.add(oMessageKey);
oArgList.add(oRow);
oExceptionList.add(new EnrgiseMessageKeyException("wenrgise.common.field.duplicatefound", oArgList, "E"));
} else {
oArgList.add(oRow);
oExceptionList.add(new EnrgiseApplicationException("wenrgise.common.duplicatefound", oArgList, "E"));
}
}
}
}
}
private static String getAllFieldsValue(Object obj, String[] sItems) throws EnrgiseSystemException {
String sValues = " ";
for (int i = 0; i < sItems.length; i++) {
String sValue = (String)getFieldValue(obj, sItems[i]);
if (null != sValue)
sValues = String.valueOf(sValues).concat(String.valueOf(sValue.trim()));
}
return sValues.trim();
}
private static boolean compareObject(Object oSource, Object oTarget) {
if (oSource.getClass().getName().equals("java.lang.String")) {
String sSource = ((String)oSource).trim();
String sTarget = ((String)oTarget).trim();
if (sSource.equalsIgnoreCase(sTarget))
return true;
} else if (oSource.equals(oTarget)) {
return true;
}
return false;
}
public static Timestamp convertToSqlDate(String sDate) throws EnrgiseSystemException {
if (!checkString(sDate))
return null;
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
try {
Date oDate = dateFormat.parse(sDate);
return new Timestamp(oDate.getTime());
} catch (ParseException oParEx) {
System.out.println(String.valueOf("Date comparison problem ").concat(String.valueOf(oParEx.getMessage())));
throw new EnrgiseSystemException();
}
}
public static String convertToString(Date oDate) {
return (null != oDate) ? (new SimpleDateFormat("dd-MMM-yyyy")).format(oDate) : null;
}
public static boolean checkNumber(String sInputValue, int iScale, int iPrecision, String sSign) {
String sLeft = null;
String sRight = null;
boolean bDecimal = false;
if (checkString(sInputValue)) {
String sVal = sInputValue.trim();
int iDecimalIndex = sVal.indexOf(".");
if (iDecimalIndex != -1) {
sLeft = sVal.substring(0, iDecimalIndex);
sRight = sVal.substring(iDecimalIndex + 1);
} else {
sLeft = sVal;
}
if (!sLeft.startsWith("+") && !sLeft.startsWith("-"))
sLeft = String.valueOf("+").concat(String.valueOf(sLeft));
if (iPrecision == 0 && iScale == 0)
return false;
try {
if (iPrecision == 0) {
long lVal = Long.parseLong(sVal);
if (sLeft.length() <= iScale + 1) {
if (Double.parseDouble(sLeft) == false && (sSign.equals("N") || sSign.equals("P")))
return false;
} else {
return false;
}
} else {
double d = Double.parseDouble(sVal);
}
} catch (NumberFormatException oNumEx) {
return false;
}
if (sLeft.length() > iScale + 1)
return false;
if (null != sRight)
if (sRight.length() > iPrecision)
return false;
if (null != sSign) {
if (sSign.equals("N") && !sLeft.startsWith("-"))
return false;
if (sSign.equals("P") && !sLeft.startsWith("+"))
return false;
if (sSign.equals("NN") && sLeft.startsWith("-"))
return false;
if (sSign.equals("NP") && sLeft.startsWith("+"))
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,111 @@
package wenrgise.common.utility;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.xml.vo.LOV;
import wenrgise.common.xml.vo.LOVClass;
import wenrgise.common.xml.vo.LOVInfo;
import wenrgise.common.xml.vo.Screen;
import wenrgise.common.xml.vo.ScreenMode;
import wenrgise.common.xml.vo.ScreenModes;
import wenrgise.common.xml.vo.Screens;
import wenrgise.ejb.common.helper.DBObject;
import wenrgise.ejb.common.helper.QueryRow;
import wenrgise.ejb.common.helper.QueryValue;
import wenrgise.ejb.common.utility.DBUtilitiesBean;
public class LOVManager {
private static LOVManager me;
private HashMap oMap = new HashMap();
public static LOVManager getInstance() {
if (me == null)
me = new LOVManager();
return me;
}
public LOVInfo getCachedObject(String name_) {
if (name_ == null || name_.trim().length() <= 0)
return null;
return (LOVInfo)this.oMap.get(name_);
}
public void init(LOVClass oLOVClass) {
if (oLOVClass == null)
return;
ArrayList oList = oLOVClass.get_LOV();
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
LOV oLOV = oIt.next();
String sLOVName = oLOV.get_LovKey();
Screens oScreens = oLOV.get_Screens();
Iterator oScreenIt = oScreens.get_Screen().iterator();
while (oScreenIt.hasNext()) {
Screen oScreen = oScreenIt.next();
String sScreenName = oScreen.get_ScreenName();
ScreenModes oScreenModes = oScreen.get_ScreenModes();
Iterator oScreenModeIt = oScreenModes.get_ScreenMode().iterator();
while (oScreenModeIt.hasNext()) {
ScreenMode oScreenMode = oScreenModeIt.next();
String sMode = oScreenMode.get_ModeName();
LOVInfo oLOVInfo = new LOVInfo();
oLOVInfo.setFacadeName(oScreenMode.get_FacadeName());
oLOVInfo.setFunctionName(oScreenMode.get_FunctionName());
oLOVInfo.setInsertFlag(oScreenMode.get_InsertFlag());
oLOVInfo.setRecursiveFlag(oScreenMode.get_RecursiveFlag());
String sCombinedKey = String.valueOf(String.valueOf(sLOVName).concat(String.valueOf(sScreenName))).concat(String.valueOf(sMode));
if (!this.oMap.containsKey(sCombinedKey))
this.oMap.put(sCombinedKey, oLOVInfo);
}
}
}
}
public static void main(String[] argv) {
LOVManager oLov = new LOVManager();
oLov.myFunc2();
}
private void myFunc() {
try {
String sDate = "12-JAN-1980";
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters.add(new DBObject(1, 1, 4, new Integer(2)));
oParameters.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
oParameters.add(new DBObject(3, 2, 4));
oBean.callProc(oParameters, "BASU_AREA.proc_DateTester(?,?,?)");
System.out.println("Insert successfull");
} catch (EnrgiseSystemException oEx) {
System.out.println(String.valueOf("The problem is ").concat(String.valueOf(oEx.getMessage())));
}
}
private void myFunc2() {
try {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters.add(new DBObject(1, 1, 93, EnrgiseUtil.convertToSqlDate("12-JAN-1980")));
oParameters.add(new DBObject(2, 2, -10));
oParameters.add(new DBObject(3, 2, 4));
ArrayList oList2 = oBean.callProc(oParameters, "BASU_AREA.proc_DateTester2(?,?,?)");
DBObject oOutObject = oList2.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
QueryRow oRow = oIt.next();
QueryValue oVal = oRow.get("ID");
String sId = oVal.getString();
QueryValue oVal2 = oRow.get("purchase_date");
String sDate = EnrgiseUtil.convertToString(oVal2.getDate());
System.out.println(String.valueOf(String.valueOf(String.valueOf(String.valueOf("ID is ").concat(String.valueOf(sId))).concat(String.valueOf(" "))).concat(String.valueOf("Purchase Date is "))).concat(String.valueOf(sDate)));
}
System.out.println("Fetch successfull");
} catch (EnrgiseSystemException oEx) {
System.out.println(String.valueOf("The problem is ").concat(String.valueOf(oEx.getMessage())));
}
}
}

View File

@@ -0,0 +1,21 @@
package wenrgise.common.utility;
import java.io.Serializable;
public class MessageKey implements Serializable {
private String key;
public MessageKey() {}
public MessageKey(String key) {
this.key = key;
}
public String getKey() {
return this.key;
}
public void setKey(String newKey) {
this.key = newKey;
}
}

View File

@@ -0,0 +1,94 @@
package wenrgise.common.utility;
import java.util.ArrayList;
import wenrgise.common.xml.vo.DetailScreen;
import wenrgise.common.xml.vo.DetailScreens;
import wenrgise.common.xml.vo.HashedEnrgiseForms;
import wenrgise.common.xml.vo.ReportInfo;
import wenrgise.common.xml.vo.SingleForm;
public class ParamUtil {
public static String getDBName() {
return (String)EnrgiseManager.getInstance().getAppMap().get("DBName");
}
public static String getModuleName() {
return (String)EnrgiseManager.getInstance().getAppMap().get("Module");
}
public static String getQueryVO(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_EnrgiseQueryVO();
}
public static String getHeaderBD(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_HeaderBD();
}
public static String getHeaderSaveRequired(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_HeaderSave();
}
public static String getPseudoHeaderFlag(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_PseudoHeader();
}
public static String getDetailBD(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return oDetailScreen.get_DetailBD();
}
public static String getDetailArrayName(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return oDetailScreen.get_DetailArrayName();
}
public static String getDetailBeanName(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return oDetailScreen.get_DetailBean();
}
public static String getSessionBeanName() {
return String.valueOf(getModuleName()).concat(String.valueOf("_UserSession"));
}
public static String getHeaderBean(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_HeaderBean();
}
public static int getHeaderSize(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return Integer.parseInt(oHashedEnrgiseForms.getSingleForm().get_HeaderSize());
}
public static int getDetailRecordPerPage(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return Integer.parseInt(oDetailScreen.get_DetailRecordPerPage());
}
public static int getMaxDetailPages(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return Integer.parseInt(oDetailScreen.get_DetailPagesPerSlot());
}
public static ArrayList getDetailList(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
SingleForm oSingleForm = oHashedEnrgiseForms.getSingleForm();
DetailScreens oDetailScreens = oSingleForm.get_DetailScreens();
return oDetailScreens.get_DetailScreen();
}
public static String getKeyinfo(String sMODULEname, String sJSPname, String sReportkey) {
ReportInfo oReportInfo = ReportManager.getInstance().getCachedObject(String.valueOf(String.valueOf(sMODULEname).concat(String.valueOf(sJSPname))).concat(String.valueOf(sReportkey)));
return oReportInfo.getReportKey();
}
}

View File

@@ -0,0 +1,26 @@
package wenrgise.common.utility;
import java.io.Serializable;
import java.sql.Timestamp;
public class RecordMetaInfo implements Serializable {
private Timestamp oWhenPicked = null;
private long recordCount = 0L;
public long getRecordCount() {
return this.recordCount;
}
public void setRecordCount(long newRecordCount) {
this.recordCount = newRecordCount;
}
public Timestamp getOWhenPicked() {
return this.oWhenPicked;
}
public void setOWhenPicked(Timestamp newOWhenPicked) {
this.oWhenPicked = newOWhenPicked;
}
}

View File

@@ -0,0 +1,58 @@
package wenrgise.common.utility;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import wenrgise.common.xml.vo.INFOClass;
import wenrgise.common.xml.vo.Module;
import wenrgise.common.xml.vo.Report;
import wenrgise.common.xml.vo.ReportInfo;
import wenrgise.common.xml.vo.Reports;
import wenrgise.common.xml.vo.ScreenInfo;
public class ReportManager {
private static ReportManager me;
private HashMap oMap = new HashMap();
public static ReportManager getInstance() {
if (me == null)
me = new ReportManager();
return me;
}
public ReportInfo getCachedObject(String name_) {
if (name_ == null || name_.trim().length() <= 0)
return null;
return (ReportInfo)this.oMap.get(name_);
}
public void init(INFOClass oINFOClass) {
if (oINFOClass == null)
return;
ArrayList oList = oINFOClass.get_Module();
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
Module oModule = oIt.next();
String sModuleName = oModule.get_ModuleName();
ArrayList oScreenInfoList = oModule.get_ScreenInfo();
Iterator oScreenInfoIt = oScreenInfoList.iterator();
while (oScreenInfoIt.hasNext()) {
ScreenInfo oScreenInfo = oScreenInfoIt.next();
String sScreenName = oScreenInfo.get_ScreenName();
Reports oReports = oScreenInfo.get_Reports();
ArrayList oReportList = oReports.get_Report();
Iterator oReportIt = oReportList.iterator();
while (oReportIt.hasNext()) {
Report oReport = oReportIt.next();
ReportInfo oReportInfo = new ReportInfo();
oReportInfo.setReportKey(oReport.get_ReportKey());
String sCombinedKey = String.valueOf(String.valueOf(sModuleName).concat(String.valueOf(sScreenName))).concat(String.valueOf(oReport.get_KeyInfo()));
System.out.println(String.valueOf("The key is ").concat(String.valueOf(sCombinedKey)));
if (!this.oMap.containsKey(sCombinedKey))
this.oMap.put(sCombinedKey, oReportInfo);
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
package wenrgise.common.utility;
import javax.servlet.ServletException;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;
public class ReportPlugin implements PlugIn {
private String reportPathName = "/WEB-INF/EnrgiseReport.xml";
public void init(ActionServlet servlet, ModuleConfig config) throws ServletException {}
public void destroy() {}
private String calculatePath(ActionServlet servlet, String sPath) {
return servlet.getServletContext().getRealPath(sPath);
}
}

View File

@@ -0,0 +1,39 @@
package wenrgise.common.utility;
public class ReportReader {
String parameter;
String parameterValue;
public String getAppServerName() {
return "reportserver";
}
public String getAppServerPortNumber() {
return "8888";
}
public String getAppServerReportPathAlias() {
return "reports";
}
public String getStatsRep() {
return "statusKey";
}
public String getParameter() {
return this.parameter;
}
public void setParameter(String newParameter) {
this.parameter = newParameter;
}
public String getParameterValue() {
return this.parameterValue;
}
public void setParameterValue(String newParameterValue) {
this.parameterValue = newParameterValue;
}
}

View File

@@ -0,0 +1,83 @@
package wenrgise.common.utility;
import java.util.HashMap;
import javax.ejb.EJBLocalHome;
import javax.naming.Context;
import javax.naming.NamingException;
import wenrgise.common.exception.EnrgiseSystemException;
public class ServiceLocator {
private HashMap homeCache;
private final HashMap cacheMap = new HashMap();
private static ServiceLocator serviceLocator = new ServiceLocator();
private ServiceLocator() {
try {
this.homeCache = new HashMap();
} catch (Throwable e) {
e.printStackTrace();
}
}
public static ServiceLocator getLocator() {
return serviceLocator;
}
public Object getService(String jndiName) throws EnrgiseSystemException {
try {
if (!this.homeCache.containsKey(jndiName.trim())) {
Context context = ContextProvider.getContext();
this.homeCache.put(jndiName.trim(), context.lookup(jndiName.trim()));
}
} catch (NamingException oNa) {
oNa.printStackTrace();
System.out.println(oNa.getExplanation());
throw new EnrgiseSystemException(oNa);
} catch (Exception oEx) {
oEx.printStackTrace();
throw new EnrgiseSystemException(oEx);
}
return this.homeCache.get(jndiName.trim());
}
public Object getLocalService(String jndiHomeName) throws EnrgiseSystemException {
Object obj = null;
try {
Context context = ContextProvider.getLocalContext();
if (this.cacheMap.containsKey(jndiHomeName)) {
obj = this.cacheMap.get(jndiHomeName);
} else {
obj = context.lookup(jndiHomeName);
this.cacheMap.put(jndiHomeName, obj);
}
} catch (NamingException ne) {
ne.printStackTrace();
throw new EnrgiseSystemException(ne);
}
return obj;
}
public EJBLocalHome getLocalHome(String jndiHomeName) throws EnrgiseSystemException {
System.out.println(String.valueOf("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").concat(String.valueOf(jndiHomeName)));
EJBLocalHome home = null;
try {
Context context = ContextProvider.getLocalContext();
if (this.cacheMap.containsKey(jndiHomeName)) {
home = (EJBLocalHome)this.cacheMap.get(jndiHomeName);
} else {
home = (EJBLocalHome)context.lookup(String.valueOf("java:comp/env/").concat(String.valueOf(jndiHomeName)));
this.cacheMap.put(jndiHomeName, home);
}
} catch (NamingException ne) {
System.out.println(ne);
ne.printStackTrace();
throw new EnrgiseSystemException(ne);
} catch (Exception oEx) {
oEx.printStackTrace();
throw new EnrgiseSystemException(oEx);
}
return home;
}
}

View File

@@ -0,0 +1,175 @@
package wenrgise.common.utility;
import java.io.Serializable;
public class UserInfo implements Serializable {
private String userSystemId;
private String userId;
private String siteId;
private String userType;
private String userTypeId;
private String userLocked;
private String userActiveFlag;
private String userName;
private String siteName;
private String currentYear;
private boolean superUser = false;
private String moduleId;
private String gradeId;
private String grade;
private String desigId;
private String designation;
private String siteCode;
public String getUserName() {
return this.userName;
}
public void setUserName(String newUserName) {
this.userName = newUserName;
}
public String getSiteName() {
return this.siteName;
}
public void setSiteName(String newSiteName) {
this.siteName = newSiteName;
}
public String getSiteId() {
return this.siteId;
}
public void setSiteId(String newSiteId) {
this.siteId = newSiteId;
}
public String getUserActiveFlag() {
return this.userActiveFlag;
}
public void setUserActiveFlag(String newUserActiveFlag) {
this.userActiveFlag = newUserActiveFlag;
}
public String getUserId() {
return this.userId;
}
public void setUserId(String newUserId) {
this.userId = newUserId;
}
public String getUserLocked() {
return this.userLocked;
}
public void setUserLocked(String newUserLocked) {
this.userLocked = newUserLocked;
}
public String getUserSystemId() {
return this.userSystemId;
}
public void setUserSystemId(String newUserSystemId) {
this.userSystemId = newUserSystemId;
}
public String getUserType() {
return this.userType;
}
public void setUserType(String newUserType) {
this.userType = newUserType;
}
public String getUserTypeId() {
return this.userTypeId;
}
public void setUserTypeId(String newUserTypeId) {
this.userTypeId = newUserTypeId;
}
public String getCurrentYear() {
return this.currentYear;
}
public void setCurrentYear(String newCurrentYear) {
this.currentYear = newCurrentYear;
}
public boolean isSuperUser() {
return this.superUser;
}
public void setSuperUser(boolean newSuperUser) {
this.superUser = newSuperUser;
}
public String getModuleId() {
return this.moduleId;
}
public void setModuleId(String newModuleId) {
this.moduleId = newModuleId;
}
public String getGradeId() {
return this.gradeId;
}
public void setGradeId(String newGradeId) {
this.gradeId = newGradeId;
}
public String getGrade() {
return this.grade;
}
public void setGrade(String newGrade) {
this.grade = newGrade;
}
public String getDesigId() {
return this.desigId;
}
public void setDesigId(String newDesigId) {
this.desigId = newDesigId;
}
public String getDesignation() {
return this.designation;
}
public void setDesignation(String newDesignation) {
this.designation = newDesignation;
}
public String getSiteCode() {
return this.siteCode;
}
public void setSiteCode(String newSiteCode) {
this.siteCode = newSiteCode;
}
}

View File

@@ -0,0 +1,32 @@
package wenrgise.common.utility;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
public class WorkFlowContextProvider {
private Context ctx = null;
public static InitialContext localContext;
private static WorkFlowContextProvider objContextProvider = new WorkFlowContextProvider();
private WorkFlowContextProvider() {
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory");
env.put("java.naming.provider.url", "iiop://tcs093390:2811");
this.ctx = new InitialContext(env);
} catch (Throwable e) {
e.printStackTrace();
}
}
public static Context getContext() {
return objContextProvider.ctx;
}
public static InitialContext getLocalContext() {
return localContext;
}
}

View File

@@ -0,0 +1,35 @@
package wenrgise.common.utility;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
public class WorkFlowContextProvider2 {
private Context ctx = null;
public static InitialContext localContext;
private static WorkFlowContextProvider2 objContextProvider = new WorkFlowContextProvider2();
private WorkFlowContextProvider2() {
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial", "com.evermind.server.rmi.RMIInitialContextFactory");
env.put("java.naming.security.principal", "admin");
env.put("dedicated.rmicontext", "true");
env.put("java.naming.security.credentials", "welcome");
env.put("java.naming.provider.url", "ormi://tcs041981:23892/current-workspace-app");
this.ctx = new InitialContext(env);
} catch (Throwable e) {
e.printStackTrace();
}
}
public static Context getContext() {
return objContextProvider.ctx;
}
public static InitialContext getLocalContext() {
return localContext;
}
}

View File

@@ -0,0 +1,61 @@
package wenrgise.common.utility;
import java.util.HashMap;
import javax.ejb.EJBLocalHome;
import javax.naming.Context;
import javax.naming.NamingException;
import wenrgise.common.exception.EnrgiseSystemException;
public class WorkFlowServiceLocator {
private HashMap homeCache;
private final HashMap cacheMap = new HashMap();
private static WorkFlowServiceLocator serviceLocator = new WorkFlowServiceLocator();
private WorkFlowServiceLocator() {
try {
this.homeCache = new HashMap();
} catch (Throwable e) {
e.printStackTrace();
}
}
public static WorkFlowServiceLocator getLocator() {
return serviceLocator;
}
public Object getService(String jndiName) throws EnrgiseSystemException {
try {
if (!this.homeCache.containsKey(jndiName)) {
Context context = WorkFlowContextProvider.getContext();
this.homeCache.put(jndiName, context.lookup(jndiName));
}
} catch (NamingException oNa) {
System.out.println(String.valueOf(String.valueOf(String.valueOf("The problem is ").concat(String.valueOf(oNa.getMessage()))).concat(String.valueOf(" the type is "))).concat(String.valueOf(oNa.getClass().getName())));
throw new EnrgiseSystemException(oNa);
} catch (Exception oEx) {
System.out.println(String.valueOf(String.valueOf(String.valueOf("The problem is ").concat(String.valueOf(oEx.getMessage()))).concat(String.valueOf(" the type is "))).concat(String.valueOf(oEx.getClass().getName())));
throw new EnrgiseSystemException(oEx);
}
return this.homeCache.get(jndiName);
}
public EJBLocalHome getLocalHome(String jndiHomeName) throws EnrgiseSystemException {
EJBLocalHome home = null;
try {
jndiHomeName = jndiHomeName.trim();
Context context = WorkFlowContextProvider.getLocalContext();
if (this.cacheMap.containsKey(jndiHomeName)) {
home = (EJBLocalHome)this.cacheMap.get(jndiHomeName);
} else {
home = (EJBLocalHome)context.lookup(String.valueOf("java:comp/env/").concat(String.valueOf(jndiHomeName)));
this.cacheMap.put(jndiHomeName, home);
}
} catch (NamingException ne) {
ne.printStackTrace();
throw new EnrgiseSystemException(ne);
}
return home;
}
}

View File

@@ -0,0 +1,61 @@
package wenrgise.common.utility;
import java.util.HashMap;
import javax.ejb.EJBLocalHome;
import javax.naming.Context;
import javax.naming.NamingException;
import wenrgise.common.exception.EnrgiseSystemException;
public class WorkFlowServiceLocator2 {
private HashMap homeCache;
private final HashMap cacheMap = new HashMap();
private static WorkFlowServiceLocator2 serviceLocator = new WorkFlowServiceLocator2();
private WorkFlowServiceLocator2() {
try {
this.homeCache = new HashMap();
} catch (Throwable e) {
e.printStackTrace();
}
}
public static WorkFlowServiceLocator2 getLocator() {
return serviceLocator;
}
public Object getService(String jndiName) throws EnrgiseSystemException {
try {
if (!this.homeCache.containsKey(jndiName)) {
Context context = WorkFlowContextProvider2.getContext();
this.homeCache.put(jndiName, context.lookup(jndiName));
}
} catch (NamingException oNa) {
System.out.println(String.valueOf(String.valueOf(String.valueOf("The problem is ").concat(String.valueOf(oNa.getMessage()))).concat(String.valueOf(" the type is "))).concat(String.valueOf(oNa.getClass().getName())));
throw new EnrgiseSystemException(oNa);
} catch (Exception oEx) {
System.out.println(String.valueOf(String.valueOf(String.valueOf("The problem is ").concat(String.valueOf(oEx.getMessage()))).concat(String.valueOf(" the type is "))).concat(String.valueOf(oEx.getClass().getName())));
throw new EnrgiseSystemException(oEx);
}
return this.homeCache.get(jndiName);
}
public EJBLocalHome getLocalHome(String jndiHomeName) throws EnrgiseSystemException {
EJBLocalHome home = null;
try {
jndiHomeName = jndiHomeName.trim();
Context context = WorkFlowContextProvider2.getLocalContext();
if (this.cacheMap.containsKey(jndiHomeName)) {
home = (EJBLocalHome)this.cacheMap.get(jndiHomeName);
} else {
home = (EJBLocalHome)context.lookup(String.valueOf("java:comp/env/").concat(String.valueOf(jndiHomeName)));
this.cacheMap.put(jndiHomeName, home);
}
} catch (NamingException ne) {
ne.printStackTrace();
throw new EnrgiseSystemException(ne);
}
return home;
}
}

View File

@@ -0,0 +1,5 @@
package wenrgise.common.vo;
import java.io.Serializable;
public class BaseDetailInfo implements Serializable {}

View File

@@ -0,0 +1,144 @@
package wenrgise.common.vo;
import java.io.Serializable;
import java.util.ArrayList;
public class BaseDetailVO extends BaseVO implements Serializable {
private int recordsPerPage = 0;
private int maxPage = 0;
private long currentPage = 0L;
private long currentSlot = 0L;
private long totalDetailRecord = 0L;
private ArrayList oThisPageData = null;
private ArrayList oAllPageData = null;
int rowAdded = 0;
int rowDeleted = 0;
public BaseDetailVO() {
this.oThisPageData = new ArrayList();
this.oAllPageData = new ArrayList();
this.currentSlot = 0L;
}
public void reset() {
this.currentPage = 0L;
this.currentSlot = 0L;
this.oThisPageData = new ArrayList();
this.oAllPageData = new ArrayList();
}
public ArrayList getOAllPageData() {
return this.oAllPageData;
}
public void setOAllPageData(ArrayList newOAllPageData) {
this.oAllPageData = newOAllPageData;
}
public ArrayList getOThisPageData() {
return this.oThisPageData;
}
public void setOThisPageData(ArrayList newOThisPageData) {
this.oThisPageData = newOThisPageData;
}
public long getTotalDetailRecord() {
return this.totalDetailRecord;
}
public void setTotalDetailRecord(long newTotalDetailRecord) {
this.totalDetailRecord = newTotalDetailRecord;
}
public int getRowAdded() {
return this.rowAdded;
}
public void setRowAdded(int newRowAdded) {
this.rowAdded = newRowAdded;
}
public int getRowDeleted() {
return this.rowDeleted;
}
public void setRowDeleted(int newRowDeleted) {
this.rowDeleted = newRowDeleted;
}
public long getCurrentPage() {
return this.currentPage;
}
public void setCurrentPage(long newCurrentPage) {
this.currentPage = newCurrentPage;
}
public long getCurrentSlot() {
return this.currentSlot;
}
public void setCurrentSlot(long newCurrentSlot) {
this.currentSlot = newCurrentSlot;
}
public int getMaxPage() {
return this.maxPage;
}
public void setMaxPage(int newMaxPage) {
this.maxPage = newMaxPage;
}
public int getRecordsPerPage() {
return this.recordsPerPage;
}
public void setRecordsPerPage(int newRecordsPerPage) {
this.recordsPerPage = newRecordsPerPage;
}
public long getSlot(long lPageRequested) {
return (lPageRequested % this.maxPage != 0L) ? (lPageRequested / this.maxPage + 1L) : (lPageRequested / this.maxPage);
}
public int getRelativeStart(long lPageRequested) {
long lAbsoluteIndex = (lPageRequested - 1L) * this.recordsPerPage + 1L;
return (int)(lAbsoluteIndex % (this.recordsPerPage * this.maxPage)) - 1;
}
public int getRelativeEnd(long lPageRequested) {
long lAbsoluteIndexStart = (lPageRequested - 1L) * this.recordsPerPage;
long lAbsoluteEnd = (lAbsoluteIndexStart + this.recordsPerPage < this.totalDetailRecord) ? (lAbsoluteIndexStart + this.recordsPerPage) : this.totalDetailRecord;
int iMod = (int)(lAbsoluteEnd % (this.recordsPerPage * this.maxPage));
if (iMod != 0)
return iMod - 1;
return this.recordsPerPage * this.maxPage - 1;
}
public long getAbsoluteStart(long lPageRequested) {
return (lPageRequested - 1L) * this.recordsPerPage + 1L;
}
public long getAbsoluteEnd(long lPageRequested) {
long lStart = (lPageRequested - 1L) * this.recordsPerPage;
return (lStart + (this.recordsPerPage * this.maxPage) < this.totalDetailRecord) ? (lStart + (this.recordsPerPage * this.maxPage)) : this.totalDetailRecord;
}
public long getSlotStartPosition() {
return (this.currentSlot - 1L) * this.recordsPerPage * this.maxPage + 1L;
}
public long getSlotLastPosition() {
return (this.currentSlot * this.recordsPerPage * this.maxPage < this.totalDetailRecord) ? (this.currentSlot * this.recordsPerPage * this.maxPage) : this.totalDetailRecord;
}
}

View File

@@ -0,0 +1,85 @@
package wenrgise.common.vo;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.exception.EnrgiseApplicationException;
public class BaseHeaderVO extends BaseVO implements Serializable {
private ArrayList oHeaderVOTable = new ArrayList();
private long positionRequested = 0L;
private long currentSlot = 0L;
private long totalCount = 0L;
private long maxHeaderSize = 0L;
private Timestamp oWhenPicked = null;
public ArrayList getOHeaderVOTable() {
return this.oHeaderVOTable;
}
public long getHeaderStartPosition() throws EnrgiseApplicationException {
int iSlot = getSlot();
return (iSlot - 1) * this.maxHeaderSize + 1L;
}
public long getHeaderLastPosition() throws EnrgiseApplicationException {
int iSlot = getSlot();
return (iSlot * this.maxHeaderSize < this.totalCount) ? (iSlot * this.maxHeaderSize) : this.totalCount;
}
public int getSlot() throws EnrgiseApplicationException {
if (this.positionRequested < 0L || this.positionRequested > this.totalCount)
throw new EnrgiseApplicationException("wenrgise.common.navigation", "E");
return ((int)(this.positionRequested % this.maxHeaderSize) != 0) ? (int)((int)this.positionRequested / this.maxHeaderSize + 1L) : (int)(this.positionRequested / this.maxHeaderSize);
}
public void setOHeaderVOTable(ArrayList newOHeaderVOTable) {
this.oHeaderVOTable = newOHeaderVOTable;
}
public BaseHeaderBean getHeaderRecord(int iPosition) throws EnrgiseApplicationException {
if (this.oHeaderVOTable == null)
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
if (this.oHeaderVOTable.size() == 0 || this.oHeaderVOTable.size() < iPosition)
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
return this.oHeaderVOTable.get(iPosition - 1);
}
public long getPositionRequested() {
return this.positionRequested;
}
public void setPositionRequested(long newPositionRequested) {
this.positionRequested = newPositionRequested;
}
public long getCurrentSlot() {
return this.currentSlot;
}
public void setCurrentSlot(long newCurrentSlot) {
this.currentSlot = newCurrentSlot;
}
public long getTotalCount() {
return this.totalCount;
}
public void setTotalCount(long newTotalCount) {
this.totalCount = newTotalCount;
}
public long getMaxHeaderSize() {
return this.maxHeaderSize;
}
public void setMaxHeaderSize(long newMaxHeaderSize) {
this.maxHeaderSize = newMaxHeaderSize;
}
}

View File

@@ -0,0 +1,45 @@
package wenrgise.common.vo;
import java.io.Serializable;
public class BaseQueryVO implements Serializable {
private long positionRequested = 0L;
private String headerPrimaryKey = null;
private int maxHeaderSize = 0;
private String workListId;
public long getPositionRequested() {
return this.positionRequested;
}
public void setPositionRequested(long newPositionRequested) {
this.positionRequested = newPositionRequested;
}
public String getHeaderPrimaryKey() {
return this.headerPrimaryKey;
}
public void setHeaderPrimaryKey(String newHeaderPrimaryKey) {
this.headerPrimaryKey = newHeaderPrimaryKey;
}
public int getMaxHeaderSize() {
return this.maxHeaderSize;
}
public void setMaxHeaderSize(int newMaxHeaderSize) {
this.maxHeaderSize = newMaxHeaderSize;
}
public String getWorkListId() {
return this.workListId;
}
public void setWorkListId(String newWorkListId) {
this.workListId = newWorkListId;
}
}

View File

@@ -0,0 +1,36 @@
package wenrgise.common.vo;
import java.io.Serializable;
import java.sql.Timestamp;
public class BaseVO implements Serializable {
private Timestamp oWhenPicked = null;
private long firstPosition = 0L;
private long lastPosition = 0L;
public Timestamp getOWhenPicked() {
return this.oWhenPicked;
}
public void setOWhenPicked(Timestamp newOWhenPicked) {
this.oWhenPicked = newOWhenPicked;
}
public long getFirstPosition() {
return this.firstPosition;
}
public void setFirstPosition(long newFirstPosition) {
this.firstPosition = newFirstPosition;
}
public long getLastPosition() {
return this.lastPosition;
}
public void setLastPosition(long newLastPosition) {
this.lastPosition = newLastPosition;
}
}

View File

@@ -0,0 +1,30 @@
package wenrgise.common.vo;
import java.io.Serializable;
public class ComboVO implements Serializable {
private String label;
private String value;
public ComboVO(String newLabel, String newValue) {
this.label = newLabel;
this.value = newValue;
}
public String getLabel() {
return this.label;
}
public void setLabel(String newLabel) {
this.label = newLabel;
}
public String getValue() {
return this.value;
}
public void setValue(String newValue) {
this.value = newValue;
}
}

View File

@@ -0,0 +1,25 @@
package wenrgise.common.vo;
import java.io.Serializable;
public class DetailSizeValues implements Serializable {
int detailRecordPerPage = 0;
int maxPages = 0;
public int getDetailRecordPerPage() {
return this.detailRecordPerPage;
}
public void setDetailRecordPerPage(int newDetailRecordPerPage) {
this.detailRecordPerPage = newDetailRecordPerPage;
}
public int getMaxPages() {
return this.maxPages;
}
public void setMaxPages(int newMaxPages) {
this.maxPages = newMaxPages;
}
}

View File

@@ -0,0 +1,96 @@
package wenrgise.common.vo;
import java.io.Serializable;
import java.util.Properties;
public class LovQueryVO extends Properties implements Serializable {
private String searchField1;
private String searchField2;
private int level;
private int finalLevel;
private int initialLevel;
private String searchField3;
private String searchField4;
private String searchField5;
private String searchField6;
public String getSearchField1() {
return this.searchField1;
}
public void setSearchField1(String newSearchField1) {
this.searchField1 = newSearchField1;
}
public String getSearchField2() {
return this.searchField2;
}
public void setSearchField2(String newSearchField2) {
this.searchField2 = newSearchField2;
}
public int getLevel() {
return this.level;
}
public void setLevel(int newLevel) {
this.level = newLevel;
}
public int getFinalLevel() {
return this.finalLevel;
}
public void setFinalLevel(int newFinalLevel) {
this.finalLevel = newFinalLevel;
}
public int getInitialLevel() {
return this.initialLevel;
}
public void setInitialLevel(int newInitialLevel) {
this.initialLevel = newInitialLevel;
}
public String getSearchField3() {
return this.searchField3;
}
public void setSearchField3(String newSearchField3) {
this.searchField3 = newSearchField3;
}
public String getSearchField4() {
return this.searchField4;
}
public void setSearchField4(String newSearchField4) {
this.searchField4 = newSearchField4;
}
public String getSearchField5() {
return this.searchField5;
}
public void setSearchField5(String newSearchField5) {
this.searchField5 = newSearchField5;
}
public String getSearchField6() {
return this.searchField6;
}
public void setSearchField6(String newSearchField6) {
this.searchField6 = newSearchField6;
}
}

View File

@@ -0,0 +1,66 @@
package wenrgise.common.vo;
import java.io.Serializable;
import java.util.ArrayList;
public class LovVO implements Serializable {
private ArrayList detailList;
private ArrayList headerList;
private ArrayList visibilityList;
private int finalLevel;
private int level;
private int initialLevel;
public ArrayList getDetailList() {
return this.detailList;
}
public void setDetailList(ArrayList newDetailList) {
this.detailList = newDetailList;
}
public ArrayList getHeaderList() {
return this.headerList;
}
public void setHeaderList(ArrayList newHeaderList) {
this.headerList = newHeaderList;
}
public ArrayList getVisibilityList() {
return this.visibilityList;
}
public void setVisibilityList(ArrayList newVisibilityList) {
this.visibilityList = newVisibilityList;
}
public int getFinalLevel() {
return this.finalLevel;
}
public void setFinalLevel(int newFinalLevel) {
this.finalLevel = newFinalLevel;
}
public int getLevel() {
return this.level;
}
public void setLevel(int newLevel) {
this.level = newLevel;
}
public int getInitialLevel() {
return this.initialLevel;
}
public void setInitialLevel(int newInitialLevel) {
this.initialLevel = newInitialLevel;
}
}

View File

@@ -0,0 +1,57 @@
package wenrgise.common.vo;
import java.io.Serializable;
import java.util.ArrayList;
import wenrgise.common.bean.BaseHeaderBean;
public class ThisPageVO extends BaseVO implements Serializable {
private BaseHeaderBean oHeaderBean;
private ArrayList oDetailList;
private String screenMode;
private String screenName;
private int actionName;
public BaseHeaderBean getOHeaderBean() {
return this.oHeaderBean;
}
public void setOHeaderBean(BaseHeaderBean newOHeaderBean) {
this.oHeaderBean = newOHeaderBean;
}
public ArrayList getODetailList() {
return this.oDetailList;
}
public void setODetailList(ArrayList newODetailList) {
this.oDetailList = newODetailList;
}
public String getScreenMode() {
return this.screenMode;
}
public void setScreenMode(String newScreenMode) {
this.screenMode = newScreenMode;
}
public String getScreenName() {
return this.screenName;
}
public void setScreenName(String newScreenName) {
this.screenName = newScreenName;
}
public int getActionName() {
return this.actionName;
}
public void setActionName(int newActionName) {
this.actionName = newActionName;
}
}

View File

@@ -0,0 +1,133 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseDetailBean;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.DetailSizeValues;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class AddRowAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
if (oBaseForm.getScreenMode().equals("N") || oBaseForm.getHeaderPrimaryKey() == null) {
String sHeaderSave = ParamUtil.getHeaderSaveRequired(sFormName);
if (null == sHeaderSave)
throw new EnrgiseApplicationException("wenrgise.common.saveheaderrecord", "M");
}
String sScreenName = oBaseForm.getScreenName();
String sHeaderPrimaryKey = oBaseForm.getHeaderPrimaryKey();
UserSession oUser = getUserSessionBean(request);
String sComponentName = getComponentName(sFormName);
checkAccessInfo(oUser, sComponentName, oBaseForm.getScreenMode(), "", 10, oBaseForm.getWorkListId());
DetailSizeValues oDetailSizeValues = new DetailSizeValues();
oDetailSizeValues.setDetailRecordPerPage(ParamUtil.getDetailRecordPerPage(sFormName, sScreenName));
oDetailSizeValues.setMaxPages(ParamUtil.getMaxDetailPages(sFormName, sScreenName));
BaseDetailVO oBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
boolean bGetDetailNotPressed = false;
BaseBD oBaseBD = getDetailBusinessDelegate((ActionForm)oBaseForm, request);
if (null == oBaseDetailVO) {
bGetDetailNotPressed = true;
oBaseDetailVO = getDetailData(oBaseForm, sFormName, sScreenName, 1L, request, oBaseBD, false, oUser);
long l = oBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, sScreenName, l));
}
if (oBaseDetailVO.getCurrentPage() == 0L)
oBaseDetailVO.setCurrentPage(1L);
long lPageRequested = getPageRequested(oBaseDetailVO, oDetailSizeValues);
ArrayList oDetailList = null;
if (oBaseDetailVO.getCurrentPage() != lPageRequested) {
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged()) {
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), getDetailArray(oBaseForm));
throw new EnrgiseApplicationException("wenrgise.common.savefirst", "M");
}
oBaseBD = getDetailBusinessDelegate(form, request);
oBaseDetailVO = getDetailData(oBaseForm, sFormName, sScreenName, lPageRequested, request, oBaseBD, false, oUser);
oBaseDetailVO.setRowAdded(oBaseDetailVO.getRowAdded() + 1);
oDetailList = oBaseDetailVO.getOThisPageData();
} else {
if (bGetDetailNotPressed) {
oDetailList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
} else {
oDetailList = getDetailArray(oBaseForm);
}
oBaseDetailVO.setRowAdded(oBaseDetailVO.getRowAdded() + 1);
}
BaseDetailBean oBaseDetailBean = getDetailBean(form);
oBaseDetailBean.setStatus("N");
oDetailList.add(oBaseDetailBean);
oBaseForm.setThisPageDetailCount(oBaseForm.getThisPageDetailCount() + 1);
oBaseForm.setDetailDataChanged(true);
long totDetRecord = oBaseDetailVO.getTotalDetailRecord() - oBaseDetailVO.getRowDeleted() + oBaseDetailVO.getRowAdded();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, sScreenName, totDetRecord));
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oDetailList);
oUser.putBaseDetailVO(sFormName, sScreenName, oBaseDetailVO);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "DETAIL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap) {
if (null != oSecMap.get("D"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
ArrayList oEnableList = new ArrayList();
oEnableList.add("butSave");
if (null != oSecMap.get("E"))
oEnableList.addAll((ArrayList)oSecMap.get("E"));
enableDisable(oBaseForm, oEnableList, "E");
}
BaseHeaderBean oThisBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oThisBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oThisBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(14);
oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oList = getDetailArrayList(oBaseForm, sFormName, sScreenName);
oThisPageVO.setODetailList(oList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 14);
return mapping.findForward("success");
}
private void populateThisPageList(BaseDetailVO oBaseDetailVO, DetailSizeValues oDetailSizeValues) {
long lGrandTotalDetailRecord = oBaseDetailVO.getTotalDetailRecord() - oBaseDetailVO.getRowDeleted() + oBaseDetailVO.getRowAdded();
int iPage = (int)lGrandTotalDetailRecord % oDetailSizeValues.getDetailRecordPerPage() + 1;
int iDetailStartPosition = (iPage - 1) * oDetailSizeValues.getDetailRecordPerPage() + 1;
if (iDetailStartPosition < lGrandTotalDetailRecord + 1L);
}
private long getPageRequested(BaseDetailVO oBaseDetailVO, DetailSizeValues oDetailSizeValues) {
long lLastRecordNumber = oBaseDetailVO.getTotalDetailRecord() - oBaseDetailVO.getRowDeleted() + oBaseDetailVO.getRowAdded() + 1L;
return (lLastRecordNumber % oDetailSizeValues.getDetailRecordPerPage() != 0L) ? (lLastRecordNumber / oDetailSizeValues.getDetailRecordPerPage() + 1L) : (lLastRecordNumber / oDetailSizeValues.getDetailRecordPerPage());
}
}

View File

@@ -0,0 +1,751 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.logging.Logger;
import javax.ejb.CreateException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.util.MessageResources;
import wenrgise.common.bean.AccessBean;
import wenrgise.common.bean.BaseDetailBean;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.bean.EmpInfoBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseMessageKeyException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.DebugHelper;
import wenrgise.common.utility.EnrgiseUtil;
import wenrgise.common.utility.MessageKey;
import wenrgise.common.utility.UserInfo;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.DetailSizeValues;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.common.xml.vo.DetailScreen;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.session.UserSessionHome;
import wenrgise.ejb.common.utility.ParamUtil;
import wenrgise.ejb.common.utility.ServiceLocator;
import wenrgise.hrms.ejb.facade.HrmFacade;
import wenrgise.hrms.ejb.facade.HrmFacadeHome;
import wenrgise.hrms.ejb.facade.HrmSecondFacade;
import wenrgise.hrms.ejb.facade.HrmSecondFacadeHome;
import wenrgise.hrms.ejb.facade.HrmThirdFacade;
import wenrgise.hrms.ejb.facade.HrmThirdFacadeHome;
public abstract class BaseAction extends Action {
static final Logger log = Logger.getLogger("wenrgise.common.webtier.action.BaseAction");
MessageResources oMsgRes = null;
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ActionErrors oErrorTable = null;
ActionMessages oMessageTable = null;
BaseForm oBaseForm = (BaseForm)form;
this.oMsgRes = getResources(request);
try {
HttpSession oSes = request.getSession();
String sUserId = (String)oSes.getAttribute("userId");
System.out.println(String.valueOf("I am in Base Action and UserId: --->").concat(String.valueOf(sUserId)));
if (null == sUserId) {
System.out.println("I am in Base Action And session expired");
System.out.println("Session has expired");
return mapping.findForward("failure");
}
DebugHelper.createUserEjb(request.getSession());
return executeImpl(mapping, form, request, response);
} catch (ClassNotFoundException oClassEx) {
processSystemException(oClassEx, oErrorTable);
} catch (InstantiationException oInSt) {
processSystemException(oInSt, oErrorTable);
} catch (InvocationTargetException oInvTar) {
processSystemException(oInvTar, oErrorTable);
} catch (IllegalAccessException oIlAcc) {
processSystemException(oIlAcc, oErrorTable);
} catch (EnrgiseSystemException oSys) {
if (oErrorTable == null)
oErrorTable = new ActionErrors();
String sKey = (null != oSys.getKey()) ? oSys.getKey() : "wenrgise.common.system";
ActionError oSysError = new ActionError(sKey);
oErrorTable.add("org.apache.struts.action.GLOBAL_ERROR", oSysError);
} catch (EnrgiseApplicationException oApp) {
if (oErrorTable == null)
oErrorTable = new ActionErrors();
if (oMessageTable == null)
oMessageTable = new ActionMessages();
processException(oErrorTable, oMessageTable, oApp);
if (oApp.getList() != null) {
Iterator oIt = oApp.getList().iterator();
while (oIt.hasNext()) {
EnrgiseApplicationException oAppErr = oIt.next();
processException(oErrorTable, oMessageTable, oAppErr);
}
}
} finally {
if (oErrorTable != null) {
System.out.println("Save errors");
if (oErrorTable.size() > 0) {
saveErrors(request, oErrorTable);
return mapping.findForward("success");
}
}
if (oMessageTable != null)
if (oMessageTable.size() > 0) {
System.out.println("Save messages");
saveMessages(request, oMessageTable);
return mapping.findForward("success");
}
}
return mapping.findForward("failure");
}
private void processSystemException(Exception oEc, ActionErrors oErrorTable) {
if (oErrorTable == null)
oErrorTable = new ActionErrors();
EnrgiseSystemException oSys = new EnrgiseSystemException("wenrgise.common.system", oEc);
ActionError oSysError = new ActionError(oSys.getKey());
oErrorTable.add("org.apache.struts.action.GLOBAL_ERROR", oSysError);
}
private void processException(ActionErrors oErrorTable, ActionMessages oMessageTable, EnrgiseApplicationException oApp) {
if (oApp.getArguments() == null) {
if (oApp.getErrorType().equals("E")) {
oErrorTable.add("org.apache.struts.action.GLOBAL_ERROR", new ActionError(oApp.getKey()));
} else {
oMessageTable.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage(oApp.getKey()));
}
} else if (oApp instanceof EnrgiseMessageKeyException) {
processMessageKeyException((EnrgiseMessageKeyException)oApp, oErrorTable, oMessageTable);
} else if (oApp.getErrorType().equals("E")) {
oErrorTable.add("org.apache.struts.action.GLOBAL_ERROR", new ActionError(oApp.getKey(), oApp.getArguments().toArray()));
} else {
oMessageTable.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage(oApp.getKey(), oApp.getArguments().toArray()));
}
}
private void processMessageKeyException(EnrgiseMessageKeyException oApp, ActionErrors oErrorTable, ActionMessages oMessageTable) {
ArrayList oList = oApp.getArguments();
if (null == oList) {
if (oApp.getErrorType().equals("E")) {
oErrorTable.add("org.apache.struts.action.GLOBAL_ERROR", new ActionError(oApp.getKey()));
} else {
oMessageTable.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage(oApp.getKey()));
}
} else {
ArrayList oNewList = new ArrayList();
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
Object obj = oIt.next();
if (obj instanceof MessageKey) {
MessageKey oMsgKey = (MessageKey)obj;
oNewList.add(this.oMsgRes.getMessage(oMsgKey.getKey()));
continue;
}
oNewList.add(obj);
}
if (oApp.getErrorType().equals("E")) {
oErrorTable.add("org.apache.struts.action.GLOBAL_ERROR", new ActionError(oApp.getKey(), oNewList.toArray()));
} else {
oMessageTable.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage(oApp.getKey(), oNewList.toArray()));
}
}
}
protected BaseQueryVO getQueryVO(ActionForm form) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
String sQueryVO = ParamUtil.getQueryVO(sFormName);
BaseQueryVO oBaseQueryVO = (BaseQueryVO)Class.forName(sQueryVO).newInstance();
oBaseQueryVO.setMaxHeaderSize(ParamUtil.getHeaderSize(sFormName));
return oBaseQueryVO;
}
protected BaseDetailBean getDetailBean(ActionForm form) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
String sDetailBean = ParamUtil.getDetailBeanName(sFormName, sScreenName);
BaseDetailBean oBaseDetailBean = (BaseDetailBean)Class.forName(sDetailBean).newInstance();
return oBaseDetailBean;
}
protected BaseBD getHeaderBusinessDelegate(ActionForm form, HttpServletRequest request) throws EnrgiseApplicationException, EnrgiseSystemException, RemoteException, IllegalAccessException, InstantiationException, ClassNotFoundException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
String sBusinessDelegate = ParamUtil.getHeaderBD(sFormName);
try {
BaseBD oBaseBD = (BaseBD)Class.forName(sBusinessDelegate).newInstance();
UserSession oUser = getUserSessionBean(request);
oBaseBD.setModuleName(ParamUtil.getModuleName());
oBaseBD.setModuleFacade(oUser.getModuleFacade());
oBaseBD.setOUserInfo(oUser.getUserInfo());
return oBaseBD;
} catch (Exception Ex) {
Ex.printStackTrace();
return null;
}
}
protected BaseBD getDetailBusinessDelegate(ActionForm form, HttpServletRequest request) throws EnrgiseApplicationException, EnrgiseSystemException, RemoteException, IllegalAccessException, InstantiationException, ClassNotFoundException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
String sBusinessDelegate = ParamUtil.getDetailBD(sFormName, sScreenName);
BaseBD oBaseBD = (BaseBD)Class.forName(sBusinessDelegate).newInstance();
UserSession oUser = getUserSessionBean(request);
oBaseBD.setModuleName(ParamUtil.getModuleName());
oBaseBD.setModuleFacade(oUser.getModuleFacade());
oBaseBD.setOUserInfo(oUser.getUserInfo());
return oBaseBD;
}
protected BaseHeaderBean getBaseHeaderBean(String sFormName) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
String sBaseHeaderBean = ParamUtil.getHeaderBean(sFormName);
try {
BaseHeaderBean oBaseHeaderBean = (BaseHeaderBean)Class.forName(sBaseHeaderBean).newInstance();
String pseudoHeader = ParamUtil.getPseudoHeaderFlag(sFormName);
oBaseHeaderBean.setPseudoHeader(pseudoHeader);
return oBaseHeaderBean;
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
protected ArrayList getDetailArrayList(BaseForm oBaseForm, String sFormName, String sScreenName) throws EnrgiseSystemException, IllegalAccessException, InstantiationException, ClassNotFoundException {
String sDetailArrayList = ParamUtil.getDetailArrayName(sFormName, sScreenName);
ArrayList oList = (ArrayList)EnrgiseUtil.getFieldValue(oBaseForm, sDetailArrayList);
return oList;
}
protected UserSession getUserSessionBean(HttpServletRequest request) throws EnrgiseApplicationException, RemoteException, EnrgiseSystemException {
UserInfo oUserInfo = new UserInfo();
HttpSession session = request.getSession();
UserSession oUser = (UserSession)session.getAttribute(ParamUtil.getSessionBeanName());
if (oUser == null)
try {
String sEmpId = (String)session.getAttribute("empId");
String sSiteId = (String)session.getAttribute("siteId");
UserSessionHome oUserHome = (UserSessionHome)ServiceLocator.getLocator().getService("HrmUserSession");
oUser = oUserHome.create();
HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade");
HrmFacade oHrmFacade = oHome.create();
oUserInfo = oHrmFacade.getLoginUserInfo(sEmpId, sSiteId);
oUser.setUserInfo(oUserInfo);
HrmSecondFacadeHome oSecHome = (HrmSecondFacadeHome)ServiceLocator.getLocator().getService("HrmSecondFacade");
HrmSecondFacade oSecHrmFacade = oSecHome.create();
HrmThirdFacadeHome oThirdHome = (HrmThirdFacadeHome)ServiceLocator.getLocator().getService("HrmThirdFacade");
HrmThirdFacade oThirdFacade = oThirdHome.create();
HashMap oMap = new HashMap();
oMap.put(ParamUtil.getModuleName(), oHrmFacade);
oMap.put("SecHRMS", oSecHrmFacade);
oMap.put("ThirdHRMS", oThirdFacade);
oUser.setModuleFacade(oMap);
session.setAttribute(ParamUtil.getSessionBeanName(), oUser);
EmpInfoBean oEmpInfoBean = new EmpInfoBean();
oEmpInfoBean.setModuleId("8");
oEmpInfoBean.setEmpId(oUserInfo.getUserTypeId());
SecurityBD oSecurityBD = new SecurityBD();
ArrayList menu = oSecurityBD.getTreeSet(oEmpInfoBean);
HashMap secMap = oSecurityBD.getAccessInfo(oEmpInfoBean);
oUser.setAccessInfo(secMap);
session.setAttribute("menuList", menu);
session.setAttribute("userId", sEmpId);
} catch (CreateException ex) {
ex.printStackTrace();
}
return oUser;
}
protected void clearDetailLists(BaseForm form, ArrayList oDetailList) throws IllegalAccessException, InvocationTargetException {
Iterator oIt = oDetailList.iterator();
while (oIt.hasNext()) {
DetailScreen oDetailScreen = oIt.next();
BeanUtils.copyProperty(form, oDetailScreen.get_DetailArrayName(), new ArrayList());
}
}
protected ArrayList getDetailArray(BaseForm oBaseForm) throws EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException {
String sFormName = oBaseForm.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
ArrayList oDetailArray = new ArrayList();
String sDetailBean = ParamUtil.getDetailBeanName(sFormName, sScreenName);
BaseDetailBean oBaseDetailBean = (BaseDetailBean)Class.forName(sDetailBean).newInstance();
ArrayList oFieldList = new ArrayList();
oFieldList = getFieldList(oFieldList, oBaseDetailBean.getClass());
ArrayList oList = (ArrayList)EnrgiseUtil.getFieldValue(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName));
for (int iRecord = 0; iRecord < oBaseForm.getThisPageDetailCount(); iRecord++) {
if (null == oList)
break;
oBaseDetailBean = oList.get(iRecord);
if (null == oBaseDetailBean)
break;
Iterator oIt = oFieldList.iterator();
while (oIt.hasNext()) {
try {
Field ob = oIt.next();
String sFieldName = ob.getName();
if (sFieldName.startsWith("disab"))
continue;
if (ob.getType().getName().equals("java.lang.String")) {
String sValue = BeanUtils.getIndexedProperty(oBaseForm, sFieldName, iRecord);
BeanUtils.setProperty(oBaseDetailBean, sFieldName, sValue);
}
} catch (NoSuchMethodException noSuchMethodException) {}
}
oDetailArray.add(oBaseDetailBean);
}
return oDetailArray;
}
private ArrayList getFieldList(ArrayList oFieldList, Class oClass) {
if (oClass == null)
return oFieldList;
Field[] oFields = oClass.getDeclaredFields();
EnrgiseUtil.addToList(oFieldList, (Object[])oFields);
return getFieldList(oFieldList, oClass.getSuperclass());
}
protected void changeMode(BaseForm oBaseForm, HttpServletRequest request) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
String sFormName = oBaseForm.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseForm, oBaseHeaderBean);
clearDetailLists(oBaseForm, ParamUtil.getDetailList(sFormName));
UserSession oUser = getUserSessionBean(request);
oUser.putBaseHeaderVO(sFormName, null);
oUser.removeAllDetailVO(sFormName);
resetForm(oBaseForm);
}
protected void checkHeaderNavigation(BaseForm oBaseForm, BaseHeaderVO oBaseHeaderVO) throws EnrgiseApplicationException {
long lPositionRequested = Long.parseLong(oBaseForm.getUserPositionRequested());
if (null != oBaseHeaderVO) {
if (lPositionRequested <= 0L || lPositionRequested > oBaseHeaderVO.getTotalCount())
throw new EnrgiseApplicationException("wenrgise.common.headerNavigation", "E");
oBaseForm.setPositionRequested(lPositionRequested);
} else {
throw new EnrgiseApplicationException("wenrgise.common.headerNavigation", "E");
}
}
private void resetForm(BaseForm oBaseForm) {
oBaseForm.setPageRequested(0L);
oBaseForm.setPositionRequested(0L);
oBaseForm.setTotalCount(0L);
oBaseForm.setTotalDetailRecord(0L);
oBaseForm.setTotalHeaderRecord(0L);
oBaseForm.setHeaderPrimaryKey(null);
oBaseForm.setUserPageRequested(null);
oBaseForm.setDetailId(null);
oBaseForm.setStatus(null);
oBaseForm.setDetailDataChanged(false);
oBaseForm.setHeaderDataChanged(false);
oBaseForm.setChecked(null);
oBaseForm.setUserPositionRequested(null);
oBaseForm.setTotalCount(0L);
oBaseForm.setNewPageRequested(null);
oBaseForm.setItemChecked(null);
oBaseForm.setLovKey(null);
oBaseForm.setTxtSearchFields(null);
oBaseForm.setTxtDisplayFields(null);
oBaseForm.setTxtIndex(null);
oBaseForm.setThisPageDetailCount(0);
oBaseForm.setTotalPageCount(0L);
oBaseForm.setHeaderStatus(null);
oBaseForm.setButtonClicked(null);
oBaseForm.setButtonName(null);
oBaseForm.setDetailStartPage(0);
}
protected void checkDetailNavigation(BaseForm oBaseForm, BaseDetailVO oBaseDetailVO) throws EnrgiseApplicationException {
boolean flag = false;
long lPageRequested = 0L;
if (EnrgiseUtil.checkString(oBaseForm.getUserPageRequested())) {
lPageRequested = Long.parseLong(oBaseForm.getUserPageRequested());
} else {
flag = true;
}
if (null != oBaseDetailVO) {
if (flag == false) {
if (lPageRequested <= 0L || oBaseDetailVO.getTotalDetailRecord() <= oBaseDetailVO.getRecordsPerPage() * (lPageRequested - 1L))
throw new EnrgiseApplicationException("wenrgise.common.detailNavigation", "E");
oBaseForm.setPageRequested(lPageRequested);
} else if (oBaseForm.getDetailList() != null) {
oBaseForm.setPageRequested(1L);
} else {
oBaseForm.setPageRequested(0L);
}
} else {
throw new EnrgiseApplicationException("wenrgise.common.detailNavigation", "E");
}
}
protected void enableDisable(BaseForm oBaseForm, ArrayList arylstFields, String enableFlag) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
if (null != arylstFields) {
Iterator iterFields = arylstFields.iterator();
while (iterFields.hasNext()) {
StringBuffer sField = new StringBuffer(iterFields.next());
String sProperty = String.valueOf("setDisab").concat(String.valueOf(sField.toString()));
try {
Class[] oCls = { Class.forName("java.lang.String") };
Method oMethod = oBaseForm.getClass().getMethod(sProperty, oCls);
String sFlag = enableFlag.equals("D") ? "true" : "false";
Object[] obj = { sFlag };
oMethod.invoke(oBaseForm, obj);
} catch (NoSuchMethodException nse) {
System.out.println(String.valueOf(String.valueOf(String.valueOf("The problem is ").concat(String.valueOf(nse.getMessage()))).concat(String.valueOf(" "))).concat(String.valueOf(sProperty)));
}
}
}
}
protected void enableAll(BaseForm oBaseForm) {
try {
ArrayList arylstDisFields = new ArrayList();
ArrayList arylstFields = new ArrayList();
arylstFields = getFieldList(arylstFields, oBaseForm.getClass());
Iterator iterFields = arylstFields.iterator();
while (iterFields.hasNext()) {
Field oField = iterFields.next();
if (oField.getName().startsWith("disab"))
arylstDisFields.add(oField.getName().replaceFirst("disab", ""));
}
enableDisable(oBaseForm, arylstDisFields, "E");
} catch (Exception exception) {}
}
protected void disableAll(BaseForm oBaseForm) {
try {
ArrayList arylstDisFields = new ArrayList();
ArrayList arylstFields = new ArrayList();
arylstFields = getFieldList(arylstFields, oBaseForm.getClass());
Iterator iterFields = arylstFields.iterator();
while (iterFields.hasNext()) {
Field oField = iterFields.next();
if (oField.getName().startsWith("disab"))
arylstDisFields.add(oField.getName().replaceFirst("disab", ""));
}
enableDisable(oBaseForm, arylstDisFields, "D");
} catch (Exception exception) {}
}
protected ArrayList queryClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butQuery");
arylstFields.add("butSave");
arylstFields.add("butDelete");
arylstFields.add("butPrint");
arylstFields.add("butGetDetail");
arylstFields.add("butAddRow");
arylstFields.add("butDelRow");
arylstFields.add("butNextHeader");
arylstFields.add("butPrevHeader");
arylstFields.add("newPositionRequested");
arylstFields.add("butJumpHeader");
arylstFields.add("butNextDetail");
arylstFields.add("butPrevDetail");
arylstFields.add("newPageRequested");
arylstFields.add("butJumpDetail");
return arylstFields;
}
protected ArrayList insertClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butInsert");
arylstFields.add("butExecute");
arylstFields.add("butDelete");
arylstFields.add("butPrint");
arylstFields.add("butGetDetail");
arylstFields.add("butAddRow");
arylstFields.add("butDelRow");
arylstFields.add("butNextHeader");
arylstFields.add("butPrevHeader");
arylstFields.add("newPositionRequested");
arylstFields.add("butJumpHeader");
arylstFields.add("butNextDetail");
arylstFields.add("butPrevDetail");
arylstFields.add("newPageRequested");
arylstFields.add("butJumpDetail");
return arylstFields;
}
protected ArrayList executeClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butExecute");
arylstFields.add("butAddRow");
arylstFields.add("butDelRow");
arylstFields.add("butExecute");
arylstFields.add("butNextDetail");
arylstFields.add("butPrevDetail");
arylstFields.add("butJumpDetail");
arylstFields.add("newPageRequested");
return arylstFields;
}
protected ArrayList deleteClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butQuery");
arylstFields.add("butExecute");
arylstFields.add("butDelete");
return arylstFields;
}
protected ArrayList saveClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butExecute");
arylstFields.add("butGetDetail");
return arylstFields;
}
protected ArrayList refreshClicked() {
ArrayList arylstFields = new ArrayList();
return arylstFields;
}
protected ArrayList nextHeaderClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butExecute");
arylstFields.add("butAddRow");
arylstFields.add("butDelRow");
arylstFields.add("butNextDetail");
arylstFields.add("butPrevDetail");
arylstFields.add("butJumpDetail");
arylstFields.add("newPageRequested");
return arylstFields;
}
protected ArrayList prevHeaderClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butExecute");
arylstFields.add("butAddRow");
arylstFields.add("butDelRow");
arylstFields.add("butNextDetail");
arylstFields.add("butPrevDetail");
arylstFields.add("butJumpDetail");
arylstFields.add("newPageRequested");
return arylstFields;
}
protected ArrayList getDetailClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butGetDetail");
return arylstFields;
}
protected ArrayList addRowClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butGetDetail");
return arylstFields;
}
protected ArrayList delRowClicked() {
ArrayList arylstFields = new ArrayList();
arylstFields.add("butDelRow");
arylstFields.add("butGetDetail");
return arylstFields;
}
protected void controlHeaderNavigation(BaseForm oBaseForm) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
ArrayList arylstFields = new ArrayList();
long lTotalRecord = oBaseForm.getTotalCount();
long lRecordNum = oBaseForm.getPositionRequested();
if (lTotalRecord == 0L || lTotalRecord == 1L) {
arylstFields.add("butNextHeader");
arylstFields.add("butPrevHeader");
arylstFields.add("newPositionRequested");
arylstFields.add("butJumpHeader");
} else {
if (lRecordNum == lTotalRecord)
arylstFields.add("butNextHeader");
if (lRecordNum == 1L)
arylstFields.add("butPrevHeader");
}
enableDisable(oBaseForm, arylstFields, "D");
}
protected void controlDetailNavigation(BaseForm oBaseForm) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
ArrayList oEnableList = new ArrayList();
ArrayList oDisableList = new ArrayList();
long lTotalRecord = oBaseForm.getTotalPageCount();
long lRecordNum = oBaseForm.getPageRequested();
if (lTotalRecord == 0L || lTotalRecord == 1L) {
oDisableList.add("butNextDetail");
oDisableList.add("butPrevDetail");
oDisableList.add("newPageRequested");
oDisableList.add("butJumpDetail");
} else if (lRecordNum == lTotalRecord) {
oEnableList.add("butPrevDetail");
oEnableList.add("newPageRequested");
oEnableList.add("butJumpDetail");
oDisableList.add("butNextDetail");
} else if (lRecordNum == 1L) {
oEnableList.add("newPageRequested");
oEnableList.add("butJumpDetail");
oEnableList.add("butNextDetail");
oDisableList.add("butPrevDetail");
} else {
oEnableList.add("newPageRequested");
oEnableList.add("butJumpDetail");
oEnableList.add("butNextDetail");
oEnableList.add("butPrevDetail");
}
enableDisable(oBaseForm, oEnableList, "E");
enableDisable(oBaseForm, oDisableList, "D");
}
protected void resetDetailPageData(BaseForm oBaseForm) {
oBaseForm.setPageRequested(0L);
oBaseForm.setTotalPageCount(0L);
}
protected long calculateTotalDetailPage(String sFormName, String sScreenName, long lTotDetRecord) {
long totRecPerPage = ParamUtil.getDetailRecordPerPage(sFormName, sScreenName);
if (lTotDetRecord % totRecPerPage != 0L)
return lTotDetRecord / totRecPerPage + 1L;
return lTotDetRecord / totRecPerPage;
}
protected BaseDetailVO getDetailData(BaseForm oBaseForm, String sFormName, String sScreenName, long lPageRequested, HttpServletRequest request, BaseBD oBaseBD, boolean bForce, UserSession oUser) throws RemoteException, ClassNotFoundException, InvocationTargetException, InstantiationException, IllegalAccessException, EnrgiseApplicationException, EnrgiseSystemException {
String sHeaderPrimaryKey = oBaseForm.getHeaderPrimaryKey();
String pseudoHeader = ParamUtil.getPseudoHeaderFlag(sFormName);
DetailSizeValues oDetailSizeValues = new DetailSizeValues();
oDetailSizeValues.setDetailRecordPerPage(ParamUtil.getDetailRecordPerPage(sFormName, sScreenName));
oDetailSizeValues.setMaxPages(ParamUtil.getMaxDetailPages(sFormName, sScreenName));
BaseDetailVO oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
if (!EnrgiseUtil.checkString(pseudoHeader)) {
oBaseDetailVO = oBaseBD.getDetailRecord(sFormName, sScreenName, sHeaderPrimaryKey, lPageRequested, oDetailSizeValues, oBaseDetailVO, bForce, oUser);
} else {
BaseQueryVO oBaseQueryVO = getQueryVO((ActionForm)oBaseForm);
BeanUtils.copyProperties(oBaseQueryVO, oBaseForm);
oBaseDetailVO = oBaseBD.getDetailRecord(sFormName, sScreenName, oBaseQueryVO, lPageRequested, oDetailSizeValues, oBaseDetailVO, bForce, oUser);
}
if (oBaseDetailVO.getOThisPageData() != null)
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oBaseDetailVO.getOThisPageData());
oBaseForm.setPageRequested(lPageRequested);
oBaseForm.setThisPageDetailCount((null != oBaseDetailVO.getOThisPageData()) ? oBaseDetailVO.getOThisPageData().size() : 0);
BeanUtils.copyProperties(oBaseForm, oBaseDetailVO);
oBaseForm.setNewPageRequested(null);
oBaseForm.setPageRequested(lPageRequested);
oUser.putBaseDetailVO(sFormName, sScreenName, oBaseDetailVO);
return oBaseDetailVO;
}
protected void onLoad(ActionForm form, HttpServletRequest request, int actionName) throws RemoteException, ClassNotFoundException, InvocationTargetException, InstantiationException, IllegalAccessException, EnrgiseApplicationException, EnrgiseSystemException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
BaseDetailVO oBaseDetailVO = new BaseDetailVO();
UserSession oUser = getUserSessionBean(request);
BaseBD oBaseBD = getHeaderBusinessDelegate(form, request);
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setActionName(actionName);
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
if (null != oBaseDetailVO) {
ArrayList oDetailList = getDetailArrayList(oBaseForm, sFormName, sScreenName);
oThisPageVO.setODetailList(oDetailList);
}
oBaseBD.onLoadAction(oThisPageVO);
if (oThisPageVO != null)
if (oThisPageVO.getOHeaderBean() != null)
BeanUtils.copyProperties(form, oThisPageVO.getOHeaderBean());
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
}
protected void checkAccessInfo(UserSession oUserSession, String sComponentName, String sScreenMode, String sButtonName, int iActionName, String sWorkListId) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
HashMap oSecMap = oUserSession.getAccessInfo();
AccessBean objBean = (AccessBean)oSecMap.get(sComponentName);
if (!EnrgiseUtil.checkString(sWorkListId)) {
if (iActionName == 10 || iActionName == 14 || iActionName == 23) {
String s = null;
System.out.println("I am in AccessInfo");
System.out.println("Insert Flag: ");
try {
if (!objBean.getInsertFlag().equalsIgnoreCase("Y")) {
System.out.println("after Insert Flag: ");
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("right.for.insert");
oParam.add(oMessageKey);
throw new EnrgiseMessageKeyException("wenrgise.authorisation.error", oParam, "M");
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (iActionName == 8)
if (sScreenMode.equalsIgnoreCase("N")) {
if (!objBean.getInsertFlag().equalsIgnoreCase("Y")) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("right.for.insert");
oParam.add(oMessageKey);
throw new EnrgiseMessageKeyException("wenrgise.authorisation.error", oParam, "M");
}
} else if (sScreenMode.equalsIgnoreCase("U")) {
if (!objBean.getUpdateFlag().equalsIgnoreCase("Y")) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("right.for.update");
oParam.add(oMessageKey);
throw new EnrgiseMessageKeyException("wenrgise.authorisation.error", oParam, "M");
}
}
if (iActionName == 17 || iActionName == 15)
if (!objBean.getDeleteFlag().equalsIgnoreCase("Y")) {
ArrayList oParam = new ArrayList();
MessageKey oMessageKey = new MessageKey("right.for.delete");
oParam.add(oMessageKey);
throw new EnrgiseMessageKeyException("wenrgise.authorisation.error", oParam, "M");
}
}
}
protected String getComponentName(String sFormName) {
String sModFormName = sFormName.replace('.', ',');
int index = 0;
char g = ',';
char[] arrayModeFormName = sModFormName.toCharArray();
int k;
for (k = arrayModeFormName.length - 1; k > 0; k--) {
if (arrayModeFormName[k] == g) {
index = k + 1;
break;
}
}
String sComponentName = sModFormName.substring(index, sModFormName.length());
return sComponentName;
}
public abstract ActionForward executeImpl(ActionMapping paramActionMapping, ActionForm paramActionForm, HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException;
}

View File

@@ -0,0 +1,22 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.webtier.form.BaseForm;
public class CancelAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
oBaseForm.setHeaderDataChanged(false);
oBaseForm.setDetailDataChanged(false);
return mapping.getInputForward();
}
}

View File

@@ -0,0 +1,64 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseDetailBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class DecrAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
UserSession oUser = getUserSessionBean(request);
BaseDetailVO oBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
int count = 0;
ArrayList oDetailArray = getDetailArray(oBaseForm);
try {
String[] itemChecked = oBaseForm.getItemChecked();
String[] sStatuss = oBaseForm.getStatus();
String[] sStartFields = BeanUtils.getArrayProperty(oBaseForm, "startField");
for (int i = 0; i < itemChecked.length; i++) {
if (itemChecked[i].equals("Y")) {
count++;
String sStartField = sStartFields[i];
if (i < itemChecked.length - 1) {
for (int j = i + 1; j < itemChecked.length; j++) {
String sStatus = sStatuss[j];
if (!sStatus.equals("D")) {
BaseDetailBean oBaseDetailBean = oDetailArray.get(j);
oBaseDetailBean.setStatus("U");
BeanUtils.setProperty(oBaseDetailBean, "startField", sStartField);
oDetailArray.set(j, oBaseDetailBean);
break;
}
}
((BaseDetailBean)oDetailArray.get(i)).setStatus("D");
((BaseDetailBean)oDetailArray.get(i)).setItemChecked("N");
oBaseDetailVO.setRowDeleted(oBaseDetailVO.getRowDeleted() + 1);
}
}
}
} catch (NoSuchMethodException noSuchMethodException) {}
if (count > 0)
oBaseForm.setDetailDataChanged(true);
oBaseDetailVO.setOThisPageData(oDetailArray);
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oBaseDetailVO.getOThisPageData());
oUser.putBaseDetailVO(sFormName, sScreenName, oBaseDetailVO);
onLoad(form, request, 16);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,108 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class DeleteAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
BaseBD oBaseBD = getHeaderBusinessDelegate(form, request);
UserSession oUser = getUserSessionBean(request);
String sComponentName = getComponentName(sFormName);
checkAccessInfo(oUser, sComponentName, oBaseForm.getScreenMode(), "", 17, oBaseForm.getWorkListId());
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
ArrayList oDetailBeanArray = null;
BaseDetailVO oBaseDetailVO = null;
BaseHeaderVO oBaseHeaderVO = null;
Timestamp oHeaderPicked = null;
Timestamp oDetailPicked = null;
oBaseHeaderVO = oUser.getBaseHeaderVO(sFormName);
if (oBaseHeaderVO != null) {
oHeaderPicked = oBaseHeaderVO.getOWhenPicked();
oBaseHeaderBean = getBaseHeaderBean(sFormName);
if (oBaseHeaderBean == null)
oBaseHeaderBean = getBaseHeaderBean(sFormName);
}
BeanUtils.copyProperties(oBaseHeaderBean, form);
oBaseForm.setHeaderDataChanged(true);
String sHeaderPrimaryKey = oBaseBD.saveRecord(oBaseHeaderBean, oHeaderPicked, oBaseForm.getScreenName(), "D", oBaseForm.isHeaderDataChanged(), oDetailBeanArray, oBaseForm.isDetailDataChanged(), oDetailPicked);
BaseQueryVO oBaseQueryVO = null;
if (oBaseForm.getPositionRequested() > 0L && sHeaderPrimaryKey == null) {
if (oBaseForm.getTotalHeaderRecord() == 1L) {
oBaseForm.setScreenMode("Q");
changeMode(oBaseForm, request);
} else {
oBaseHeaderVO = oBaseBD.getNextHeaderRecord(oBaseQueryVO, oBaseForm.getPositionRequested(), sFormName, true, oUser);
int iRelativePosition = (int)(oBaseHeaderVO.getPositionRequested() - oBaseHeaderVO.getHeaderStartPosition() + 1L);
BeanUtils.copyProperties(form, oBaseHeaderVO.getHeaderRecord(iRelativePosition));
BeanUtils.copyProperties(form, oBaseHeaderVO);
oBaseForm.setTotalHeaderRecord(((int)oBaseForm.getTotalHeaderRecord() - 1));
oBaseHeaderVO.setTotalCount(oBaseHeaderVO.getTotalCount() - 1L);
oBaseForm.setHeaderDataChanged(false);
oBaseForm.setDetailDataChanged(false);
oBaseForm.setScreenMode("U");
}
} else {
oBaseQueryVO = getQueryVO(form);
oBaseQueryVO.setHeaderPrimaryKey(sHeaderPrimaryKey);
oBaseQueryVO.setMaxHeaderSize(ParamUtil.getHeaderSize(sFormName));
oBaseHeaderVO = oBaseBD.getHeaderRecord(oBaseQueryVO, sFormName, oUser);
BeanUtils.copyProperties(form, oBaseHeaderVO.getHeaderRecord(1));
BeanUtils.copyProperties(form, oBaseHeaderVO);
oBaseForm.setScreenMode("U");
}
enableAll(oBaseForm);
enableDisable(oBaseForm, saveClicked(), "D");
controlHeaderNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "ALL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap)
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
BaseHeaderBean oThisBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oThisBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oThisBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(17);
oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oDetailList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
onLoad(form, request, 17);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,89 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseDetailBean;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.UserInfo;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class DeleteRowAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
String[] itemChecked = oBaseForm.getItemChecked();
UserSession oUser = getUserSessionBean(request);
String sComponentName = getComponentName(sFormName);
checkAccessInfo(oUser, sComponentName, oBaseForm.getScreenMode(), "", 17, oBaseForm.getWorkListId());
BaseDetailVO oBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
BaseDetailBean oBaseDetailBean = null;
boolean newRecordFlag = false;
UserInfo oUserInfo = oUser.getUserInfo();
SecurityBD oSecBD = new SecurityBD();
ArrayList oDetailArray = getDetailArray(oBaseForm);
int count = 0;
for (int i = 0; i < itemChecked.length; i++) {
if (itemChecked[i].equals("Y"))
if (!((BaseDetailBean)oDetailArray.get(i)).getStatus().equals("N")) {
count++;
((BaseDetailBean)oDetailArray.get(i)).setStatus("D");
oBaseDetailVO.setRowDeleted(oBaseDetailVO.getRowDeleted() + 1);
} else {
oDetailArray.remove(i);
oBaseDetailVO.setRowDeleted(oBaseDetailVO.getRowAdded() - 1);
newRecordFlag = true;
}
}
if (count == 0 && newRecordFlag == false)
throw new EnrgiseApplicationException("wenrgise.common.norowselected");
if (count > 0)
oBaseForm.setDetailDataChanged(true);
oBaseDetailVO.setOThisPageData(oDetailArray);
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oBaseDetailVO.getOThisPageData());
oUser.putBaseDetailVO(sFormName, sScreenName, oBaseDetailVO);
BaseHeaderBean oThisBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oThisBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oThisBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oThisList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oThisList);
}
BaseBD oBaseBD = getDetailBusinessDelegate(form, request);
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 15);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,33 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
public class ExitAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
System.out.println("I am in Exit Action ---->");
BaseForm oBaseForm = (BaseForm)form;
String sFormBean = mapping.getAttribute();
String sScreenName = oBaseForm.getScreenName();
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged())
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
String sFormName = form.getClass().getName();
UserSession oUser = getUserSessionBean(request);
if (oUser != null)
oUser.removeAllIfExists(sFormName, sScreenName);
HttpSession session = request.getSession();
session.removeAttribute(sFormBean);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,131 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.DetailSizeValues;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class GetButtonAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
if (oBaseForm.getScreenMode().equals("N"))
throw new EnrgiseApplicationException("wenrgise.common.saveheaderrecord", "M");
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged())
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
BaseBD oBaseBD = getHeaderBusinessDelegate(form, request);
UserSession oUser = getUserSessionBean(request);
String sComponentName = getComponentName(sFormName);
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
ArrayList oDetailBeanArray = null;
BaseDetailVO oBaseDetailVO = null;
BaseHeaderVO oBaseHeaderVO = null;
Timestamp oHeaderPicked = null;
Timestamp oDetailPicked = null;
oBaseHeaderVO = oUser.getBaseHeaderVO(sFormName);
if (oBaseHeaderVO != null) {
oHeaderPicked = oBaseHeaderVO.getOWhenPicked();
oBaseHeaderBean = getBaseHeaderBean(sFormName);
}
BeanUtils.copyProperties(oBaseHeaderBean, form);
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
if (oBaseDetailVO != null) {
oDetailPicked = oBaseDetailVO.getOWhenPicked();
oDetailBeanArray = getDetailArray(oBaseForm);
}
String sHeaderPrimaryKey = oBaseBD.submit(oBaseForm.getButtonName(), oBaseHeaderBean, oHeaderPicked, oBaseForm.getScreenName(), oBaseForm.getScreenMode(), oBaseForm.isHeaderDataChanged(), oDetailBeanArray, oBaseForm.isDetailDataChanged(), oDetailPicked);
oBaseForm.setHeaderPrimaryKey(sHeaderPrimaryKey);
BaseQueryVO oBaseQueryVO = null;
oBaseQueryVO = getQueryVO(form);
BeanUtils.copyProperties(oBaseQueryVO, form);
oBaseQueryVO.setHeaderPrimaryKey(sHeaderPrimaryKey);
oBaseQueryVO.setMaxHeaderSize(ParamUtil.getHeaderSize(sFormName));
oBaseHeaderVO = oBaseBD.getHeaderRecord(oBaseQueryVO, sFormName, oUser);
BeanUtils.copyProperties(form, oBaseHeaderVO.getHeaderRecord(1));
BeanUtils.copyProperties(form, oBaseHeaderVO);
oUser.putBaseHeaderVO(sFormName, oBaseHeaderVO);
if (null != oBaseDetailVO) {
if (oBaseDetailVO.getTotalDetailRecord() + oBaseDetailVO.getRowAdded() - oBaseDetailVO.getRowDeleted() > 0L) {
oBaseDetailVO.setRowDeleted(0);
oBaseDetailVO.setRowAdded(0);
DetailSizeValues oDetailSizeValues = new DetailSizeValues();
oDetailSizeValues.setDetailRecordPerPage(ParamUtil.getDetailRecordPerPage(sFormName, sScreenName));
oDetailSizeValues.setMaxPages(ParamUtil.getMaxDetailPages(sFormName, sScreenName));
oBaseDetailVO = getDetailData(oBaseForm, sFormName, sScreenName, 1L, request, oBaseBD, true, oUser);
oBaseForm.setPageRequested(1L);
long totDetRecord = oBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, sScreenName, totDetRecord));
if (oBaseDetailVO.getOThisPageData() != null) {
oBaseForm.setThisPageDetailCount(oBaseDetailVO.getOThisPageData().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oBaseDetailVO.getOThisPageData());
} else {
oBaseForm.setThisPageDetailCount(0);
}
checkDetailNavigation(oBaseForm, oUser.getBaseDetailVO(sFormName, sScreenName));
BeanUtils.copyProperties(oBaseForm, oBaseDetailVO);
}
oBaseDetailVO.setRowAdded(0);
oBaseDetailVO.setRowDeleted(0);
oUser.putBaseDetailVO(sFormName, sScreenName, oBaseDetailVO);
}
oBaseForm.setHeaderDataChanged(false);
oBaseForm.setDetailDataChanged(false);
oBaseForm.setScreenMode("U");
enableAll(oBaseForm);
enableDisable(oBaseForm, saveClicked(), "D");
controlHeaderNavigation(oBaseForm);
controlDetailNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "ALL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap)
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
BaseHeaderBean oThisBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oThisBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oThisBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(18);
oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oDetailList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 18);
throw new EnrgiseApplicationException("wenrgise.common.datasaved", "M");
}
}

View File

@@ -0,0 +1,89 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class GetDetailAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
if (oBaseForm.getScreenMode().equals("N"))
throw new EnrgiseApplicationException("wenrgise.common.saveheaderrecord", "M");
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged())
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
String sFormName = form.getClass().getName();
UserSession oUser = getUserSessionBean(request);
BaseBD oBaseBD = getDetailBusinessDelegate(form, request);
String sScreenName = oBaseForm.getScreenName();
BaseDetailVO oBaseDetailVO = getDetailData(oBaseForm, sFormName, sScreenName, 1L, request, oBaseBD, true, oUser);
if (oBaseDetailVO.getOThisPageData() != null)
oBaseForm.setScreenMode("U");
long totDetRecord = oBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, sScreenName, totDetRecord));
ArrayList oClicked = getDetailClicked();
ArrayList oEnableList = new ArrayList();
oEnableList.add("butAddRow");
if (totDetRecord == 0L) {
oBaseForm.setPageRequested(0L);
oClicked.add("butDelRow");
} else {
oEnableList.add("butDelRow");
oEnableList.add("butSave");
}
enableDisable(oBaseForm, oClicked, "D");
enableDisable(oBaseForm, oEnableList, "E");
controlDetailNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "DETAIL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap) {
if (null != oSecMap.get("D"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
if (null != oSecMap.get("E"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("E"), "E");
}
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(6);
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oDetailList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 6);
oUser.setForwardedPage(sFormName, "success");
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,85 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class GetDetailPageAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged())
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
String sFormName = form.getClass().getName();
UserSession oUser = getUserSessionBean(request);
BaseBD oBaseBD = getDetailBusinessDelegate(form, request);
String sScreenName = oBaseForm.getScreenName();
checkDetailNavigation(oBaseForm, oUser.getBaseDetailVO(sFormName, sScreenName));
BaseDetailVO oBaseDetailVO = getDetailData(oBaseForm, sFormName, sScreenName, oBaseForm.getPageRequested(), request, oBaseBD, false, oUser);
long totDetRecord = oBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, oBaseForm.getScreenName(), totDetRecord));
ArrayList oClicked = getDetailClicked();
ArrayList oEnableList = new ArrayList();
oEnableList.add("butAddRow");
if (totDetRecord == 0L) {
oClicked.add("butDelRow");
} else {
oEnableList.add("butDelRow");
oEnableList.add("butSave");
}
enableDisable(oBaseForm, oClicked, "D");
enableDisable(oBaseForm, oEnableList, "E");
controlDetailNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "DETAIL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap) {
if (null != oSecMap.get("D"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
if (null != oSecMap.get("E"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("E"), "E");
}
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(6);
oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oDetailList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 6);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,68 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class GetHeaderAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged())
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
String sFormName = form.getClass().getName();
BaseQueryVO oBaseQueryVO = getQueryVO(form);
BaseBD oBaseBD = getHeaderBusinessDelegate(form, request);
BeanUtils.copyProperties(oBaseQueryVO, form);
oBaseQueryVO.setMaxHeaderSize(ParamUtil.getHeaderSize(sFormName));
UserSession oUser = getUserSessionBean(request);
BaseHeaderVO oBaseHeaderVO = oBaseBD.getHeaderRecord(oBaseQueryVO, sFormName, oUser);
BeanUtils.copyProperties(form, oBaseHeaderVO.getHeaderRecord(1));
BeanUtils.copyProperties(form, oBaseHeaderVO);
resetDetailPageData(oBaseForm);
if (oBaseHeaderVO.getTotalCount() > 0L)
oBaseForm.setScreenMode("U");
enableAll(oBaseForm);
enableDisable(oBaseForm, executeClicked(), "D");
controlHeaderNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "HEADER", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap)
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(1);
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
onLoad(form, request, 1);
oUser.setForwardedPage(sFormName, "success");
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,105 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.UserInfo;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.DetailSizeValues;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class GetInsertAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
BaseQueryVO oBaseQueryVO = getQueryVO(form);
System.out.println(String.valueOf("Class name ").concat(String.valueOf(oBaseQueryVO.getClass().getName())));
BaseBD oBaseBD = getHeaderBusinessDelegate(form, request);
BeanUtils.copyProperties(oBaseQueryVO, form);
oBaseQueryVO.setMaxHeaderSize(ParamUtil.getHeaderSize(sFormName));
UserSession oUser = getUserSessionBean(request);
String sComponentName = getComponentName(sFormName);
checkAccessInfo(oUser, sComponentName, oBaseForm.getScreenMode(), "", 8, oBaseForm.getWorkListId());
UserInfo oUserInfo = oUser.getUserInfo();
SecurityBD oSecBD = new SecurityBD();
System.out.println(oBaseForm.getHeaderPrimaryKey());
String sNewPK = oBaseBD.getInsertDataImpl(oBaseQueryVO);
oBaseQueryVO = getQueryVO(form);
BeanUtils.copyProperties(oBaseQueryVO, form);
oBaseQueryVO.setHeaderPrimaryKey(sNewPK);
oBaseQueryVO.setMaxHeaderSize(ParamUtil.getHeaderSize(sFormName));
oUser = getUserSessionBean(request);
BaseHeaderVO oBaseHeaderVO = oBaseBD.getHeaderRecord(oBaseQueryVO, sFormName, oUser);
oUser.putBaseHeaderVO(sFormName, oBaseHeaderVO);
oUser.putBaseQueryVO(sFormName, oBaseQueryVO);
BeanUtils.copyProperties(form, oBaseHeaderVO.getHeaderRecord(1));
BeanUtils.copyProperties(form, oBaseHeaderVO);
DetailSizeValues oDetailSizeValues = new DetailSizeValues();
oDetailSizeValues.setDetailRecordPerPage(ParamUtil.getDetailRecordPerPage(sFormName, sScreenName));
oDetailSizeValues.setMaxPages(ParamUtil.getMaxDetailPages(sFormName, sScreenName));
System.out.println(oBaseHeaderVO.getHeaderRecord(1).getHeaderPrimaryKey());
BaseDetailVO oBaseDetailVO = getDetailData(oBaseForm, sFormName, sScreenName, 1L, request, oBaseBD, true, oUser);
oBaseForm.setDetailStartPage(1);
oBaseDetailVO.setCurrentPage(1L);
oBaseForm.setThisPageDetailCount((null != oBaseDetailVO.getOThisPageData()) ? oBaseDetailVO.getOThisPageData().size() : 0);
if (oBaseDetailVO.getOThisPageData() != null)
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oBaseDetailVO.getOThisPageData());
BeanUtils.copyProperties(oBaseForm, oBaseDetailVO);
oBaseForm.setHeaderDataChanged(false);
oBaseForm.setDetailDataChanged(false);
oBaseForm.setScreenMode("U");
enableAll(oBaseForm);
enableDisable(oBaseForm, nextHeaderClicked(), "D");
controlHeaderNavigation(oBaseForm);
enableDisable(oBaseForm, getDetailClicked(), "D");
controlDetailNavigation(oBaseForm);
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "ALL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap)
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(23);
oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oDetailList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 23);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,71 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class GetNextHeaderAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, EnrgiseApplicationException, EnrgiseSystemException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged())
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
UserSession oUser = getUserSessionBean(request);
checkHeaderNavigation(oBaseForm, oUser.getBaseHeaderVO(sFormName));
BaseBD oBaseBD = getHeaderBusinessDelegate(form, request);
BaseQueryVO oBaseQueryVO = oUser.getBaseQueryVO(sFormName);
BaseHeaderVO oBaseHeaderVO = oBaseBD.getNextHeaderRecord(oBaseQueryVO, oBaseForm.getPositionRequested(), sFormName, false, oUser);
int iRelativePosition = (int)(oBaseHeaderVO.getPositionRequested() - oBaseHeaderVO.getHeaderStartPosition() + 1L);
BeanUtils.copyProperties(form, oBaseHeaderVO.getHeaderRecord(iRelativePosition));
oBaseForm.setTotalDetailRecord(0L);
clearDetailLists(oBaseForm, ParamUtil.getDetailList(sFormName));
oUser.removeAllDetailVO(sFormName);
oBaseForm.setDetailStartPage(0);
BeanUtils.copyProperties(form, oBaseHeaderVO);
oBaseForm.setNewPositionRequested(null);
resetDetailPageData(oBaseForm);
enableAll(oBaseForm);
enableDisable(oBaseForm, nextHeaderClicked(), "D");
controlHeaderNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "HEADER", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap)
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(1);
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
onLoad(form, request, 1);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,104 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.DetailSizeValues;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class GetRefreshTabAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged()) {
if (oBaseForm.isDetailDataChanged()) {
ArrayList arrayList = getDetailArray(oBaseForm);
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), arrayList);
}
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
}
BaseBD oBaseBD = getDetailBusinessDelegate(form, request);
UserSession oUser = getUserSessionBean(request);
String sForwardedPage = oBaseForm.getForwardedPage();
BaseDetailVO oPresentBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
if (null != oPresentBaseDetailVO)
oPresentBaseDetailVO.setCurrentPage(oBaseForm.getPageRequested());
oUser.putBaseDetailVO(sFormName, sScreenName, oPresentBaseDetailVO);
BaseDetailVO oNextBaseDetailVO = oUser.getBaseDetailVO(sFormName, sForwardedPage);
if (oPresentBaseDetailVO != null) {
DetailSizeValues oDetailSizeValues = new DetailSizeValues();
oDetailSizeValues.setDetailRecordPerPage(ParamUtil.getDetailRecordPerPage(sFormName, sForwardedPage));
oDetailSizeValues.setMaxPages(ParamUtil.getMaxDetailPages(sFormName, sForwardedPage));
oNextBaseDetailVO = getDetailData(oBaseForm, sFormName, sForwardedPage, 1L, request, oBaseBD, true, oUser);
if (oNextBaseDetailVO.getOThisPageData() != null)
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sForwardedPage), oNextBaseDetailVO.getOThisPageData());
oBaseForm.setPageRequested(oNextBaseDetailVO.getCurrentPage());
oBaseForm.setThisPageDetailCount((null != oNextBaseDetailVO.getOThisPageData()) ? oNextBaseDetailVO.getOThisPageData().size() : 0);
long lTotDetRecord = oNextBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, oBaseForm.getForwardedPage(), lTotDetRecord));
oUser.putBaseDetailVO(sFormName, sForwardedPage, oNextBaseDetailVO);
ArrayList oClicked = getDetailClicked();
if (lTotDetRecord == 0L) {
oBaseForm.setPageRequested(0L);
oClicked.add("butDelRow");
}
enableDisable(oBaseForm, oClicked, "D");
controlDetailNavigation(oBaseForm);
}
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(sForwardedPage).concat(String.valueOf(".jsp")), "DETAIL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap) {
if (null != oSecMap.get("D"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
if (null != oSecMap.get("E"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("E"), "E");
}
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
ArrayList oDetailList = null;
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
if (oNextBaseDetailVO != null) {
oDetailList = (oNextBaseDetailVO.getOThisPageData() != null) ? oNextBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
}
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getForwardedPage());
oThisPageVO.setActionName(22);
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
if (sForwardedPage != null)
oBaseForm.setScreenName(sForwardedPage);
onLoad(form, request, 22);
if (sForwardedPage != null)
return mapping.findForward(sForwardedPage);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,139 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class GetTabAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged()) {
if (oBaseForm.isDetailDataChanged()) {
ArrayList oDetailList = getDetailArray(oBaseForm);
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oDetailList);
}
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
}
BaseBD oBaseBD = getDetailBusinessDelegate(form, request);
UserSession oUser = getUserSessionBean(request);
String sForwardedPage = oBaseForm.getForwardedPage();
BaseDetailVO oPresentBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
if (null != oPresentBaseDetailVO)
oPresentBaseDetailVO.setCurrentPage(oBaseForm.getPageRequested());
oUser.putBaseDetailVO(sFormName, sScreenName, oPresentBaseDetailVO);
BaseDetailVO oNextBaseDetailVO = oUser.getBaseDetailVO(sFormName, sForwardedPage);
if (null != oNextBaseDetailVO) {
oBaseForm.setPageRequested(oNextBaseDetailVO.getCurrentPage());
oBaseForm.setThisPageDetailCount((null != oNextBaseDetailVO.getOThisPageData()) ? oNextBaseDetailVO.getOThisPageData().size() : 0);
long lTotDetRecord = oNextBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, oBaseForm.getForwardedPage(), lTotDetRecord));
ArrayList oClicked = getDetailClicked();
if (lTotDetRecord == 0L) {
oBaseForm.setPageRequested(0L);
oClicked.add("butDelRow");
}
enableDisable(oBaseForm, oClicked, "D");
controlDetailNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(sForwardedPage).concat(String.valueOf(".jsp")), "DETAIL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap) {
if (null != oSecMap.get("D"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
if (null != oSecMap.get("E"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("E"), "E");
}
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(sForwardedPage);
oThisPageVO.setActionName(22);
ArrayList oDetailList = (oNextBaseDetailVO.getOThisPageData() != null) ? oNextBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sForwardedPage), oThisPageVO.getODetailList());
}
} else {
if (oBaseForm.getHeaderPrimaryKey() == null)
throw new EnrgiseApplicationException("wenrgise.common.bringheaderdata", "M");
if (oPresentBaseDetailVO != null) {
oNextBaseDetailVO = getDetailData(oBaseForm, sFormName, sForwardedPage, 1L, request, oBaseBD, true, oUser);
long lTotDetRecord = oNextBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, oBaseForm.getForwardedPage(), lTotDetRecord));
oUser.putBaseDetailVO(sFormName, sForwardedPage, oNextBaseDetailVO);
ArrayList oClicked = getDetailClicked();
if (lTotDetRecord == 0L) {
oBaseForm.setPageRequested(0L);
oClicked.add("butDelRow");
}
enableDisable(oBaseForm, oClicked, "D");
controlDetailNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(sForwardedPage).concat(String.valueOf(".jsp")), "DETAIL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap) {
if (null != oSecMap.get("D"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
if (null != oSecMap.get("E"))
enableDisable(oBaseForm, (ArrayList)oSecMap.get("E"), "E");
}
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
ArrayList oDetailList = null;
BeanUtils.copyProperties(oBaseHeaderBean, form);
oDetailList = (oNextBaseDetailVO.getOThisPageData() != null) ? oNextBaseDetailVO.getOThisPageData() : new ArrayList();
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setODetailList(oDetailList);
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getForwardedPage());
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sForwardedPage), oThisPageVO.getODetailList());
}
}
}
if (sForwardedPage != null)
oBaseForm.setScreenName(sForwardedPage);
onLoad(form, request, 22);
if (sForwardedPage != null) {
oUser.setForwardedPage(sFormName, sForwardedPage);
return mapping.findForward(sForwardedPage);
}
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,138 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.StringTokenizer;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.businessdelegate.LOVBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.EnrgiseUtil;
import wenrgise.common.utility.UserInfo;
import wenrgise.common.vo.LovQueryVO;
import wenrgise.common.vo.LovVO;
import wenrgise.common.webtier.form.BaseLOVForm;
import wenrgise.common.xml.vo.LOVInfo;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.LOVManager;
public class LOVAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseLOVForm oBaseLOVForm = (BaseLOVForm)form;
System.out.println(oBaseLOVForm.getLovKey());
UserSession oUser = getUserSessionBean(request);
LOVInfo oLOVInfo = LOVManager.getInstance().getCachedObject(oBaseLOVForm.getLovKey());
if (oLOVInfo != null)
if (EnrgiseUtil.checkString(oLOVInfo.getRecursiveFlag())) {
if (oLOVInfo.getRecursiveFlag().equalsIgnoreCase("Y")) {
processRecursiveLov(oBaseLOVForm, oLOVInfo, mapping);
oBaseLOVForm.setRecursiveFlag("Y");
} else {
processSimpleLov(oBaseLOVForm, oLOVInfo, mapping, oUser.getUserInfo());
oBaseLOVForm.setRecursiveFlag("N");
}
} else {
processSimpleLov(oBaseLOVForm, oLOVInfo, mapping, oUser.getUserInfo());
oBaseLOVForm.setRecursiveFlag("N");
}
return mapping.findForward("success");
}
private ActionForward processSimpleLov(BaseLOVForm oBaseLOVForm, LOVInfo oLOVInfo, ActionMapping mapping, UserInfo oUserInfo) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
if (oBaseLOVForm.getTxtHidAction().equals("FirstTime")) {
oBaseLOVForm.setTxtHidTotCols(-1);
oBaseLOVForm.setTxtHidSubmitFirst("true");
oBaseLOVForm.setLevel(0);
oBaseLOVForm.setFinalLevel(0);
return mapping.findForward("success");
}
if (oBaseLOVForm.getTxtHidAction().equals("SearchRecords")) {
LOVBD oLOVBD = new LOVBD();
LovVO oLovVO = new LovVO();
LovQueryVO oLOVQueryVO = new LovQueryVO();
StringTokenizer stParameters = new StringTokenizer(oBaseLOVForm.getQueryParam(), ",");
while (stParameters.hasMoreTokens()) {
String[] sKeyValuePair = stParameters.nextToken().split("=");
oLOVQueryVO.setProperty(sKeyValuePair[0], sKeyValuePair[1]);
}
oLOVQueryVO.setProperty("LoginSiteId", oUserInfo.getSiteId());
oLOVQueryVO.setProperty("ListSiteId", String.valueOf(String.valueOf("(").concat(String.valueOf(oUserInfo.getSiteId()))).concat(String.valueOf(")")));
oLOVQueryVO.setSearchField1(oBaseLOVForm.getSearchField1());
oLOVQueryVO.setSearchField2(oBaseLOVForm.getSearchField2());
oLOVQueryVO.setSearchField2(oBaseLOVForm.getSearchField2());
oLOVQueryVO.setSearchField3(oBaseLOVForm.getSearchField3());
oLOVQueryVO.setSearchField4(oBaseLOVForm.getSearchField4());
oLOVQueryVO.setSearchField5(oBaseLOVForm.getSearchField5());
oLOVQueryVO.setSearchField6(oBaseLOVForm.getSearchField6());
oLOVQueryVO.setLevel(0);
oBaseLOVForm.setFinalLevel(-1);
oLovVO = oLOVBD.getLOVData(oLOVInfo, oLOVQueryVO);
if (oBaseLOVForm.getLevel() == 0)
oBaseLOVForm.setLevel(oLovVO.getFinalLevel());
if (oLovVO.getDetailList().size() > 0) {
BeanUtils.copyProperties(oBaseLOVForm, oLovVO);
oBaseLOVForm.setTxtHidTotRows(oLovVO.getDetailList().size());
oBaseLOVForm.setTxtHidTotCols(oLovVO.getHeaderList().size());
} else {
oBaseLOVForm.setTxtHidTotRows(0);
oBaseLOVForm.setTxtHidTotCols(-1);
}
oBaseLOVForm.setTxtHidSubmitFirst("false");
oBaseLOVForm.setInsertFlag(oLOVInfo.getInsertFlag());
}
return null;
}
private ActionForward processRecursiveLov(BaseLOVForm oBaseLOVForm, LOVInfo oLOVInfo, ActionMapping mapping) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
if (oBaseLOVForm.getTxtHidAction().equals("FirstTime")) {
oBaseLOVForm.setTxtHidTotCols(-1);
oBaseLOVForm.setTxtHidSubmitFirst("true");
oBaseLOVForm.setLevel(-999);
return mapping.findForward("success");
}
if (oBaseLOVForm.getTxtHidAction().equals("SearchRecords")) {
LOVBD oLOVBD = new LOVBD();
LovVO oLovVO = new LovVO();
LovQueryVO oLOVQueryVO = new LovQueryVO();
StringTokenizer stParameters = new StringTokenizer(oBaseLOVForm.getQueryParam(), ",");
while (stParameters.hasMoreTokens()) {
String[] sKeyValuePair = stParameters.nextToken().split("=");
oLOVQueryVO.setProperty(sKeyValuePair[0], sKeyValuePair[1]);
}
oLOVQueryVO.setSearchField1(oBaseLOVForm.getSearchField1());
oLOVQueryVO.setSearchField2(oBaseLOVForm.getSearchField2());
oLOVQueryVO.setLevel(oBaseLOVForm.getLevel());
int iLevel = oBaseLOVForm.getLevel();
int iFinalLevel = oBaseLOVForm.getFinalLevel();
int iInitialLevel = oBaseLOVForm.getInitialLevel();
oLOVQueryVO.setFinalLevel(iFinalLevel);
oLovVO = oLOVBD.getLOVData(oLOVInfo, oLOVQueryVO);
if (oLovVO.getDetailList().size() > 0) {
BeanUtils.copyProperties(oBaseLOVForm, oLovVO);
oBaseLOVForm.setTxtHidTotRows(oLovVO.getDetailList().size());
oBaseLOVForm.setTxtHidTotCols(oLovVO.getHeaderList().size());
} else {
oBaseLOVForm.setTxtHidTotRows(0);
oBaseLOVForm.setTxtHidTotCols(-1);
}
oBaseLOVForm.setTxtHidSubmitFirst("false");
if (oLOVQueryVO.getLevel() == -999) {
oBaseLOVForm.setLevel(oLovVO.getInitialLevel());
oBaseLOVForm.setFinalLevel(oLovVO.getFinalLevel());
oBaseLOVForm.setInitialLevel(oLovVO.getInitialLevel());
} else {
oBaseLOVForm.setLevel(iLevel);
oBaseLOVForm.setFinalLevel(iFinalLevel);
oBaseLOVForm.setInitialLevel(iInitialLevel);
}
oBaseLOVForm.setInsertFlag(oLOVInfo.getInsertFlag());
}
return null;
}
}

View File

@@ -0,0 +1,43 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
public class LogOutAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
Cookie cookieEmpId = null;
Cookie cookieSiteId = null;
String target = "success";
String sEmpId = null;
String sSiteId = null;
cookieEmpId = new Cookie("EmpId", sEmpId);
cookieSiteId = new Cookie("SiteId", sSiteId);
setCookieAttributes(cookieEmpId, false);
setCookieAttributes(cookieSiteId, false);
response.addCookie(cookieEmpId);
response.addCookie(cookieSiteId);
System.out.println("The cookie has been created");
HttpSession session = request.getSession();
session.setAttribute("status", "LOGOUT");
return mapping.findForward("success");
}
private void setCookieAttributes(Cookie c, boolean bValid) {
c.setPath("/");
if (bValid) {
c.setMaxAge(1800);
} else {
c.setMaxAge(0);
}
}
}

View File

@@ -0,0 +1,66 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class NewModeAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged())
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
String sComponentName = getComponentName(sFormName);
UserSession oUser = getUserSessionBean(request);
checkAccessInfo(oUser, sComponentName, oBaseForm.getScreenMode(), "", 10, oBaseForm.getWorkListId());
changeMode(oBaseForm, request);
oBaseForm.setQueried(false);
oBaseForm.setScreenMode("N");
enableAll(oBaseForm);
enableDisable(oBaseForm, insertClicked(), "D");
SecurityBD oSecBD = new SecurityBD();
HashMap oMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "HEADER", oBaseForm.getScreenMode(), "N");
if (null != oMap)
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
BaseBD oBaseBD = getHeaderBusinessDelegate(form, request);
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(10);
Map oBDMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oBDMap != null) {
if (oBDMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oBDMap.get("D"), "D");
if (oBDMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oBDMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 10);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,82 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.utility.ParamUtil;
public class QueryModeAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
if (oBaseForm.isHeaderDataChanged() || oBaseForm.isDetailDataChanged())
throw new EnrgiseApplicationException("wenrgise.common.datashouldbesaved", "M");
changeMode(oBaseForm, request);
oBaseForm.setQueried(true);
oBaseForm.setScreenMode("Q");
BaseBD oBaseBD = getHeaderBusinessDelegate((ActionForm)oBaseForm, request);
setComboValues(oBaseBD.getComboDetails(), request.getSession());
setComboValues(oBaseBD.getDetailComboDetails(), request.getSession());
enableAll(oBaseForm);
enableDisable(oBaseForm, queryClicked(), "D");
SecurityBD oSecBD = new SecurityBD();
HashMap oMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "HEADER", oBaseForm.getScreenMode(), null);
if (null != oMap)
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(10);
Map oBDMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oBDMap != null) {
if (oBDMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oBDMap.get("D"), "D");
if (oBDMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oBDMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 10);
return mapping.findForward("success");
}
private void setComboValues(HashMap oComboMap, HttpSession session) {
if (null == oComboMap)
return;
if (oComboMap.size() <= 0)
return;
Set oKeySet = oComboMap.keySet();
Iterator oIt = oKeySet.iterator();
while (oIt.hasNext()) {
String sKey = oIt.next();
session.setAttribute(sKey, oComboMap.get(sKey));
}
oKeySet.clear();
oComboMap.clear();
}
}

View File

@@ -0,0 +1,111 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class RefreshAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
UserSession oUser = getUserSessionBean(request);
BaseBD oBaseBD = getDetailBusinessDelegate(form, request);
BaseDetailVO oBaseDetailVO = null;
oBaseForm.setHeaderDataChanged(false);
oBaseForm.setDetailDataChanged(false);
String sScreenMode = oBaseForm.getScreenMode();
oBaseForm.setUserPositionRequested(null);
oBaseForm.setUserPageRequested(null);
if (sScreenMode.equals("N") || sScreenMode.equals("Q")) {
changeMode(oBaseForm, request);
oBaseForm.setScreenMode(sScreenMode);
} else {
BaseQueryVO oBaseQueryVO = null;
BaseHeaderVO oBaseHeaderVO = null;
if (oBaseForm.isQueried()) {
oBaseQueryVO = oUser.getBaseQueryVO(sFormName);
if (oBaseQueryVO != null) {
BeanUtils.copyProperties(oBaseQueryVO, form);
oBaseQueryVO.setHeaderPrimaryKey(null);
oBaseHeaderVO = oBaseBD.getNextHeaderRecord(oBaseQueryVO, oBaseForm.getPositionRequested(), sFormName, false, oUser);
int iRelativePosition = (int)(oBaseHeaderVO.getPositionRequested() - oBaseHeaderVO.getHeaderStartPosition() + 1L);
BeanUtils.copyProperties(form, oBaseHeaderVO.getHeaderRecord(iRelativePosition));
BeanUtils.copyProperties(form, oBaseHeaderVO);
}
} else {
oBaseQueryVO = getQueryVO(form);
BeanUtils.copyProperties(oBaseQueryVO, form);
if (oBaseForm.getHeaderPrimaryKey() != null) {
oBaseQueryVO.setHeaderPrimaryKey(oBaseForm.getHeaderPrimaryKey());
oBaseHeaderVO = oBaseBD.getHeaderRecord(oBaseQueryVO, sFormName, oUser);
BeanUtils.copyProperties(form, oBaseHeaderVO.getHeaderRecord(1));
BeanUtils.copyProperties(form, oBaseHeaderVO);
}
}
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
if (null != oBaseDetailVO) {
oBaseDetailVO = getDetailData(oBaseForm, sFormName, sScreenName, 1L, request, oBaseBD, false, oUser);
if (oBaseDetailVO.getOThisPageData() != null) {
oBaseForm.setThisPageDetailCount(oBaseDetailVO.getOThisPageData().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oBaseDetailVO.getOThisPageData());
} else {
oBaseForm.setThisPageDetailCount(0);
}
long totDetRecord = oBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, sScreenName, totDetRecord));
controlDetailNavigation(oBaseForm);
}
}
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "ALL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap)
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
BaseHeaderBean oThisBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oThisBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oThisBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(19);
oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oDetailList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 19);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,132 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class SaveAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
BaseBD oBaseBD = getHeaderBusinessDelegate(form, request);
UserSession oUser = getUserSessionBean(request);
String sComponentName = getComponentName(sFormName);
String wlId = oBaseForm.getWorkListId();
checkAccessInfo(oUser, sComponentName, oBaseForm.getScreenMode(), "", 8, oBaseForm.getWorkListId());
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
ArrayList oDetailBeanArray = null;
BaseDetailVO oBaseDetailVO = null;
BaseHeaderVO oBaseHeaderVO = null;
Timestamp oHeaderPicked = null;
Timestamp oDetailPicked = null;
if (!oBaseForm.isDetailDataChanged() && !oBaseForm.isHeaderDataChanged())
return mapping.findForward("success");
BeanUtils.copyProperties(oBaseHeaderBean, form);
if (oBaseForm.getScreenMode().equals("N")) {
oHeaderPicked = null;
} else {
if (oBaseForm.isHeaderDataChanged()) {
oBaseHeaderVO = oUser.getBaseHeaderVO(sFormName);
if (oBaseHeaderVO != null) {
oHeaderPicked = oBaseHeaderVO.getOWhenPicked();
oBaseHeaderBean = getBaseHeaderBean(sFormName);
}
BeanUtils.copyProperties(oBaseHeaderBean, form);
}
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
if (oBaseDetailVO != null)
oDetailPicked = oBaseDetailVO.getOWhenPicked();
if (oBaseForm.isDetailDataChanged())
oDetailBeanArray = getDetailArray(oBaseForm);
}
String sHeaderPrimaryKey = oBaseBD.saveRecord(oBaseHeaderBean, oHeaderPicked, oBaseForm.getScreenName(), oBaseForm.getScreenMode(), oBaseForm.isHeaderDataChanged(), oDetailBeanArray, oBaseForm.isDetailDataChanged(), oDetailPicked);
oBaseForm.setHeaderDataChanged(false);
oBaseForm.setDetailDataChanged(false);
oBaseForm.setHeaderPrimaryKey(sHeaderPrimaryKey);
BaseQueryVO oBaseQueryVO = getQueryVO(form);
BeanUtils.copyProperties(oBaseQueryVO, form);
oBaseQueryVO.setHeaderPrimaryKey(sHeaderPrimaryKey);
oBaseQueryVO.setMaxHeaderSize(ParamUtil.getHeaderSize(sFormName));
oBaseHeaderVO = oBaseBD.getHeaderRecord(oBaseQueryVO, sFormName, oUser);
BeanUtils.copyProperties(form, oBaseHeaderVO.getHeaderRecord(1));
BeanUtils.copyProperties(form, oBaseHeaderVO);
oUser.putBaseHeaderVO(sFormName, oBaseHeaderVO);
if (!oBaseForm.getScreenMode().equals("N"))
if (null != oBaseDetailVO) {
if (oBaseDetailVO.getTotalDetailRecord() + oBaseDetailVO.getRowAdded() - oBaseDetailVO.getRowDeleted() >= 0L) {
oBaseDetailVO.setRowDeleted(0);
oBaseDetailVO.setRowAdded(0);
oBaseDetailVO = getDetailData(oBaseForm, sFormName, sScreenName, 1L, request, oBaseBD, true, oUser);
oBaseForm.setPageRequested(1L);
long totDetRecord = oBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, sScreenName, totDetRecord));
if (oBaseDetailVO.getOThisPageData() != null) {
oBaseForm.setThisPageDetailCount(oBaseDetailVO.getOThisPageData().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oBaseDetailVO.getOThisPageData());
} else {
oBaseForm.setThisPageDetailCount(0);
}
checkDetailNavigation(oBaseForm, oUser.getBaseDetailVO(sFormName, sScreenName));
BeanUtils.copyProperties(oBaseForm, oBaseDetailVO);
}
oUser.putBaseDetailVO(sFormName, sScreenName, oBaseDetailVO);
}
oBaseForm.setScreenMode("U");
enableAll(oBaseForm);
enableDisable(oBaseForm, saveClicked(), "D");
controlHeaderNavigation(oBaseForm);
controlDetailNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "ALL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap)
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
BaseHeaderBean oThisBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oThisBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oThisBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(8);
oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oDetailList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 8);
throw new EnrgiseApplicationException("wenrgise.common.datasaved", "M");
}
}

View File

@@ -0,0 +1,110 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.businessdelegate.SecurityBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.DetailSizeValues;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.utility.ParamUtil;
public class SaveDetailAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
BaseBD oBaseBD = getDetailBusinessDelegate(form, request);
UserSession oUser = getUserSessionBean(request);
String sComponentName = getComponentName(sFormName);
checkAccessInfo(oUser, sComponentName, oBaseForm.getScreenMode(), "", 8, oBaseForm.getWorkListId());
ArrayList oDetailBeanArray = null;
BaseDetailVO oBaseDetailVO = null;
Timestamp oDetailPicked = null;
if (!oBaseForm.isDetailDataChanged())
return mapping.findForward("success");
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, sScreenName);
if (oBaseDetailVO != null)
oDetailPicked = oBaseDetailVO.getOWhenPicked();
oDetailBeanArray = getDetailArray(oBaseForm);
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
String sHeaderPrimaryKey = oBaseBD.saveRecord(oBaseHeaderBean, null, oBaseForm.getScreenName(), oBaseForm.getScreenMode(), false, oDetailBeanArray, true, oDetailPicked);
oBaseForm.setDetailDataChanged(false);
if (null != oBaseDetailVO) {
oBaseDetailVO.setRowDeleted(0);
oBaseDetailVO.setRowAdded(0);
}
BaseQueryVO oBaseQueryVO = null;
DetailSizeValues oDetailSizeValues = new DetailSizeValues();
oDetailSizeValues.setDetailRecordPerPage(ParamUtil.getDetailRecordPerPage(sFormName, sScreenName));
oDetailSizeValues.setMaxPages(ParamUtil.getMaxDetailPages(sFormName, sScreenName));
oBaseDetailVO = getDetailData(oBaseForm, sFormName, sScreenName, 1L, request, oBaseBD, true, oUser);
oBaseForm.setPageRequested(1L);
oBaseDetailVO.setRowAdded(0);
oBaseDetailVO.setRowDeleted(0);
if (oBaseDetailVO.getOThisPageData() != null) {
oBaseForm.setThisPageDetailCount(oBaseDetailVO.getOThisPageData().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oBaseDetailVO.getOThisPageData());
} else {
oBaseForm.setThisPageDetailCount(0);
}
if (oBaseDetailVO != null) {
long totDetRecord = oBaseDetailVO.getTotalDetailRecord();
oBaseForm.setTotalPageCount(calculateTotalDetailPage(sFormName, sScreenName, totDetRecord));
}
BeanUtils.copyProperties(oBaseForm, oBaseDetailVO);
oUser.putBaseDetailVO(sFormName, sScreenName, oBaseDetailVO);
oBaseForm.setScreenMode("U");
enableAll(oBaseForm);
enableDisable(oBaseForm, saveClicked(), "D");
controlHeaderNavigation(oBaseForm);
controlDetailNavigation(oBaseForm);
SecurityBD oSecBD = new SecurityBD();
Map oSecMap = oSecBD.getDisabledFields(String.valueOf(oBaseForm.getScreenName()).concat(String.valueOf(".jsp")), "ALL", oBaseForm.getScreenMode(), oBaseForm.getHeaderStatus());
if (null != oSecMap)
enableDisable(oBaseForm, (ArrayList)oSecMap.get("D"), "D");
BaseHeaderBean oThisBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oThisBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oThisBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(8);
oBaseDetailVO = null;
oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oDetailList = (oBaseDetailVO.getOThisPageData() != null) ? oBaseDetailVO.getOThisPageData() : new ArrayList();
oThisPageVO.setODetailList(oDetailList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
if (oThisPageVO.getODetailList() != null) {
oBaseForm.setThisPageDetailCount(oThisPageVO.getODetailList().size());
BeanUtils.setProperty(oBaseForm, ParamUtil.getDetailArrayName(sFormName, sScreenName), oThisPageVO.getODetailList());
}
onLoad(form, request, 8);
throw new EnrgiseApplicationException("wenrgise.common.datasaved", "M");
}
}

View File

@@ -0,0 +1,52 @@
package wenrgise.common.webtier.action;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.businessdelegate.BaseBD;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.common.webtier.form.BaseForm;
import wenrgise.ejb.common.session.UserSession;
public class ValidateAction extends BaseAction {
public ActionForward executeImpl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws EnrgiseApplicationException, EnrgiseSystemException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException, ServletException, IOException {
BaseForm oBaseForm = (BaseForm)form;
String sFormName = form.getClass().getName();
String sScreenName = oBaseForm.getScreenName();
BaseBD oBaseBD = getHeaderBusinessDelegate(form, request);
BaseHeaderBean oBaseHeaderBean = getBaseHeaderBean(sFormName);
BeanUtils.copyProperties(oBaseHeaderBean, form);
ThisPageVO oThisPageVO = new ThisPageVO();
oThisPageVO.setOHeaderBean(oBaseHeaderBean);
oThisPageVO.setScreenMode(oBaseForm.getScreenMode());
oThisPageVO.setScreenName(oBaseForm.getScreenName());
oThisPageVO.setActionName(21);
UserSession oUser = getUserSessionBean(request);
BaseDetailVO oBaseDetailVO = oUser.getBaseDetailVO(sFormName, oBaseForm.getScreenName());
if (null != oBaseDetailVO) {
ArrayList oDetailList = getDetailArray(oBaseForm);
oThisPageVO.setODetailList(oDetailList);
}
Map oMap = oBaseBD.getDisabledFields(oThisPageVO);
if (oMap != null) {
if (oMap.containsKey("D"))
enableDisable(oBaseForm, (ArrayList)oMap.get("D"), "D");
if (oMap.containsKey("E"))
enableDisable(oBaseForm, (ArrayList)oMap.get("E"), "E");
}
onLoad(form, request, 21);
return mapping.findForward("success");
}
}

View File

@@ -0,0 +1,767 @@
package wenrgise.common.webtier.form;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class BaseForm extends ActionForm {
private long totalHeaderRecord = 0L;
private long totalDetailRecord = 0L;
private ArrayList detailList = null;
private String headerPrimaryKey = null;
private long pageRequested = 0L;
private String userPageRequested = null;
private String[] detailId = null;
private String[] status = null;
private String screenName = null;
private boolean headerDataChanged = false;
private boolean detailDataChanged = false;
private int detailStartPage = 0;
private String screenMode = "Q";
private String forwardedPage = null;
private boolean[] checked = null;
private long positionRequested = 0L;
private String userPositionRequested = null;
private long totalCount = 0L;
private String newPositionRequested = null;
private String[] itemChecked = null;
private String newPageRequested = null;
private String lovKey;
private String txtSearchFields;
private String txtDisplayFields;
private String txtIndex;
private int thisPageDetailCount = 0;
private boolean queried = true;
String butQuery;
String butInsert;
String disabbutInsert;
String butExecute;
String disabbutExecute;
String butSave;
String disabbutSave;
String butDelete;
String disabbutDelete;
String butRefresh;
String disabbutRefresh;
String butHelp;
String disabbutHelp;
String butPrint;
String disabbutPrint;
String butNextHeader;
String disabbutNextHeader;
String butPrevHeader;
String disabbutPrevHeader;
String butGetDetail;
String disabbutGetDetail;
String butJumpHeader;
String disabbutJumpHeader;
String butJumpDetail;
String disabbutJumpDetail;
private String butExit;
private String disabbutExit;
private String disabheaderStatus;
private String disabbutQuery;
private String butNextDetail;
String butPrevDetail;
private String disabbutPrevDetail;
private String disabbutNextDetail;
private String disabnewPageRequested;
private String disabnewPositionRequested;
private String butAddRow;
private String butDelRow;
private String disabbutAddRow;
private String disabbutDelRow;
private long totalPageCount;
private String headerStatus;
private String buttonClicked;
private String buttonName;
protected String firstLoad;
private String confirmKey;
private String buttonKeys;
private String workListId;
private String hidWorkListId;
public void reset(ActionMapping mapping, HttpServletRequest request) {
super.reset(mapping, request);
}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
return super.validate(mapping, request);
}
public long getTotalDetailRecord() {
return this.totalDetailRecord;
}
public void setTotalDetailRecord(long newTotalDetailRecord) {
this.totalDetailRecord = newTotalDetailRecord;
}
public long getTotalHeaderRecord() {
return this.totalHeaderRecord;
}
public void setTotalHeaderRecord(long newTotalHeaderRecord) {
this.totalHeaderRecord = newTotalHeaderRecord;
}
public ArrayList getDetailList() {
return this.detailList;
}
public void setDetailList(ArrayList newDetailList) {
this.detailList = newDetailList;
}
public String getHeaderPrimaryKey() {
return this.headerPrimaryKey;
}
public void setHeaderPrimaryKey(String newHeaderPrimaryKey) {
this.headerPrimaryKey = newHeaderPrimaryKey;
}
public long getPageRequested() {
return this.pageRequested;
}
public void setPageRequested(long newPageRequested) {
this.pageRequested = newPageRequested;
}
public String[] getStatus() {
return this.status;
}
public void setStatus(String[] newStatus) {
this.status = newStatus;
}
public String[] getDetailId() {
return this.detailId;
}
public void setDetailId(String[] newDetailId) {
this.detailId = newDetailId;
}
public String getScreenName() {
return this.screenName;
}
public void setScreenName(String newScreenName) {
this.screenName = newScreenName;
}
public boolean isHeaderDataChanged() {
return this.headerDataChanged;
}
public void setHeaderDataChanged(boolean newHeaderDataChanged) {
this.headerDataChanged = newHeaderDataChanged;
}
public boolean isDetailDataChanged() {
return this.detailDataChanged;
}
public void setDetailDataChanged(boolean newDetailDataChanged) {
this.detailDataChanged = newDetailDataChanged;
}
public int getDetailStartPage() {
return this.detailStartPage;
}
public void setDetailStartPage(int newDetailStartPage) {
this.detailStartPage = newDetailStartPage;
}
public String getScreenMode() {
return this.screenMode;
}
public void setScreenMode(String newScreenMode) {
this.screenMode = newScreenMode;
}
public String getForwardedPage() {
return this.forwardedPage;
}
public void setForwardedPage(String newForwardedPage) {
this.forwardedPage = newForwardedPage;
}
public boolean[] getChecked() {
return this.checked;
}
public void setChecked(boolean[] newChecked) {
this.checked = newChecked;
}
public long getPositionRequested() {
return this.positionRequested;
}
public void setPositionRequested(long newPositionRequested) {
this.positionRequested = newPositionRequested;
}
public long getTotalCount() {
return this.totalCount;
}
public void setTotalCount(long newTotalCount) {
this.totalCount = newTotalCount;
}
public String getNewPositionRequested() {
return this.newPositionRequested;
}
public void setNewPositionRequested(String newNewPositionRequested) {
this.newPositionRequested = newNewPositionRequested;
}
public String[] getItemChecked() {
return this.itemChecked;
}
public void setItemChecked(String[] newItemChecked) {
this.itemChecked = newItemChecked;
}
public String getLovKey() {
return this.lovKey;
}
public void setLovKey(String newLovKey) {
this.lovKey = newLovKey;
}
public String getTxtIndex() {
return this.txtIndex;
}
public void setTxtIndex(String newTxtIndex) {
this.txtIndex = newTxtIndex;
}
public String getNewPageRequested() {
return this.newPageRequested;
}
public void setNewPageRequested(String newNewPageRequested) {
this.newPageRequested = newNewPageRequested;
}
public String getUserPageRequested() {
return this.userPageRequested;
}
public void setUserPageRequested(String newUserPageRequested) {
this.userPageRequested = newUserPageRequested;
}
public String getUserPositionRequested() {
return this.userPositionRequested;
}
public void setUserPositionRequested(String newUserPositionRequested) {
this.userPositionRequested = newUserPositionRequested;
}
public int getThisPageDetailCount() {
return this.thisPageDetailCount;
}
public void setThisPageDetailCount(int newThisPageDetailCount) {
this.thisPageDetailCount = newThisPageDetailCount;
}
public String getTxtDisplayFields() {
return this.txtDisplayFields;
}
public void setTxtDisplayFields(String newTxtDisplayFields) {
this.txtDisplayFields = newTxtDisplayFields;
}
public String getTxtSearchFields() {
return this.txtSearchFields;
}
public void setTxtSearchFields(String newTxtSearchFields) {
this.txtSearchFields = newTxtSearchFields;
}
public long getTotalPageCount() {
return this.totalPageCount;
}
public void setTotalPageCount(long newTotalPageCount) {
this.totalPageCount = newTotalPageCount;
}
public String getHeaderStatus() {
return this.headerStatus;
}
public void setHeaderStatus(String newHeaderStatus) {
this.headerStatus = newHeaderStatus;
}
public String getButQuery() {
return this.butQuery;
}
public void setButQuery(String newButQuery) {
this.butQuery = newButQuery;
}
public String getButInsert() {
return this.butInsert;
}
public void setButInsert(String newButInsert) {
this.butInsert = newButInsert;
}
public String getDisabbutInsert() {
return this.disabbutInsert;
}
public void setDisabbutInsert(String newDisabbutInsert) {
this.disabbutInsert = newDisabbutInsert;
}
public String getButExecute() {
return this.butExecute;
}
public void setButExecute(String newButExecute) {
this.butExecute = newButExecute;
}
public String getDisabbutExecute() {
return this.disabbutExecute;
}
public void setDisabbutExecute(String newDisabbutExecute) {
this.disabbutExecute = newDisabbutExecute;
}
public String getButSave() {
return this.butSave;
}
public void setButSave(String newButSave) {
this.butSave = newButSave;
}
public String getDisabbutSave() {
return this.disabbutSave;
}
public void setDisabbutSave(String newDisabbutSave) {
this.disabbutSave = newDisabbutSave;
}
public String getButDelete() {
return this.butDelete;
}
public void setButDelete(String newButDelete) {
this.butDelete = newButDelete;
}
public String getDisabbutDelete() {
return this.disabbutDelete;
}
public void setDisabbutDelete(String newDisabbutDelete) {
this.disabbutDelete = newDisabbutDelete;
}
public String getButRefresh() {
return this.butRefresh;
}
public void setButRefresh(String newButRefresh) {
this.butRefresh = newButRefresh;
}
public String getDisabbutRefresh() {
return this.disabbutRefresh;
}
public void setDisabbutRefresh(String newDisabbutRefresh) {
this.disabbutRefresh = newDisabbutRefresh;
}
public String getButHelp() {
return this.butHelp;
}
public void setButHelp(String newButHelp) {
this.butHelp = newButHelp;
}
public String getDisabbutHelp() {
return this.disabbutHelp;
}
public void setDisabbutHelp(String newDisabbutHelp) {
this.disabbutHelp = newDisabbutHelp;
}
public String getButPrint() {
return this.butPrint;
}
public void setButPrint(String newButPrint) {
this.butPrint = newButPrint;
}
public String getDisabbutPrint() {
return this.disabbutPrint;
}
public void setDisabbutPrint(String newDisabbutPrint) {
this.disabbutPrint = newDisabbutPrint;
}
public String getButNextHeader() {
return this.butNextHeader;
}
public void setButNextHeader(String newButNextHeader) {
this.butNextHeader = newButNextHeader;
}
public String getDisabbutNextHeader() {
return this.disabbutNextHeader;
}
public void setDisabbutNextHeader(String newDisabbutNextHeader) {
this.disabbutNextHeader = newDisabbutNextHeader;
}
public String getButPrevHeader() {
return this.butPrevHeader;
}
public void setButPrevHeader(String newButPrevHeader) {
this.butPrevHeader = newButPrevHeader;
}
public String getDisabbutPrevHeader() {
return this.disabbutPrevHeader;
}
public void setDisabbutPrevHeader(String newDisabbutPrevHeader) {
this.disabbutPrevHeader = newDisabbutPrevHeader;
}
public String getButGetDetail() {
return this.butGetDetail;
}
public void setButGetDetail(String newButGetDetail) {
this.butGetDetail = newButGetDetail;
}
public String getDisabbutGetDetail() {
return this.disabbutGetDetail;
}
public void setDisabbutGetDetail(String newDisabbutGetDetail) {
this.disabbutGetDetail = newDisabbutGetDetail;
}
public String getButJumpHeader() {
return this.butJumpHeader;
}
public void setButJumpHeader(String newButJumpHeader) {
this.butJumpHeader = newButJumpHeader;
}
public String getDisabbutJumpHeader() {
return this.disabbutJumpHeader;
}
public void setDisabbutJumpHeader(String newDisabbutJumpHeader) {
this.disabbutJumpHeader = newDisabbutJumpHeader;
}
public String getButJumpDetail() {
return this.butJumpDetail;
}
public void setButJumpDetail(String newButJumpDetail) {
this.butJumpDetail = newButJumpDetail;
}
public String getDisabbutJumpDetail() {
return this.disabbutJumpDetail;
}
public void setDisabbutJumpDetail(String newDisabbutJumpDetail) {
this.disabbutJumpDetail = newDisabbutJumpDetail;
}
public String getButExit() {
return this.butExit;
}
public void setButExit(String newButExit) {
this.butExit = newButExit;
}
public String getDisabbutExit() {
return this.disabbutExit;
}
public void setDisabbutExit(String newDisabbutExit) {
this.disabbutExit = newDisabbutExit;
}
public String getDisabheaderStatus() {
return this.disabheaderStatus;
}
public void setDisabheaderStatus(String newDisabheaderStatus) {
this.disabheaderStatus = newDisabheaderStatus;
}
public String getDisabbutQuery() {
return this.disabbutQuery;
}
public void setDisabbutQuery(String newDisabbutQuery) {
this.disabbutQuery = newDisabbutQuery;
}
public String getButNextDetail() {
return this.butNextDetail;
}
public void setButNextDetail(String newButNextDetail) {
this.butNextDetail = newButNextDetail;
}
public String getButPrevDetail() {
return this.butPrevDetail;
}
public void setButPrevDetail(String newButPrevDetail) {
this.butPrevDetail = newButPrevDetail;
}
public String getDisabbutPrevDetail() {
return this.disabbutPrevDetail;
}
public void setDisabbutPrevDetail(String newDisabbutPrevDetail) {
this.disabbutPrevDetail = newDisabbutPrevDetail;
}
public String getDisabbutNextDetail() {
return this.disabbutNextDetail;
}
public void setDisabbutNextDetail(String newDisabbutNextDetail) {
this.disabbutNextDetail = newDisabbutNextDetail;
}
public String getDisabnewPageRequested() {
return this.disabnewPageRequested;
}
public void setDisabnewPageRequested(String newDisabnewPageRequested) {
this.disabnewPageRequested = newDisabnewPageRequested;
}
public String getDisabnewPositionRequested() {
return this.disabnewPositionRequested;
}
public void setDisabnewPositionRequested(String newDisabnewPositionRequested) {
this.disabnewPositionRequested = newDisabnewPositionRequested;
}
public String getButAddRow() {
return this.butAddRow;
}
public void setButAddRow(String newButAddRow) {
this.butAddRow = newButAddRow;
}
public String getButDelRow() {
return this.butDelRow;
}
public void setButDelRow(String newButDelRow) {
this.butDelRow = newButDelRow;
}
public String getDisabbutAddRow() {
return this.disabbutAddRow;
}
public void setDisabbutAddRow(String newDisabbutAddRow) {
this.disabbutAddRow = newDisabbutAddRow;
}
public String getDisabbutDelRow() {
return this.disabbutDelRow;
}
public void setDisabbutDelRow(String newDisabbutDelRow) {
this.disabbutDelRow = newDisabbutDelRow;
}
public String getButtonClicked() {
return this.buttonClicked;
}
public void setButtonClicked(String newButtonClicked) {
this.buttonClicked = newButtonClicked;
}
public String getButtonName() {
return this.buttonName;
}
public void setButtonName(String newButtonName) {
this.buttonName = newButtonName;
}
public boolean isQueried() {
return this.queried;
}
public void setQueried(boolean newQueried) {
this.queried = newQueried;
}
public String getFirstLoad() {
return this.firstLoad;
}
public void setFirstLoad(String newFirstLoad) {
this.firstLoad = newFirstLoad;
}
public String getConfirmKey() {
return this.confirmKey;
}
public void setConfirmKey(String newConfirmKey) {
this.confirmKey = newConfirmKey;
}
public String getButtonKeys() {
return this.buttonKeys;
}
public void setButtonKeys(String newButtonKeys) {
this.buttonKeys = newButtonKeys;
}
public String getWorkListId() {
return this.hidWorkListId;
}
public void setWorkListId(String newWorkListId) {
this.workListId = newWorkListId;
}
public String getHidWorkListId() {
return this.hidWorkListId;
}
public void setHidWorkListId(String newHidWorkListId) {
this.hidWorkListId = newHidWorkListId;
}
}

View File

@@ -0,0 +1,533 @@
package wenrgise.common.webtier.form;
import java.util.ArrayList;
public class BaseLOVForm extends BaseForm {
private String[] detailField1;
private String[] detailField2;
private String[] detailField3;
private String[] detailField4;
private String[] detailField5;
private String[] detailField6;
private String[] detailField7;
private String[] detailField8;
private String[] detailField9;
private String[] detailField10;
private String[] detailField11;
private String[] detailField12;
private String[] detailField13;
private String[] detailField14;
private String[] detailField15;
private String[] detailField16;
private String[] detailField17;
private String[] detailField18;
private String[] detailField19;
private String[] detailField20;
private String selRadio;
private ArrayList detailList;
private String userAction;
private String txtHidSubmitFirst;
private String txtHidAction = "FirstTime";
private String txtHidSelectedValue;
private int txtHidTotRows;
private int txtHidTotCols;
private String searchField1;
private String searchField2;
private String insertFlag;
private String searchFieldName1;
private String searchFieldName2;
private String multipleFlag;
private String queryParam;
private ArrayList headerList;
private ArrayList visibilityList;
private String recursiveFlag;
private int level;
private int finalLevel;
private int initialLevel;
private String searchField3;
private String searchField4;
private String searchField5;
private String searchField6;
private String searchFieldName3;
private String searchFieldName4;
private String searchFieldName5;
private String searchFieldName6;
public ArrayList getDetailList() {
return this.detailList;
}
public void setDetailList(ArrayList newDetailList) {
this.detailList = newDetailList;
}
public String getSelRadio() {
return this.selRadio;
}
public void setSelRadio(String newSelRadio) {
this.selRadio = newSelRadio;
}
public String getUserAction() {
return this.userAction;
}
public void setUserAction(String newUserAction) {
this.userAction = newUserAction;
}
public String getTxtHidAction() {
return this.txtHidAction;
}
public void setTxtHidAction(String newTxtHidAction) {
this.txtHidAction = newTxtHidAction;
}
public String getTxtHidSelectedValue() {
return this.txtHidSelectedValue;
}
public void setTxtHidSelectedValue(String newTxtHidSelectedValue) {
this.txtHidSelectedValue = newTxtHidSelectedValue;
}
public String getTxtHidSubmitFirst() {
return this.txtHidSubmitFirst;
}
public void setTxtHidSubmitFirst(String newTxtHidSubmitFirst) {
this.txtHidSubmitFirst = newTxtHidSubmitFirst;
}
public String getSearchField1() {
return this.searchField1;
}
public void setSearchField1(String newSearchField1) {
this.searchField1 = newSearchField1;
}
public int getTxtHidTotRows() {
return this.txtHidTotRows;
}
public void setTxtHidTotRows(int newTxtHidTotRows) {
this.txtHidTotRows = newTxtHidTotRows;
}
public void onLoadReset() {
this.searchField1 = "";
this.searchField2 = "";
this.searchField3 = "";
this.searchField4 = "";
this.searchField5 = "";
this.searchField6 = "";
this.selRadio = "";
this.detailField1 = null;
this.detailField2 = null;
this.detailField3 = null;
this.detailField4 = null;
this.detailField5 = null;
this.detailField6 = null;
this.detailField7 = null;
this.detailField8 = null;
this.detailField9 = null;
this.detailField10 = null;
this.detailField11 = null;
this.detailField12 = null;
this.detailField13 = null;
this.detailField14 = null;
this.detailField15 = null;
this.detailField16 = null;
this.detailField17 = null;
this.detailField18 = null;
this.detailField19 = null;
this.detailField20 = null;
this.txtHidTotRows = -1;
this.txtHidTotCols = -1;
this.headerList.clear();
this.detailList.clear();
}
public String[] getDetailField4() {
return this.detailField4;
}
public void setDetailField4(String[] newDetailField4) {
this.detailField4 = newDetailField4;
}
public String[] getDetailField5() {
return this.detailField5;
}
public void setDetailField5(String[] newDetailField5) {
this.detailField5 = newDetailField5;
}
public String[] getDetailField6() {
return this.detailField6;
}
public void setDetailField6(String[] newDetailField6) {
this.detailField6 = newDetailField6;
}
public String[] getDetailField7() {
return this.detailField7;
}
public void setDetailField7(String[] newDetailField7) {
this.detailField7 = newDetailField7;
}
public String[] getDetailField8() {
return this.detailField8;
}
public void setDetailField8(String[] newDetailField8) {
this.detailField8 = newDetailField8;
}
public String[] getDetailField9() {
return this.detailField9;
}
public void setDetailField9(String[] newDetailField9) {
this.detailField9 = newDetailField9;
}
public String[] getDetailField10() {
return this.detailField10;
}
public void setDetailField10(String[] newDetailField10) {
this.detailField10 = newDetailField10;
}
public String getSearchField2() {
return this.searchField2;
}
public void setSearchField2(String newSearchField2) {
this.searchField2 = newSearchField2;
}
public String[] getDetailField1() {
return this.detailField1;
}
public void setDetailField1(String[] newDetailField1) {
this.detailField1 = newDetailField1;
}
public String[] getDetailField2() {
return this.detailField2;
}
public void setDetailField2(String[] newDetailField2) {
this.detailField2 = newDetailField2;
}
public String[] getDetailField3() {
return this.detailField3;
}
public void setDetailField3(String[] newDetailField3) {
this.detailField3 = newDetailField3;
}
public int getTxtHidTotCols() {
return this.txtHidTotCols;
}
public void setTxtHidTotCols(int newTxtHidTotCols) {
this.txtHidTotCols = newTxtHidTotCols;
}
public String getInsertFlag() {
return this.insertFlag;
}
public void setInsertFlag(String newInsertFlag) {
this.insertFlag = newInsertFlag;
}
public String getSearchFieldName1() {
return this.searchFieldName1;
}
public void setSearchFieldName1(String newSearchFieldName1) {
this.searchFieldName1 = newSearchFieldName1;
}
public String getSearchFieldName2() {
return this.searchFieldName2;
}
public void setSearchFieldName2(String newSearchFieldName2) {
this.searchFieldName2 = newSearchFieldName2;
}
public String getMultipleFlag() {
return this.multipleFlag;
}
public void setMultipleFlag(String newMultipleFlag) {
this.multipleFlag = newMultipleFlag;
}
public String getQueryParam() {
return this.queryParam;
}
public void setQueryParam(String newQueryParam) {
this.queryParam = newQueryParam;
}
public ArrayList getHeaderList() {
return this.headerList;
}
public void setHeaderList(ArrayList newHeaderList) {
this.headerList = newHeaderList;
}
public ArrayList getVisibilityList() {
return this.visibilityList;
}
public void setVisibilityList(ArrayList newVisibilityList) {
this.visibilityList = newVisibilityList;
}
public String getVisibility(int iIndex) {
return this.visibilityList.get(iIndex);
}
public String[] getDetailField11() {
return this.detailField11;
}
public void setDetailField11(String[] newDetailField11) {
this.detailField11 = newDetailField11;
}
public String[] getDetailField12() {
return this.detailField12;
}
public void setDetailField12(String[] newDetailField12) {
this.detailField12 = newDetailField12;
}
public String[] getDetailField13() {
return this.detailField13;
}
public void setDetailField13(String[] newDetailField13) {
this.detailField13 = newDetailField13;
}
public String[] getDetailField14() {
return this.detailField14;
}
public void setDetailField14(String[] newDetailField14) {
this.detailField14 = newDetailField14;
}
public String[] getDetailField15() {
return this.detailField15;
}
public void setDetailField15(String[] newDetailField15) {
this.detailField15 = newDetailField15;
}
public String[] getDetailField17() {
return this.detailField17;
}
public void setDetailField17(String[] newDetailField17) {
this.detailField17 = newDetailField17;
}
public String[] getDetailField18() {
return this.detailField18;
}
public void setDetailField18(String[] newDetailField18) {
this.detailField18 = newDetailField18;
}
public String[] getDetailField19() {
return this.detailField19;
}
public void setDetailField19(String[] newDetailField19) {
this.detailField19 = newDetailField19;
}
public String[] getDetailField16() {
return this.detailField16;
}
public void setDetailField16(String[] newDetailField16) {
this.detailField16 = newDetailField16;
}
public String[] getDetailField20() {
return this.detailField20;
}
public void setDetailField20(String[] newDetailField20) {
this.detailField20 = newDetailField20;
}
public String getRecursiveFlag() {
return this.recursiveFlag;
}
public void setRecursiveFlag(String newRecursiveFlag) {
this.recursiveFlag = newRecursiveFlag;
}
public int getLevel() {
return this.level;
}
public void setLevel(int newLevel) {
this.level = newLevel;
}
public int getFinalLevel() {
return this.finalLevel;
}
public void setFinalLevel(int newFinalLevel) {
this.finalLevel = newFinalLevel;
}
public int getInitialLevel() {
return this.initialLevel;
}
public void setInitialLevel(int newInitialLevel) {
this.initialLevel = newInitialLevel;
}
public String getSearchField3() {
return this.searchField3;
}
public void setSearchField3(String newSearchField3) {
this.searchField3 = newSearchField3;
}
public String getSearchField4() {
return this.searchField4;
}
public void setSearchField4(String newSearchField4) {
this.searchField4 = newSearchField4;
}
public String getSearchField5() {
return this.searchField5;
}
public void setSearchField5(String newSearchField5) {
this.searchField5 = newSearchField5;
}
public String getSearchField6() {
return this.searchField6;
}
public void setSearchField6(String newSearchField6) {
this.searchField6 = newSearchField6;
}
public String getSearchFieldName3() {
return this.searchFieldName3;
}
public void setSearchFieldName3(String newSearchFieldName3) {
this.searchFieldName3 = newSearchFieldName3;
}
public String getSearchFieldName4() {
return this.searchFieldName4;
}
public void setSearchFieldName4(String newSearchFieldName4) {
this.searchFieldName4 = newSearchFieldName4;
}
public String getSearchFieldName5() {
return this.searchFieldName5;
}
public void setSearchFieldName5(String newSearchFieldName5) {
this.searchFieldName5 = newSearchFieldName5;
}
public String getSearchFieldName6() {
return this.searchFieldName6;
}
public void setSearchFieldName6(String newSearchFieldName6) {
this.searchFieldName6 = newSearchFieldName6;
}
}

View File

@@ -0,0 +1,72 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
public class DetailScreen implements Serializable {
private String _DetailScreenName;
private String _DetailArrayName;
private String _DetailBD;
private String _DetailBean;
private String _DetailRecordPerPage;
private String _DetailPagesPerSlot;
public DetailScreen() {}
public DetailScreen(String _DetailScreenName, String _DetailArrayName) {
this._DetailScreenName = _DetailScreenName;
this._DetailArrayName = _DetailArrayName;
}
public String get_DetailArrayName() {
return this._DetailArrayName;
}
public void set_DetailArrayName(String new_DetailArrayName) {
this._DetailArrayName = new_DetailArrayName;
}
public String get_DetailScreenName() {
return this._DetailScreenName;
}
public void set_DetailScreenName(String new_DetailScreenName) {
this._DetailScreenName = new_DetailScreenName;
}
public String get_DetailBD() {
return this._DetailBD;
}
public void set_DetailBD(String new_DetailBD) {
this._DetailBD = new_DetailBD;
}
public String get_DetailBean() {
return this._DetailBean;
}
public void set_DetailBean(String new_DetailBean) {
this._DetailBean = new_DetailBean;
}
public String get_DetailRecordPerPage() {
return this._DetailRecordPerPage;
}
public void set_DetailRecordPerPage(String new_DetailRecordPerPage) {
this._DetailRecordPerPage = new_DetailRecordPerPage;
}
public String get_DetailPagesPerSlot() {
return this._DetailPagesPerSlot;
}
public void set_DetailPagesPerSlot(String new_DetailPagesPerSlot) {
this._DetailPagesPerSlot = new_DetailPagesPerSlot;
}
}

View File

@@ -0,0 +1,22 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
import java.util.ArrayList;
public class DetailScreens implements Serializable {
private ArrayList _DetailScreen;
public DetailScreens() {}
public DetailScreens(ArrayList _DetailScreen) {
this._DetailScreen = _DetailScreen;
}
public ArrayList get_DetailScreen() {
return this._DetailScreen;
}
public void set_DetailScreen(ArrayList new_DetailScreen) {
this._DetailScreen = new_DetailScreen;
}
}

View File

@@ -0,0 +1,33 @@
package wenrgise.common.xml.vo;
public class EnrgiseApp {
private String _DBName;
private String _WebApp;
private String _Module;
public String get_DBName() {
return this._DBName;
}
public void set_DBName(String new_DBName) {
this._DBName = new_DBName;
}
public String get_WebApp() {
return this._WebApp;
}
public void set_WebApp(String new_WebApp) {
this._WebApp = new_WebApp;
}
public String get_Module() {
return this._Module;
}
public void set_Module(String new_Module) {
this._Module = new_Module;
}
}

View File

@@ -0,0 +1,25 @@
package wenrgise.common.xml.vo;
import java.util.ArrayList;
public class EnrgiseForms {
private ArrayList _SingleForm;
public EnrgiseForms() {}
public EnrgiseForms(ArrayList _SingleForm_) {
set_SingleForm(_SingleForm_);
}
public boolean isEmpty_SingleForm() {
return (null == this._SingleForm) ? true : this._SingleForm.isEmpty();
}
public ArrayList get_SingleForm() {
return this._SingleForm;
}
public void set_SingleForm(ArrayList new_SingleForm_) {
this._SingleForm = new_SingleForm_;
}
}

View File

@@ -0,0 +1,25 @@
package wenrgise.common.xml.vo;
import java.util.HashMap;
public class HashedEnrgiseForms {
private SingleForm singleForm;
private HashMap detailMap = new HashMap();
public HashMap getDetailMap() {
return this.detailMap;
}
public void setDetailMap(HashMap newDetailMap) {
this.detailMap = newDetailMap;
}
public SingleForm getSingleForm() {
return this.singleForm;
}
public void setSingleForm(SingleForm newSingleForm) {
this.singleForm = newSingleForm;
}
}

View File

@@ -0,0 +1,22 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
import java.util.ArrayList;
public class INFOClass implements Serializable {
private ArrayList _Module;
public INFOClass() {}
public INFOClass(ArrayList _module) {
this._Module = _module;
}
public ArrayList get_Module() {
return this._Module;
}
public void set_Module(ArrayList new_Module) {
this._Module = new_Module;
}
}

View File

@@ -0,0 +1,25 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
public class LOV implements Serializable {
private String _LovKey;
private Screens _Screens;
public String get_LovKey() {
return this._LovKey;
}
public void set_LovKey(String new_LovKey) {
this._LovKey = new_LovKey;
}
public Screens get_Screens() {
return this._Screens;
}
public void set_Screens(Screens new_Screens) {
this._Screens = new_Screens;
}
}

View File

@@ -0,0 +1,16 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
import java.util.ArrayList;
public class LOVClass implements Serializable {
private ArrayList _LOV;
public ArrayList get_LOV() {
return this._LOV;
}
public void set_LOV(ArrayList new_LOV) {
this._LOV = new_LOV;
}
}

View File

@@ -0,0 +1,45 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
public class LOVInfo implements Serializable {
private String facadeName;
private String functionName;
private String insertFlag;
private String recursiveFlag;
public String getFacadeName() {
return this.facadeName;
}
public void setFacadeName(String newFacadeName) {
this.facadeName = newFacadeName;
}
public String getFunctionName() {
return this.functionName;
}
public void setFunctionName(String newFunctionName) {
this.functionName = newFunctionName;
}
public String getInsertFlag() {
return this.insertFlag;
}
public void setInsertFlag(String newInsertFlag) {
this.insertFlag = newInsertFlag;
}
public String getRecursiveFlag() {
return this.recursiveFlag;
}
public void setRecursiveFlag(String newRecursiveFlag) {
this.recursiveFlag = newRecursiveFlag;
}
}

View File

@@ -0,0 +1,32 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
import java.util.ArrayList;
public class Module implements Serializable {
private String _ModuleName;
private ArrayList _ScreenInfo;
public Module() {}
public Module(String _modulename) {
this._ModuleName = _modulename;
}
public String get_ModuleName() {
return this._ModuleName;
}
public void set_ModuleName(String new_Modulename) {
this._ModuleName = new_Modulename;
}
public ArrayList get_ScreenInfo() {
return this._ScreenInfo;
}
public void set_ScreenInfo(ArrayList new_Screeninfo) {
this._ScreenInfo = new_Screeninfo;
}
}

View File

@@ -0,0 +1,25 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
public class Report implements Serializable {
private String _KeyInfo;
private String _ReportKey;
public String get_ReportKey() {
return this._ReportKey;
}
public void set_ReportKey(String new_Reportkey) {
this._ReportKey = new_Reportkey;
}
public String get_KeyInfo() {
return this._KeyInfo;
}
public void set_KeyInfo(String new_Keyinfo) {
this._KeyInfo = new_Keyinfo;
}
}

View File

@@ -0,0 +1,25 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
public class ReportInfo implements Serializable {
private String keyinfo;
private String reportkey;
public String getKeyInfo() {
return this.keyinfo;
}
public void setKeyInfo(String newKeyinfo) {
this.keyinfo = newKeyinfo;
}
public String getReportKey() {
return this.reportkey;
}
public void setReportKey(String newReportKey) {
this.reportkey = newReportKey;
}
}

View File

@@ -0,0 +1,16 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
import java.util.ArrayList;
public class Reports implements Serializable {
private ArrayList _Report;
public ArrayList get_Report() {
return this._Report;
}
public void set_Report(ArrayList new_Report) {
this._Report = new_Report;
}
}

View File

@@ -0,0 +1,25 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
public class Screen implements Serializable {
private String _ScreenName;
private ScreenModes _ScreenModes;
public ScreenModes get_ScreenModes() {
return this._ScreenModes;
}
public void set_ScreenModes(ScreenModes new_ScreenModes) {
this._ScreenModes = new_ScreenModes;
}
public String get_ScreenName() {
return this._ScreenName;
}
public void set_ScreenName(String new_ScreenName) {
this._ScreenName = new_ScreenName;
}
}

View File

@@ -0,0 +1,31 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
public class ScreenInfo implements Serializable {
private String _ScreenName;
private Reports _Reports;
public ScreenInfo() {}
public ScreenInfo(String _sscreennme) {
this._ScreenName = _sscreennme;
}
public String get_ScreenName() {
return this._ScreenName;
}
public void set_ScreenName(String new_Screenname) {
this._ScreenName = new_Screenname;
}
public Reports get_Reports() {
return this._Reports;
}
public void set_Reports(Reports new_Reports) {
this._Reports = new_Reports;
}
}

View File

@@ -0,0 +1,55 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
public class ScreenMode implements Serializable {
private String _ModeName;
private String _FacadeName;
private String _FunctionName;
private String _InsertFlag;
private String _RecursiveFlag;
public String get_FacadeName() {
return this._FacadeName;
}
public void set_FacadeName(String new_FacadeName) {
this._FacadeName = new_FacadeName;
}
public String get_FunctionName() {
return this._FunctionName;
}
public void set_FunctionName(String new_FunctionName) {
this._FunctionName = new_FunctionName;
}
public String get_InsertFlag() {
return this._InsertFlag;
}
public void set_InsertFlag(String new_InsertFlag) {
this._InsertFlag = new_InsertFlag;
}
public String get_ModeName() {
return this._ModeName;
}
public void set_ModeName(String new_ModeName) {
this._ModeName = new_ModeName;
}
public String get_RecursiveFlag() {
return this._RecursiveFlag;
}
public void set_RecursiveFlag(String new_RecursiveFlag) {
this._RecursiveFlag = new_RecursiveFlag;
}
}

View File

@@ -0,0 +1,16 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
import java.util.ArrayList;
public class ScreenModes implements Serializable {
private ArrayList _ScreenMode;
public ArrayList get_ScreenMode() {
return this._ScreenMode;
}
public void set_ScreenMode(ArrayList new_ScreenMode) {
this._ScreenMode = new_ScreenMode;
}
}

View File

@@ -0,0 +1,16 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
import java.util.ArrayList;
public class Screens implements Serializable {
private ArrayList _Screen;
public ArrayList get_Screen() {
return this._Screen;
}
public void set_Screen(ArrayList new_Screen) {
this._Screen = new_Screen;
}
}

View File

@@ -0,0 +1,93 @@
package wenrgise.common.xml.vo;
import java.io.Serializable;
public class SingleForm implements Serializable {
private String _FormName;
private String _EnrgiseQueryVO;
private String _HeaderBD;
private String _HeaderBean;
private String _HeaderSize;
private String _PseudoHeader;
private DetailScreens _DetailScreens;
private String _HeaderSave;
public SingleForm() {}
public SingleForm(String _FormName, String _EnrgiseQueryVO, DetailScreens _DetailScreens) {
this._FormName = _FormName;
this._EnrgiseQueryVO = _EnrgiseQueryVO;
this._DetailScreens = _DetailScreens;
}
public DetailScreens get_DetailScreens() {
return this._DetailScreens;
}
public void set_DetailScreens(DetailScreens new_DetailScreens) {
this._DetailScreens = new_DetailScreens;
}
public String get_EnrgiseQueryVO() {
return this._EnrgiseQueryVO;
}
public void set_EnrgiseQueryVO(String new_EnrgiseQueryVO) {
this._EnrgiseQueryVO = new_EnrgiseQueryVO;
}
public String get_FormName() {
return this._FormName;
}
public void set_FormName(String new_FormName) {
this._FormName = new_FormName;
}
public String get_HeaderBD() {
return this._HeaderBD;
}
public void set_HeaderBD(String new_HeaderBD) {
this._HeaderBD = new_HeaderBD;
}
public String get_HeaderBean() {
return this._HeaderBean;
}
public void set_HeaderBean(String new_HeaderBean) {
this._HeaderBean = new_HeaderBean;
}
public String get_HeaderSize() {
return this._HeaderSize;
}
public void set_HeaderSize(String new_HeaderSize) {
this._HeaderSize = new_HeaderSize;
}
public String get_PseudoHeader() {
return this._PseudoHeader;
}
public void set_PseudoHeader(String new_PseudoHeader) {
this._PseudoHeader = new_PseudoHeader;
}
public String get_HeaderSave() {
return this._HeaderSave;
}
public void set_HeaderSave(String new_HeaderSave) {
this._HeaderSave = new_HeaderSave;
}
}

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

View File

@@ -0,0 +1,5 @@
package wenrgise.ejb.common.facade;
import javax.ejb.EJBObject;
public interface CommonFacade extends EJBObject {}

View File

@@ -0,0 +1,16 @@
package wenrgise.ejb.common.facade;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
public class CommonFacadeBean implements SessionBean {
public void ejbCreate() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void ejbRemove() {}
public void setSessionContext(SessionContext ctx) {}
}

View File

@@ -0,0 +1,9 @@
package wenrgise.ejb.common.facade;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface CommonFacadeHome extends EJBHome {
CommonFacade create() throws CreateException, RemoteException;
}

View File

@@ -0,0 +1,17 @@
package wenrgise.ejb.common.facade;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import javax.ejb.EJBObject;
import wenrgise.common.bean.EmpInfoBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
public interface SecurityFacade extends EJBObject {
HashMap getDisabledFields(String paramString1, String paramString2, String paramString3, String paramString4) throws RemoteException, EnrgiseSystemException, EnrgiseApplicationException;
ArrayList addMenuList(EmpInfoBean paramEmpInfoBean) throws RemoteException, EnrgiseSystemException, EnrgiseApplicationException;
HashMap getAccessInfo(EmpInfoBean paramEmpInfoBean) throws RemoteException, EnrgiseSystemException, EnrgiseApplicationException;
}

Some files were not shown because too many files have changed in this diff Show More