📄 gbs_productmasterconditionaction.java
字号:
// Created by Xslt generator for Eclipse.
// XSL : not found (java.io.FileNotFoundException: (巜掕偝傟偨僷僗偑尒偮偐傝傑偣傫丅))
// Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xsl
package ACTION;
import java.util.ArrayList;
import java.util.List;
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 COMMON.BaseCommonCheck;
import COMMON.BaseDispatchAction;
import COMMON.MessageList;
import COMMON.ReturnValue;
import COMMON.SystemConstants;
import DataBean.GBS_ProductMasterConditionList_Bean;
import LOGIC.GBS_MWideUseLogic;
import LOGIC.GBS_productMasterConditionActionLogic;
//import DataBean.*;
//END UOC
/////////////////////////////////////////////////////////////////
/**
* GBS_ProductMasterConditionAction.java created by EasyStruts - XsltGen.
* http://easystruts.sf.net
* created on 07-29-2004
*
* XDoclet definition:
* @struts:action path="/gbs_productmastercondition" name="gbs_productmasterconditionForm" attribute="GBS_ProductMasterConditionForm" input="GBS_productmastercondition.jsp" validate="true"
*/
public class GBS_ProductMasterConditionAction extends BaseDispatchAction implements SystemConstants{
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/**
* Method execute
* @param ActionMapping mapping
* @param ActionForm form
* @param HttpServletRequest request
* @param HttpServletResponse response
* @return
* @throws Exception
*/
public ActionForward init( ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response )
throws Exception {
log.info("[location info]GBS_ProductMasterConditionAction.init method!");
//get login user info from session
GBS_ProductMasterConditionForm GBS_ProductMasterConditionForm = (GBS_ProductMasterConditionForm) form;
//get login user info from session
this.setUserInfoFromSession( request, GBS_ProductMasterConditionForm);
GBS_MWideUseLogic logic = new GBS_MWideUseLogic( this.getDataSource( request ) );
//select from table wide_use and init combox list.
ReturnValue returnValue = logic.getCodeName( "PRODUCT_CATEGORY" );
List lstProductCategory = (List) returnValue.getDataValue();
returnValue = logic.getCodeName( "OPTION_CATEGORY" );
List lstOptionCategory = (List) returnValue.getDataValue();
GBS_ProductMasterConditionForm.setLstOptionCategory(lstOptionCategory);
GBS_ProductMasterConditionForm.setLstProductCategory(lstProductCategory);
return (mapping.findForward(nextview));
}
/**
* search data
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward search(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
log.info("[location info]GBS_ProductMasterConditionAction.search method!");
GBS_ProductMasterConditionForm thisForm = (GBS_ProductMasterConditionForm) form;
//get initial data
GBS_productMasterConditionActionLogic logic = new GBS_productMasterConditionActionLogic(this.getDataSource(request));
//1. get login user info from session
this.setUserInfoFromSession( request, thisForm);
//return the info of page which is select
if (thisForm.getProductCategory() != null) {
ArrayList selectedProductCategoryList = new ArrayList();
String[] productCategory = thisForm.getProductCategory();
for (int i = 0; i < productCategory.length; i++) {
selectedProductCategoryList.add(productCategory[i]);
}
thisForm.setLstSelectedProductCategory(selectedProductCategoryList);
}
if (thisForm.getOptionCategory() != null) {
ArrayList selectedOptionCategoryList = new ArrayList();
String[] OptionCategory = thisForm.getOptionCategory();
for (int i = 0; i < OptionCategory.length; i++) {
selectedOptionCategoryList.add(OptionCategory[i]);
}
thisForm.setLstSelectedOptionCategory(selectedOptionCategoryList);
}
//2. Input Check
MessageList errorMsg = new MessageList();
errorMsg = inputCheck(thisForm, request);
if (errorMsg.size() > 0) {
//save error to request
this.setMessage( errorMsg );
return (mapping.findForward(nextview));
}
// 3. search data
// System.out.println("GBS_ProductMasterConditionForm.getLocalMember()="+GBS_ProductMasterConditionForm.getLocalMember());
String productCategory = "";
//get productCategory information.
String[] ProductCategory = thisForm.getProductCategory();
if(ProductCategory != null){
for( int i = 0; i < ProductCategory.length; i++ ){
if( i != ProductCategory.length - 1 ){
if(ProductCategory[i].indexOf("'") > -1){
ProductCategory[i] = BaseCommonCheck.convertSql(ProductCategory[i]);
}
productCategory = productCategory + "'" + ProductCategory[i] + "',";
}else{
if(ProductCategory[i].indexOf("'") > -1){
ProductCategory[i] = BaseCommonCheck.convertSql(ProductCategory[i]);
}
productCategory = productCategory + "'" + ProductCategory[i] + "'";
}
}
}
String optionCategory = "";
String[] OptionCategory = thisForm.getOptionCategory();
//get optionCategory information.
if( OptionCategory != null){
for( int i = 0; i < OptionCategory.length; i++ ){
if( i != OptionCategory.length - 1 ){
if(OptionCategory[i].indexOf("'") > -1){
OptionCategory[i] = BaseCommonCheck.convertSql(OptionCategory[i]);
}
optionCategory = optionCategory + "'" + OptionCategory[i] + "',";
}else{
if(OptionCategory[i].indexOf("'") > -1){
OptionCategory[i] = BaseCommonCheck.convertSql(OptionCategory[i]);
}
optionCategory = optionCategory + "'" + OptionCategory[i] + "'";
}
}
}
List searchProductList = new ArrayList();
ReturnValue returnValue =
logic.getProductList(
thisForm.getProductId().trim(),
thisForm.getProductName().trim(),
thisForm.getMcKind().trim(),
thisForm.getOptionKind(),
productCategory,
optionCategory,
thisForm.getColorCPM().trim(),
thisForm.getColorCPM1().trim(),
thisForm.getMonoColorCPM().trim(),
thisForm.getMonoColorCPM1().trim(),
thisForm.getBwCPM().trim(),
thisForm.getBwCPM1().trim(),
thisForm.getOtherCPM().trim(),
thisForm.getOtherCPM1().trim(),
thisForm.getLoginAdminAuthority()
);
searchProductList = (List) returnValue.getDataValue();
//errorMsg = returnValuel.getMessageList();
if ( returnValue.isError() ) {
//error occur
if ( returnValue.isBussinessError() ){
this.setMessage( returnValue.getMessageList() );
}
return (mapping.findForward(nextview));
} else {
//if no error happen then set value .
//
GBS_ProductMasterConditionList_Bean ProductMasterConditionList_Bean = new GBS_ProductMasterConditionList_Bean();
ArrayList list = new ArrayList();
if(thisForm.getLoginAdminAuthority() != null && thisForm.getLoginAdminAuthority().equals("1")){
thisForm.setLstGBSProductMasterConditionSubForm( searchProductList );
}else{
for(int i=0;i<searchProductList.size();i++){
ProductMasterConditionList_Bean = (GBS_ProductMasterConditionList_Bean)searchProductList.get(i);
if(ProductMasterConditionList_Bean.getDeleteFlag() == null || !ProductMasterConditionList_Bean.getDeleteFlag().equals("D")){
list.add(ProductMasterConditionList_Bean);
}
}
thisForm.setLstGBSProductMasterConditionSubForm( list );
}
}
//Write data to session
GBS_ProductMasterConditionForm sessionForm = new GBS_ProductMasterConditionForm();
sessionForm.setBwCPM( thisForm.getBwCPM());
sessionForm.setBwCPM1(thisForm.getBwCPM1());
sessionForm.setColorCPM(thisForm.getColorCPM());
sessionForm.setColorCPM1(thisForm.getColorCPM1());
sessionForm.setLstOptionCategory( thisForm.getLstOptionCategory() );
sessionForm.setLstProductCategory( thisForm.getLstProductCategory());
sessionForm.setMcKind( thisForm.getMcKind());
sessionForm.setMonoColorCPM( thisForm.getMonoColorCPM());
sessionForm.setMonoColorCPM1( thisForm.getMonoColorCPM1());
sessionForm.setOptionCategory( thisForm.getOptionCategory());
sessionForm.setOptionKind( thisForm.getOptionKind());
sessionForm.setOtherCPM( thisForm.getOtherCPM());
sessionForm.setOtherCPM1( thisForm.getOtherCPM1());
sessionForm.setProductCategory( thisForm.getProductCategory());
sessionForm.setProductId( thisForm.getProductId());
sessionForm.setProductName( thisForm.getProductName());
this.saveToSession( request, PRODUCTMATERCONDITION, sessionForm );
//return to search result page.
return ( mapping.findForward( searchresult ) );
}
/**
* input error check
* @param thisForm GBS_UsermasterForm
* @param request HttpServletRequest
* @throws Exception
* @return ActionErrors
*/
private MessageList inputCheck(GBS_ProductMasterConditionForm thisForm,
HttpServletRequest request) throws Exception {
//create ErrorMessages to display
MessageList errorMsg = new MessageList();
//Integer Check
if ( !thisForm.getBwCPM1().trim().equals( "" ) && !BaseCommonCheck.isInteger( thisForm.getBwCPM1()) )
{
errorMsg.setMessage("bwCPM1", thisForm.getBwCPM1(), "90000008", Integer.MIN_VALUE);
}
if ( !thisForm.getBwCPM().trim().equals( "" ) && !BaseCommonCheck.isInteger( thisForm.getBwCPM()) )
{
errorMsg.setMessage("bwCPM", thisForm.getBwCPM(), "90000008", Integer.MIN_VALUE);
}
if ( !thisForm.getColorCPM().trim().equals( "" ) && !BaseCommonCheck.isInteger( thisForm.getColorCPM()) )
{
errorMsg.setMessage("colorCPM", thisForm.getColorCPM(), "90000008", Integer.MIN_VALUE);
}
if ( !thisForm.getColorCPM1().trim().equals( "" ) && !BaseCommonCheck.isInteger( thisForm.getColorCPM1()) )
{
errorMsg.setMessage("colorCPM1", thisForm.getColorCPM1(), "90000008", Integer.MIN_VALUE);
}
if ( !thisForm.getMonoColorCPM().trim().equals( "" ) && !BaseCommonCheck.isInteger( thisForm.getMonoColorCPM()) )
{
errorMsg.setMessage("monoColorCPM", thisForm.getMonoColorCPM(), "90000008", Integer.MIN_VALUE);
}
if ( !thisForm.getMonoColorCPM1().trim().equals( "" ) && !BaseCommonCheck.isInteger( thisForm.getMonoColorCPM1()) )
{
errorMsg.setMessage("monoColorCPM1", thisForm.getMonoColorCPM1(), "90000008", Integer.MIN_VALUE);
}
if ( !thisForm.getOtherCPM().trim().equals( "" ) && !BaseCommonCheck.isInteger( thisForm.getOtherCPM()) )
{
errorMsg.setMessage("otherCPM", thisForm.getOtherCPM(), "90000008", Integer.MIN_VALUE);
}
if ( !thisForm.getOtherCPM1().trim().equals( "" ) && !BaseCommonCheck.isInteger( thisForm.getOtherCPM1()) )
{
errorMsg.setMessage("otherCPM1", thisForm.getOtherCPM1(), "90000008", Integer.MIN_VALUE);
}
return errorMsg;
}
/**
* init page
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward download(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
log.info("[location info]GBS_ServiceinfoAction.download method!");
GBS_ProductMasterConditionForm thisForm = (GBS_ProductMasterConditionForm) form;
this.setUserInfoFromSession( request, thisForm);
// read data
GBS_productMasterConditionActionLogic logic = new GBS_productMasterConditionActionLogic(this.getDataSource(request));
ReturnValue returnValue = logic.getAttachmentFile( thisForm.getProductId(), response);
return (null);
}
/**
* init pagelike SUBSIDIARY data
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward subPageSubmit(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
log.info("[location info]GBS_UsermasterAction.subPageSubmit method!");
GBS_ProductMasterConditionForm requestForm = (GBS_ProductMasterConditionForm) form;
//get login user info from session
this.setUserInfoFromSession( request, requestForm);
//read data from session to the form
GBS_ProductMasterConditionForm sessionBean =
( GBS_ProductMasterConditionForm ) this.getFromSession( request, PRODUCTMATERCONDITION);
if ( sessionBean != null ){
requestForm.setBwCPM( sessionBean.getBwCPM());
requestForm.setBwCPM1(sessionBean.getBwCPM1());
requestForm.setColorCPM(sessionBean.getColorCPM());
requestForm.setColorCPM1(sessionBean.getColorCPM1());
requestForm.setLstOptionCategory( sessionBean.getLstOptionCategory() );
requestForm.setLstProductCategory( sessionBean.getLstProductCategory());
requestForm.setMcKind( sessionBean.getMcKind());
requestForm.setMonoColorCPM( sessionBean.getMonoColorCPM());
requestForm.setMonoColorCPM1( sessionBean.getMonoColorCPM1());
requestForm.setOptionCategory( sessionBean.getOptionCategory());
requestForm.setOptionKind( sessionBean.getOptionKind());
requestForm.setOtherCPM( sessionBean.getOtherCPM());
requestForm.setOtherCPM1( sessionBean.getOtherCPM1());
requestForm.setProductCategory( sessionBean.getProductCategory());
requestForm.setProductId( sessionBean.getProductId());
requestForm.setProductName( sessionBean.getProductName());
return search(mapping,requestForm,request,response);
}
return (init(mapping,requestForm,request,response));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -