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

📄 rightholdmanagerimpl.java

📁 基于java的组号查询模块
💻 JAVA
字号:
/**
 * 
 */
package com.lily.dap.service.right.impl;

import java.util.List;

import com.lily.dap.model.right.Permission;
import com.lily.dap.model.right.RightHoldInterface;
import com.lily.dap.model.right.Role;
import com.lily.dap.service.core.BaseManager;
import com.lily.dap.service.core.exception.NotSupportOperationException;
import com.lily.dap.service.right.RightHoldManager;
import com.lily.dap.service.right.RoleManager;

/**
 * @author zouxuemo
 *
 */
public class RightHoldManagerImpl extends BaseManager implements
		RightHoldManager {
    protected RoleManager roleManager;

	/**
	 * @param roleManager the roleManager to set
	 */
	public void setRoleManager(RoleManager roleManager) {
		this.roleManager = roleManager;
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#addHaveHold(com.lily.dap.model.right.RightHoldInterface, com.lily.dap.model.right.RightHoldInterface)
	 */
	public void addHaveHold(RightHoldInterface hold, RightHoldInterface haveHold) {
		long privateRoleID = hold.getPrivateRoleID();
		long havePrivateRoleID = haveHold.getPrivateRoleID();
		
		roleManager.addHaveRole(privateRoleID, havePrivateRoleID);
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#addHavePermission(com.lily.dap.model.right.RightHoldInterface, java.lang.String, java.lang.String[], java.lang.String)
	 */
	public void addHavePermission(RightHoldInterface hold, String object_code,
			String[] operation_code, String des) {
		long privateRoleID = hold.getPrivateRoleID();
		
		roleManager.addPermission(privateRoleID, object_code, operation_code, des);
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#addHaveRole(com.lily.dap.model.right.RightHoldInterface, com.lily.dap.model.right.Role)
	 */
	public void addHaveRole(RightHoldInterface hold, Role role) {
		long privateRoleID = hold.getPrivateRoleID();
		long have_role_id = role.getId();
		
		roleManager.addHaveRole(privateRoleID, have_role_id);
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#listHoldsPermissions(com.lily.dap.model.right.RightHoldInterface)
	 */
	public List listHoldsPermissions(RightHoldInterface hold) {
		long privateRoleID = hold.getPrivateRoleID();
		
		return roleManager.getHavePermissions(privateRoleID);
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#listHoldsRoles(com.lily.dap.model.right.RightHoldInterface)
	 */
	public List listHoldsRoles(RightHoldInterface hold) {
		long privateRoleID = hold.getPrivateRoleID();
		
		return roleManager.getHavePublicRoles(privateRoleID);
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#providerHoldsRole(com.lily.dap.model.right.RightHoldInterface)
	 */
	public void providerHoldsRole(RightHoldInterface hold) {
		String des = "private role: " + hold.getClass().getName() + " -- " + hold.getName();
		
		Role role = roleManager.createPrivateRole(des);
		hold.setPrivateRoleID(role.getId());
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#removeHaveHold(com.lily.dap.model.right.RightHoldInterface, com.lily.dap.model.right.RightHoldInterface)
	 */
	public void removeHaveHold(RightHoldInterface hold,
			RightHoldInterface haveHold) {
		long privateRoleID = hold.getPrivateRoleID();
		long havePrivateRoleID = haveHold.getPrivateRoleID();
		
		roleManager.removeHaveRole(privateRoleID, havePrivateRoleID);
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#removeHaveRole(com.lily.dap.model.right.RightHoldInterface, com.lily.dap.model.right.Role)
	 */
	public void removeHaveRole(RightHoldInterface hold, Role role) {
		long privateRoleID = hold.getPrivateRoleID();
		long have_role_id = role.getId();
		
		roleManager.removeHaveRole(privateRoleID, have_role_id);
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#removeHaveRole(com.lily.dap.model.right.RightHoldInterface, com.lily.dap.model.right.Permission)
	 */
	public void removeHaveRole(RightHoldInterface hold, Permission permission) {
		roleManager.remove(Permission.class, new Long(permission.getId()));
	}

	/* (non-Javadoc)
	 * @see com.lily.dap.service.right.RightHoldManager#removeHoldsRoles(com.lily.dap.model.right.RightHoldInterface)
	 */
	public void removeHoldsRoles(RightHoldInterface hold) {
		long privateRoleID = hold.getPrivateRoleID();
		
		roleManager.removeRole(privateRoleID);
		
		hold.setPrivateRoleID(0);
	}

	/* (非 Javadoc)
	 * @see com.lily.dap.service.core.BaseManager#onBeforeAdd(java.lang.Object)
	 */
	protected Object onBeforeAdd(Object entity) {
		throw new NotSupportOperationException("接口不允许调用add(...)方法!");
	}

	/* (非 Javadoc)
	 * @see com.lily.dap.service.core.BaseManager#onBeforeModify(java.lang.Object)
	 */
	protected Object onBeforeModify(Object entity) {
		throw new NotSupportOperationException("接口不允许调用modify(...)方法!");
	}

	/* (非 Javadoc)
	 * @see com.lily.dap.service.core.BaseManager#onBeforeRemove(java.lang.Object)
	 */
	protected void onBeforeRemove(Object entity) {
		throw new NotSupportOperationException("接口不允许调用remove(...)方法!");
	}
}

⌨️ 快捷键说明

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