Example usage for org.springframework.validation BindingResult rejectValue

List of usage examples for org.springframework.validation BindingResult rejectValue

Introduction

In this page you can find the example usage for org.springframework.validation BindingResult rejectValue.

Prototype

void rejectValue(@Nullable String field, String errorCode, String defaultMessage);

Source Link

Document

Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description.

Usage

From source file:org.egov.wtms.web.controller.application.RegularisedConnectionController.java

@PostMapping("/regulariseconnection-form/{id}")
public String createRegularisedConnection(@ModelAttribute WaterConnectionDetails waterConnectionDetails,
        @PathVariable Long id, BindingResult errors, Model model, HttpServletRequest request) {

    User currentUser = securityUtils.getCurrentUser();
    boolean citizenPortalUser = waterTaxUtils.isCitizenPortalUser(currentUser);
    boolean isCSCOperator = waterTaxUtils.isCSCoperator(currentUser);
    boolean isAnonymousUser = waterTaxUtils.isAnonymousUser(currentUser);
    boolean loggedUserIsMeesevaUser = waterTaxUtils.isMeesevaUser(currentUser);
    if (!isCSCOperator && !citizenPortalUser && !loggedUserIsMeesevaUser && !isAnonymousUser) {
        boolean isJuniorAsstOrSeniorAsst = waterTaxUtils
                .isLoggedInUserJuniorOrSeniorAssistant(currentUser.getId());
        if (!isJuniorAsstOrSeniorAsst)
            throw new ValidationException("err.creator.application");
    }/*from  w  w w.  j a  v  a 2 s.c  o m*/
    RegularisedConnection connection = null;
    if (id != null)
        connection = regularisedConnectionService.findById(id);
    if (connection != null) {
        waterConnectionDetails.setApplicationDate(connection.getApplicationDate());
        waterConnectionDetails.setApplicationNumber(connection.getApplicationNumber());
        if ("SURVEY".equals(connection.getSource()))
            waterConnectionDetails.setSource(SURVEY);
    } else if (isCSCOperator)
        waterConnectionDetails.setSource(CSC);
    else if (citizenPortalUser)
        waterConnectionDetails.setSource(CITIZENPORTAL);
    else if (loggedUserIsMeesevaUser)
        waterConnectionDetails.setSource(MEESEVA);
    else
        waterConnectionDetails.setSource(SYSTEM);

    if (ConnectionType.NON_METERED.equals(waterConnectionDetails.getConnectionType()))
        waterConnectionDetailsService.validateWaterRateAndDonationHeader(waterConnectionDetails);
    List<ApplicationDocuments> applicationDocuments = new ArrayList<>();
    String documentsRequired = waterTaxUtils.documentRequiredForBPLCategory();
    int i = 0;
    if (!waterConnectionDetails.getApplicationDocs().isEmpty())
        for (ApplicationDocuments applicationDocument : waterConnectionDetails.getApplicationDocs())
            newConnectionService.validateDocuments(applicationDocuments, applicationDocument, i, errors,
                    waterConnectionDetails.getCategory().getId(), documentsRequired);

    if (waterConnectionDetails.getState() == null)
        waterConnectionDetails
                .setStatus(waterTaxUtils.getStatusByCodeAndModuleType(APPLICATION_STATUS_CREATED, MODULETYPE));
    if (errors.hasErrors())
        loadApplicationForm(waterConnectionDetails, model, request);
    waterConnectionDetails.getApplicationDocs().clear();
    waterConnectionDetails.setApplicationDocs(applicationDocuments);
    processAndStoreApplicationDocuments(waterConnectionDetails);
    Long approvalPosition = 0l;
    String approvalComment = "";
    String workFlowAction = "";
    if (request.getParameter("approvalComent") != null)
        approvalComment = request.getParameter("approvalComent");
    if (request.getParameter("workFlowAction") != null)
        workFlowAction = request.getParameter("workFlowAction");
    if (isNotBlank(request.getParameter(APPROVALPOSITION)))
        approvalPosition = Long.valueOf(request.getParameter(APPROVALPOSITION));

    boolean applicationByOthers = waterTaxUtils.getCurrentUserRole(currentUser);
    if (applicationByOthers || citizenPortalUser || isAnonymousUser) {
        Position userPosition = waterTaxUtils.getZonalLevelClerkForLoggedInUser(
                waterConnectionDetails.getConnection().getPropertyIdentifier());

        if (userPosition == null) {
            model.addAttribute(VALIDIFPTDUEEXISTS, waterTaxUtils.isConnectionAllowedIfPTDuePresent());
            WorkflowContainer workflowContainer = new WorkflowContainer();
            prepareWorkflow(model, waterConnectionDetails, workflowContainer);
            model.addAttribute(ADDITIONALRULE, waterConnectionDetails.getApplicationType().getCode());
            model.addAttribute("approvalPosOnValidate", request.getParameter(APPROVALPOSITION));
            model.addAttribute(CURRENTUSER, applicationByOthers);
            model.addAttribute(STATETYPE, waterConnectionDetails.getClass().getSimpleName());
            errors.rejectValue(CONNECTION_PROPERTYID, "err.validate.connection.user.mapping",
                    "err.validate.connection.user.mapping");
            model.addAttribute("noJAORSAMessage", "No JA/SA exists to forward the application.");
        } else
            approvalPosition = userPosition.getId();
    }

    if (isAnonymousUser)
        waterConnectionDetails.setSource(ONLINE);

    if (citizenPortalUser && waterConnectionDetails.getSource() == null)
        waterConnectionDetails.setSource(waterTaxUtils.setSourceOfConnection(currentUser));

    if (loggedUserIsMeesevaUser) {
        HashMap<String, String> meesevaParams = new HashMap<>();
        meesevaParams.put("APPLICATIONNUMBER", waterConnectionDetails.getMeesevaApplicationNumber());
        if (waterConnectionDetails.getApplicationNumber() == null) {
            waterConnectionDetails.setApplicationNumber(waterConnectionDetails.getMeesevaApplicationNumber());
            waterConnectionDetails.setSource(MEESEVA);
        }
    }
    regularisedConnectionService.updateCurrentWorkFlow(connection);
    waterConnectionDetailsService.createNewWaterConnection(waterConnectionDetails, approvalPosition,
            approvalComment, waterConnectionDetails.getApplicationType().getCode(), workFlowAction);

    if (loggedUserIsMeesevaUser)
        return "redirect:/application/generate-meesevareceipt?transactionServiceNumber="
                + waterConnectionDetails.getApplicationNumber();
    else
        return "redirect:/application/citizeenAcknowledgement?pathVars="
                + waterConnectionDetails.getApplicationNumber();
}

From source file:org.georchestra.console.ws.newaccount.NewAccountFormController.java

/**
 * Creates a new account in ldap. If the application was configured with "moderated signup" the new account is added with the PENDING role,
 * in other case, it will be inserted with the USER role
 *
 *
 * @param formBean/*from w w w  . jav a 2s .co  m*/
 * @param result
 * @param sessionStatus
 *
 * @return the next view
 *
 * @throws IOException
 */
@RequestMapping(value = "/account/new", method = RequestMethod.POST)
public String create(HttpServletRequest request, @ModelAttribute AccountFormBean formBean,
        @RequestParam("orgCities") String orgCities, BindingResult result, SessionStatus sessionStatus,
        Model model) throws IOException, SQLException {

    // Populate orgs droplist
    model.addAttribute("orgs", this.getOrgs());

    // Populate org type droplist
    model.addAttribute("orgTypes", this.getOrgTypes());

    // uid validation
    if (!this.validation.validateUserField("uid", formBean.getUid())) {
        result.rejectValue("uid", "uid.error.required", "required");
    } else {
        // A valid user identifier (uid) can only contain characters, numbers, hyphens or dot.
        // It must begin with a character.
        Pattern regexp = Pattern.compile("[a-zA-Z][a-zA-Z0-9.-]*");
        Matcher m = regexp.matcher(formBean.getUid());
        if (!m.matches())
            result.rejectValue("uid", "uid.error.invalid", "required");
    }

    // first name and surname validation
    if (!this.validation.validateUserField("firstName", formBean.getFirstName()))
        result.rejectValue("firstName", "firstName.error.required", "required");
    if (!this.validation.validateUserField("surname", formBean.getSurname()))
        result.rejectValue("surname", "surname.error.required", "required");

    // email validation
    if (!this.validation.validateUserField("email", formBean.getEmail()))
        result.rejectValue("email", "email.error.required", "required");
    else if (!EmailValidator.getInstance().isValid(formBean.getEmail()))
        result.rejectValue("email", "email.error.invalidFormat", "Invalid Format");

    // password validation
    PasswordUtils.validate(formBean.getPassword(), formBean.getConfirmPassword(), result);

    // Check captcha
    RecaptchaUtils.validate(reCaptchaParameters, formBean.getRecaptcha_response_field(), result);

    // Validate remaining fields
    this.validation.validateUserField("phone", formBean.getPhone(), result);
    this.validation.validateUserField("title", formBean.getTitle(), result);
    this.validation.validateUserField("description", formBean.getDescription(), result);

    // Create org if needed
    if (formBean.getCreateOrg() && !result.hasErrors()) {
        try {

            // Check required fields
            this.validation.validateOrgField("name", formBean.getOrgName(), result);
            this.validation.validateOrgField("shortName", formBean.getOrgShortName(), result);
            this.validation.validateOrgField("address", formBean.getOrgAddress(), result);
            this.validation.validateOrgField("type", formBean.getOrgType(), result);

            Org org = new Org();
            OrgExt orgExt = new OrgExt();

            // Generate textual identifier based on name
            String orgId = this.orgDao.generateId(formBean.getOrgName());
            org.setId(orgId);
            orgExt.setId(orgId);

            // Generate numeric identifier
            orgExt.setNumericId(this.orgDao.generateNumericId());

            // Store name, short name, orgType and address
            org.setName(formBean.getOrgName());
            org.setShortName(formBean.getOrgShortName());
            orgExt.setAddress(formBean.getOrgAddress());
            orgExt.setOrgType(formBean.getOrgType());

            // Parse and store cities
            orgCities = orgCities.trim();
            if (orgCities.length() > 0)
                org.setCities(Arrays.asList(orgCities.split("\\s*,\\s*")));

            // Set default value
            org.setStatus(Org.STATUS_PENDING);

            // Persist changes to LDAP server
            if (!result.hasErrors()) {
                this.orgDao.insert(org);
                this.orgDao.insert(orgExt);

                // Set real org identifier in form
                formBean.setOrg(orgId);
            }

        } catch (Exception e) {
            LOG.error(e.getMessage());
            throw new IOException(e);
        }
    } else {
        this.validation.validateUserField("org", formBean.getOrg(), result);
    }

    if (result.hasErrors())
        return "createAccountForm";

    // inserts the new account
    try {

        Account account = AccountFactory.createBrief(formBean.getUid().toLowerCase(), formBean.getPassword(),
                formBean.getFirstName(), formBean.getSurname(), formBean.getEmail(), formBean.getPhone(),
                formBean.getTitle(), formBean.getDescription());

        if (!formBean.getOrg().equals("-"))
            account.setOrg(formBean.getOrg());

        String roleID = this.moderator.moderatedSignup() ? Role.PENDING : Role.USER;

        this.accountDao.insert(account, roleID, request.getHeader("sec-username"));

        final ServletContext servletContext = request.getSession().getServletContext();

        // email to the moderator
        this.mailService.sendNewAccountRequiresModeration(servletContext, account.getUid(),
                account.getCommonName(), account.getEmail(), this.moderator.getModeratorEmail());

        // email to delegated admin if org is specified
        if (!formBean.getOrg().equals("-")) {
            // and a delegation is defined
            List<DelegationEntry> delegations = this.advancedDelegationDao.findByOrg(formBean.getOrg());
            for (DelegationEntry delegation : delegations) {
                Account delegatedAdmin = this.accountDao.findByUID(delegation.getUid());
                this.mailService.sendNewAccountRequiresModeration(servletContext, account.getUid(),
                        account.getCommonName(), account.getEmail(), delegatedAdmin.getEmail());
            }
        }

        // email to the user
        if (this.moderator.moderatedSignup()) {
            this.mailService.sendAccountCreationInProcess(servletContext, account.getUid(),
                    account.getCommonName(), account.getEmail());
        } else {
            this.mailService.sendAccountWasCreated(servletContext, account.getUid(), account.getCommonName(),
                    account.getEmail());
        }
        sessionStatus.setComplete();

        return "welcomeNewUser";

    } catch (DuplicatedEmailException e) {

        result.rejectValue("email", "email.error.exist", "there is a user with this e-mail");
        return "createAccountForm";

    } catch (DuplicatedUidException e) {

        try {
            String proposedUid = this.accountDao.generateUid(formBean.getUid());

            formBean.setUid(proposedUid);

            result.rejectValue("uid", "uid.error.exist", "the uid exist");

            return "createAccountForm";

        } catch (DataServiceException e1) {
            throw new IOException(e);
        }

    } catch (DataServiceException e) {

        throw new IOException(e);
    }
}

From source file:org.georchestra.console.ws.passwordrecovery.PasswordRecoveryFormController.java

/**
 * Generates a new unique http URL based on a token, then an e-mail is sent to the user with instruction to change his password.
 *
 *
 * @param formBean      Contains the user's email
 * @param resultErrors    will be updated with the list of found errors.
 * @param sessionStatus/*from w ww  . ja  v  a  2  s .  c  o m*/
 *
 * @return the next view
 *
 * @throws IOException
 */
@RequestMapping(value = "/account/passwordRecovery", method = RequestMethod.POST)
public String generateToken(HttpServletRequest request, @ModelAttribute PasswordRecoveryFormBean formBean,
        BindingResult resultErrors, SessionStatus sessionStatus) throws IOException {

    RecaptchaUtils.validate(reCaptchaParameters, formBean.getRecaptcha_response_field(), resultErrors);
    if (resultErrors.hasErrors()) {
        return "passwordRecoveryForm";
    }

    try {
        Account account = this.accountDao.findByEmail(formBean.getEmail());
        List<Role> role = this.roleDao.findAllForUser(account.getUid());
        // Finds the user using the email as key, if it exists a new token is generated to include in the unique http URL.

        for (Role g : role) {
            if (g.getName().equals(Role.PENDING)) {
                throw new NameNotFoundException("User in PENDING role");
            }
        }

        String token = UUID.randomUUID().toString();

        // if there is a previous token it is removed
        if (this.userTokenDao.exist(account.getUid())) {
            this.userTokenDao.delete(account.getUid());
        }

        this.userTokenDao.insertToken(account.getUid(), token);

        String contextPath = this.config.getPublicContextPath();
        String url = makeChangePasswordURL(this.georConfig.getProperty("publicUrl"), contextPath, token);

        ServletContext servletContext = request.getSession().getServletContext();
        this.mailService.sendChangePasswordURL(servletContext, account.getUid(), account.getCommonName(), url,
                account.getEmail());

        sessionStatus.setComplete();

        return "emailWasSent";

    } catch (DataServiceException e) {

        throw new IOException(e);

    } catch (NameNotFoundException e) {

        resultErrors.rejectValue("email", "email.error.notFound", "No user found for this email.");

        return "passwordRecoveryForm";

    }
}

From source file:org.jbb.members.web.base.controller.UcpEditAccountController.java

@RequestMapping(method = RequestMethod.POST)
public String editAccountPost(Model model, Authentication authentication,
        @ModelAttribute(EDIT_ACCOUNT_FORM) EditAccountForm form, BindingResult bindingResult) {
    Member member = getCurrentMember(authentication);
    fillFieldWithUsername(form, member);

    // check correction of current password - it is necessary to proceed
    if (currentPasswordIsIncorrect(member.getId(), form.getCurrentPassword())) {
        bindingResult.rejectValue("currentPassword", "CP", "Given password is not match to current password");
        return formViewWithError(model);
    }//from w  w w. j  av a 2 s  . c  o m

    // detect which data user want to update
    AccountDataToChange accountData = AccountDataToChange.builder().build();
    Email newEmail = Email.builder().value(form.getEmail()).build();
    if (emailChanged(member, newEmail)) {
        accountData.setEmail(Optional.of(newEmail));
    }

    if (passwordChanged(form)) {
        Password newPassword = Password.builder().value(form.getNewPassword().toCharArray()).build();
        Password newPasswordAgain = Password.builder().value(form.getNewPasswordAgain().toCharArray()).build();
        if (newPassword.equals(newPasswordAgain)) {
            accountData.setNewPassword(Optional.of(newPassword));
        } else {
            bindingResult.rejectValue("newPassword", "NP", "Passwords don't match");
            return formViewWithError(model);
        }
    }

    // invoke service for updating data
    try {
        memberService.updateAccount(member.getId(), accountData);
    } catch (AccountException e) {
        log.debug("Problem with updating account for username {} with data to change: {}", member.getUsername(),
                accountData, e);
        errorsBindingMapper.map(e.getConstraintViolations(), bindingResult);
        return formViewWithError(model);
    }

    model.addAttribute(FORM_SAVED_FLAG, true);
    model.addAttribute(EMAIL_FIELD_ENABLED, permissionService.checkPermission(CAN_CHANGE_EMAIL));
    return VIEW_NAME;
}

From source file:org.jbb.members.web.base.logic.AccountEditor.java

public boolean editAccountWithSuccess(EditMemberForm form, BindingResult bindingResult, Member member) {
    AccountDataToChange accountDataToChange = AccountDataToChange.builder().build();
    if (!member.getEmail().getValue().equals(form.getEmail())) {
        Email email = Email.builder().value(form.getEmail()).build();
        accountDataToChange.setEmail(Optional.of(email));
    }//from w ww  .j a v  a2  s  . c  o m
    if (StringUtils.isNoneBlank(form.getNewPassword())) {
        if (!form.getNewPassword().equals(form.getNewPasswordAgain())) {
            bindingResult.rejectValue("newPassword", "NP", "Passwords don't match");
            return false;
        }
        Password password = Password.builder().value(form.getNewPassword().toCharArray()).build();
        accountDataToChange.setNewPassword(Optional.of(password));
    }

    try {
        memberService.updateAccount(member.getId(), accountDataToChange);
    } catch (AccountException e) {
        log.debug("Problem with updating account for username {} with data to change: {}", member.getUsername(),
                accountDataToChange, e);
        errorsBindingMapper.map(e.getConstraintViolations(), bindingResult);
        return false;
    }
    return true;
}

From source file:org.jbb.members.web.registration.logic.RegistrationErrorsBindingMapper.java

public void map(Set<ConstraintViolation<?>> constraintViolations, BindingResult bindingResult) {
    for (ConstraintViolation violation : constraintViolations) {
        String propertyPath = violation.getPropertyPath().toString();
        if ("visiblePassword".equals(propertyPath)) {
            PasswordPolicy policy = passwordService.currentPolicy();
            bindingResult.rejectValue("password", "x", MessageFormat.format(violation.getMessage(),
                    policy.getMinimumLength(), policy.getMaximumLength()));
        } else {/*from  ww  w .j a  va  2 s  .com*/
            bindingResult.rejectValue(unwrap(propertyPath), "x", violation.getMessage());
        }
    }
}

From source file:org.jbb.security.web.acp.controller.AcpMemberLocksController.java

@RequestMapping(method = RequestMethod.POST)
public String memberLocksPost(@ModelAttribute(LOCKS_SEARCH_FORM) SearchLockForm form, Pageable pageable,
        BindingResult bindingResult, RedirectAttributes redirectAttributes) {
    Long memberId = null;/* ww  w. j a  va 2 s  . co  m*/
    if (StringUtils.isNotBlank(form.getDisplayedName())) {
        Optional<Member> member = memberService
                .getMemberWithDisplayedName(DisplayedName.of(form.getDisplayedName()));
        if (member.isPresent()) {
            memberId = member.get().getId();
        } else {
            bindingResult.rejectValue("displayedName", "x", "Member not found");
            return LOCK_BROWSER_ACP_VIEW;
        }
    }

    LockSearchCriteria criteria = criteriaFactory.buildCriteria(memberId, form.getStatus(), pageable);
    Page<MemberLockRow> resultPage = memberLockoutService.getLocksWithCriteria(criteria)
            .map(memberLockRowTranslator::toRow);

    redirectAttributes.addFlashAttribute(FORM_SAVED_FLAG, true);
    redirectAttributes.addFlashAttribute("resultPage", new PageWrapper<>(resultPage));
    redirectAttributes.addFlashAttribute(LOCKS_SEARCH_FORM, form);

    return "redirect:/" + LOCK_BROWSER_ACP_VIEW;
}

From source file:org.nishkarma.petclinic.controller.OwnerController.java

@RequestMapping(value = "/{internationalPath:[a-zA-Z]{2,10}\\-[a-zA-Z]{2,10}}/owners", method = RequestMethod.GET)
public String processFindForm(FindOwnerParam findOwnerParam, BindingResult result, Map<String, Object> model) {
    try {//from   w w w.j ava  2 s .c  o  m
        // allow parameterless GET request for /owners to return all records
        if (findOwnerParam.getLastName() == null) {
            findOwnerParam.setLastName(""); // empty string signifies
            // broadest possible search
        }

        logger.debug("findOwnerParam.getPage_page()=" + findOwnerParam.getPage_page());
        logger.debug("findOwnerParam.getPage_size()=" + findOwnerParam.getPage_size());

        findOwnerParam.makePageQuery();

        // find owners by last name
        Collection<Owners> results = this.clinicService.findOwnerByLastName(findOwnerParam);

        long findCount = this.clinicService.findOwnerByLastNameCount(findOwnerParam);

        findOwnerParam.setTotalPages(PagingUtil.getTotalPages(findOwnerParam.getPage_size(), findCount));

        if (results.size() < 1) {
            // no owners found
            result.rejectValue("lastName", "notFound", "not found");

            BindingResultDebug.print(result);

            return "owners/findOwners";
        }
        if (results.size() > 1) {
            // multiple owners found
            model.put("selections", results);
            model.put("findOwnerParam", findOwnerParam);

            String pageUrl = "owners.html?lastName="
                    + (URLEncoder.encode(findOwnerParam.getLastName(), "UTF-8")) + "&page_page=";
            model.put("pageUrl", pageUrl);

            return "owners/ownersList";
        } else {
            // 1 owner found
            Owners owner = results.iterator().next();
            return "redirect:/{internationalPath}/owners/" + owner.getId();
        }
    } catch (Exception e) {
        logger.error(ExceptionUtils.getStackTrace(e));

        throw new NishkarmaException(
                NishkarmaMessageSource.getMessage("exception_message", NishkarmaLocaleUtil.resolveLocale()));
    }
}

From source file:org.ojbc.web.portal.controllers.helpers.SimpleSearchParser.java

public PersonSearchRequest validateAndParseSimpleSearch(PersonSearchCommand personSearchCommand,
        BindingResult errors) {
    String simpleSearch = personSearchCommand.getSimpleSearch();

    if (StringUtils.isBlank(simpleSearch)) {
        errors.rejectValue("simpleSearch", "emptySearch", "Search terms cannot be empty");
    }//from w  w  w.  j  a  v a  2  s  .c  o  m

    PersonSearchRequest personSearchRequest = new PersonSearchRequest();
    List<String> searchTokens = searchTermsTokenizer.tokenize(simpleSearch);

    for (SearchTermExtractorInterface extractor : searchTermExtractors) {
        searchTokens = extractor.extractTerm(searchTokens, personSearchRequest);
    }

    personSearchRequest.setPurpose(personSearchCommand.getAdvanceSearch().getPurpose());
    personSearchRequest.setOnBehalfOf(personSearchCommand.getAdvanceSearch().getOnBehalfOf());
    if (personSearchCommand.getAdvanceSearch().getSourceSystems() != null) {
        personSearchRequest.setSourceSystems(
                new ArrayList<String>(personSearchCommand.getAdvanceSearch().getSourceSystems()));
    }
    validateExtractedTerms(errors, personSearchRequest, searchTokens);

    return personSearchRequest;
}

From source file:org.ojbc.web.portal.controllers.helpers.SimpleSearchParser.java

private void validateExtractedTerms(BindingResult errors, PersonSearchRequest personSearchRequest,
        List<String> searchTokens) {
    if (searchTokens.size() > 0) {
        errors.rejectValue("simpleSearch", "invalidTokens",
                "Unable to parse the following terms: " + searchTokens);
    }// w  ww .j a v a  2 s  .  c  o  m

    if (StringUtils.isBlank(personSearchRequest.getPersonSurName()) //
            && StringUtils.isBlank(personSearchRequest.getPersonSocialSecurityNumber()) //
            && StringUtils.isBlank(personSearchRequest.getPersonSID()) //
            && StringUtils.isBlank(personSearchRequest.getPersonDriversLicenseNumber()) //
            && StringUtils.isBlank(personSearchRequest.getPersonFBINumber())) {
        errors.rejectValue("simpleSearch", "missingRequiredInput",
                "Search must have either a last name or an identifier (SSN, SID, DL, or FBI Number)");
    }

    if (personSearchRequest.getSourceSystems() == null || personSearchRequest.getSourceSystems().size() == 0) {
        errors.rejectValue("simpleSearch", "missingSourceSystems", "No Source Systems to search are selected.");
    }
}