View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0;
9   
10  /**
11   * Class JdoRole.
12   * 
13   * @version $Revision$ $Date$
14   */
15  public class JdoRole
16      extends org.codehaus.plexus.security.rbac.AbstractRole
17      implements org.codehaus.plexus.security.rbac.Role, java.io.Serializable
18  {
19  
20        //--------------------------/
21       //- Class/Member Variables -/
22      //--------------------------/
23  
24      /**
25       * Field name.
26       */
27      private String name;
28  
29      /**
30       * Field description.
31       */
32      private String description;
33  
34      /**
35       * 
36       *             true if this role is available to be assigned to
37       * a user
38       *           .
39       */
40      private boolean assignable = false;
41  
42      /**
43       * 
44       *             true if this object is permanent.
45       *           
46       */
47      private boolean permanent = false;
48  
49      /**
50       * Field childRoleNames.
51       */
52      private java.util.List/*<String>*/ childRoleNames = new java.util.ArrayList/*<String>*/();
53  
54      /**
55       * Field permissions.
56       */
57      private java.util.List/*<JdoPermission>*/ permissions = new java.util.ArrayList/*<JdoPermission>*/();
58  
59  
60        //-----------/
61       //- Methods -/
62      //-----------/
63  
64      /**
65       * Method addChildRoleName.
66       * 
67       * @param string
68       */
69      public void addChildRoleName( String string )
70      {
71          getChildRoleNames().add( string );
72      } //-- void addChildRoleName( String )
73  
74      /**
75       * Method addPermission.
76       * 
77       * @param jdoPermission
78       */
79      public void addPermission( org.codehaus.plexus.security.rbac.Permission jdoPermission )
80      {
81          if ( !( jdoPermission instanceof JdoPermission ) )
82          {
83              throw new ClassCastException( "JdoRole.addPermissions( jdoPermission ) parameter must be instanceof " + JdoPermission.class.getName() );
84          }
85          getPermissions().add( ( (JdoPermission) jdoPermission ) );
86      } //-- void addPermission( org.codehaus.plexus.security.rbac.Permission )
87  
88      /**
89       * Method equals.
90       * 
91       * @param other
92       * @return boolean
93       */
94      public boolean equals( Object other )
95      {
96          if ( this == other )
97          {
98              return true;
99          }
100 
101         if ( !( other instanceof JdoRole ) )
102         {
103             return false;
104         }
105 
106         JdoRole that = (JdoRole) other;
107         boolean result = true;
108 
109         result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
110         result = result && ( super.equals( other ) );
111 
112         return result;
113     } //-- boolean equals( Object )
114 
115     /**
116      * Method getChildRoleNames.
117      * 
118      * @return List
119      */
120     public java.util.List/*<String>*/ getChildRoleNames()
121     {
122         return this.childRoleNames;
123     } //-- java.util.List/*<String>*/ getChildRoleNames()
124 
125     /**
126      * Get the description field.
127      * 
128      * @return String
129      */
130     public String getDescription()
131     {
132         return this.description;
133     } //-- String getDescription()
134 
135     /**
136      * Get the name field.
137      * 
138      * @return String
139      */
140     public String getName()
141     {
142         return this.name;
143     } //-- String getName()
144 
145     /**
146      * Method getPermissions.
147      * 
148      * @return List
149      */
150     public java.util.List/*<JdoPermission>*/ getPermissions()
151     {
152         return this.permissions;
153     } //-- java.util.List/*<JdoPermission>*/ getPermissions()
154 
155     /**
156      * Method hashCode.
157      * 
158      * @return int
159      */
160     public int hashCode()
161     {
162         int result = 17;
163 
164         result = 37 * result + ( name != null ? name.hashCode() : 0 );
165         result = 37 * result + super.hashCode();
166 
167         return result;
168     } //-- int hashCode()
169 
170     /**
171      * Get true if this role is available to be assigned to a user.
172      * 
173      * @return boolean
174      */
175     public boolean isAssignable()
176     {
177         return this.assignable;
178     } //-- boolean isAssignable()
179 
180     /**
181      * Get true if this object is permanent.
182      * 
183      * @return boolean
184      */
185     public boolean isPermanent()
186     {
187         return this.permanent;
188     } //-- boolean isPermanent()
189 
190     /**
191      * Method removeChildRoleName.
192      * 
193      * @param string
194      */
195     public void removeChildRoleName( String string )
196     {
197         getChildRoleNames().remove( string );
198     } //-- void removeChildRoleName( String )
199 
200     /**
201      * Method removePermission.
202      * 
203      * @param jdoPermission
204      */
205     public void removePermission( org.codehaus.plexus.security.rbac.Permission jdoPermission )
206     {
207         if ( !( jdoPermission instanceof JdoPermission ) )
208         {
209             throw new ClassCastException( "JdoRole.removePermissions( jdoPermission ) parameter must be instanceof " + JdoPermission.class.getName() );
210         }
211         getPermissions().remove( ( (JdoPermission) jdoPermission ) );
212     } //-- void removePermission( org.codehaus.plexus.security.rbac.Permission )
213 
214     /**
215      * Set true if this role is available to be assigned to a user.
216      * 
217      * @param assignable
218      */
219     public void setAssignable( boolean assignable )
220     {
221         this.assignable = assignable;
222     } //-- void setAssignable( boolean )
223 
224     /**
225      * Set roles that will inherit the permissions of this role.
226      * 
227      * @param childRoleNames
228      */
229     public void setChildRoleNames( java.util.List/*<String>*/ childRoleNames )
230     {
231         this.childRoleNames = childRoleNames;
232     } //-- void setChildRoleNames( java.util.List )
233 
234     /**
235      * Set the description field.
236      * 
237      * @param description
238      */
239     public void setDescription( String description )
240     {
241         this.description = description;
242     } //-- void setDescription( String )
243 
244     /**
245      * Set the name field.
246      * 
247      * @param name
248      */
249     public void setName( String name )
250     {
251         this.name = name;
252     } //-- void setName( String )
253 
254     /**
255      * Set true if this object is permanent.
256      * 
257      * @param permanent
258      */
259     public void setPermanent( boolean permanent )
260     {
261         this.permanent = permanent;
262     } //-- void setPermanent( boolean )
263 
264     /**
265      * Set the permissions field.
266      * 
267      * @param permissions
268      */
269     public void setPermissions( java.util.List/*<JdoPermission>*/ permissions )
270     {
271         this.permissions = permissions;
272     } //-- void setPermissions( java.util.List )
273 
274     /**
275      * Method toString.
276      * 
277      * @return String
278      */
279     public java.lang.String toString()
280     {
281         StringBuffer buf = new StringBuffer( 128 );
282 
283         buf.append( "name = '" );
284         buf.append( getName() );
285         buf.append( "'" );
286         buf.append( "\n" );
287         buf.append( super.toString() );
288 
289         return buf.toString();
290     } //-- java.lang.String toString()
291 
292 }