Package playRepository

Examples of playRepository.PlayRepository


    @IsAllowed(Operation.READ)
    public static Result show(String ownerName, String projectName, String commitId)
            throws IOException, UnsupportedOperationException, ServletException, GitAPIException,
            SVNException, NoSuchMethodException {
        Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
        PlayRepository repository = RepositoryService.getRepository(project);

        Commit commit = null;

        try {
            commit = repository.getCommit(commitId);
        } catch (org.eclipse.jgit.errors.MissingObjectException e) {
            return notFound(ErrorViews.NotFound.render("error.notfound.commit", project));
        }

        if(commit == null) {
            return notFound(ErrorViews.NotFound.render("error.notfound.commit", project));
        }

        Commit parentCommit = repository.getParentCommitOf(commitId);
        List<CommentThread> threads
                = CommentThread.findByCommitId(CommentThread.find, project, commitId);

        String selectedBranch = StringUtils.defaultIfBlank(request().getQueryString("branch"), "HEAD");
        String path = StringUtils.defaultIfBlank(request().getQueryString("path"), "");

        if(project.vcs.equals(RepositoryService.VCS_SUBVERSION)) {
            String patch = repository.getPatch(commitId);

            if (patch == null) {
                return notFound(ErrorViews.NotFound.render("error.notfound", project));
            }

            List<CommitComment> comments = CommitComment.find.where()
                .eq("commitId", commitId)
                .eq("project.id", project.id)
                .order("createdDate")
                .findList();

            return ok(svnDiff.render(project, commit, parentCommit, patch, comments, selectedBranch, path));
        } else {
            List<FileDiff> fileDiffs = repository.getDiff(commitId);

            if (fileDiffs == null) {
                return notFound(ErrorViews.NotFound.render("error.notfound", project));
            }
View Full Code Here


        if (project == null) {
            return notFound();
        }

        PlayRepository repository = RepositoryService.getRepository(project);
        if (!AccessControl.isAllowed(currentUser, repository.asResource(),
                getRequestedOperation(request().method()))) {
            if (currentUser.isAnonymous()) {
                return BasicAuthAction.unauthorized(response());
            } else {
                return forbidden("You have no permission to access this repository.");
View Full Code Here

public class CompareApp extends Controller {
    @IsAllowed(Operation.READ)
    public static Result compare(String ownerName, String projectName, String revA, String revB)
            throws Exception {
        Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
        PlayRepository repository = RepositoryService.getRepository(project);
        Commit commitA = repository.getCommit(revA);
        Commit commitB = repository.getCommit(revB);

        if (commitA == null || commitB == null) {
            return notFound(ErrorViews.NotFound.render("error.notfound.commit", project));
        }

        if (RepositoryService.VCS_SUBVERSION.equals(project.vcs)) {
            String patch = repository.getPatch(revA, revB);
            if (patch == null) {
                return notFound(ErrorViews.NotFound.render("error.notfound", project));
            }
            return ok(compare_svn.render(project, commitA, commitB, patch));
        } else {
            List<FileDiff> diffs = repository.getDiff(revA, revB);
            if (diffs == null) {
                return notFound(ErrorViews.NotFound.render("error.notfound", project));
            }
            return ok(compare.render(project, commitA, commitB, diffs));
        }
View Full Code Here

TOP

Related Classes of playRepository.PlayRepository

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.