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

📄 admingroupdatabean.java

📁 一个免费的CA,基于EJB平台的,老师叫我们测试,现把之共享出来让大家参考
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/************************************************************************* *                                                                       * *  EJBCA: The OpenSource Certificate Authority                          * *                                                                       * *  This software is free software; you can redistribute it and/or       * *  modify it under the terms of the GNU Lesser General Public           * *  License as published by the Free Software Foundation; either         * *  version 2.1 of the License, or any later version.                    * *                                                                       * *  See terms of license at gnu.org.                                     * *                                                                       * *************************************************************************/package org.ejbca.core.ejb.authorization;import java.util.ArrayList;import java.util.Collection;import java.util.Iterator;import javax.ejb.CreateException;import javax.ejb.EJBException;import javax.ejb.RemoveException;import org.ejbca.core.ejb.BaseEntityBean;import org.ejbca.core.ejb.ServiceLocator;import org.ejbca.core.model.authorization.AccessRule;import org.ejbca.core.model.authorization.AdminEntity;import org.ejbca.core.model.authorization.AdminGroup;/** Entity bean should not be used directly, use though Session beans. * * Entity Bean representing authorization admingroup. * Information stored: * <pre> * admingroupname * caid * * AccessRules * Admin entities * </pre> * * @version $Id: AdminGroupDataBean.java,v 1.6 2006/11/10 11:22:18 anatom Exp $ * * @ejb.bean *   description="This enterprise bean entity represents an authorization usergroup" *   display-name="AdminGroupDataEB" *   name="AdminGroupData" *   jndi-name="AdminGroupData" *   view-type="local" *   type="CMP" *   reentrant="False" *   cmp-version="2.x" *   transaction-type="Container" *   schema="AdminGroupDataBean" *   primkey-field="primKey" * * @ejb.home *   generate="local" *   local-extends="javax.ejb.EJBLocalHome" *   local-class="org.ejbca.core.ejb.authorization.AdminGroupDataLocalHome" * * @ejb.persistence table-name = "AdminGroupData" *  * Vi use EJB relationships here and it often requires a transaction so it's easiest to set Required on all. * @ejb.transaction type="Required" *  * @ejb.interface *   generate="local" *   local-extends="javax.ejb.EJBLocalObject" *   local-class="org.ejbca.core.ejb.authorization.AdminGroupDataLocal" * * @ejb.finder *   description="findByGroupNameAndCAId" *   signature="org.ejbca.core.ejb.authorization.AdminGroupDataLocal findByGroupNameAndCAId(java.lang.String name,  int id)" *   query="SELECT OBJECT(a) from AdminGroupDataBean a WHERE a.adminGroupName=?1 AND a.caId=?2" * * @ejb.finder *   description="findAll" *   signature="java.util.Collection findAll()" *   query="SELECT OBJECT(a) from AdminGroupDataBean a" * * @ejb.ejb-external-ref *   description="" *   view-type="local" *   ref-name="ejb/AdminEntityDataLocal" *   type="Entity" *   home="org.ejbca.core.ejb.authorization.AdminEntityDataLocalHome" *   business="org.ejbca.core.ejb.authorization.AdminEntityDataLocal" *   link="AdminEntityData" * * @ejb.ejb-external-ref *   description="" *   view-type="local" *   ref-name="ejb/AccessRulesDataLocal" *   type="Entity" *   home="org.ejbca.core.ejb.authorization.AccessRulesDataLocalHome" *   business="org.ejbca.core.ejb.authorization.AccessRulesDataLocal" *   link="AccessRulesData" * */public abstract class AdminGroupDataBean extends BaseEntityBean {    /**     * @ejb.persistence column-name="pK"     * @ejb.pk-field     */    public abstract Integer getPrimKey();    public abstract void setPrimKey(Integer primKey);    /**     * @ejb.persistence column-name="adminGroupName"     * @ejb.interface-method view-type="local"     */    public abstract String getAdminGroupName();    /**     * @ejb.interface-method view-type="local"     */    public abstract void setAdminGroupName(String admingroupname);    /**     * @ejb.persistence column-name="cAId"     * @ejb.interface-method view-type="local"     */    public abstract int getCaId();    /**     * @ejb.interface-method view-type="local"     */    public abstract void setCaId(int caid);    /**     * @ejb.relation name="AdminGroupDataToAdminEntities" role-name="AdminGroupData"     * target-role-name="AdminEntityData" target-ejb="AdminEntityData"     *      * @jboss.target-relation     * related-pk-field="primKey"     * fk-column="AdminGroupData_adminEntities"       *      * @weblogic.target-column-map     * key-column="pK"     * foreign-key-column="AdminGroupData_adminEntities"     *      * @sunone.relation     * column="AdminGroupData.pK"     * target="AdminEntityData.AdminGroupData_adminEntities"     */    public abstract Collection getAdminEntities();    public abstract void setAdminEntities(Collection adminentities);    /**     * @ejb.relation     * name="AdminGroupDataToAccessRules" role-name="AdminGroupData"     * target-role-name="AccessRulesData" target-ejb="AccessRulesData"     *      * @jboss.target-relation     * related-pk-field="primKey"     * fk-column="AdminGroupData_accessRules"     *           * @weblogic.target-column-map     * key-column="pK"     * foreign-key-column="AdminGroupData_accessRules"     *      * @sunone.relation     * column="AdminGroupData.pK"     * target="AccessRulesData.AdminGroupData_accessRules"     */    public abstract Collection getAccessRules();    public abstract void setAccessRules(Collection accessrules);    /**     * Adds a Collection of AccessRule to the database. Changing their values if they already exists     * @ejb.interface-method view-type="local"     */    public void addAccessRules(Collection accessrules) {        Iterator iter = accessrules.iterator();        while (iter.hasNext()) {            AccessRule accessrule = (AccessRule) iter.next();            try {                AccessRulesDataLocal data = createAccessRule(accessrule);                Iterator i = getAccessRules().iterator();                while (i.hasNext()) {                    AccessRulesDataLocal ar = (AccessRulesDataLocal) i.next();                    if (ar.getAccessRuleObject().getAccessRule().equals(accessrule.getAccessRule())) {                        getAccessRules().remove(ar);                        try {                            ar.remove();                        } catch (RemoveException e) {                        	error("Error adding AccessRules: ", e);                        	throw new EJBException(e);                        }                        break;                    }                }                getAccessRules().add(data);            } catch (Exception e) {                error("Error adding AccessRules: ", e);            }        }    } // addAccessRules    /**     * Removes a Collection of (String) accessrules from the database.     * @ejb.interface-method view-type="local"     */    public void removeAccessRules(Collection accessrules) {        Iterator iter = accessrules.iterator();        while (iter.hasNext()) {            String accessrule = (String) iter.next();

⌨️ 快捷键说明

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