📄 fromsideaction.java
字号:
/**
* =============================================
* Copyright 2006 szmx
* <p/>
* Change Revision
* --------------------------------
* Date Author Remarks
* 2006-4-19 terry.zhang Create com.szmx.tlms.supplychain.web.ConditTaxAction
* =============================================
*/
package com.szmx.tlms.supplychain.web;
import com.szmx.framework.base.web.BaseAction;
import com.szmx.framework.base.model.Pagination;
import com.szmx.tlms.supplychain.service.FromSideService;
import com.szmx.tlms.supplychain.model.FromSide;
import com.szmx.tlms.TlmsServiceException;
import com.szmx.tlms.GlobalConstants;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author terry.zhang
* @since 2006-4-19
*/
public class FromSideAction extends BaseAction {
/**
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward searchFromSideInfo(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'searchFromSideInfo' method");
}
FromSideService fromSideService = (FromSideService) getBean("fromSideService");
DynaActionForm dynaForm = (DynaActionForm) form;
Pagination pageObj = new Pagination(request, "row");
FromSide fromSide= (FromSide)dynaForm.get("searchBean");
fromSide.check();//to check the fromSide's name wheather are empty or null
Pagination pagination = fromSideService.getFromSides(pageObj,fromSide);
request.setAttribute("pagination", pagination);
return mapping.findForward("success");
}
/**
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward initUpdateFromSide(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'edit' method");
}
DynaActionForm dynaForm = (DynaActionForm) form;
FromSide fromSide = (FromSide) dynaForm.get("fromSideBean");
FromSideService fromSideService = (FromSideService) getBean("fromSideService");
try {
fromSide = fromSideService.getFromSide(fromSide.getId().toString());
} catch (TlmsServiceException e) {
saveActionErrorMessage(request, GlobalConstants.COMMON_MESSAGE_UPDATE_FAIL, null);
throw e;
}
if (fromSide == null) {
saveActionErrorMessage(request, "err.supplychain.fromSide.get.noExisted", null);
return mapping.findForward("failure");
}
dynaForm.set("fromSideBean", fromSide);
return mapping.findForward("success");
}
/**
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward updateFromSide(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'updateFromSide' method");
}
DynaActionForm dynaForm = (DynaActionForm) form;
FromSide fromSide = (FromSide) dynaForm.get("fromSideBean");
fromSide.populateUpdateBean(new Long(1111));//todo
FromSideService fromSideService = (FromSideService) getBean("fromSideService");
try {
fromSideService.saveFromSide(fromSide);
dynaForm.set("fromSideBean", fromSide);
request.setAttribute("fromSideBean", fromSide);
} catch (TlmsServiceException e) {
request.setAttribute("fromSideBean", fromSide);
saveActionErrorMessage(request, GlobalConstants.COMMON_MESSAGE_UPDATE_FAIL, null);
throw e;
}
saveActionTripMessage(request, "message.update", null);
return mapping.findForward("success");
}
/**
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward initAddFromSide(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'initAddFromSide' method");
}
FromSide fromSide = new FromSide();
request.setAttribute("fromSideBean", fromSide);
return mapping.findForward("success");
}
/**
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward addFromSide(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'addFromSide' method");
}
DynaActionForm dynaForm = (DynaActionForm) form;
FromSide fromSide = (FromSide) dynaForm.get("fromSideBean");
fromSide.populateCreateBean(new Long(1010));//todo
FromSideService fromSideService = (FromSideService) getBean("fromSideService");
try {
fromSideService.saveFromSide(fromSide);
dynaForm.set("fromSideBean", fromSide);
request.setAttribute("fromSideBean", fromSide);
} catch (TlmsServiceException e) {
saveActionErrorMessage(request, GlobalConstants.COMMON_MESSAGE_ADD_FAIL, null);
throw e;
}
saveActionTripMessage(request,"message.add", null);
return mapping.findForward("success");
}
/**
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward removeFromSide(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'removeFromSide' method");
}
DynaActionForm dynaForm = (DynaActionForm) form;
String[] splitString = (String[]) dynaForm.get("idArr");
FromSideService fromSideService = (FromSideService) getBean("fromSideService");
try {
fromSideService.removeAllFromSide(splitString);
saveActionTripMessage(request,"message.delete" , null);
} catch (TlmsServiceException e) {
saveActionErrorMessage(request,GlobalConstants.COMMON_MESSAGE_DELETE_FAIL, null);
throw e;
}
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -