opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
@@ -1907,7 +1907,7 @@ dcr.getProhibitedAttributes().contains(removeType)) { LocalizableMessage message = ERR_SCHEMA_MODIFY_REMOVE_AT_IN_DCR.get( removeType.getNameOrOID(), dcr.getName()); removeType.getNameOrOID(), dcr.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } } @@ -2220,7 +2220,7 @@ dcr.getAuxiliaryClasses().contains(removeClass)) { LocalizableMessage message = ERR_SCHEMA_MODIFY_REMOVE_OC_IN_DCR.get( removeClass.getNameOrOID(), dcr.getName()); removeClass.getNameOrOID(), dcr.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } } @@ -2542,8 +2542,8 @@ else { LocalizableMessage message = ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_DCR. get(ditContentRule.getName(), existingDCR.getName(), dcr.getName()); get(ditContentRule.getNameOrOID(), existingDCR.getNameOrOID(), dcr.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } @@ -2562,8 +2562,8 @@ if ((existingRuleForClass != null) && (existingRuleForClass != existingDCR)) { LocalizableMessage message = ERR_SCHEMA_MODIFY_STRUCTURAL_OC_CONFLICT_FOR_ADD_DCR. get(ditContentRule.getName(), structuralClass.getNameOrOID(), existingRuleForClass.getName()); get(ditContentRule.getNameOrOID(), structuralClass.getNameOrOID(), existingRuleForClass.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } @@ -2574,21 +2574,21 @@ if (! schema.hasObjectClass(structuralClass.getOID())) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_UNDEFINED_STRUCTURAL_OC.get( ditContentRule.getName(), structuralClass.getNameOrOID()); ditContentRule.getNameOrOID(), structuralClass.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } if (structuralClass.getObjectClassType() != ObjectClassType.STRUCTURAL) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_OC_NOT_STRUCTURAL.get( ditContentRule.getName(), structuralClass.getNameOrOID()); ditContentRule.getNameOrOID(), structuralClass.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } if (structuralClass.isObsolete()) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_STRUCTURAL_OC_OBSOLETE.get( ditContentRule.getName(), structuralClass.getNameOrOID()); ditContentRule.getNameOrOID(), structuralClass.getNameOrOID()); throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); } @@ -2597,19 +2597,19 @@ if (! schema.hasObjectClass(oc.getOID())) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_UNDEFINED_AUXILIARY_OC.get( ditContentRule.getName(), oc.getNameOrOID()); ditContentRule.getNameOrOID(), oc.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } if (oc.getObjectClassType() != ObjectClassType.AUXILIARY) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_OC_NOT_AUXILIARY.get( ditContentRule.getName(), oc.getNameOrOID()); ditContentRule.getNameOrOID(), oc.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } if (oc.isObsolete()) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_OBSOLETE_AUXILIARY_OC.get( ditContentRule.getName(), oc.getNameOrOID()); ditContentRule.getNameOrOID(), oc.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } } @@ -2619,13 +2619,13 @@ if (! schema.hasAttributeType(at.getOID())) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_UNDEFINED_REQUIRED_ATTR.get( ditContentRule.getName(), at.getNameOrOID()); ditContentRule.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } else if (at.isObsolete()) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_OBSOLETE_REQUIRED_ATTR.get( ditContentRule.getName(), at.getNameOrOID()); ditContentRule.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); } } @@ -2635,13 +2635,13 @@ if (! schema.hasAttributeType(at.getOID())) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_UNDEFINED_OPTIONAL_ATTR.get( ditContentRule.getName(), at.getNameOrOID()); ditContentRule.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } else if (at.isObsolete()) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_OBSOLETE_OPTIONAL_ATTR.get( ditContentRule.getName(), at.getNameOrOID()); ditContentRule.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); } } @@ -2651,13 +2651,13 @@ if (! schema.hasAttributeType(at.getOID())) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_UNDEFINED_PROHIBITED_ATTR.get( ditContentRule.getName(), at.getNameOrOID()); ditContentRule.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } else if (at.isObsolete()) { LocalizableMessage message = ERR_SCHEMA_MODIFY_DCR_OBSOLETE_PROHIBITED_ATTR.get( ditContentRule.getName(), at.getNameOrOID()); ditContentRule.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); } } @@ -2754,7 +2754,7 @@ if ((removeDCR == null) || (! removeDCR.equals(ditContentRule))) { LocalizableMessage message = ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_DCR.get(ditContentRule.getName()); ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_DCR.get(ditContentRule.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java
@@ -26,7 +26,6 @@ */ package org.opends.server.types; import org.forgerock.opendj.ldap.ByteString; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -35,13 +34,12 @@ import java.util.Map; import java.util.Set; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.ByteString; import org.opends.server.schema.DITContentRuleSyntax; import org.forgerock.i18n.slf4j.LocalizedLogger; import static org.opends.server.util.ServerConstants.*; import static org.forgerock.util.Reject.*; import static org.opends.server.util.ServerConstants.*; /** * This class defines a DIT content rule, which defines the set of @@ -236,6 +234,7 @@ * @return The definition string used to create this DIT content * rule. */ @Override public String getDefinition() { return definition; @@ -246,6 +245,7 @@ /** * {@inheritDoc} */ @Override public DITContentRule recreateFromDefinition(Schema schema) throws DirectoryException { @@ -294,7 +294,7 @@ * @return The primary name to use to reference this DIT content * rule, or {@code null} if there is none. */ public String getName() public String getNameOrOID() { if (names.isEmpty()) { @@ -334,6 +334,7 @@ * for this DIT content rule, or {@code null} if it is not * known or if it is not stored in any schema file. */ @Override public String getSchemaFile() { List<String> values = @@ -355,6 +356,7 @@ * @param schemaFile The name of the schema file that contains the * definition for this DIT content rule. */ @Override public void setSchemaFile(String schemaFile) { setExtraProperty(SCHEMA_PROPERTY_FILENAME, schemaFile); @@ -363,19 +365,6 @@ /** * Retrieves the description for this DIT content rule. * * @return The description for this DIT content rule, or * {@code null} if there is none. */ public String getDescription() { return description; } /** * Retrieves the set of auxiliary objectclasses that may be used for * entries associated with this DIT content rule. * @@ -390,24 +379,6 @@ /** * Indicates whether the provided auxiliary objectclass is allowed * for use by this DIT content rule. * * @param auxiliaryClass The auxiliary objectclass for which to * make the determination. * * @return {@code true} if the provided auxiliary objectclass is * allowed for use by this DIT content rule, or * {@code false} if not. */ public boolean isAllowedAuxiliaryClass(ObjectClass auxiliaryClass) { return auxiliaryClasses.contains(auxiliaryClass); } /** * Retrieves the set of required attributes for this DIT content * rule. * @@ -489,38 +460,6 @@ /** * Indicates whether the provided attribute type is in the list of * required or optional attributes for this DIT content rule. * * @param attributeType The attribute type for which to make the * determination. * @param acceptEmpty Indicates whether an empty list of * required or optional attributes should be * taken to indicate that all attributes * allowed for an objectclass will be * acceptable. * * @return {@code true} if the provided attribute type is required * or allowed for this DIT content rule, or {@code false} * if it is not. */ public boolean isRequiredOrOptional(AttributeType attributeType, boolean acceptEmpty) { if (acceptEmpty && (requiredAttributes.isEmpty() || optionalAttributes.isEmpty())) { return true; } return (requiredAttributes.contains(attributeType) || optionalAttributes.contains(attributeType)); } /** * Retrieves the set of prohibited attributes for this DIT content * rule. * @@ -533,25 +472,6 @@ } /** * Indicates whether the provided attribute type is included in the * prohibited attribute list for this DIT content rule. * * @param attributeType The attribute type for which to make the * determination. * * @return {@code true} if the provided attribute type is * prohibited for this DIT content rule, or {@code false} * if not. */ public boolean isProhibited(AttributeType attributeType) { return prohibitedAttributes.contains(attributeType); } /** * Indicates whether this DIT content rule is declared "obsolete". * @@ -582,24 +502,6 @@ /** * Retrieves the value of the specified "extra" property for this * DIT content rule. * * @param propertyName The name of the "extra" property for which * to retrieve the value. * * @return The value of the specified "extra" property for this DIT * content rule, or {@code null} if no such property is * defined. */ public List<String> getExtraProperty(String propertyName) { return extraProperties.get(propertyName); } /** * Specifies the provided "extra" property for this DIT content * rule. * @@ -608,7 +510,7 @@ * @param value The value for the "extra" property, or * {@code null} if the property is to be removed. */ public void setExtraProperty(String name, String value) private void setExtraProperty(String name, String value) { ifNull(name); @@ -628,32 +530,6 @@ /** * Specifies the provided "extra" property for this DIT content * rule. * * @param name The name for the "extra" property. It must not * be {@code null}. * @param values The set of value for the "extra" property, or * {@code null} if the property is to be removed. */ public void setExtraProperty(String name, List<String> values) { ifNull(name); if ((values == null) || values.isEmpty()) { extraProperties.remove(name); } else { LinkedList<String> valuesCopy = new LinkedList<String>(values); extraProperties.put(name, valuesCopy); } } /** * Indicates whether the provided object is equal to this DIT * content rule. The object will be considered equal if it is a DIT * content rule for the same structural objectclass and the same @@ -667,6 +543,7 @@ * @return {@code true} if the provided object is equal to * this DIT content rule, or {@code false} if not. */ @Override public boolean equals(Object o) { if (this == o) @@ -710,6 +587,7 @@ * * @return The hash code for this DIT content rule. */ @Override public int hashCode() { return structuralClass.hashCode(); @@ -724,6 +602,7 @@ * @return The string representation of this DIT content rule in * the form specified in RFC 2252. */ @Override public String toString() { StringBuilder buffer = new StringBuilder(); opendj3-server-dev/src/server/org/opends/server/types/Entry.java
@@ -1997,7 +1997,7 @@ ERR_ENTRY_SCHEMA_DISALLOWED_AUXILIARY_CLASS.get( dn, o.getNameOrOID(), ditContentRule.getName()); ditContentRule.getNameOrOID()); if (structuralPolicy == AcceptRejectWarn.REJECT) { invalidReason.append(message); @@ -2207,7 +2207,7 @@ ERR_ENTRY_SCHEMA_MISSING_REQUIRED_ATTR_FOR_DCR.get( dn, t.getNameOrOID(), ditContentRule.getName()); ditContentRule.getNameOrOID()); if (structuralPolicy == AcceptRejectWarn.REJECT) { @@ -2231,7 +2231,7 @@ ERR_ENTRY_SCHEMA_PROHIBITED_ATTR_FOR_DCR.get( dn, t.getNameOrOID(), ditContentRule.getName()); ditContentRule.getNameOrOID()); if (structuralPolicy == AcceptRejectWarn.REJECT) { opendj3-server-dev/src/server/org/opends/server/types/Schema.java
@@ -2507,9 +2507,9 @@ ditContentRules.get(objectClass); LocalizableMessage message = ERR_SCHEMA_CONFLICTING_DIT_CONTENT_RULE. get(ditContentRule.getName(), get(ditContentRule.getNameOrOID(), objectClass.getNameOrOID(), conflictingRule.getName()); conflictingRule.getNameOrOID()); throw new DirectoryException( ResultCode.CONSTRAINT_VIOLATION, message); }