Package models

Examples of models.Project


            }
        });
    }

    private Project createProject(String owner, String name) {
        Project project = new Project();
        project.owner = owner;
        project.name = name;
        return project;
    }
View Full Code Here


    /**
     * when: GET /:user/:project/milestones
     */
    @IsAllowed(Operation.READ)
    public static Result milestones(String userName, String projectName) {
        Project project = Project.findByOwnerAndProjectName(userName, projectName);
        MilestoneCondition mCondition = form(MilestoneCondition.class).bindFromRequest().get();

        List<Milestone> milestones = Milestone.findMilestones(project.id,
                State.getValue(mCondition.state),
                mCondition.orderBy,
View Full Code Here

     * when: GET /:user/:project/newMilestoneForm
     */
    @With(AnonymousCheckAction.class)
    @IsCreatable(ResourceType.MILESTONE)
    public static Result newMilestoneForm(String userName, String projectName) {
        Project project = Project.findByOwnerAndProjectName(userName, projectName);
        return ok(create.render("title.newMilestone", new Form<>(Milestone.class), project));
    }
View Full Code Here

     */
    @Transactional
    @IsCreatable(ResourceType.MILESTONE)
    public static Result newMilestone(String userName, String projectName) {
        Form<Milestone> milestoneForm = new Form<>(Milestone.class).bindFromRequest();
        Project project = Project.findByOwnerAndProjectName(userName, projectName);

        validate(project, milestoneForm);
        if (milestoneForm.hasErrors()) {
            return ok(create.render("title.newMilestone", milestoneForm, project));
        } else {
View Full Code Here

     * when: GET /:user/:project/milestone/:id/editform
     */
    @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

     * when: POST /:user/:project/milestone/:id/edit
     */
    @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);
View Full Code Here

     * when: GET /:user/:project/milestone/:id/delete
     */
    @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();
        }
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);
View Full Code Here

    public Result call(Http.Context context) throws Throwable {
        PathParser parser = new PathParser(context);
        String ownerLoginId = parser.getOwnerLoginId();
        String projectName = parser.getProjectName();

        Project project = Project.findByOwnerAndProjectName(ownerLoginId, projectName);

        if (project == null) {
            if (UserApp.currentUser() == User.anonymous){
                flash("failed", Messages.get("error.auth.unauthorized.waringMessage"));
                return AccessLogger.log(context.request(),
View Full Code Here

public class StatisticsApp extends Controller {

    @With(DefaultProjectCheckAction.class)
    public static Result statistics(String userName, String projectName) {
        Project project = Project.findByOwnerAndProjectName(userName, projectName);
        return ok(statistics.render("statistics", project));
    }
View Full Code Here

TOP

Related Classes of models.Project

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.