View Javadoc

1   /*
2    *   Copyright 2004 The Apache Software Foundation
3    *
4    *   Licensed under the Apache License, Version 2.0 (the "License");
5    *   you may not use this file except in compliance with the License.
6    *   You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *   Unless required by applicable law or agreed to in writing, software
11   *   distributed under the License is distributed on an "AS IS" BASIS,
12   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *   See the License for the specific language governing permissions and
14   *   limitations under the License.
15   *
16   */
17  package org.apache.ldap.server.tools.schema;
18  
19  
20  import org.apache.ldap.common.util.ArrayUtils;
21  import org.apache.ldap.common.schema.UsageEnum;
22  
23  
24  /***
25   * A bean used to hold the literal values of an AttributeType parsed out of an
26   * OpenLDAP schema configuration file.
27   *
28   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
29   * @version $Rev: 157708 $
30   */
31  public class AttributeTypeLiteral
32  {
33      private boolean obsolete = false;
34      private boolean singleValue = false;
35      private boolean collective = false;
36      private boolean noUserModification = false;
37  
38      private final String oid;
39      private String description;
40      private String superior;
41      private String equality;
42      private String ordering;
43      private String substr;
44      private String syntax;
45  
46      private UsageEnum usage = UsageEnum.USERAPPLICATIONS;
47  
48      private String[] names = ArrayUtils.EMPTY_STRING_ARRAY;
49  
50      private int length = -1;
51  
52  
53      // ------------------------------------------------------------------------
54      // C O N S T R U C T O R S
55      // ------------------------------------------------------------------------
56  
57  
58      public AttributeTypeLiteral( String oid )
59      {
60          this.oid = oid;
61      }
62  
63  
64      // ------------------------------------------------------------------------
65      // Accessors and mutators
66      // ------------------------------------------------------------------------
67  
68  
69      public boolean isObsolete()
70      {
71          return obsolete;
72      }
73  
74      public void setObsolete( boolean obsolete )
75      {
76          this.obsolete = obsolete;
77      }
78  
79      public boolean isSingleValue()
80      {
81          return singleValue;
82      }
83  
84      public void setSingleValue( boolean singleValue )
85      {
86          this.singleValue = singleValue;
87      }
88  
89      public boolean isCollective()
90      {
91          return collective;
92      }
93  
94      public void setCollective( boolean collective )
95      {
96          this.collective = collective;
97      }
98  
99      public boolean isNoUserModification()
100     {
101         return noUserModification;
102     }
103 
104     public void setNoUserModification( boolean noUserModification )
105     {
106         this.noUserModification = noUserModification;
107     }
108 
109     public String getOid()
110     {
111         return oid;
112     }
113 
114     public String getDescription()
115     {
116         return description;
117     }
118 
119     public void setDescription( String description )
120     {
121         this.description = description;
122     }
123 
124     public String getSuperior()
125     {
126         return superior;
127     }
128 
129     public void setSuperior( String superior )
130     {
131         this.superior = superior;
132     }
133 
134     public String getEquality()
135     {
136         return equality;
137     }
138 
139     public void setEquality( String equality )
140     {
141         this.equality = equality;
142     }
143 
144     public String getOrdering()
145     {
146         return ordering;
147     }
148 
149     public void setOrdering( String ordering )
150     {
151         this.ordering = ordering;
152     }
153 
154     public String getSubstr()
155     {
156         return substr;
157     }
158 
159     public void setSubstr( String substr )
160     {
161         this.substr = substr;
162     }
163 
164     public String getSyntax()
165     {
166         return syntax;
167     }
168 
169     public void setSyntax( String syntax )
170     {
171         this.syntax = syntax;
172     }
173 
174     public UsageEnum getUsage()
175     {
176         return usage;
177     }
178 
179     public void setUsage( UsageEnum usage )
180     {
181         this.usage = usage;
182     }
183 
184     public String[] getNames()
185     {
186         return names;
187     }
188 
189     public void setNames( String[] names )
190     {
191         this.names = names;
192     }
193 
194     public int getLength()
195     {
196         return length;
197     }
198 
199     public void setLength( int length )
200     {
201         this.length = length;
202     }
203 
204 
205     // ------------------------------------------------------------------------
206     // Object overrides
207     // ------------------------------------------------------------------------
208 
209 
210     public int hashCode()
211     {
212         return getOid().hashCode();
213     }
214 
215 
216     public boolean equals( Object obj )
217     {
218         if ( this == obj )
219         {
220             return true;
221         }
222 
223         if ( ! ( obj instanceof AttributeTypeLiteral ) )
224         {
225             return false;
226         }
227 
228         return getOid().equals( ( ( AttributeTypeLiteral ) obj ).getOid() );
229     }
230 
231 
232     public String toString()
233     {
234         return getOid();
235     }
236 }