/** * Validates newName. Name must be not null and unique. * * @param oldName old name * @param newName new name * @param projectId project ID * @param handler validation and permission check handler */ protected void validateName(Handler handler, String oldName, String newName, Long projectId) { if (StringUtils.isBlank(newName)) { // New component name cannot be null or empty string handler.addErrorKey(FIELD_NAME, KEY_NAME_NOT_SET, null, ErrorCollection.Reason.VALIDATION_FAILED); } else if (!newName.equalsIgnoreCase(oldName) && projectComponentManager.containsName(newName, projectId)) { // You must specify a UNIQUE newName for this component. New name is already being used handler.addErrorKey(FIELD_NAME, KEY_NAME_NOT_UNIQUE, newName, ErrorCollection.Reason.VALIDATION_FAILED); } }