コード例 #1
0
  public static Result deleteThirdParty(long thirdPartyId) {
    AppUtils.setHeaders(response());

    ThirdParty thirdParty = ThirdParty.getById(thirdPartyId);
    thirdParty.delete();

    return Results.ok(AppUtils.okJsonResponse());
  }
コード例 #2
0
  public static Result editThirdParty(long thirdPartyId) {
    AppUtils.setHeaders(response());

    if (thirdPartyId == 0) {
      try {
        ThirdParty thirdParty = Form.form(ThirdParty.class).bindFromRequest().get();
        thirdParty.save();

        return Results.ok(AppUtils.okJsonResponse());
      } catch (Exception e) {
        e.printStackTrace();
        return Results.internalServerError(AppUtils.errorJsonResponse(e.getMessage()));
      }
    }

    return Results.ok(AppUtils.okJsonResponse());
  }
コード例 #3
0
  public Result render() {

    boolean disableIndexing = true;
    String title = Messages.get("playauthenticate.index.intro");
    String description = Messages.get("playauthenticate.index.intro.description");
    String keywords = Messages.get("playauthenticate.index.intro.keywords");

    Content content = ViewIndex.render();

    ContentInner contentInner = new ContentInner(title, description, keywords, content);
    return Results.ok(this.onRenderListener.onRender(contentInner, disableIndexing));
  }
  public Result renderRemindPassword(final String email) {

    com.feth.play.module.pa.controllers.AuthenticateDI.noCache(this.session.response());
    Form<ModelAuth.Identity> form = getForgotPasswordForm();

    if (email != null && !email.trim().isEmpty()) {
      form = form.fill(new ModelAuth.Identity(email));
    }

    boolean disableIndexing = false;
    ContentInner contentInner = renderRemindPasswordView(form);

    return Results.ok(this.onRenderListener.onRender(contentInner, disableIndexing));
  }
コード例 #5
0
  public static Promise<Result> get(String symbol) {
    ActorRef stockSentimentActor =
        ActorManagerExtension.ActorManagerExtensionProvider.get(Akka.system())
            .getStockSentimentProxy();
    Future<Object> futureStockSentiments =
        Patterns.ask(stockSentimentActor, new StockSentimentActor.GetSentiment(symbol), timeout);
    Promise<Object> promiseSentiments = Promise.wrap(futureStockSentiments);

    return promiseSentiments
        .<Result>map(
            obj -> {
              StockSentimentActor.SendSentiment sendSentiment =
                  (StockSentimentActor.SendSentiment) obj;
              return Results.ok(sendSentiment.getSentiment());
            })
        .recover(StockSentiment::errorResponse);
  }
  public Result renderResetPassword(final String token) {
    com.feth.play.module.pa.controllers.AuthenticateDI.noCache(this.session.response());
    final EntryTokenAction ta = Auth.isTokenValid(token, EntryTokenAction.Type.PASSWORD_RESET);
    if (ta == null) {

      ContentInner contentInner =
          new PageAuthAccount(this.session, this.onRenderListener).renderNoTokenOrInvalidView();
      boolean disableIndexing = false;

      return Results.badRequest(this.onRenderListener.onRender(contentInner, disableIndexing));
    }

    boolean disableIndexing = false;
    ContentInner contentInner =
        renderResetPasswordView(getResetPasswordForm().fill(new ModelAuth.PasswordReset(token)));

    return Results.ok(this.onRenderListener.onRender(contentInner, disableIndexing));
  }
コード例 #7
0
ファイル: Common.java プロジェクト: CMDA-CMU/CMDA
 public static Result badRequestWrapper(String s) {
   Map<String, String> map = new HashMap<>();
   map.put("error", s);
   String error = new Gson().toJson(map);
   return Results.ok(error);
 }
コード例 #8
0
  public static Result getThirdParty(long thirdPartyId) {
    AppUtils.setHeaders(response());

    ThirdParty thirdParty = ThirdParty.getById(thirdPartyId);
    return Results.ok(Json.toJson(thirdParty));
  }
コード例 #9
0
  public static Result getThirdParties() {
    AppUtils.setHeaders(response());

    List<ThirdParty> thirdParties = ThirdParty.getAll();
    return Results.ok(Json.toJson(thirdParties));
  }