gbs_productmasterconditionmaintenanceaction.java

来自「对日软件外包 为东芝做的一个全球商业管理系统」· Java 代码 · 共 420 行 · 第 1/2 页

JAVA
420
字号
	 * @param ActionForm form
	 * @param HttpServletRequest request
	 * @param HttpServletResponse response
	 * @return ActionForward
	 * @throws Exception
	 */
	 
	public ActionForward update(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response)
			throws Exception {
				
			GBS_ProductMasterConditionMaintenanceForm requestForm =	(GBS_ProductMasterConditionMaintenanceForm) form;
			GBS_ProductMasterMaintenanceActionLogic logic = new GBS_ProductMasterMaintenanceActionLogic(this.getDataSource(request));
			//get login user info from session
			this.setUserInfoFromSession( request, requestForm);
			//get combox value from Wide_use master.
			GBS_MWideUseLogic logicMWideUse = new GBS_MWideUseLogic( this.getDataSource( request ) );
			ReturnValue returnValue = logicMWideUse.getCodeName( "PRODUCT_CATEGORY" );
			List lstProductCategory = (List) returnValue.getDataValue();
			returnValue = logicMWideUse.getCodeName( "OPTION_CATEGORY" );
			ArrayList lstOptionCategory = (ArrayList) returnValue.getDataValue();
			requestForm.setProductCategoryLabelList( lstProductCategory );
			
			ArrayList optionCategoryValueList = new ArrayList();
			ArrayList optionCategoryLabelList = new ArrayList();
			optionCategoryValueList.add( "" );
			optionCategoryLabelList.add( "" );
			for ( int i = 0; i < lstOptionCategory.size() ; i ++ ){
				GBS_CodeName_stBean st = (GBS_CodeName_stBean)lstOptionCategory.get( i );
				optionCategoryValueList.add( st.getCode() );
				optionCategoryLabelList.add( st.getName() );
			}
			requestForm.setOptnCategoryAlst( optionCategoryLabelList );
			requestForm.setOptionCategoryValueList( optionCategoryValueList );
			requestForm.setProductCategory(requestForm.getRadioProductcategory());
			//input check
			MessageList errorMsg = new MessageList();
			errorMsg = inputCheck(requestForm, request);
			if (errorMsg.size() > 0) {
				//save error to request
				this.setMessage( errorMsg );
				return (mapping.findForward(nextview));
			}
			FormFile attachFile = requestForm.getAttachmentFile();
			boolean FileDelete = false;
			boolean recordDelete = false;
			if(requestForm.getDeleteCheck().equals("on")) {
				FileDelete = true;
			}
			//save data
			returnValue = logic.updateProductInfo( 
													requestForm.getProductId(),
													requestForm.getDispOrder(),   //DISP_ORDER ,廋惓昁梫偱偡   丅
													requestForm.getProductName(),
													requestForm.getProductAbbrName(),   //PRODUCT_ABBR_NAME ,廋惓昁梫偱偡丅
													requestForm.getKind(),
													requestForm.getRadioProductcategory(),
													requestForm.getOptionCategory(),
													requestForm.getColorCPM(),
													requestForm.getBwCPM(),
													requestForm.getMonoColorCPM(),
													requestForm.getOtherCPM(),
													requestForm.getAttachmentFile(),
													requestForm.getLoginUserId(),
													FileDelete
												);
			if ( returnValue.isError() ){
				if ( returnValue.isBussinessError() ){
					this.setMessage( errorMsg );
				}
				return (mapping.findForward(nextview));
			}
		// forward to sucess 
		requestForm.setMethod("close");
		return (mapping.findForward(nextview));
	}
	 
	/** 
	 * Method delete
	 * @param ActionMapping mapping
	 * @param ActionForm form
	 * @param HttpServletRequest request
	 * @param HttpServletResponse response
	 * @return ActionForward
	 * @throws Exception
	 */
	
	public ActionForward delete(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response)
			throws Exception {
				
			GBS_ProductMasterConditionMaintenanceForm requestForm =	(GBS_ProductMasterConditionMaintenanceForm) form;
			GBS_ProductMasterMaintenanceActionLogic logic = new GBS_ProductMasterMaintenanceActionLogic(this.getDataSource(request));
			//get login user info from session
			this.setUserInfoFromSession( request, requestForm);

			MessageList errorMsg = new MessageList();
			//get combox value from Wide_use master.
			GBS_MWideUseLogic logicMWideUse = new GBS_MWideUseLogic( this.getDataSource( request ) );
			ReturnValue returnValue = logicMWideUse.getCodeName( "PRODUCT_CATEGORY" );
			List lstProductCategory = (List) returnValue.getDataValue();
			returnValue = logicMWideUse.getCodeName( "OPTION_CATEGORY" );
			ArrayList lstOptionCategory = (ArrayList) returnValue.getDataValue();
			requestForm.setProductCategoryLabelList( lstProductCategory );
			ArrayList optionCategoryValueList = new ArrayList();
			ArrayList optionCategoryLabelList = new ArrayList();
			optionCategoryValueList.add( "" );
			optionCategoryLabelList.add( "" );
			for ( int i = 0; i < lstOptionCategory.size() ; i ++ ){
				GBS_CodeName_stBean st = (GBS_CodeName_stBean)lstOptionCategory.get( i );
				optionCategoryValueList.add( st.getCode() );
				optionCategoryLabelList.add( st.getName() );
			}
			requestForm.setOptnCategoryAlst( optionCategoryLabelList );
			requestForm.setOptionCategoryValueList( optionCategoryValueList );
			//delete data
			//Edit by Gxk 2004/08/23:Add updateUserId
			returnValue = logic.deleteByProductId(requestForm.getProductId(),requestForm.getLoginUserId());
			if ( returnValue.isError() ){
				if ( returnValue.isBussinessError() ){
					this.setMessage( errorMsg );
				}
				return (mapping.findForward(nextview));
			}
			requestForm.setMethod("close");
			return (mapping.findForward(nextview));
	}
		
	/** 
	 * Method inputCheck
	 * @param ActionMapping mapping
	 * @param ActionForm form
	 * @param HttpServletRequest request
	 * @param HttpServletResponse response
	 * @return ActionForward
	 * @throws Exception
	 */
    
	private MessageList inputCheck(GBS_ProductMasterConditionMaintenanceForm requestForm,
										HttpServletRequest request) throws Exception {
	  
			//create ErrorMessages to display error message
			MessageList messages = new MessageList();
			FormFile attachmentFile = requestForm.getAttachmentFile();
	        //productId check 
			if (BaseCommonCheck.isEmpty(requestForm.getProductId())) {
				messages.setMessage("productId", requestForm.getProductId(), "10000009", Integer.MIN_VALUE,new Object[]{ "Product ID" }, "productId");
			}
			//dispOrder check
			if (BaseCommonCheck.isEmpty(requestForm.getDispOrder())) {
				messages.setMessage("dispOrder", requestForm.getDispOrder(), "10000009", Integer.MIN_VALUE,new Object[]{ "Display Order By" }, "dispOrder");
			}
			if ( !requestForm.getDispOrder().trim().equals( "" ) && !BaseCommonCheck.isInteger( requestForm.getDispOrder()) )
			{
				messages.setMessage("dispOrder", requestForm.getDispOrder(), "90000008", Integer.MIN_VALUE);
			}
			//getProductName check 
			if (BaseCommonCheck.isEmpty(requestForm.getProductName())) {
				messages.setMessage("productName", requestForm.getProductName(), "10000009", Integer.MIN_VALUE,new Object[]{ "Product Name" }, "productName");
			}
			//productAbbrName check
			if (BaseCommonCheck.isEmpty(requestForm.getProductAbbrName())) {
				messages.setMessage("productAbbrName", requestForm.getProductAbbrName(), "10000009", Integer.MIN_VALUE,new Object[]{ "Product Abbreviation" }, "productAbbrName");
			}
			//bwCPM check
			if ( !requestForm.getBwCPM().trim().equals( "" ) && !BaseCommonCheck.isInteger( requestForm.getBwCPM()) )
			{
				messages.setMessage("bwCPM", requestForm.getBwCPM(), "90000008", Integer.MIN_VALUE);
			}
			//colorCPM check
			if ( !requestForm.getColorCPM().trim().equals( "" ) && !BaseCommonCheck.isInteger( requestForm.getColorCPM()) )
			{
				messages.setMessage("colorCPM", requestForm.getColorCPM(), "90000008", Integer.MIN_VALUE);
			}
			//monoColorCPM check
			if ( !requestForm.getMonoColorCPM().trim().equals( "" ) && !BaseCommonCheck.isInteger( requestForm.getMonoColorCPM()) )
			{
				messages.setMessage("monoColorCPM", requestForm.getMonoColorCPM(), "90000008", Integer.MIN_VALUE);
			}
			//otherCPM check
			if ( !requestForm.getOtherCPM().trim().equals( "" ) && !BaseCommonCheck.isInteger( requestForm.getOtherCPM()) )
			{
				messages.setMessage("otherCPM", requestForm.getOtherCPM(), "90000008", Integer.MIN_VALUE);
			}
			
			//AttachmentFile check
			if((attachmentFile != null && !attachmentFile.getFileName().equals("")) && attachmentFile.getFileSize()==0){
				messages.setMessage( "attachmentFile", null, "10000012", Integer.MIN_VALUE,
				new Object[]{ "AttachmentFile" }, "AttachmentFile");						
			}
			//AttachmentFile's name check
			if(attachmentFile != null && attachmentFile.getFileName().length() > 100){
				messages.setMessage("","", "10000018", Integer.MIN_VALUE);
			}
			return messages;
		}
		
    // method: message List END
    
	
} 


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?