001: /******************************************************************************
002: * JBoss, a division of Red Hat *
003: * Copyright 2006, Red Hat Middleware, LLC, and individual *
004: * contributors as indicated by the @authors tag. See the *
005: * copyright.txt in the distribution for a full listing of *
006: * individual contributors. *
007: * *
008: * This is free software; you can redistribute it and/or modify it *
009: * under the terms of the GNU Lesser General Public License as *
010: * published by the Free Software Foundation; either version 2.1 of *
011: * the License, or (at your option) any later version. *
012: * *
013: * This software is distributed in the hope that it will be useful, *
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
016: * Lesser General Public License for more details. *
017: * *
018: * You should have received a copy of the GNU Lesser General Public *
019: * License along with this software; if not, write to the Free *
020: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
021: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
022: ******************************************************************************/package org.jboss.portal.migration.model20.impl.role;
023:
024: import org.jboss.portal.migration.model20.model.Role20;
025:
026: import java.util.HashSet;
027: import java.util.Set;
028:
029: /**
030: * @author <a href="mailto:julien@jboss.org">Julien Viet </a>
031: * @author <a href="mailto:theute@jboss.org">Thomas Heute </a>
032: * @author Roy Russo : roy at jboss dot org
033: * @version $Revision: 8784 $
034: * @hibernate.class table="jbp_roles"
035: */
036: public class Role20Impl implements Role20 {
037:
038: //private Integer id;
039: public Integer id;
040:
041: //private String name;
042: public String name;
043:
044: //private Set users;
045: public Set users;
046:
047: //private String displayName;
048: public String displayName;
049:
050: //private Integer rid; // role_ID
051: public Integer rid; // role_ID
052:
053: /** Called by hibernate. */
054: public Role20Impl() {
055: this .id = null;
056: this .name = null;
057: this .users = new HashSet();
058: }
059:
060: public Role20Impl(String name) {
061: this .id = null;
062: this .name = name;
063: this .displayName = name;
064: this .users = new HashSet();
065: }
066:
067: public Role20Impl(String name, String displayName) {
068: this .id = null;
069: this .name = name;
070: this .displayName = displayName;
071: this .users = new HashSet();
072: }
073:
074: /** Called by hibernate. */
075: private void setID(Integer id) {
076: this .id = id;
077: }
078:
079: /** Called by hibernate. */
080: public void setName(String name) {
081: this .name = name;
082: }
083:
084: /** Called by hibernate. */
085: public void setDisplayName(String displayName) {
086: this .displayName = displayName;
087: }
088:
089: /** Called by hibernate. */
090: private void setUsers(Set users) {
091: this .users = users;
092: }
093:
094: // ******************************************************************************************************************
095:
096: /** @hibernate.id column="jbp_rid" generator-class="native" */
097: public Integer getID() {
098: return id;
099: }
100:
101: /** @hibernate.property column="jbp_name" unique="true" update="false" */
102: public String getName() {
103: return name;
104: }
105:
106: /** @hibernate.property column="jbp_displayname" unique="true" update="true" */
107: public String getDisplayName() {
108: return displayName;
109: }
110:
111: /**
112: * @hibernate.set inverse="true" table="jbp_role_membership" lazy="true" cascade="none"
113: * @hibernate.collection-key column="jbp_rid"
114: * @hibernate.collection-many-to-many column="jbp_uid" class="org.jboss.portal.core.impl.user.UserImpl"
115: * outer-join="false"
116: */
117: public Set getUsers() {
118: return users;
119: }
120:
121: public String toString() {
122: return "Role[" + id + "," + name + "]";
123: }
124: }
|