예제 #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());
  }
  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));
  }