⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gbs_rfpcountryaction.java

📁 对日软件外包 为东芝做的一个全球商业管理系统
💻 JAVA
字号:
/** 
 * method GBS_UsermasterAction.java
 * created on 07-30-2004
 * 
 * @author   GXK
 * @version  1.0
 */

package ACTION;

import java.util.ArrayList;

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.BaseDispatchAction;
import COMMON.ReturnValue;
import COMMON.SystemConstants;
import DataBean.GBS_RfpCountry_stBean;
import LOGIC.GBS_RequestActionLogic;
//import DataBean.*;
//END UOC
/////////////////////////////////////////////////////////////////

public class GBS_RfpCountryAction extends BaseDispatchAction implements SystemConstants {

	/**
	 * init pagelike SUBSIDIARY data
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward init(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {

		log.info("[location info]GBS_ServiceinfoAction.download method!");
		GBS_RfpCountryForm thisForm = (GBS_RfpCountryForm) form;
		this.setUserInfoFromSession(request, thisForm);

		//get All Country List From DB
		GBS_RequestActionLogic logic = new GBS_RequestActionLogic(this.getDataSource(request));
		ReturnValue returnValue = logic.getAllCountryName();
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			return mapping.findForward(nextview);
		}
		ArrayList countryList = (ArrayList) returnValue.getDataValue();
		thisForm.setCountryList(countryList);
		String countriesCode = thisForm.getCountryCode();
		
		//Return the Select Counttry List to Page
		ArrayList selectCountryList = new ArrayList();
		while (countriesCode.lastIndexOf(",") > 0) {
			selectCountryList.add(countriesCode.substring(countriesCode.lastIndexOf(",") + 1));
			countriesCode = countriesCode.substring(0, countriesCode.lastIndexOf(","));
		}
		selectCountryList.add(countriesCode);
		thisForm.setSelectCountryList(selectCountryList);
		//thisForm.setMethod("returnCountries");
		return (mapping.findForward(nextview));
	}

	/**
	 * input error check
	 * @param thisForm GBS_UsermasterForm
	 * @param request HttpServletRequest
	 * @throws Exception
	 * @return ActionErrors
	 */

	public ActionForward returnCountries(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {
		log.info("[location info]GBS_ServiceinfoAction.download method!");
		GBS_RfpCountryForm thisForm = (GBS_RfpCountryForm) form;
		this.setUserInfoFromSession(request, thisForm);
		ArrayList selectCountryList = new ArrayList();
		ArrayList countryList = new ArrayList();
		if (thisForm.getCountry() != null) {
			String[] country = thisForm.getCountry();
			for (int i = 0; i < country.length; i++) {
				selectCountryList.add(country[i]);
			}
			thisForm.setSelectCountryList(selectCountryList);
		}
		GBS_RfpCountry_stBean RfpCountry_stBean = new GBS_RfpCountry_stBean();
		for (int i = 0; i < thisForm.getCountryList().size(); i++) {
			RfpCountry_stBean = (GBS_RfpCountry_stBean) thisForm.getCountryList().get(i);
			for (int j = 0; j < selectCountryList.size(); j++) {
				if (RfpCountry_stBean.getCountryCode().equals(selectCountryList.get(j))) {
					countryList.add(RfpCountry_stBean);
					RfpCountry_stBean = new GBS_RfpCountry_stBean();
					break;
				}
			}
		}
		String countries = "";
		String subsidiary = "";
		for (int i = 0; i < countryList.size(); i++) {
			RfpCountry_stBean = (GBS_RfpCountry_stBean) countryList.get(i);
			if (i == countryList.size() - 1) {
				if (RfpCountry_stBean.getCountryName() != null) {
					countries = countries + RfpCountry_stBean.getCountryName();
				}
			} else {
				if (RfpCountry_stBean.getCountryName() != null) {
					countries = countries + RfpCountry_stBean.getCountryName() + ",";
				}
			}
		}
		thisForm.setCountryName("asd");
		//尰朄柤
		GBS_RfpCountry_stBean RfpCountry_stBean1 = new GBS_RfpCountry_stBean();
		//int size = RfpCountryList.size();
		for (int i = 0; i < countryList.size(); i++) {
			for (int j = i + 1; j < countryList.size(); j++) {
				RfpCountry_stBean = (GBS_RfpCountry_stBean) countryList.get(i);
				RfpCountry_stBean1 = (GBS_RfpCountry_stBean) countryList.get(j);
				if (RfpCountry_stBean.getSubsidiaryCode().equals(RfpCountry_stBean1.getSubsidiaryCode())) {
					countryList.remove(j);
					j--;
				}
			}
		}
		for (int i = 0; i < countryList.size(); i++) {
			RfpCountry_stBean = (GBS_RfpCountry_stBean) countryList.get(i);
			if (RfpCountry_stBean.getSubsidiaryName() == null || RfpCountry_stBean.getSubsidiaryName().equals("")) {
				countryList.remove(i);
				i--;
			}
		}
		for (int i = 0; i < countryList.size(); i++) {
			RfpCountry_stBean = (GBS_RfpCountry_stBean) countryList.get(i);
			if (i == countryList.size() - 1) {
				subsidiary = subsidiary + RfpCountry_stBean.getSubsidiaryName();
			} else {
				subsidiary = subsidiary + RfpCountry_stBean.getSubsidiaryName() + ",";
			}
		}
		thisForm.setSubsidiaryName(subsidiary);
		thisForm.setSelectCountryList(selectCountryList);
		thisForm.setMethod("close");
		return (mapping.findForward(nextview));
	}
}

⌨️ 快捷键说明

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