Package net.sourceforge.stripes.validation

Examples of net.sourceforge.stripes.validation.SimpleError


        }
        disconnect();
          addDataLine("id",oUsr.id());
      } catch (Exception xcpt) {
        Log.out.error("SaveUser.save() "+xcpt.getMessage(), xcpt);
        addError(new SimpleError(xcpt.getMessage()));
      } finally {
        close();
      }
    } else {
      Log.out.debug("SaveUser.save() "+String.valueOf(getErrorsCount())+" validation errors found");     
View Full Code Here


    @DontValidate
    public Resolution preEdit() {
        if (this.bugIds == null) {
            getContext().getValidationErrors().addGlobalError(
                new SimpleError("You must select at least one bug to edit.") );
            return getContext().getSourcePageResolution();
        }

        BugManager bm = new BugManager();
        for (int id : this.bugIds) {
View Full Code Here

    /** Validates that only resources in the allowed places are asked for. */
    @ValidationMethod
    public void validate(ValidationErrors errors) {
        if (resource.startsWith("/WEB-INF") && !resource.startsWith("/WEB-INF/src")) {
            errors.add("resource",
                       new SimpleError("Naughty, naughty. We mustn't hack the URL now."));
        }
    }
View Full Code Here

     * are not dividing by zero.
     */
    @ValidationMethod(on="division")
    public void avoidDivideByZero(ValidationErrors errors) {
        if (this.numberTwo == 0) {
            errors.add("numberTwo", new SimpleError("Dividing by zero is not allowed."));
        }
    }
View Full Code Here

        if (!passwordMatch) {
            errors.add("password", new LocalizableError("password.nomatch"));
        }

        if (!compliant) {
            errors.add("password", new SimpleError(passwordPolicy.getDescription()));
        }

        if (errors.size() == 0) {
            user.setFullName(this.formUser.getFullName());
            userService.saveWithPassword(user, this.formUser.getPassword());
View Full Code Here

            if (!passwordMatch) {
                passwordError.add("password", new LocalizableError("password.nomatch"));
            }

            if (!compliant) {
                passwordError.add("password", new SimpleError(passwordPolicy.getDescription()));
            }
        }

        if (passwordError.size() == 0) {
            actualUser.setFullName(this.formUser.getFullName());
View Full Code Here

        if (!passwordMatch) {
            errors.add("password", new LocalizableError("password.nomatch"));
        }

        if (!compliant) {
            errors.add("password", new SimpleError(passwordPolicy.getDescription()));
        }

        User otherUser = getUserService().findUser(this.formUser.getUsername());
        if (otherUser != null) {
            errors.add("username", new SimpleError("That username is not available"));
        }

        if (formUser.getRoles().isEmpty()) {
            errors.add("roles", new SimpleError("You must select one role"));
        }

        if (errors.size() == 0) {
            User user = new User();
            user.setFullName(this.formUser.getFullName());
View Full Code Here

    @HandlesEvent("SaveOrUpdate")
    public Resolution onSave() {
        ValidationErrors errors = new ValidationErrors();

        if (!job.scriptExists() && job.runOnThisHost()) {
            errors.add("script", new SimpleError(String.format("The script %s does not exist.", job.getScript())));
        }

        if (errors.isEmpty()) {
            job.setLastModified(System.currentTimeMillis());
            getJobService().save(job);
View Full Code Here

    public Resolution onSave() {

        ValidationErrors errors = new ValidationErrors();

        if (!job.scriptExists() && job.runOnThisHost()) {
            errors.add("script", new SimpleError(String.format("The script %s does not exist.", job.getScript())));
        }

        if (errors.isEmpty()) {
            job.setLastModified(System.currentTimeMillis());
            job.incrementVersion();
View Full Code Here

        // Check for the "view" parameter. It will be there if we got here by a form submission.
        BugzookyActionBeanContext context = getContext();
        boolean fromForm = context.getRequest().getParameter("view") != null;
        if (fromForm && (getBugs() == null || getBugs().isEmpty())) {
            context.getValidationErrors().addGlobalError(
                    new SimpleError("You must select at least one bug to edit."));
            return context.getSourcePageResolution();
        }

        return new ForwardResolution("/bugzooky/BulkAddEditBugs.jsp");
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.validation.SimpleError

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.