for (FieldTypeEntry fieldTypeEntry : fieldTypeEntries) {
if (fieldTypeEntry.isMandatory()) {
FieldType fieldType = getTypeManager().getFieldTypeById(fieldTypeEntry.getFieldTypeId());
QName fieldName = fieldType.getName();
if (fieldsToDelete.contains(fieldName)) {
throw new InvalidRecordException("Field: '" + fieldName + "' is mandatory.", record.getId());
}
if (!record.hasField(fieldName) && !originalRecord.hasField(fieldName)) {
throw new InvalidRecordException("Field: '" + fieldName + "' is mandatory.", record.getId());
}
}
}
}