Examples of App


Examples of com.erudika.para.core.App

  }

  private Inflector<ContainerRequestContext, Response> listTypesHandler() {
    return new Inflector<ContainerRequestContext, Response>() {
      public Response apply(ContainerRequestContext ctx) {
        App app = RestUtils.getPrincipalApp();
        if (app != null) {
          return Response.ok(RestUtils.getAllTypes(app)).build();
        }
        return RestUtils.getStatusResponse(Response.Status.NOT_FOUND, "App not found.");
      }
View Full Code Here

Examples of com.erudika.para.core.App

  }

  private Inflector<ContainerRequestContext, Response> keysHandler() {
    return new Inflector<ContainerRequestContext, Response>() {
      public Response apply(ContainerRequestContext ctx) {
        App app = RestUtils.getPrincipalApp();
        if (app != null) {
          app.resetSecret();
          app.update();
          Map<String, String> creds = app.getCredentials();
          creds.put("info", "Save the secret key! It is showed only once!");
          return Response.ok(creds).build();
        }
        return RestUtils.getStatusResponse(Response.Status.NOT_FOUND, "App not found.");
      }
View Full Code Here

Examples of com.erudika.para.core.App

  }

  private Inflector<ContainerRequestContext, Response> setupHandler() {
    return new Inflector<ContainerRequestContext, Response>() {
      public Response apply(ContainerRequestContext ctx) {
        App app = new App(Config.APP_NAME_NS); // the root app name
        if (app.exists()) {
          return RestUtils.getStatusResponse(Response.Status.OK, "All set!");
        } else {
          app.setName(Config.APP_NAME);
          app.create();
          Map<String, String> creds = app.getCredentials();
          creds.put("info", "Save the secret key! It is showed only once!");
          return Response.ok(creds).build();
        }
      }
    };
View Full Code Here

Examples of com.erudika.para.core.App

  }

  private Inflector<ContainerRequestContext, Response> batchCreateHandler() {
    return new Inflector<ContainerRequestContext, Response>() {
      public Response apply(ContainerRequestContext ctx) {
        App app = RestUtils.getPrincipalApp();
        return RestUtils.getBatchCreateResponse(app, ctx.getEntityStream());
      }
    };
  }
View Full Code Here

Examples of com.erudika.para.core.App

  }

  private Inflector<ContainerRequestContext, Response> batchReadHandler() {
    return new Inflector<ContainerRequestContext, Response>() {
      public Response apply(ContainerRequestContext ctx) {
        App app = RestUtils.getPrincipalApp();
        return RestUtils.getBatchReadResponse(app, ctx.getUriInfo().getQueryParameters().get("ids"));
      }
    };
  }
View Full Code Here

Examples of com.erudika.para.core.App

  }

  private Inflector<ContainerRequestContext, Response> batchUpdateHandler() {
    return new Inflector<ContainerRequestContext, Response>() {
      public Response apply(ContainerRequestContext ctx) {
        App app = RestUtils.getPrincipalApp();
        return RestUtils.getBatchUpdateResponse(app, ctx.getEntityStream());
      }
    };
  }
View Full Code Here

Examples of com.erudika.para.core.App

  }

  private Inflector<ContainerRequestContext, Response> batchDeleteHandler() {
    return new Inflector<ContainerRequestContext, Response>() {
      public Response apply(ContainerRequestContext ctx) {
        App app = RestUtils.getPrincipalApp();
        return RestUtils.getBatchDeleteResponse(app, ctx.getUriInfo().getQueryParameters().get("ids"));
      }
    };
  }
View Full Code Here

Examples of com.erudika.para.core.App

  }

  private Inflector<ContainerRequestContext, Response> searchHandler(final String type) {
    return new Inflector<ContainerRequestContext, Response>() {
      public Response apply(ContainerRequestContext ctx) {
        App app = RestUtils.getPrincipalApp();
        MultivaluedMap<String, String> params = ctx.getUriInfo().getQueryParameters();
        String queryType = ctx.getUriInfo().getPathParameters().getFirst("querytype");
        return Response.ok(buildQueryAndSearch(app, queryType, params, type)).build();
      }
    };
View Full Code Here

Examples of com.erudika.para.core.App

      Object principal = auth.getPrincipal();
      if (principal != null) {
        if (principal instanceof App) {
          return (App) principal;
        } else if (principal instanceof User) {
          return Para.getDAO().read(Config.APP_NAME_NS, new App(((User) principal).getAppid()).getId());
        }
      }
    }
    logger.info("Unauthenticated request - returning root App: '{}'", Config.APP_NAME_NS);
    return Para.getDAO().read(Config.APP_NAME_NS, new App(Config.APP_NAME_NS).getId());
  }
View Full Code Here

Examples of com.erudika.para.core.App

   */
  protected static App getApp(String appid) {
    if (StringUtils.isBlank(appid)) {
      return null;
    } else {
      return  Para.getDAO().read(Config.APP_NAME_NS, new App(appid).getId());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.