Package org.springframework.validation

Examples of org.springframework.validation.ObjectError


            if (keyVaultEntry != null && keyVaultEntry.getId() != null && keyVaultEntry.getId() > 0) {
                redirectAttributes.addFlashAttribute("success", true);
            } else {
                log.info(String.format("Unable to save KeyVaultEntry for domain: %s", userService.getUserFromSecurityContext().getActiveOrganization().getId()));
                String[] codes = {"desktop.manager.keyVault.generic.error"};
                ObjectError error = new ObjectError("keyVaultEntryForm", codes, null, null);
                bindingResult.addError(error);

                redirectAttributes.addFlashAttribute("org.springframework.validation.BindingResult.keyVaultEntryForm", bindingResult);
                redirectAttributes.addFlashAttribute("keyVaultEntryForm", keyVaultEntryForm);
            }
View Full Code Here


                }
            }
        } catch (Exception ex) {
            log.info("Error updating systemNotification.", ex);
            String[] codes = {"transaction.genericError"};
            ObjectError error = new ObjectError("systemNotificationForm", codes, null, "An error occurred processing your request.  Please try again.");
            bindingResult.addError(error);

            redirectAttributes.addFlashAttribute("org.springframework.validation.BindingResult.systemNotificationForm", bindingResult);
            redirectAttributes.addFlashAttribute("systemNotificationForm", systemNotificationForm);
        }
View Full Code Here

        } else {
            //Only create organization if user is System Admin
            User user = userService.getUserFromSecurityContext();
            if (!user.isSystemAdmin()) {
                String[] codes = {"desktop.manager.organization.generic.error"};
                ObjectError error = new ObjectError("organizationForm", codes, null, null);
                bindingResult.addError(error);
                return addOrganization(model);
            }

            Organization organization = organizationService.createOrganization(organizationForm);
            if (organization == null || organization.getId() == null || organization.getId() <= 0) {
                String[] codes = {"desktop.manager.organization.create.error"};
                ObjectError error = new ObjectError("organizationForm", codes, null, null);
                bindingResult.addError(error);
                return addOrganization(model);
            }
            categoryService.createDefaultCategories(organization.getId());
            orgId = organization.getId();
View Full Code Here

            groupService.editGroup(groupForm);
        } else {
            Group group = groupService.createGroup(groupForm);
            if (group == null || group.getId() == null || group.getId() <= 0) {
                String[] codes = {"desktop.manager.group.create.error"};
                ObjectError error = new ObjectError("groupForm", codes, null, null);
                bindingResult.addError(error);
                return addGroup(model);
            }

            groupId = group.getId();
View Full Code Here

        try {
            savedApplicationVersion = applicationVersionControllerService.saveApplicationVersion(applicationVersionForm, true);
        } catch (ApplicationVersionResignException e) {
            log.error(e.getMessage());
            String[] codes = {"desktop.manageApplicationVersion.resignError.generic"};
            ObjectError error = new ObjectError("version", codes, null, null);
            bindingResult.addError(error);

            redirectAttributes.addFlashAttribute("org.springframework.validation.BindingResult.version", bindingResult);
            redirectAttributes.addFlashAttribute("version", applicationVersionForm);
View Full Code Here

                    deliveryMechanism.sendNotifications(user);
                }
            } catch (MailException e) {
                log.error("Error sending Activation email to " + user.getEmail() + ".", e);
                String[] codes = {"registration.emailException"};
                ObjectError error = new ObjectError("registrationForm", codes, null, null);
                bindingResult.addError(error);
            }
            return "redirect:/auth/login?registrationSuccess=true";
        }

        String[] codes = {"registration.failure"};

        ObjectError error = new ObjectError("registrationForm", codes, null, null);
        bindingResult.addError(error);

        return showRegistrationPage(request, response, model, null);
    }
View Full Code Here

            if (region != null && region.getId() != null && region.getId() > 0) {
                redirectAttributes.addFlashAttribute("updateSuccess", true);
            } else {
                log.info(String.format("Unable to save Region for domain: Domain Id: %s", domainRegionForm.getDomainId()));
                String[] codes = {"desktop.manager.domainRegions.generic.error"};
                ObjectError error = new ObjectError("domainRegionForm", codes, null, null);
                bindingResult.addError(error);

                redirectAttributes.addFlashAttribute("org.springframework.validation.BindingResult.domainRegionForm", bindingResult);
                redirectAttributes.addFlashAttribute("domainRegionForm", domainRegionForm);
            }
View Full Code Here

                    }
                } else {
                    log.error(String.format("Unable to process public request for domain.  Entity not persisted to database. Domain UUID: %s", domain.getUuid()));

                    String[] codes = {"desktop.domain_public_request.generic.error"};
                    ObjectError error = new ObjectError("domainRequestForm", codes, null, null);
                    bindingResult.addError(error);

                    redirectAttributes.addFlashAttribute("org.springframework.validation.BindingResult.domainRequestForm", bindingResult);
                    redirectAttributes.addFlashAttribute("domainRequestForm", domainRequestForm);
                }
View Full Code Here

    }

    @Test
    public void invalidForumInformationShouldProduceFailResponse() {
        BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(new Object(), "");
        bindingResult.addError(new ObjectError("name", "message"));
        JsonResponse response = administrationController.setForumInformation(new ComponentInformation(), bindingResult,
                Locale.UK);

        assertEquals(response.getStatus(), JsonResponseStatus.FAIL);
    }
View Full Code Here

    }

    @Test
    public void invalidBranchInformationShouldProduceFailResponse() throws NotFoundException {
        BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(new Object(), "");
        bindingResult.addError(new ObjectError("name", "message"));
        BranchDto branchDto = new BranchDto();
        JsonResponse response = administrationController.setBranchInformation(branchDto, bindingResult, Locale.UK);

        assertEquals(response.getStatus(), JsonResponseStatus.FAIL);
    }
View Full Code Here

TOP

Related Classes of org.springframework.validation.ObjectError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.