opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java
@@ -886,6 +886,10 @@ return false; } if (!isObsolete() && superiorClass.isObsolete()) { warnings.add(WARN_OBJECTCLASS_HAS_OBSOLETE_SUPERIOR_CLASS.get(getNameOrOID(), superClassOid)); } // Make sure that the inheritance configuration is acceptable. final ObjectClassType superiorType = superiorClass.getObjectClassType(); final ObjectClassType type = getObjectClassType(); @@ -1015,6 +1019,10 @@ failValidation(invalidSchemaElements, warnings, message); return false; } if (!isObsolete() && attributeType.isObsolete()) { warnings.add(WARN_OBJECTCLASS_HAS_OBSOLETE_REQUIRED_ATTR.get(getNameOrOID(), requiredAttribute)); } declaredRequiredAttributes.add(attributeType); } if (requiredAttributes == Collections.EMPTY_SET) { @@ -1039,6 +1047,10 @@ failValidation(invalidSchemaElements, warnings, message); return false; } if (!isObsolete() && attributeType.isObsolete()) { warnings.add(WARN_OBJECTCLASS_HAS_OBSOLETE_OPTIONAL_ATTR.get(getNameOrOID(), optionalAttribute)); } declaredOptionalAttributes.add(attributeType); } if (optionalAttributes == Collections.EMPTY_SET) { opendj-core/src/main/resources/com/forgerock/opendj/ldap/core.properties
@@ -1627,7 +1627,13 @@ ERR_TEMPLATE_FILE_INVALID_LEADING_SPACE=Unable to parse line %d ("%s") from the \ template file because the line started with a space but there were no previous \ lines in the entry to which this line could be appended WARN_OBJECTCLASS_HAS_OBSOLETE_SUPERIOR_CLASS=The object class "%s" specifies the \ superior object class "%s" which is marked as OBSOLETE in the schema WARN_OBJECTCLASS_HAS_OBSOLETE_REQUIRED_ATTR=The object class "%s" specifies the \ required attribute type "%s" which is marked as OBSOLETE in the schema WARN_OBJECTCLASS_HAS_OBSOLETE_OPTIONAL_ATTR=The object class "%s" specifies the \ optional attribute type "%s" which is marked as OBSOLETE in the schema required attribute type "%s" which is marked as OBSOLETE in the schema # Labels for generated documentation DOC_LOCALE_TAG=Code tag: %s DOC_LOCALE_OID=Collation order object identifier: %s opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -1244,57 +1244,6 @@ } } // Make sure that the new objectclass doesn't reference an undefined // superior class, or an undefined required or optional attribute type, // and that none of them are OBSOLETE. for(ObjectClass superiorClass : objectClass.getSuperiorClasses()) { if (! schema.hasObjectClass(superiorClass.getOID())) { LocalizableMessage message = ERR_SCHEMA_MODIFY_UNDEFINED_SUPERIOR_OBJECTCLASS.get( objectClass.getNameOrOID(), superiorClass.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } else if (superiorClass.isObsolete()) { LocalizableMessage message = ERR_SCHEMA_MODIFY_OBSOLETE_SUPERIOR_OBJECTCLASS.get( objectClass.getNameOrOID(), superiorClass.getNameOrOID()); throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); } } for (AttributeType at : objectClass.getDeclaredRequiredAttributes()) { if (! schema.hasAttributeType(at.getOID())) { LocalizableMessage message = ERR_SCHEMA_MODIFY_OC_UNDEFINED_REQUIRED_ATTR.get( objectClass.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } else if (at.isObsolete()) { LocalizableMessage message = ERR_SCHEMA_MODIFY_OC_OBSOLETE_REQUIRED_ATTR.get( objectClass.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); } } for (AttributeType at : objectClass.getDeclaredOptionalAttributes()) { if (! schema.hasAttributeType(at.getOID())) { LocalizableMessage message = ERR_SCHEMA_MODIFY_OC_UNDEFINED_OPTIONAL_ATTR.get( objectClass.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); } else if (at.isObsolete()) { LocalizableMessage message = ERR_SCHEMA_MODIFY_OC_OBSOLETE_OPTIONAL_ATTR.get( objectClass.getNameOrOID(), at.getNameOrOID()); throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); } } // If there is no existing class, then we're adding a new objectclass. // Otherwise, we're replacing an existing one. if (existingClass.isPlaceHolder()) opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
@@ -1497,7 +1497,8 @@ "SUP testAddOCObsoleteSuperiorSup STRUCTURAL MUST cn " + "X-ORIGIN 'SchemaBackendTestCase' )"); runModify(argsNotPermissive(), ldif, CONSTRAINT_VIOLATION); // object class is obsolete so having an obsolete superior is OK runModify(argsNotPermissive(), ldif, SUCCESS); } /**