/////////////////////////////////////////////////////////////////
//Copyright (C) 2005 NTT CORPORATION.
//
//	LOOo^ANVNX
//
//		ύX
//			2005.02.12  VK쐬  ~ _i
//
//	@\
//
//	̃NXLOOo^ʂ̃ANVNXłB
//
////////////////////////////////////////////////////////////////

package jp.co.ntt.lms.xmf.actions.xmo.lo.prerequisite;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.util.Vector;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;

import jp.co.ntt.lms.xmf.common.CommonFunction;
import jp.co.ntt.lms.xmf.common.LoCommonFunction;

/**
 *  LOOo^ANVNX
 * 
 *  ̃NXLOOo^ʂ̃ANVNXłB
 * 
 *  @author ~ _i
 *  @version 1.0
 */
public class LoPrerequisiteInsertAction extends Action {

	/**
	 * execute\bh
	 * 
	 * @param ActionMapping ̃ANVIꂽƂɎgpꂽActionMapping
	 * @param ActionForm ̓tH[
	 * @param HttpServletRequest HTTPNGXg
	 * @param HttpServletResponse HTTPX|X
	 * @return ActionForward ANVtH[h
	 * @throws Exception 
	 */
public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws Exception {

		// bZ[W\[X擾
		MessageResources resources = getResources(request, "msg.xmf.xmo.Lo.Prerequisite.MessageResources");

		//-------------------------------------------------------------------------
		// URLp[^̎擾
		//-------------------------------------------------------------------------
		String strParentID = CommonFunction.null2blank(request.getParameter("parentID"));		// eLoID
		String strLoType = CommonFunction.null2blank(request.getParameter("LoType"));			// LoType

		//-------------------------------------------------------------------------
		// p[^`FbN
		//-------------------------------------------------------------------------
		if( strParentID == null || strParentID.equals( "" ) ) {
			request.setAttribute("message", resources.getMessage("M042001"));
			request.setAttribute("detail", resources.getMessage("D042001"));
			request.setAttribute("close", "");
			return mapping.findForward("error");
		}

		//w肳ꂽLOzLO擾
		LoCommonFunction objLoCom = new LoCommonFunction();
		Vector vecLoInfo = objLoCom.getChild(strParentID);

		request.setAttribute("strParentID", strParentID);
		request.setAttribute("strLoType", strLoType);
		request.setAttribute("vecLoInfo", vecLoInfo);
		
		return mapping.findForward("success");
	}
}
