This project has retired. For details please refer to its Attic page.
JdoRole xref
View Javadoc

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