Source:
<code>public void validate(Object object, Errors errors) { AppConfig appConfig = (AppConfig)object; if (!isNew && isBlank(appConfig.getGuid())) { errors.rejectValue("guid", "is required"); } if (isBlank(appConfig.getLabel())) { errors.rejectValue("label", "is required"); } if (appConfig.getCriteria() == null) { errors.rejectValue("criteria", "are required"); } else { CriteriaUtils.validate(appConfig.getCriteria(), dataGroups, errors); } if (isBlank(appConfig.getStudyId())) { errors.rejectValue("studyId", "is required"); } else { if (appConfig.getSchemaReferences() != null) { StudyIdentifier studyId = new StudyIdentifierImpl(appConfig.getStudyId()); for (int i=0; i < appConfig.getSchemaReferences().size(); i++) { SchemaReference ref = appConfig.getSchemaReferences().get(i); errors.pushNestedPath("schemaReferences["+i+"]"); if (ref.getRevision() == null) { errors.rejectValue("revision", "is required"); } else { try { <START> schemaService.getUploadSchema(studyId, ref.getId()); <END> } catch(EntityNotFoundException e) { errors.rejectValue("", "does not refer to an upload schema"); } } errors.popNestedPath(); } } } if (appConfig.getSurveyReferences() != null) { for (int i=0; i < appConfig.getSurveyReferences().size(); i++) { SurveyReference ref = appConfig.getSurveyReferences().get(i); errors.pushNestedPath("surveyReferences["+i+"]"); if (ref.getCreatedOn() == null) { errors.rejectValue("createdOn", "is required"); } else { try { GuidCreatedOnVersionHolder keys = new GuidCreatedOnVersionHolderImpl(ref); Survey survey = surveyService.getSurvey(keys, false); if (!survey.isPublished()) { errors.rejectValue("", "has not been published"); } } catch(EntityNotFoundException e) { errors.rejectValue("", "does not refer to a survey"); } } errors.popNestedPath(); } } }</code><technical_language>ID valid, revision invalid. Consider getUploadSchemaByIdAndRev() instead</technical_language>

Target:
public void validate(Object object, Errors errors) { AppConfig appConfig = (AppConfig)object; if (!isNew && isBlank(appConfig.getGuid())) { errors.rejectValue("guid", "is required"); } if (isBlank(appConfig.getLabel())) { errors.rejectValue("label", "is required"); } if (appConfig.getCriteria() == null) { errors.rejectValue("criteria", "are required"); } else { CriteriaUtils.validate(appConfig.getCriteria(), dataGroups, errors); } if (isBlank(appConfig.getStudyId())) { errors.rejectValue("studyId", "is required"); } else { if (appConfig.getSchemaReferences() != null) { StudyIdentifier studyId = new StudyIdentifierImpl(appConfig.getStudyId()); for (int i=0; i < appConfig.getSchemaReferences().size(); i++) { SchemaReference ref = appConfig.getSchemaReferences().get(i); errors.pushNestedPath("schemaReferences["+i+"]"); if (ref.getRevision() == null) { errors.rejectValue("revision", "is required"); } else { try { schemaService.getUploadSchemaByIdAndRev(studyId, ref.getId(), ref.getRevision()); } catch(EntityNotFoundException e) { errors.rejectValue("", "does not refer to an upload schema"); } } errors.popNestedPath(); } } } if (appConfig.getSurveyReferences() != null) { for (int i=0; i < appConfig.getSurveyReferences().size(); i++) { SurveyReference ref = appConfig.getSurveyReferences().get(i); errors.pushNestedPath("surveyReferences["+i+"]"); if (ref.getCreatedOn() == null) { errors.rejectValue("createdOn", "is required"); } else { try { GuidCreatedOnVersionHolder keys = new GuidCreatedOnVersionHolderImpl(ref); Survey survey = surveyService.getSurvey(keys, false); if (!survey.isPublished()) { errors.rejectValue("", "has not been published"); } } catch(EntityNotFoundException e) { errors.rejectValue("", "does not refer to a survey"); } } errors.popNestedPath(); } } }