first commit
This commit is contained in:
15
hrmsWeb/WEB-INF/classes/wenrgise/common/bean/BaseBean.java
Normal file
15
hrmsWeb/WEB-INF/classes/wenrgise/common/bean/BaseBean.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package WEB-INF.classes.wenrgise.common.bean;
|
||||
|
||||
import wenrgise.common.bean.CommonAttributes;
|
||||
|
||||
public class BaseBean {
|
||||
private CommonAttributes oCommonAttributes = null;
|
||||
|
||||
public CommonAttributes getOCommonAttributes() {
|
||||
return this.oCommonAttributes;
|
||||
}
|
||||
|
||||
public void setOCommonAttributes(CommonAttributes newOCommonAttributes) {
|
||||
this.oCommonAttributes = newOCommonAttributes;
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package WEB-INF.classes.wenrgise.common.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import wenrgise.common.bean.BaseBean;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package WEB-INF.classes.wenrgise.common.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import wenrgise.common.bean.BaseBean;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package WEB-INF.classes.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package WEB-INF.classes.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package WEB-INF.classes.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");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package WEB-INF.classes.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package WEB-INF.classes.wenrgise.common.exception;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import wenrgise.common.exception.BaseException;
|
||||
|
||||
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(wenrgise.common.exception.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package WEB-INF.classes.wenrgise.common.exception;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import wenrgise.common.exception.EnrgiseApplicationException;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package WEB-INF.classes.wenrgise.common.exception;
|
||||
|
||||
import java.io.Serializable;
|
||||
import wenrgise.common.exception.BaseException;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package WEB-INF.classes.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 wenrgise.common.utility.ContextProvider objContextProvider = new wenrgise.common.utility.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package WEB-INF.classes.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.common.utility.ParamUtil;
|
||||
import wenrgise.common.utility.UserInfo;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
package WEB-INF.classes.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 wenrgise.common.utility.EnrgiseManager me;
|
||||
|
||||
private HashMap oEnrgiseMap = new HashMap();
|
||||
|
||||
private HashMap appMap = new HashMap();
|
||||
|
||||
public static wenrgise.common.utility.EnrgiseManager getInstance() {
|
||||
if (me == null)
|
||||
me = new wenrgise.common.utility.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package WEB-INF.classes.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.utility.EnrgiseManager;
|
||||
import wenrgise.common.utility.LOVManager;
|
||||
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;
|
||||
}
|
||||
}
|
343
hrmsWeb/WEB-INF/classes/wenrgise/common/utility/EnrgiseUtil.java
Normal file
343
hrmsWeb/WEB-INF/classes/wenrgise/common/utility/EnrgiseUtil.java
Normal file
@@ -0,0 +1,343 @@
|
||||
package WEB-INF.classes.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.common.utility.MessageKey;
|
||||
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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package WEB-INF.classes.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package WEB-INF.classes.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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package WEB-INF.classes.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
package WEB-INF.classes.wenrgise.common.utility;
|
||||
|
||||
import java.util.HashMap;
|
||||
import javax.ejb.EJBLocalHome;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
import wenrgise.common.exception.EnrgiseSystemException;
|
||||
import wenrgise.common.utility.ContextProvider;
|
||||
|
||||
public class ServiceLocator {
|
||||
private HashMap homeCache;
|
||||
|
||||
private final HashMap cacheMap = new HashMap();
|
||||
|
||||
private static wenrgise.common.utility.ServiceLocator serviceLocator = new wenrgise.common.utility.ServiceLocator();
|
||||
|
||||
private ServiceLocator() {
|
||||
try {
|
||||
this.homeCache = new HashMap();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static wenrgise.common.utility.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;
|
||||
}
|
||||
}
|
175
hrmsWeb/WEB-INF/classes/wenrgise/common/utility/UserInfo.java
Normal file
175
hrmsWeb/WEB-INF/classes/wenrgise/common/utility/UserInfo.java
Normal file
@@ -0,0 +1,175 @@
|
||||
package WEB-INF.classes.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package WEB-INF.classes.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 wenrgise.common.utility.WorkFlowContextProvider objContextProvider = new wenrgise.common.utility.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package WEB-INF.classes.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 wenrgise.common.utility.WorkFlowContextProvider2 objContextProvider = new wenrgise.common.utility.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package WEB-INF.classes.wenrgise.common.utility;
|
||||
|
||||
import java.util.HashMap;
|
||||
import javax.ejb.EJBLocalHome;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
import wenrgise.common.exception.EnrgiseSystemException;
|
||||
import wenrgise.common.utility.WorkFlowContextProvider;
|
||||
|
||||
public class WorkFlowServiceLocator {
|
||||
private HashMap homeCache;
|
||||
|
||||
private final HashMap cacheMap = new HashMap();
|
||||
|
||||
private static wenrgise.common.utility.WorkFlowServiceLocator serviceLocator = new wenrgise.common.utility.WorkFlowServiceLocator();
|
||||
|
||||
private WorkFlowServiceLocator() {
|
||||
try {
|
||||
this.homeCache = new HashMap();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static wenrgise.common.utility.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package WEB-INF.classes.wenrgise.common.utility;
|
||||
|
||||
import java.util.HashMap;
|
||||
import javax.ejb.EJBLocalHome;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
import wenrgise.common.exception.EnrgiseSystemException;
|
||||
import wenrgise.common.utility.WorkFlowContextProvider2;
|
||||
|
||||
public class WorkFlowServiceLocator2 {
|
||||
private HashMap homeCache;
|
||||
|
||||
private final HashMap cacheMap = new HashMap();
|
||||
|
||||
private static wenrgise.common.utility.WorkFlowServiceLocator2 serviceLocator = new wenrgise.common.utility.WorkFlowServiceLocator2();
|
||||
|
||||
private WorkFlowServiceLocator2() {
|
||||
try {
|
||||
this.homeCache = new HashMap();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static wenrgise.common.utility.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;
|
||||
}
|
||||
}
|
145
hrmsWeb/WEB-INF/classes/wenrgise/common/vo/BaseDetailVO.java
Normal file
145
hrmsWeb/WEB-INF/classes/wenrgise/common/vo/BaseDetailVO.java
Normal file
@@ -0,0 +1,145 @@
|
||||
package WEB-INF.classes.wenrgise.common.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import wenrgise.common.vo.BaseVO;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
86
hrmsWeb/WEB-INF/classes/wenrgise/common/vo/BaseHeaderVO.java
Normal file
86
hrmsWeb/WEB-INF/classes/wenrgise/common/vo/BaseHeaderVO.java
Normal file
@@ -0,0 +1,86 @@
|
||||
package WEB-INF.classes.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;
|
||||
import wenrgise.common.vo.BaseVO;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
45
hrmsWeb/WEB-INF/classes/wenrgise/common/vo/BaseQueryVO.java
Normal file
45
hrmsWeb/WEB-INF/classes/wenrgise/common/vo/BaseQueryVO.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package WEB-INF.classes.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;
|
||||
}
|
||||
}
|
36
hrmsWeb/WEB-INF/classes/wenrgise/common/vo/BaseVO.java
Normal file
36
hrmsWeb/WEB-INF/classes/wenrgise/common/vo/BaseVO.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package WEB-INF.classes.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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,134 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,751 @@
|
||||
package WEB-INF.classes.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;
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,109 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,132 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,106 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,105 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,140 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package WEB-INF.classes.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;
|
||||
import wenrgise.common.webtier.action.BaseAction;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
package WEB-INF.classes.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 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.utility.EnrgiseUtil;
|
||||
import wenrgise.common.vo.ThisPageVO;
|
||||
import wenrgise.common.webtier.action.BaseAction;
|
||||
import wenrgise.common.webtier.form.BaseForm;
|
||||
import wenrgise.ejb.common.session.UserSession;
|
||||
import wenrgise.hrms.webtier.form.HrmBaseForm;
|
||||
|
||||
public class OnLoadAction 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();
|
||||
HrmBaseForm oHrmBaseForm = (HrmBaseForm)oBaseForm;
|
||||
HttpSession oSes = request.getSession();
|
||||
String sSesId = oSes.getId();
|
||||
if (null == sSesId)
|
||||
throw new EnrgiseApplicationException("wenrgise.common.session.expire", "E");
|
||||
String sUserId = (String)oSes.getAttribute("userId");
|
||||
if (null == sUserId) {
|
||||
oBaseForm.setFirstLoad("false");
|
||||
throw new EnrgiseApplicationException("wenrgise.common.session.expire", "E");
|
||||
}
|
||||
oHrmBaseForm.setEmpId(sUserId);
|
||||
UserSession oUser = getUserSessionBean(request);
|
||||
String sForwardedPage = oUser.getForwardedPage(sFormName);
|
||||
if (EnrgiseUtil.checkString(oUser.getForwardedPage(sFormName))) {
|
||||
sForwardedPage = oUser.getForwardedPage(sFormName);
|
||||
oBaseForm.setScreenName(sForwardedPage);
|
||||
return mapping.findForward(sForwardedPage);
|
||||
}
|
||||
sScreenName = request.getParameter("screenName");
|
||||
if (sScreenName.equalsIgnoreCase("HrmLvAppln")) {
|
||||
changeMode(oBaseForm, request);
|
||||
oBaseForm.setQueried(true);
|
||||
oBaseForm.setScreenMode("N");
|
||||
oBaseForm.setFirstLoad("false");
|
||||
enableAll(oBaseForm);
|
||||
enableDisable(oBaseForm, insertClicked(), "D");
|
||||
} else {
|
||||
changeMode(oBaseForm, request);
|
||||
oBaseForm.setQueried(true);
|
||||
oBaseForm.setScreenMode("Q");
|
||||
oBaseForm.setFirstLoad("false");
|
||||
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");
|
||||
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());
|
||||
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");
|
||||
}
|
||||
onLoad(form, request, 13);
|
||||
return mapping.findForward("success");
|
||||
}
|
||||
}
|
@@ -0,0 +1,83 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,112 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,133 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,111 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package WEB-INF.classes.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.action.BaseAction;
|
||||
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");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user