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.ObjectClassTypeEnum;
22  
23  
24  /***
25   * A bean used to encapsulate the literal String values of an ObjectClass
26   * definition found within an OpenLDAP schema configuration file.
27   *
28   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
29   * @version $Rev: 264732 $
30   */
31  public class ObjectClassLiteral
32  {
33      private boolean obsolete = false;
34  
35      private String oid;
36      private String description;
37  
38      private String[] names = ArrayUtils.EMPTY_STRING_ARRAY;
39      private String[] superiors = ArrayUtils.EMPTY_STRING_ARRAY;
40      private String[] must = ArrayUtils.EMPTY_STRING_ARRAY;
41      private String[] may = ArrayUtils.EMPTY_STRING_ARRAY;
42  
43      private ObjectClassTypeEnum classType = ObjectClassTypeEnum.STRUCTURAL;
44  
45  
46      // ------------------------------------------------------------------------
47      // C O N S T R U C T O R S
48      // ------------------------------------------------------------------------
49  
50  
51      public ObjectClassLiteral( String oid )
52      {
53          this.oid = oid;
54      }
55  
56  
57      // ------------------------------------------------------------------------
58      // Accessors and mutators
59      // ------------------------------------------------------------------------
60  
61  
62      public boolean isObsolete()
63      {
64          return obsolete;
65      }
66  
67      public void setObsolete( boolean obsolete )
68      {
69          this.obsolete = obsolete;
70      }
71  
72      public String getOid()
73      {
74          return oid;
75      }
76  
77      public void setOid( String oid )
78      {
79          this.oid = oid;
80      }
81  
82      public String getDescription()
83      {
84          return description;
85      }
86  
87      public void setDescription( String description )
88      {
89          this.description = description;
90      }
91  
92      public String[] getNames()
93      {
94          return names;
95      }
96  
97      public void setNames( String[] names )
98      {
99          this.names = names;
100     }
101 
102     public String[] getSuperiors()
103     {
104         return superiors;
105     }
106 
107     public void setSuperiors( String[] superiors )
108     {
109         this.superiors = superiors;
110     }
111 
112     public String[] getMust()
113     {
114         return must;
115     }
116 
117     public void setMust( String[] must )
118     {
119         this.must = must;
120     }
121 
122     public String[] getMay()
123     {
124         return may;
125     }
126 
127     public void setMay( String[] may )
128     {
129         this.may = may;
130     }
131 
132     public ObjectClassTypeEnum getClassType()
133     {
134         return classType;
135     }
136 
137     public void setClassType( ObjectClassTypeEnum classType )
138     {
139         this.classType = classType;
140     }
141 
142 
143     // ------------------------------------------------------------------------
144     // Object overrides
145     // ------------------------------------------------------------------------
146 
147 
148     public int hashCode()
149     {
150         return getOid().hashCode();
151     }
152 
153 
154     public boolean equals( Object obj )
155     {
156         if ( this == obj )
157         {
158             return true;
159         }
160 
161         if ( ! ( obj instanceof ObjectClassLiteral ) )
162         {
163             return false;
164         }
165 
166         return getOid().equals( ( ( ObjectClassLiteral ) obj ).getOid() );
167     }
168 
169 
170     public String toString()
171     {
172         return getOid();
173     }
174 }