当前位置: 首页>>代码示例>>Java>>正文


Java Validate类代码示例

本文整理汇总了Java中org.folio.rest.annotations.Validate的典型用法代码示例。如果您正苦于以下问题:Java Validate类的具体用法?Java Validate怎么用?Java Validate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Validate类属于org.folio.rest.annotations包,在下文中一共展示了Validate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: putAdminLoglevel

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void putAdminLoglevel(Level level, String javaPackage, java.util.Map<String, String>okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  try {
    JsonObject updatedLoggers = LogUtil.updateLogConfiguration(javaPackage, level.name());
    OutStream os = new OutStream();
    os.setData(updatedLoggers);
    asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PutAdminLoglevelResponse.withJsonOK(os)));
  } catch (Exception e) {
    asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PutAdminLoglevelResponse.withPlainInternalServerError("ERROR"
        + e.getMessage())));
    log.error(e.getMessage(), e);
  }

}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:18,代码来源:AdminAPI.java

示例2: getAdminPostgresActiveSessions

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void getAdminPostgresActiveSessions(String dbname, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  PostgresClient.getInstance(vertxContext.owner(), "public").select("SELECT pid , usename, "
      + "application_name, client_addr, client_hostname, "
      + "query, state from pg_stat_activity where datname='"+dbname+"'", reply -> {

        if(reply.succeeded()){

          OutStream stream = new OutStream();
          stream.setData(reply.result().getRows());

          asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetAdminPostgresActiveSessionsResponse.
            withJsonOK(stream)));
        }
        else{
          log.error(reply.cause().getMessage(), reply.cause());
          asyncResultHandler.handle(io.vertx.core.Future.failedFuture(reply.cause().getMessage()));
        }
      });
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:24,代码来源:AdminAPI.java

示例3: getAdminPostgresTableAccessStats

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void getAdminPostgresTableAccessStats(Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  PostgresClient.getInstance(vertxContext.owner()).select(
      "SELECT schemaname,relname,seq_scan,idx_scan,cast(idx_scan "
      + "AS numeric) / (idx_scan + seq_scan) AS idx_scan_pct "
      + "FROM pg_stat_user_tables WHERE (idx_scan + seq_scan)>0 "
      + "ORDER BY idx_scan_pct;", reply -> {

        if(reply.succeeded()){

          OutStream stream = new OutStream();
          stream.setData(reply.result().getRows());

          asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetAdminPostgresTableAccessStatsResponse.
            withJsonOK(stream)));
        }
        else{
          log.error(reply.cause().getMessage(), reply.cause());
          asyncResultHandler.handle(io.vertx.core.Future.failedFuture(reply.cause().getMessage()));
        }
      });
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:26,代码来源:AdminAPI.java

示例4: getAdminPostgresTableSize

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void getAdminPostgresTableSize(String dbname, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  PostgresClient.getInstance(vertxContext.owner()).select(
    "SELECT relname as \"Table\", pg_size_pretty(pg_relation_size(relid)) As \" Table Size\","
    + " pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as \"Index Size\""
    + " FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;", reply -> {
      if(reply.succeeded()){

        OutStream stream = new OutStream();
        stream.setData(reply.result().getRows());

        asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetAdminPostgresTableAccessStatsResponse.
          withJsonOK(stream)));
      }
      else{
        log.error(reply.cause().getMessage(), reply.cause());
        asyncResultHandler.handle(io.vertx.core.Future.failedFuture(reply.cause().getMessage()));
      }
    });

}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:25,代码来源:AdminAPI.java

示例5: postAdminGetPassword

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void postAdminGetPassword(String key, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  String tenantId = TenantTool.calculateTenantId( okapiHeaders.get(ClientGenerator.OKAPI_HEADER_TENANT) );

  if(tenantId == null){
    asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(
      PostAdminGetPasswordResponse.withPlainBadRequest("Tenant id is null")));
  }
  else{
    try {
      String password = AES.encryptPasswordAsBase64(tenantId, AES.getSecretKeyObject(key));
      asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostAdminGetPasswordResponse.withPlainOK(password)));
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(
        PostAdminGetPasswordResponse.withPlainInternalServerError(e.getMessage())));
    }

  }

}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:25,代码来源:AdminAPI.java

示例6: getAdminSlowQueries

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void getAdminSlowQueries(int querytimerunning, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  /** the queries returned are of this backend's most recent query. If state is active this field shows the currently
   * executing query. In all other states, it shows the last query that was executed.*/
  PostgresClient.getInstance(vertxContext.owner()).select(
    "SELECT EXTRACT(EPOCH FROM now() - query_start) as runtime, client_addr, usename, datname, state, query "+
    "FROM  pg_stat_activity " +
    "WHERE now() - query_start > '"+querytimerunning+" seconds'::interval "+
    "ORDER BY runtime DESC;", reply -> {
      if(reply.succeeded()){

        OutStream stream = new OutStream();
        stream.setData(reply.result().getRows());

        asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetAdminSlowQueriesResponse.
          withJsonOK(stream)));
      }
      else{
        log.error(reply.cause().getMessage(), reply.cause());
        asyncResultHandler.handle(io.vertx.core.Future.failedFuture(reply.cause().getMessage()));
      }
    });
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:27,代码来源:AdminAPI.java

示例7: getAdminTotalDbSize

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void getAdminTotalDbSize(String dbname, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {
  PostgresClient.getInstance(vertxContext.owner()).select(
    "select pg_size_pretty(pg_database_size('"+dbname+"')) as db_size", reply -> {
      if(reply.succeeded()){

        OutStream stream = new OutStream();
        stream.setData(reply.result().getRows());

        asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetAdminTotalDbSizeResponse.
          withJsonOK(stream)));
      }
      else{
        log.error(reply.cause().getMessage(), reply.cause());
        asyncResultHandler.handle(io.vertx.core.Future.failedFuture(reply.cause().getMessage()));
      }
    });
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:21,代码来源:AdminAPI.java

示例8: deleteAdminKillQuery

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void deleteAdminKillQuery(String pid, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  PostgresClient.getInstance(vertxContext.owner()).select(
    "SELECT pg_terminate_backend('"+pid+"');", reply -> {
      if(reply.succeeded()){
        System.out.println("locking q -> " + reply.result().getResults().get(0).getBoolean(0));

        if(false == (reply.result().getResults().get(0).getBoolean(0))){
          asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(DeleteAdminKillQueryResponse.withPlainNotFound(pid)));
        }
        else{
          asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(DeleteAdminKillQueryResponse.withNoContent()));
        }
      }
      else{
        log.error(reply.cause().getMessage(), reply.cause());
        asyncResultHandler.handle(io.vertx.core.Future.failedFuture(reply.cause().getMessage()));
      }
  });

}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:25,代码来源:AdminAPI.java

示例9: deleteLoanPolicyStorageLoanPolicies

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Override
@Validate
public void deleteLoanPolicyStorageLoanPolicies(
  String lang, Map<String, String> okapiHeaders,
  Handler<AsyncResult<Response>> asyncResultHandler,
  Context vertxContext) throws Exception {

  String tenantId = okapiHeaders.get(TENANT_HEADER);

  vertxContext.runOnContext(v -> {
    try {
      PostgresClient postgresClient = PostgresClient.getInstance(
        vertxContext.owner(), TenantTool.calculateTenantId(tenantId));

      postgresClient.mutate(String.format("TRUNCATE TABLE %s_%s.%s",
        tenantId, "mod_circulation_storage", LOAN_POLICY_TABLE),
        reply -> {
          asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(
            LoanPolicyStorageResource.DeleteLoanPolicyStorageLoanPoliciesResponse
              .noContent().build()));
        });
    }
    catch(Exception e) {
      asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(
        LoanPolicyStorageResource.DeleteLoanPolicyStorageLoanPoliciesResponse
          .withPlainInternalServerError(e.getMessage())));
    }
  });
}
 
开发者ID:folio-org,项目名称:mod-circulation-storage,代码行数:30,代码来源:LoanPoliciesAPI.java

示例10: getRmbtestsBooks

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
/**
 * validate to test the validation aspect
 */
@Validate
@Override
public void getRmbtestsBooks(String author, BigDecimal publicationYear, BigDecimal rating,
    String isbn, List<String> facets, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetRmbtestsBooksResponse.withJsonOK(new Book())));

}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:13,代码来源:BooksDemoAPI.java

示例11: putRmbtestsBooks

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void putRmbtestsBooks(BigDecimal accessToken, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(null));

}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:9,代码来源:BooksDemoAPI.java

示例12: postRmbtestsBooks

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void postRmbtestsBooks(Book entity, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {
  OutStream stream = new OutStream();
  stream.setData(entity);
  asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostRmbtestsBooksResponse.withJsonCreated("/dummy/location", stream)));
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:9,代码来源:BooksDemoAPI.java

示例13: getTenant

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void getTenant(Map<String, String> headers, Handler<AsyncResult<Response>> handlers,
    Context context) throws Exception {

  context.runOnContext(v -> {
    try {

      String tenantId = TenantTool.calculateTenantId( headers.get(ClientGenerator.OKAPI_HEADER_TENANT) );
      log.info("sending... postTenant for " + tenantId);

      tenantExists(context, tenantId, res -> {
        boolean exists = false;
        if(res.succeeded()){
          exists = res.result();
          handlers.handle(io.vertx.core.Future.succeededFuture(GetTenantResponse.withPlainOK(String.valueOf(
            exists))));
        }
        else{
          log.error(res.cause().getMessage(), res.cause());
          handlers.handle(io.vertx.core.Future.succeededFuture(GetTenantResponse
            .withPlainInternalServerError(res.cause().getMessage())));
        }
      });
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      handlers.handle(io.vertx.core.Future.succeededFuture(GetTenantResponse
        .withPlainInternalServerError(e.getMessage())));
    }
  });
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:32,代码来源:TenantAPI.java

示例14: getAdminLoglevel

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void getAdminLoglevel(java.util.Map<String, String>okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  try {
    JsonObject loggers = LogUtil.getLogConfiguration();
    OutStream os = new OutStream();
    os.setData(loggers);
    asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PutAdminLoglevelResponse.withJsonOK(os)));
  } catch (Exception e) {
    asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PutAdminLoglevelResponse.withPlainInternalServerError("ERROR"
        + e.getMessage())));
    log.error(e.getMessage(), e);
  }
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:16,代码来源:AdminAPI.java

示例15: postAdminUploadmultipart

import org.folio.rest.annotations.Validate; //导入依赖的package包/类
@Validate
@Override
public void postAdminUploadmultipart(PersistMethod persistMethod, String busAddress,
    String fileName, MimeMultipart entity, Map<String, String> okapiHeaders,
    Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {

  if(entity != null){
    int parts = entity.getCount();
    for (int i = 0; i < parts; i++) {
      BodyPart bp = entity.getBodyPart(i);
      System.out.println(bp.getFileName());
      //System.out.println(bp.getContent());
      //System.out.println("-----------------------------------------");
    }
    String name = "";
    try{
      if(fileName == null){
        name = entity.getBodyPart(0).getFileName();
      }
      else{
        name = fileName;
      }
    }
    catch(Exception e){
      log.error(e.getMessage(), e);
    }
  }

  asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostAdminUploadmultipartResponse.withOK("TODO"
      )));
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:32,代码来源:AdminAPI.java


注:本文中的org.folio.rest.annotations.Validate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。