| | |
| | | } |
| | | |
| | | |
| | | |
| | | private ResultCode typeConformsToSchemaError = null; |
| | | |
| | | /** |
| | | * Returns a error when entry type does not conform to a schema |
| | | * requirements. Otherwise returns {@code null} |
| | | **/ |
| | | public ResultCode getTypeConformsToSchemaError() { |
| | | return typeConformsToSchemaError; |
| | | } |
| | | /** |
| | | * Indicates whether this entry conforms to the server's schema |
| | | * requirements. The checks performed by this method include: |
| | |
| | | boolean validateStructureRules, |
| | | LocalizableMessageBuilder invalidReason) |
| | | { |
| | | typeConformsToSchemaError = OBJECTCLASS_VIOLATION; |
| | | // Get the structural objectclass for the entry. If there isn't |
| | | // one, or if there's more than one, then see if that's OK. |
| | | AcceptRejectWarn structuralPolicy = |
| | |
| | | |
| | | if (validateNameForms) |
| | | { |
| | | typeConformsToSchemaError = NAMING_VIOLATION; |
| | | /** |
| | | * There may be multiple nameforms registered with this |
| | | * structural objectclass.However, we need to select only one |
| | |
| | | LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder(); |
| | | if (! entry.conformsToSchema(parentEntry, true, true, true, invalidReason)) |
| | | { |
| | | throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, |
| | | throw new DirectoryException(entry.getTypeConformsToSchemaError(), |
| | | invalidReason.toMessage()); |
| | | } |
| | | |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions copyright 2024 3A Systems,LLC. |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | if (! newEntry.conformsToSchema(null, false, true, true, |
| | | invalidReason)) |
| | | { |
| | | throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, |
| | | throw new DirectoryException(newEntry.getTypeConformsToSchemaError(), |
| | | ERR_MODDN_VIOLATES_SCHEMA.get(entryDN, invalidReason)); |
| | | } |
| | | |
| | |
| | | if (! newEntry.conformsToSchema(null, false, true, true, |
| | | invalidReason)) |
| | | { |
| | | throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, |
| | | throw new DirectoryException(newEntry.getTypeConformsToSchemaError(), |
| | | ERR_MODDN_PREOP_VIOLATES_SCHEMA.get(entryDN, invalidReason)); |
| | | } |
| | | } |
| | |
| | | LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder(); |
| | | if (!modifiedEntry.conformsToSchema(null, false, false, false, invalidReason)) |
| | | { |
| | | setResultCode(ResultCode.OBJECTCLASS_VIOLATION); |
| | | setResultCode(modifiedEntry.getTypeConformsToSchemaError()); |
| | | appendErrorMessage(ERR_MODIFY_VIOLATES_SCHEMA.get(entryDN, invalidReason)); |
| | | return; |
| | | } |