Search in sources :

Example 1 with JobsConfs

use of org.folio.rest.jaxrs.model.JobsConfs in project raml-module-builder by folio-org.

the class JobAPI method getJobsJobconfs.

@Validate
@Override
public void getJobsJobconfs(String query, String orderBy, Order order, int offset, int limit, String lang, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {
    try {
        Criterion criterion = Criterion.json2Criterion(query);
        criterion.setLimit(new Limit(limit)).setOffset(new Offset(offset));
        org.folio.rest.persist.Criteria.Order or = getOrder(order, orderBy);
        if (or != null) {
            criterion.setOrder(or);
        }
        System.out.println("sending... getJobsJobconfs");
        vertxContext.runOnContext(v -> {
            try {
                PostgresClient.getInstance(vertxContext.owner()).get(RTFConsts.JOB_CONF_COLLECTION, JobConf.class, criterion, true, reply -> {
                    JobsConfs ps = new JobsConfs();
                    @SuppressWarnings("unchecked") List<JobConf> jobConfs = (List<JobConf>) reply.result().getResults();
                    ps.setJobConfs(jobConfs);
                    ps.setTotalRecords(jobConfs.size());
                    asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetJobsJobconfsResponse.withJsonOK(ps)));
                });
            } catch (Exception e) {
                log.error(e);
                asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetJobsJobconfsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
            }
        });
    } catch (Exception e) {
        log.error(e);
        asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetJobsJobconfsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
    }
}
Also used : Criteria(org.folio.rest.persist.Criteria.Criteria) Offset(org.folio.rest.persist.Criteria.Offset) Criterion(org.folio.rest.persist.Criteria.Criterion) JobsConfs(org.folio.rest.jaxrs.model.JobsConfs) List(java.util.List) Limit(org.folio.rest.persist.Criteria.Limit) JobConf(org.folio.rest.jaxrs.model.JobConf) Validate(org.folio.rest.annotations.Validate)

Aggregations

List (java.util.List)1 Validate (org.folio.rest.annotations.Validate)1 JobConf (org.folio.rest.jaxrs.model.JobConf)1 JobsConfs (org.folio.rest.jaxrs.model.JobsConfs)1 Criteria (org.folio.rest.persist.Criteria.Criteria)1 Criterion (org.folio.rest.persist.Criteria.Criterion)1 Limit (org.folio.rest.persist.Criteria.Limit)1 Offset (org.folio.rest.persist.Criteria.Offset)1