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

📄 userrolebean.java

📁 老外的在线考试
💻 JAVA
字号:
/* * UserEJB - CyberDemia's User management library implemented using EJBs. * Copyright (C) 2004 CyberDemia Research and Services * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA  02111-1307, USA. * * See the COPYING file located in the top-level-directory of * the archive of this library for complete text of license. */package com.cyberdemia.user;import javax.ejb.*;import com.cyberdemia.ejb.SimpleEntityBean;/** * UserRoleBean implements mapping of a user to a role. * Users may have a many-to-many relationship with roles. * The name attribute of UserRoleBean is used to store the user's * login name, which also happens to be stored in the UserBean's name attribute. * These matching column names come in handy when used with container * managed authentication. * * @ejb.bean name="UserRoleBean" *           type="CMP" *           view-type="local" *           schema="UserRole" *           cmp-version="2.x" *           primkey-field="id" *           local-jndi-name="ejb/LocalUserRole" * * @ejb.util generate="physical" * @ejb.interface local-class="com.cyberdemia.user.LocalUserRole" local-extends="javax.ejb.EJBLocalObject" * @ejb.home local-class="com.cyberdemia.user.LocalUserRoleHome" local-extends="javax.ejb.EJBLocalHome" * @ejb.persistence table-name="UserRole" * @ejb.finder signature="java.util.Collection findByLoginName(java.lang.String loginName)" *             query="select Object(r) from UserRole r where r.name=?1" * @jboss.method-attributes pattern="get*" read-only="true" * @jboss.container-configuration name="CyberDemia Optimized Standalone CMP" * * @author Alexander Yap * @version $Revision: 1.6 $ at $Date: 2004/06/20 10:18:12 $ by $Author: alexycyap $ */public abstract class UserRoleBean extends SimpleEntityBean{    /**     * Gets the role name.     *     * @ejb.interface-method     * @ejb.persistence     *     * @return The role name.     */    public abstract String getRoleName();    /**     * Sets the role name.     *     * @param role The role name.     */    public abstract void setRoleName(String role);    //-----------------------------    // Create methods.    //-----------------------------    /**     * Creates a UserRoleBean.     *     * @ejb.create-method view-type="local"     */    public Integer ejbCreate( String userLoginName, String roleName ) throws CreateException    {        // Unique id is assigned by auto-increament        setName(userLoginName);        setRoleName( roleName );        long nowMillis = System.currentTimeMillis();        setCreatedMillis(nowMillis);        return null;    }    public void ejbPostCreate( String userLoginName, String roleName )    {        // Nothing here    }}

⌨️ 快捷键说明

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