return KeyVaultEntryForm.class.isAssignableFrom(clazz);
}
@Override
public void validate(Object target, Errors errors) {
KeyVaultEntryForm form = (KeyVaultEntryForm) target;
boolean isEdit = (form.getId() != null && form.getId() > 0);
if (!isEdit && (form.getApplicationType() == null || !form.getApplicationType().isKeyVaultCandidate())) {
errors.rejectValue(APPLICATION_TYPE_FIELD, "keyVaultEntryValidator.invalidApplicationType");
}
if (!StringUtils.hasText(form.getName())) {
errors.rejectValue(NAME_FIELD, "keyVaultEntryValidator.invalidName");
}
if (!errors.hasFieldErrors(APPLICATION_TYPE_FIELD) && !isEdit) {
switch (form.getApplicationType()) {
case IOS:
validateIOS(form, errors);
break;
default:
errors.rejectValue(APPLICATION_TYPE_FIELD, "keyVaultEntryValidator.invalidApplicationType");