001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * docs/licenses/cddl.txt
011 * or http://www.opensource.org/licenses/cddl1.php.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * docs/licenses/cddl.txt.  If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 *      Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 *      Portions Copyright 2010-2024 Ping Identity Corporation
026 */
027package com.unboundid.directory.sdk.common.schema;
028
029
030
031import java.util.List;
032import java.util.Map;
033import java.util.Set;
034
035import com.unboundid.util.NotExtensible;
036import com.unboundid.util.ThreadSafety;
037import com.unboundid.util.ThreadSafetyLevel;
038
039
040
041/**
042 * This interface defines a set of methods that may be used to obtain
043 * information about a DIT content rule defined in the server schema.
044 */
045@NotExtensible()
046@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
047public interface DITContentRule
048{
049  /**
050   * Retrieves the list of names for this DIT content rule, if any.
051   *
052   * @return  The list of names for this DIT content rule, or an empty list if
053   *          there are no user-defined names.
054   */
055  List<String> getNames();
056
057
058
059  /**
060   * Retrieves the primary name for this DIT content rule, or the numeric OID
061   * of the structural object class no names are defined.
062   *
063   * @return The primary name or structural class OID for this DIT content rule.
064   */
065  String getNameOrOID();
066
067
068
069  /**
070   * Indicates whether the provided string is equal to any of the defined names
071   * or the OID of the structural class for this DIT content rule.
072   *
073   * @param  name  The name for which to make the determination.
074   *
075   * @return  {@code true} if the provided string matches one of the names or
076   *          the structural class OID for this DIT content rule, or
077   *          {@code false} if not.
078   */
079  boolean hasNameOrOID(final String name);
080
081
082
083  /**
084   * Retrieves the description for this DIT content rule, if any.
085   *
086   * @return  The description for this DIT content rule, or {@code null} if it
087   *          does not have a description.
088   */
089  String getDescription();
090
091
092
093  /**
094   * Retrieves the structural object class for this DIT content rule.
095   *
096   * @return  The structural object class for this DIT content rule.
097   */
098  ObjectClass getStructuralClass();
099
100
101
102  /**
103   * Retrieves the set of allowed auxiliary classes for this DIT content rule,
104   * if any.
105   *
106   * @return  The set of allowed auxiliary classes for this DIT content rule, or
107   *          an empty set if there are no associated auxiliary classes.
108   */
109  Set<ObjectClass> getAuxiliaryClasses();
110
111
112
113  /**
114   * Retrieves the set of required attributes for this DIT content rule, if any.
115   *
116   * @return  The set of required attributes for this DIT content rule, or an
117   *          empty list if there are no required attributes.
118   */
119  Set<AttributeType> getRequiredAttributes();
120
121
122
123  /**
124   * Indicates whether the provided attribute type is required by this DIT
125   * content rule.
126   *
127   * @param  t  The attribute type for which to make the determination.
128   *
129   * @return  {@code true} if the provided attribute type is required by this
130   *          DIT content rule, or {@code false} if not.
131   */
132  boolean isRequired(final AttributeType t);
133
134
135
136  /**
137   * Retrieves the set of optional attributes for this DIT content rule, if any.
138   *
139   * @return  The set of optional attributes for this DIT content rule, or an
140   *          empty set if there are no optional attributes.
141   */
142  Set<AttributeType> getOptionalAttributes();
143
144
145
146  /**
147   * Indicates whether the provided attribute type is optional for this DIT
148   * content rule.
149   *
150   * @param  t  The attribute type for which to make the determination.
151   *
152   * @return  {@code true} if the provided attribute type is optional for this
153   *          DIT content rule, or {@code false} if not.
154   */
155  boolean isOptional(final AttributeType t);
156
157
158
159  /**
160   * Indicates whether the provided attribute type is allowed for use with this
161   * DIT content rule as either a required or optional type.
162   *
163   * @param  t  The attribute type for which to make the determination.
164   *
165   * @return  {@code true} if the provided attribute type is allowed for use
166   *          with this DIT content rule, or {@code false} if not.
167   */
168  boolean isRequiredOrOptional(final AttributeType t);
169
170
171
172  /**
173   * Retrieves the set of prohibited attributes for this DIT content rule, if
174   * any.
175   *
176   * @return  The set of prohibited attributes for this DIT content rule, or an
177   *          empty set if there are no prohibited attributes.
178   */
179  Set<AttributeType> getProhibitedAttributes();
180
181
182
183  /**
184   * Indicates whether the provided attribute type is prohibited for this DIT
185   * content rule.
186   *
187   * @param  t  The attribute type for which to make the determination.
188   *
189   * @return  {@code true} if the provided attribute type is prohibited for this
190   *          DIT content rule, or {@code false} if not.
191   */
192  boolean isProhibited(final AttributeType t);
193
194
195
196  /**
197   * Indicates whether this DIT content rule is declared obsolete in the server
198   * schema.
199   *
200   * @return  {@code true} if this DIT content rule is declared obsolete in the
201   *          server schema, or {@code false} if not.
202   */
203  boolean isObsolete();
204
205
206
207  /**
208   * Retrieves a map of all defined extensions for this DIT content rule.
209   *
210   * @return  A map of all defined extensions for this DIT content rule.
211   */
212  Map<String,List<String>> getExtensions();
213
214
215
216  /**
217   * Retrieves the name of the schema file in which this DIT content rule is
218   * defined.
219   *
220   * @return  The name of the schema file in which this DIT content rule is
221   *          defined.
222   */
223  String getSchemaFileName();
224
225
226
227  /**
228   * Indicates whether the provided object is equal to this DIT content rule.
229   *
230   * @param  o  The object for which to make the determination.
231   *
232   * @return  {@code true} if the provided object is equal to this DIT content
233   *          rule, or {@code false} if not.
234   */
235  boolean equals(final Object o);
236
237
238
239  /**
240   * Retrieves a hash code for this DIT content rule.
241   *
242   * @return  A hash code for this DIT content rule.
243   */
244  int hashCode();
245
246
247
248  /**
249   * Retrieves a string representation of this DIT content rule definition.
250   *
251   * @return  A string representation of this DIT content rule definition.
252   */
253  String toString();
254}