Package play.mvc

Examples of play.mvc.Call


    private UserService userService;

    public Result redirect() {
        Startpage startpage = currentUser().getStartpage();

        Call call;
        if (startpage == null || StartpageRouteHelper.getCall(startpage) == null) {
            call = routes.SearchController.globalSearch();
        } else {
            call = StartpageRouteHelper.getCall(startpage);
        }
View Full Code Here


            flash("success", "Configured new startpage for your user.");
        } else {
            flash("error", "Could not set new startpage for your user.");
        }

        Call redirectTarget;
        switch (type) {
            case STREAM:
                redirectTarget = routes.StreamsController.index();
                break;
            case DASHBOARD:
View Full Code Here

              loginUser = getUserService()
                  .merge(newUser, oldUser);
            } else {
              // Account auto merging is disabled - forward user
              // to merge request page
              final Call c = getResolver().askMerge();
              if (c == null) {
                throw new RuntimeException(
                    Messages.get(
                        "playauthenticate.core.exception.merge.controller_undefined",
                        SETTING_KEY_ACCOUNT_AUTO_MERGE));
              }
              storeMergeUser(newUser, session);
              return Controller.redirect(c);
            }
          } else {
            // the currently logged in user and the new login belong
            // to the same local user,
            // or Account merge is disabled, so just change the log
            // in to the new user
            loginUser = newUser;
          }

        } else if (!isLoggedIn) {
          // 3. -> Signup
          loginUser = signupUser(newUser, session, ap);
        } else {
          // !isLinked && isLoggedIn:

          // 4. -> Link additional
          if (isAccountAutoLink()) {
            // Account auto linking is enabled

            loginUser = getUserService().link(oldUser, newUser);
          } else {
            // Account auto linking is disabled - forward user to
            // link suggestion page
            final Call c = getResolver().askLink();
            if (c == null) {
              throw new RuntimeException(
                  Messages.get(
                      "playauthenticate.core.exception.link.controller_undefined",
                      SETTING_KEY_ACCOUNT_AUTO_LINK));
            }
            storeLinkUser(newUser, session);
            return Controller.redirect(c);
          }

        }

        return loginAndRedirect(context, loginUser);
      } else {
        return Controller.internalServerError(Messages
            .get("playauthenticate.core.exception.general"));
      }
    } catch (final AuthException e) {
      final Call c = getResolver().onException(e);
      if (c != null) {
        return Controller.redirect(c);
      } else {
        final String message = e.getMessage();
        if (message != null) {
View Full Code Here

    final boolean isHttps = useSecureRedirectUri();
        final PlayAuthenticate.Resolver resolver = PlayAuthenticate.getResolver();
        if (resolver == null) {
            throw new ResolverMissingException("Resolver has not been set.");
        }
    final Call c = resolver.auth(getKey());
    if (overrideHost != null && !overrideHost.trim().isEmpty()) {
      return "http" + (isHttps ? "s" : "") + "://" + overrideHost
          + c.url();
    } else {
      return c.absoluteURL(request, isHttps);
    }
  }
View Full Code Here

    public static Result nextState(String ownerName, String projectName, Long number) {
        Project project = Project.findByOwnerAndProjectName(ownerName, projectName);

        final Issue issue = Issue.findByNumber(project, number);

        Call redirectTo = routes.IssueApp.issue(project.owner, project.name, number);
        issue.toNextState();
        NotificationEvent notiEvent = NotificationEvent.afterStateChanged(issue.previousState(), issue);
        IssueEvent.addFromNotificationEvent(notiEvent, issue, UserApp.currentUser().loginId);
        return redirect(redirectTo);
    }
View Full Code Here

        setMilestone(issueForm, issue);
        issue.dueDate = JodaDateUtil.lastSecondOfDay(issue.dueDate);

        final Issue originalIssue = Issue.findByNumber(project, number);

        Call redirectTo = routes.IssueApp.issue(project.owner, project.name, number);

        // preUpdateHook.run would be called just before this issue is updated.
        // It updates some properties only for issues, such as assignee or labels, but not for non-issues.
        Runnable preUpdateHook = new Runnable() {
            @Override
View Full Code Here

        Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
        Issue issue = Issue.findByNumber(project, number);
        if(!issue.canBeDeleted()) {
            return badRequest(ErrorViews.BadRequest.render());
        }
        Call redirectTo =
            routes.IssueApp.issues(project.owner, project.name, State.OPEN.state(), "html", 1);

        return delete(issue, issue.asResource(), redirectTo);
    }
View Full Code Here

    @Transactional
    @With(NullProjectCheckAction.class)
    public static Result newComment(String ownerName, String projectName, Long number) throws IOException {
        Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
        final Issue issue = Issue.findByNumber(project, number);
        Call redirectTo = routes.IssueApp.issue(project.owner, project.name, number);
        Form<IssueComment> commentForm = new Form<>(IssueComment.class).bindFromRequest();

        if (!AccessControl.isResourceCreatable(
                    UserApp.currentUser(), issue.asResource(), ResourceType.ISSUE_COMMENT)) {
            return forbidden(ErrorViews.Forbidden.render("error.forbidden", project));
View Full Code Here

    @With(NullProjectCheckAction.class)
    public static Result deleteComment(String ownerName, String projectName, Long issueNumber,
            Long commentId) {
        Comment comment = IssueComment.find.byId(commentId);
        Project project = comment.asResource().getProject();
        Call redirectTo =
            routes.IssueApp.issue(project.owner, project.name, issueNumber);

        return delete(comment, comment.asResource(), redirectTo);
    }
View Full Code Here

        Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
        Issue issue = Issue.findByNumber(project, issueNumber);

        issue.addVoter(UserApp.currentUser());

        Call call = routes.IssueApp.issue(ownerName, projectName, issueNumber);

        return redirect(call);
    }
View Full Code Here

TOP

Related Classes of play.mvc.Call

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.