use of org.folio.rest.annotations.Validate in project raml-module-builder by folio-org.
the class BooksDemoAPI method postRmbtestsBooks.
@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)));
}
use of org.folio.rest.annotations.Validate 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))));
}
}
use of org.folio.rest.annotations.Validate in project raml-module-builder by folio-org.
the class JobAPI method postJobsJobconfsByJobconfsIdJobs.
@Validate
@Override
public void postJobsJobconfsByJobconfsIdJobs(String jobconfsId, String lang, Job entity, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {
System.out.println("sending... postJobsJobconfsByJobconfsIdJobs");
entity.setJobConfId(jobconfsId);
try {
vertxContext.runOnContext(v -> {
try {
PostgresClient.getInstance(vertxContext.owner()).save(RTFConsts.JOBS_COLLECTION, entity, reply -> {
try {
OutStream stream = new OutStream();
stream.setData(entity);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostJobsJobconfsByJobconfsIdJobsResponse.withJsonCreated(reply.result(), stream)));
} catch (Exception e) {
log.error(e);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostJobsJobconfsByJobconfsIdJobsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
}
});
} catch (Exception e) {
log.error(e.getMessage(), e);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostJobsJobconfsByJobconfsIdJobsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
}
});
} catch (Exception e) {
log.error(e.getMessage(), e);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostJobsJobconfsByJobconfsIdJobsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
}
}
use of org.folio.rest.annotations.Validate in project raml-module-builder by folio-org.
the class JobAPI method postJobsJobconfs.
@Validate
@Override
public void postJobsJobconfs(String lang, JobConf entity, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {
System.out.println("sending... postJobsJobconfs");
try {
vertxContext.runOnContext(v -> {
try {
PostgresClient.getInstance(vertxContext.owner()).save(RTFConsts.JOB_CONF_COLLECTION, entity, reply -> {
OutStream stream = new OutStream();
stream.setData(entity);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostJobsJobconfsResponse.withJsonCreated(reply.result(), stream)));
});
} catch (Exception e) {
log.error(e);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostJobsJobconfsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
}
});
} catch (Exception e) {
log.error(e);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(PostJobsJobconfsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
}
}
use of org.folio.rest.annotations.Validate in project raml-module-builder by folio-org.
the class JobAPI method getJobsJobconfsByJobconfsIdJobs.
@Validate
@Override
public void getJobsJobconfsByJobconfsIdJobs(String jobconfsId, String query, String orderBy, Order order, int offset, int limit, String lang, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) throws Exception {
System.out.println("sending... getJobsJobconfsByJobconfsIdJobs");
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);
}
vertxContext.runOnContext(v -> {
try {
PostgresClient.getInstance(vertxContext.owner()).get(RTFConsts.JOBS_COLLECTION, Job.class, criterion, true, reply -> {
try {
@SuppressWarnings("unchecked") List<Job> jobs = (List<Job>) reply.result().getResults();
Jobs jobList = new Jobs();
jobList.setJobs(jobs);
jobList.setTotalRecords(jobs.size());
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetJobsJobconfsByJobconfsIdJobsResponse.withJsonOK(jobList)));
} catch (Exception e) {
log.error(e.getMessage(), e);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetJobsJobconfsByJobconfsIdJobsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
}
});
} catch (Exception e) {
log.error(e.getMessage(), e);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetJobsJobconfsByJobconfsIdJobsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
}
});
} catch (Exception e) {
log.error(e.getMessage(), e);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(GetJobsJobconfsByJobconfsIdJobsResponse.withPlainInternalServerError(messages.getMessage(lang, MessageConsts.InternalServerError))));
}
}
Aggregations