Examples of BugManager


Examples of net.sourceforge.stripes.examples.bugzooky.biz.BugManager

        this.bugs = bugs;
    }

    @DefaultHandler
    public Resolution save() {
        BugManager bm = new BugManager();

        for (Bug bug : bugs) {
            Bug newBug = populateBug(bug);
            bm.saveOrUpdate(newBug);
        }

        return new RedirectResolution("/bugzooky/BugList.jsp");
    }
View Full Code Here

Examples of net.sourceforge.stripes.examples.bugzooky.biz.BugManager

            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) {
            this.bugs.add( bm.getBug(id) );
        }

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

Examples of net.sourceforge.stripes.examples.bugzooky.biz.BugManager

    public Integer getAttachmentIndex() { return attachmentIndex; }
    public void setAttachmentIndex(Integer attachmentIndex) { this.attachmentIndex = attachmentIndex; }

    @DefaultHandler
    public Resolution getAttachment() {
        BugManager bm = new BugManager();
        Bug bug = bm.getBug(this.bugId);
        Attachment attachment = bug.getAttachments().get(this.attachmentIndex);

        // Uses a StreamingResolution to send the file contents back to the user.
        // Note the use of the chained .setFilename() method, which causes the
        // browser to [prompt to] save the "file" instead of displaying it in browser
View Full Code Here

Examples of net.sourceforge.stripes.examples.bugzooky.biz.BugManager

     *
     * @param bug a bug from which to create a fully populated bug
     * @return a fully populated bug
     */
    protected Bug populateBug(Bug bug) {
        BugManager bm = new BugManager();
        ComponentManager cm = new ComponentManager();
        PersonManager pm = new PersonManager();
        Bug newBug;

        if (bug.getId() == null) {
            newBug = new Bug();
            newBug.setOpenDate(new Date());
        }
        else {
            newBug = bm.getBug((bug.getId()));
        }

        // Populate the fields from the bug on the form
        newBug.setLongDescription( bug.getLongDescription() );
        newBug.setPriority( bug.getPriority());
View Full Code Here

Examples of net.sourceforge.stripes.examples.bugzooky.biz.BugManager

    public void setNewAttachment(FileBean newAttachment) { this.newAttachment = newAttachment; }

    /** Loads a bug on to the form ready for editing. */
    @DontValidate
    public Resolution preEdit() {
        BugManager bm = new BugManager();
        this.bug = bm.getBug( this.bug.getId() );
        return new ForwardResolution("/bugzooky/AddEditBug.jsp");
    }
View Full Code Here

Examples of net.sourceforge.stripes.examples.bugzooky.biz.BugManager

    }

    /** Saves (or updates) a bug, and then returns the user to the bug list. */
    @DefaultHandler
    public Resolution save() throws IOException {
        BugManager bm = new BugManager();

        Bug newBug = populateBug(this.bug);
        if (this.newAttachment != null) {
            Attachment attachment = new Attachment();
            attachment.setName(this.newAttachment.getFileName());
            attachment.setSize(this.newAttachment.getSize());
            attachment.setContentType(this.newAttachment.getContentType());

            byte[] data = new byte[(int) this.newAttachment.getSize()];
            InputStream in = this.newAttachment.getInputStream();
            in.read(data);
            attachment.setData(data);
            newBug.addAttachment(attachment);
        }

        bm.saveOrUpdate(newBug);

        return new RedirectResolution("/bugzooky/BugList.jsp");
    }
View Full Code Here

Examples of net.sourceforge.stripes.examples.bugzooky.biz.BugManager

        return new ForwardResolution("/bugzooky/AddEditBug.jsp");
    }

    /** Saves (or updates) a bug, and then returns the user to the bug list. */
    public Resolution save() throws IOException {
        BugManager bm = new BugManager();

        Bug bug = getBug();
        if (this.newAttachment != null) {
            Attachment attachment = new Attachment();
            attachment.setName(this.newAttachment.getFileName());
            attachment.setSize(this.newAttachment.getSize());
            attachment.setContentType(this.newAttachment.getContentType());

            byte[] data = new byte[(int) this.newAttachment.getSize()];
            InputStream in = this.newAttachment.getInputStream();
            in.read(data);
            attachment.setData(data);
            bug.addAttachment(attachment);
        }

        // Set the open date for new bugs
        if (bug.getOpenDate() == null)
            bug.setOpenDate(new Date());

        bm.saveOrUpdate(bug);

        return new RedirectResolution(BugListActionBean.class);
    }
View Full Code Here

Examples of net.sourceforge.stripes.examples.bugzooky.biz.BugManager

        return new ForwardResolution("/bugzooky/BulkAddEditBugs.jsp");
    }

    public Resolution save() {
        BugManager bm = new BugManager();

        for (Bug bug : bugs) {
            bm.saveOrUpdate(bug);
        }

        return new RedirectResolution(BugListActionBean.class);
    }
View Full Code Here

Examples of net.sourceforge.stripes.examples.bugzooky.biz.BugManager

            Collection<ValidationError> errors) {
        Bug bug = null;

        try {
            int id = Integer.valueOf(input);
            BugManager bugManager = new BugManager();
            bug = bugManager.getBug(id);
        }
        catch (NumberFormatException e) {
            errors.add(new SimpleError("The number {0} is not a valid Bug ID", input));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.