Package models

Examples of models.Milestone


        validate(project, milestoneForm);
        if (milestoneForm.hasErrors()) {
            return ok(create.render("title.newMilestone", milestoneForm, project));
        } else {
            Milestone newMilestone = milestoneForm.get();

            if (newMilestone.contents == null) {
                return status(REQUEST_ENTITY_TOO_LARGE,
                        ErrorViews.RequestTextEntityTooLarge.render());
            }

            newMilestone.project = project;
            newMilestone.dueDate = JodaDateUtil.lastSecondOfDay(newMilestone.dueDate);
            Milestone.create(newMilestone);
            Attachment.moveAll(UserApp.currentUser().asResource(), newMilestone.asResource());
            return redirect(routes.MilestoneApp.milestone(userName, projectName, newMilestone.id));
        }
    }
View Full Code Here


     */
    @With(AnonymousCheckAction.class)
    @IsAllowed(value = Operation.UPDATE, resourceType = ResourceType.MILESTONE)
    public static Result editMilestoneForm(String userName, String projectName, Long milestoneId) {
        Project project = Project.findByOwnerAndProjectName(userName, projectName);
        Milestone milestone = Milestone.findById(milestoneId);

        Form<Milestone> editForm = new Form<>(Milestone.class).fill(milestone);
        return ok(edit.render("title.editMilestone", editForm, milestoneId, project));
    }
View Full Code Here

    @Transactional
    @IsAllowed(value = Operation.UPDATE, resourceType = ResourceType.MILESTONE)
    public static Result editMilestone(String userName, String projectName, Long milestoneId) {
        Project project = Project.findByOwnerAndProjectName(userName, projectName);
        Form<Milestone> milestoneForm = new Form<>(Milestone.class).bindFromRequest();
        Milestone original = Milestone.findById(milestoneId);

        if(!original.title.equals(milestoneForm.field("title").value())) {
            validate(project, milestoneForm);
        }
        if (milestoneForm.hasErrors()) {
            return ok(edit.render("title.editMilestone", milestoneForm, milestoneId, project));
        } else {
            Milestone existingMilestone = Milestone.findById(milestoneId);
            Milestone milestone = milestoneForm.get();

            if (milestone.contents == null) {
                return status(REQUEST_ENTITY_TOO_LARGE,
                        ErrorViews.RequestTextEntityTooLarge.render());
            }
View Full Code Here

     */
    @Transactional
    @IsAllowed(value = Operation.DELETE, resourceType = ResourceType.MILESTONE)
    public static Result deleteMilestone(String userName, String projectName, Long id) {
        Project project = Project.findByOwnerAndProjectName(userName, projectName);
        Milestone milestone = Milestone.findById(id);

        if(!project.id.equals(milestone.project.id)) {
            return internalServerError();
        }
        milestone.delete();

        if(HttpUtil.isRequestedWithXHR(request())){
            response().setHeader("Location", routes.MilestoneApp.milestones(userName, projectName).toString());
            return status(204);
        }
View Full Code Here

    }

    @Transactional
    @IsAllowed(value = Operation.UPDATE, resourceType = ResourceType.MILESTONE)
    public static Result open(String userName, String projectName, Long id) {
        Milestone milestone = Milestone.findById(id);
        milestone.open();
        return redirect(routes.MilestoneApp.milestone(userName, projectName, id));
    }
View Full Code Here

    }

    @Transactional
    @IsAllowed(value = Operation.UPDATE, resourceType = ResourceType.MILESTONE)
    public static Result close(String userName, String projectName, Long id) {
        Milestone milestone = Milestone.findById(id);
        milestone.close();
        return redirect(routes.MilestoneApp.milestone(userName, projectName, id));
    }
View Full Code Here

     * when: GET /:user/:project/milestone/:id
     */
    @IsAllowed(value = Operation.READ, resourceType = ResourceType.MILESTONE)
    public static Result milestone(String userName, String projectName, Long id) {
        Project project = Project.findByOwnerAndProjectName(userName, projectName);
        Milestone milestone = Milestone.findById(id);

        String paramState = request().getQueryString("state");
        State state = State.getValue(paramState);
        UserApp.currentUser().visits(project);
        return ok(view.render(milestone.title, milestone, project, state));
View Full Code Here

TOP

Related Classes of models.Milestone

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.