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

📄 actorrightaction.java

📁 实现办公自动化系统
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.oa.struts.systemManager.actor.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
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 com.oa.struts.systemManager.actor.form.ActorRightForm;
import com.oa.struts.systemManager.actorDAO.ActorDAO;
import com.oa.struts.systemManager.actorDAO.ActorRightDAO;
import com.oa.struts.systemManager.actorDAO.RightDAO;
import com.oa.struts.vo.ActorInfo;
import com.oa.struts.vo.RightInfo;
import com.oa.util.Chinese_Do;
import com.oa.util.PageHelp;

/** 
 * MyEclipse Struts
 * Creation date: 11-14-2008
 * 
 * XDoclet definition:
 * @struts.action path="/actorRight" name="actorRightForm" input="/systemManager/role/add_role.jsp" scope="request" validate="true"
 */
public class ActorRightAction extends Action {
	/*
	 * Generated Methods
	 */

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws IOException 
	 * @throws ServletException 
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		ActorRightForm actorRightForm = (ActorRightForm) form;// TODO Auto-generated method stub
		RightInfo rightInfo=new RightInfo();
		//取出表单中的角色名
		Chinese_Do cd=new Chinese_Do();
		String actorName=cd.getString(request.getParameter("actorName"));
		if(actorName==null){actorName="";}
		ActorDAO actorDAO=new ActorDAO();
		boolean exist=actorDAO.searchactor(actorName);		//判断新的角色名在数据库中是否已存在
		if(exist)
		{
			boolean insertActor=actorDAO.addactor(actorName);	//如果不存在则执行插入操作
			if(insertActor)										//当插入角色操作成功的情况下,进行权限的插入操作
			{
				rightInfo.setAddEqu(this.exchangeOn(actorRightForm.getAddEqu()+""));
				rightInfo.setAddUser(this.exchangeOn(actorRightForm.getAddUser()+"0"));
				rightInfo.setCancelRoom(this.exchangeOn(actorRightForm.getCancelRoom()+""));
				rightInfo.setDeleteFile(this.exchangeOn(actorRightForm.getDeleteFile()+""));
				rightInfo.setDeleteUser(this.exchangeOn(actorRightForm.getDeleteUser()+""));
				rightInfo.setDownload(this.exchangeOn(actorRightForm.getDownload()+""));
				rightInfo.setLaunchMeet(this.exchangeOn(actorRightForm.getLaunchMeet()+""));
				rightInfo.setRegisterRoom(this.exchangeOn(actorRightForm.getRegisterRoom()+""));
				rightInfo.setReviewMeet(this.exchangeOn(actorRightForm.getReviewMeet()+""));
				rightInfo.setSetUserDaily(this.exchangeOn(actorRightForm.getSetUserDaily()+""));
				rightInfo.setUpdateFile(this.exchangeOn(actorRightForm.getUpdateFile()+""));
				rightInfo.setUpdateMeet(this.exchangeOn(actorRightForm.getUpdateMeet()+""));
				rightInfo.setUpdateRoom(this.exchangeOn(actorRightForm.getUpdateRoom()+""));
				rightInfo.setUpdateUser(this.exchangeOn(actorRightForm.getUpdateUser()+""));
				rightInfo.setUpload(this.exchangeOn(actorRightForm.getUpload()+""));
				rightInfo.setUploadMeetNote(this.exchangeOn(actorRightForm.getUploadMeetNote()+""));
				
				RightDAO rightDAO=new RightDAO();
				boolean insertRight=rightDAO.insertRight(rightInfo);
				System.out.println("insertRight="+insertRight);
				if(insertRight)
				{
					PageHelp ph=new PageHelp();
					List<ActorInfo> lt=actorDAO.getAllList(1, actorDAO.getTotulRows());
					System.out.println("ph.getTotulRows()="+actorDAO.getTotulRows());
					ph.setPageList(lt);
					request.setAttribute("roleList",ph);		//保存信息列表
					request.setAttribute("exist", "true");	
					
					ActorRightDAO aRDAO=new ActorRightDAO();
					boolean insertAR=aRDAO.insert();
					if(insertAR)
					{
						request.getRequestDispatcher("/F-YOA/systemManager/role/role_list.jsp").forward(request, response);
						System.out.println("权限角色表插入成功!");
					}
				}
				else
				{
					request.setAttribute("exist", "false");			//保存角色名已经存在信息,提示操作人员
					System.out.println("插入权限失败!");
				}
				
			}
		}
		else
		{
			System.out.println("插入角色失败!");
		}
		
		return null;
	}
	public int exchangeOn(String str)
	{
		int i=0;
		if(str.equals("on"))
		{
			i=1;
		}else
		{
			if(str==null || str.equals(""))
			{
				i=0;
			}
		}
		return i;
	}
}

⌨️ 快捷键说明

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