📄 rolegroupadmaction.java
字号:
/*
* Created on 2004-8-24
*
*/
package com.esimple.service.rbac.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import com.esimple.framework.util.*;
import com.esimple.framework.web.action.BaseForm;
import com.esimple.framework.web.action.IbatisSupportAction;
import com.esimple.service.rbac.po.RoleGroup;
/**
* @author steven
*
*/
public class RoleGroupAdmAction extends IbatisSupportAction {
/* (non-Javadoc)
* @see com.esimple.framework.web.action.BaseAction#execute(com.esimple.framework.web.action.BaseForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
public String execute(
BaseForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
String actionType = form.getValueAsString(
ACTION_CODE,true);
ActionErrors errors = new ActionErrors();
if(actionType==null) {
request.setAttribute("result",
this.getSqlMapDao().query("rbac.role.getRoleGroups",null)
);
return this.FORWARD_SUCCESS;
}
RoleGroup group = new RoleGroup();
BaseFormUtil.copySimpleProperties(group,form,true);
boolean canDo = true;
Object getGroup = this.getSqlMapDao().load("rbac.role.getRoleGroup",group);
if(getGroup!=null && actionType.equals("add")){
errors.add( ActionErrors.GLOBAL_ERROR,
new ActionError("error.rbac.role.group.exist"));
canDo = false;
}
if(getGroup==null && actionType.equals("del")){
errors.add( ActionErrors.GLOBAL_ERROR,
new ActionError("error.rbac.role.group.notExist"));
canDo = false;
}
logger.debug( form.getValue("groupname") );
if( actionType.equals("add") && canDo ){
this.getSqlMapDao().insert("rbac.role.addRoleGroup",group);
}else if( actionType.equals("update") ){
this.getSqlMapDao().update("rbac.role.updateRoleGroup",group);
}else if(actionType.equals("del") ){
this.getSqlMapDao().delete("rbac.role.deleteRoleGroup",group);
}
saveErrors(request, errors);
request.setAttribute("result",
this.getSqlMapDao().query("rbac.role.getRoleGroups",null)
);
return this.FORWARD_SUCCESS;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -