/////////////////////////////////////////////////////////////////
//Copyright (C) 2005 NTT CORPORATION.
//
//	LOOt[ANVNX
//
//		ύX
//			2005.02.12  VK쐬  ~ _i
//
//	@\
//
//	̃NXLOOt[̃ANVNXłB
//
////////////////////////////////////////////////////////////////

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

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

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;

/**
 *  LOOt[ANVNX
 * 
 *  ̃NXLOOt[̃ANVNXłB
 * 
 *  @author ~ _i
 *  @version 1.0
 */
public class LoPrerequisiteFrameAction  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");

		//-------------------------------------------------------------------------
		// p[^擾
		//-------------------------------------------------------------------------
		String strParentID = request.getParameter("parentID");		// eLoID
		String strLoID = request.getParameter("LoID");				// LoID
		String strLoType = request.getParameter("LoType");			// LoType

		//-------------------------------------------------------------------------
		// p[^`FbN
		//-------------------------------------------------------------------------
		if (strParentID == null)
		{
			strParentID = "";
		}
		if (strLoID == null)
		{
			strLoID = "";
		}
		if (strLoType == null)
		{
			// ftHgLO^Cvݒ肵܂
			strLoType = resources.getMessage("CONTAINER_TYPE");
		}

		//-------------------------------------------------------------------------
		// Oo^AXVʂ̕\I
		//-------------------------------------------------------------------------
		String strDisplayPrerequisite;
		String strTitle;
		//VKo^
		if (strLoID == null || strLoID.equals(""))
		{
			strDisplayPrerequisite = "LoPrerequisiteInsert.do" + 
				"?parentID=" + strParentID + 
				"&LoType=" + strLoType;

			strTitle = resources.getMessage("STR_TITLE_NEW_PREREQUISITE");
		}
		//XVo^
		else
		{
			strDisplayPrerequisite = "LoPrerequisiteUpdate.do" + 
				"?LoID=" + strLoID + 
				"&LoType=" + strLoType;

			strTitle = resources.getMessage("STR_TITLE_UPD_PREREQUISITE");
		}

		request.setAttribute("strDisplayPrerequisite", strDisplayPrerequisite);
		request.setAttribute("strTitle", strTitle);

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