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 JdoPermission.
12   * 
13   * @version $Revision$ $Date$
14   */
15  public class JdoPermission
16      implements org.codehaus.plexus.security.rbac.Permission, java.io.Serializable
17  {
18  
19        //--------------------------/
20       //- Class/Member Variables -/
21      //--------------------------/
22  
23      /**
24       * Field name.
25       */
26      private String name;
27  
28      /**
29       * Field description.
30       */
31      private String description;
32  
33      /**
34       * 
35       *             true if this object is permanent.
36       *           
37       */
38      private boolean permanent = false;
39  
40      /**
41       * Field operation.
42       */
43      private JdoOperation operation;
44  
45      /**
46       * Field resource.
47       */
48      private JdoResource resource;
49  
50  
51        //-----------/
52       //- Methods -/
53      //-----------/
54  
55      /**
56       * Method equals.
57       * 
58       * @param other
59       * @return boolean
60       */
61      public boolean equals( Object other )
62      {
63          if ( this == other )
64          {
65              return true;
66          }
67  
68          if ( !( other instanceof JdoPermission ) )
69          {
70              return false;
71          }
72  
73          JdoPermission that = (JdoPermission) other;
74          boolean result = true;
75  
76          result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
77  
78          return result;
79      } //-- boolean equals( Object )
80  
81      /**
82       * Get the description field.
83       * 
84       * @return String
85       */
86      public String getDescription()
87      {
88          return this.description;
89      } //-- String getDescription()
90  
91      /**
92       * Get the name field.
93       * 
94       * @return String
95       */
96      public String getName()
97      {
98          return this.name;
99      } //-- String getName()
100 
101     /**
102      * Get the operation field.
103      * 
104      * @return Operation
105      */
106     public org.codehaus.plexus.security.rbac.Operation getOperation()
107     {
108         return (org.codehaus.plexus.security.rbac.Operation) this.operation;
109     } //-- org.codehaus.plexus.security.rbac.Operation getOperation()
110 
111     /**
112      * Get the resource field.
113      * 
114      * @return Resource
115      */
116     public org.codehaus.plexus.security.rbac.Resource getResource()
117     {
118         return (org.codehaus.plexus.security.rbac.Resource) this.resource;
119     } //-- org.codehaus.plexus.security.rbac.Resource getResource()
120 
121     /**
122      * Method hashCode.
123      * 
124      * @return int
125      */
126     public int hashCode()
127     {
128         int result = 17;
129 
130         result = 37 * result + ( name != null ? name.hashCode() : 0 );
131 
132         return result;
133     } //-- int hashCode()
134 
135     /**
136      * Get true if this object is permanent.
137      * 
138      * @return boolean
139      */
140     public boolean isPermanent()
141     {
142         return this.permanent;
143     } //-- boolean isPermanent()
144 
145     /**
146      * Set the description field.
147      * 
148      * @param description
149      */
150     public void setDescription( String description )
151     {
152         this.description = description;
153     } //-- void setDescription( String )
154 
155     /**
156      * Set the name field.
157      * 
158      * @param name
159      */
160     public void setName( String name )
161     {
162         this.name = name;
163     } //-- void setName( String )
164 
165     /**
166      * Set the operation field.
167      * 
168      * @param operation
169      */
170     public void setOperation( org.codehaus.plexus.security.rbac.Operation operation )
171     {
172         if ( !( operation instanceof JdoOperation ) )
173         {
174             throw new ClassCastException( "JdoPermission.setOperation( operation ) parameter must be instanceof " + JdoOperation.class.getName() );
175         }
176         this.operation = (JdoOperation) operation;
177     } //-- void setOperation( org.codehaus.plexus.security.rbac.Operation )
178 
179     /**
180      * Set true if this object is permanent.
181      * 
182      * @param permanent
183      */
184     public void setPermanent( boolean permanent )
185     {
186         this.permanent = permanent;
187     } //-- void setPermanent( boolean )
188 
189     /**
190      * Set the resource field.
191      * 
192      * @param resource
193      */
194     public void setResource( org.codehaus.plexus.security.rbac.Resource resource )
195     {
196         if ( !( resource instanceof JdoResource ) )
197         {
198             throw new ClassCastException( "JdoPermission.setResource( resource ) parameter must be instanceof " + JdoResource.class.getName() );
199         }
200         this.resource = (JdoResource) resource;
201     } //-- void setResource( org.codehaus.plexus.security.rbac.Resource )
202 
203     /**
204      * Method toString.
205      * 
206      * @return String
207      */
208     public java.lang.String toString()
209     {
210         StringBuffer buf = new StringBuffer( 128 );
211 
212         buf.append( "name = '" );
213         buf.append( getName() );
214         buf.append( "'" );
215 
216         return buf.toString();
217     } //-- java.lang.String toString()
218 
219 }