Search in sources :

Example 16 with HridSettings

use of org.folio.rest.jaxrs.model.HridSettings in project mod-inventory-storage by folio-org.

the class HridSettingsStorageAPI method putHridSettingsStorageHridSettings.

@Validate
@Override
public void putHridSettingsStorageHridSettings(HridSettings hridSettings, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
    try {
        vertxContext.runOnContext(v -> {
            try {
                final PostgresClient postgresClient = PostgresClient.getInstance(vertxContext.owner(), TenantTool.tenantId(okapiHeaders));
                final HridManager hridManager = new HridManager(vertxContext, postgresClient);
                hridManager.updateHridSettings(hridSettings).map(success -> successPut(asyncResultHandler)).otherwise(error -> internalErrorPut(asyncResultHandler, error));
            } catch (Exception e) {
                internalErrorPut(asyncResultHandler, e);
            }
        });
    } catch (Exception e) {
        internalErrorPut(asyncResultHandler, e);
    }
}
Also used : Validate(org.folio.rest.annotations.Validate) TenantTool(org.folio.rest.tools.utils.TenantTool) Context(io.vertx.core.Context) Future(io.vertx.core.Future) PostgresClient(org.folio.rest.persist.PostgresClient) HridManager(org.folio.rest.support.HridManager) Logger(org.apache.logging.log4j.Logger) Response(javax.ws.rs.core.Response) Map(java.util.Map) AsyncResult(io.vertx.core.AsyncResult) Handler(io.vertx.core.Handler) LogManager(org.apache.logging.log4j.LogManager) HridSettings(org.folio.rest.jaxrs.model.HridSettings) HridSettingsStorage(org.folio.rest.jaxrs.resource.HridSettingsStorage) HridManager(org.folio.rest.support.HridManager) PostgresClient(org.folio.rest.persist.PostgresClient) Validate(org.folio.rest.annotations.Validate)

Example 17 with HridSettings

use of org.folio.rest.jaxrs.model.HridSettings in project mod-inventory-storage by folio-org.

the class HridSettingsStorageAPI method getHridSettingsStorageHridSettings.

@Validate
@Override
public void getHridSettingsStorageHridSettings(Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
    try {
        vertxContext.runOnContext(v -> {
            try {
                final PostgresClient postgresClient = PostgresClient.getInstance(vertxContext.owner(), TenantTool.tenantId(okapiHeaders));
                final HridManager hridManager = new HridManager(vertxContext, postgresClient);
                hridManager.getHridSettings().map(hridSettings -> successGet(asyncResultHandler, hridSettings)).otherwise(error -> internalErrorGet(asyncResultHandler, error));
            } catch (Exception e) {
                internalErrorGet(asyncResultHandler, e);
            }
        });
    } catch (Exception e) {
        internalErrorGet(asyncResultHandler, e);
    }
}
Also used : Validate(org.folio.rest.annotations.Validate) TenantTool(org.folio.rest.tools.utils.TenantTool) Context(io.vertx.core.Context) Future(io.vertx.core.Future) PostgresClient(org.folio.rest.persist.PostgresClient) HridManager(org.folio.rest.support.HridManager) Logger(org.apache.logging.log4j.Logger) Response(javax.ws.rs.core.Response) Map(java.util.Map) AsyncResult(io.vertx.core.AsyncResult) Handler(io.vertx.core.Handler) LogManager(org.apache.logging.log4j.LogManager) HridSettings(org.folio.rest.jaxrs.model.HridSettings) HridSettingsStorage(org.folio.rest.jaxrs.resource.HridSettingsStorage) HridManager(org.folio.rest.support.HridManager) PostgresClient(org.folio.rest.persist.PostgresClient) Validate(org.folio.rest.annotations.Validate)

Aggregations

HridSettings (org.folio.rest.jaxrs.model.HridSettings)17 CompletableFuture (java.util.concurrent.CompletableFuture)14 Response (org.folio.rest.support.Response)14 Test (org.junit.Test)14 HridSetting (org.folio.rest.jaxrs.model.HridSetting)13 Future (io.vertx.core.Future)11 LogManager (org.apache.logging.log4j.LogManager)11 Logger (org.apache.logging.log4j.Logger)11 PostgresClient (org.folio.rest.persist.PostgresClient)11 HridManager (org.folio.rest.support.HridManager)11 Promise (io.vertx.core.Promise)9 Vertx (io.vertx.core.Vertx)9 Async (io.vertx.ext.unit.Async)9 TestContext (io.vertx.ext.unit.TestContext)9 Timeout (io.vertx.ext.unit.junit.Timeout)9 VertxUnitRunner (io.vertx.ext.unit.junit.VertxUnitRunner)9 Row (io.vertx.sqlclient.Row)9 UUID (java.util.UUID)9 ExecutionException (java.util.concurrent.ExecutionException)9 SECONDS (java.util.concurrent.TimeUnit.SECONDS)9