/////////////////////////////////////////////////////////////////
//Copyright (C) 2005 NTT CORPORATION.
//
//	ATCsʁip[^[`FbNj\ActionNX
//
//		ύX
//			2005.02.16  VK쐬   ΍茫Y
//
//	@\
//
//	ATCsʁip[^[`FbNj\ActionNXłB
//
/////////////////////////////////////////////////////////////////
package jp.co.ntt.lms.xmf.actions.xmo.RoleAssignments;

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;

/**
 * ATCsʁip[^[`FbNj\ActionNXłB
 * 
 * @author Kentaro Ishizaki (UNITEC)
 * @version 1.0
 */
public class RoleAssignmentsframe_functionAction extends Action
{
	/**
	 * strutst[[NĂ΂郁\bhłB
	 * 
	 * @param mapping }bsOIuWFNgB
	 * @param form ANVtH[IuWFNgB
	 * @param request NGXgIuWFNgB
	 * @param response X|XIuWFNgB
	 * @return ActionForward ANVtH[hIuWFNgB
	 * @throws Exception
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		///////////////////////////////////////////
		// p[^擾
		// 	EparentID	eO[vID	K{
		// 	EselectID	lID			K{
		// 	EreturnURL	߂y[W		K{
		///////////////////////////////////////////
		String strParentID_o = request.getParameter("parentID");		// eO[vID
		String strSelectID_o = request.getParameter("selectID");		// lID
		String strReturnURL_o = request.getParameter("returnURL");	// ߂y[W

		// bZ[W\[X擾
		MessageResources resources = getResources(request, "msg.xmf.xmo.RoleAssignments.MessageResources");
		
		///////////////////////////////////////////
		// p[^`FbN
		///////////////////////////////////////////
		if( strParentID_o == null || strParentID_o.equals( "" ) ) {
			Exception e = new Exception();
			e.printStackTrace();
			String strMessage = resources.getMessage("M092001");
			String strDetail = resources.getMessage("D092001");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strSelectID_o == null || strSelectID_o.equals( "" ) ) {
			Exception e = new Exception();
			e.printStackTrace();
			String strMessage = resources.getMessage("M092002");
			String strDetail = resources.getMessage("D092002");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strReturnURL_o == null || strReturnURL_o.equals( "" ) ) {
			Exception e = new Exception();
			e.printStackTrace();
			request.setAttribute("message", "");
			request.setAttribute("detail", "");
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "../Com/ComSystemErr.vm");
			return mapping.findForward("error");
		}


		// c[f[^擾p̃Avbg
		String strServerName_o = request.getServerName();
		int intServerPort_o = request.getServerPort();
		String strContextPath_o = request.getContextPath();

		
		// NGXgɕϐZbg
		request.setAttribute("strParentID_o", strParentID_o);
		request.setAttribute("strSelectID_o", strSelectID_o);
		request.setAttribute("strServerName_o", strServerName_o);
		request.setAttribute("intServerPort_o", new Integer(intServerPort_o));
		request.setAttribute("strContextPath_o", strContextPath_o);
		
		return mapping.findForward("success");
		
	}
}
