/////////////////////////////////////////////////////////////////
//Copyright (C) 2005 NTT CORPORATION.
//
//	LOOXVANVNX
//
//		ύX
//			2005.02.12  VK쐬  ~ _i
//
//	@\
//
//	̃NXLOOXVʂ̃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;

/**
 *  LOOXVANVNX
 * 
 *  ̃NXLOOXVʂ̃ANVNXłB
 * 
 *  @author ~ _i
 *  @version 1.0
 */
public class LoPrerequisiteUpdateAction 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 strLoID = CommonFunction.null2blank(request.getParameter("LoID"));		// LoID
		String strLoType = CommonFunction.null2blank(request.getParameter("LoType"));	// LoType

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

		// ̐eLO擾
		LoCommonFunction objLoCom = new LoCommonFunction();
		Vector vecParentInfo = objLoCom.getParentLO(strLoID);
		String[] strParentInfo = (String[])vecParentInfo.get(0);
		
		//ZLO擾
		Vector vecLoInfo = objLoCom.getChild(strParentInfo[0]);

		request.setAttribute("strLoID", strLoID);
		request.setAttribute("strLoType", strLoType);
		request.setAttribute("vecLoInfo", vecLoInfo);

		return mapping.findForward("success");
	}
}
