Search in sources :

Example 1 with TenantInstallOptions

use of org.folio.okapi.util.TenantInstallOptions in project okapi by folio-org.

the class InternalModule method createTenantOptions.

private TenantInstallOptions createTenantOptions(RoutingContext ctx) {
    TenantInstallOptions options = new TenantInstallOptions();
    options.setSimulate(getParamBoolean(ctx.request(), "simulate", false));
    options.setPreRelease(getParamBoolean(ctx.request(), "preRelease", true));
    options.setDeploy(getParamBoolean(ctx.request(), "deploy", false));
    return options;
}
Also used : TenantInstallOptions(org.folio.okapi.util.TenantInstallOptions)

Example 2 with TenantInstallOptions

use of org.folio.okapi.util.TenantInstallOptions in project okapi by folio-org.

the class InternalModule method installModulesForTenant.

private void installModulesForTenant(ProxyContext pc, String id, String body, Handler<ExtendedAsyncResult<String>> fut) {
    try {
        TenantInstallOptions options = createTenantOptions(pc.getCtx());
        final TenantModuleDescriptor[] tml = Json.decodeValue(body, TenantModuleDescriptor[].class);
        List<TenantModuleDescriptor> tm = new LinkedList<>();
        Collections.addAll(tm, tml);
        tenantManager.installUpgradeModules(id, pc, options, tm, res -> {
            if (res.failed()) {
                fut.handle(new Failure<>(res.getType(), res.cause()));
            } else {
                logger.info("installUpgradeModules returns:\n" + Json.encodePrettily(res.result()));
                fut.handle(new Success<>(Json.encodePrettily(res.result())));
            }
        });
    } catch (DecodeException ex) {
        fut.handle(new Failure<>(USER, ex));
    }
}
Also used : TenantModuleDescriptor(org.folio.okapi.bean.TenantModuleDescriptor) DecodeException(io.vertx.core.json.DecodeException) LinkedList(java.util.LinkedList) Failure(org.folio.okapi.common.Failure) TenantInstallOptions(org.folio.okapi.util.TenantInstallOptions)

Example 3 with TenantInstallOptions

use of org.folio.okapi.util.TenantInstallOptions in project okapi by folio-org.

the class InternalModule method upgradeModulesForTenant.

private void upgradeModulesForTenant(ProxyContext pc, String id, Handler<ExtendedAsyncResult<String>> fut) {
    try {
        TenantInstallOptions options = createTenantOptions(pc.getCtx());
        tenantManager.installUpgradeModules(id, pc, options, null, res -> {
            if (res.failed()) {
                fut.handle(new Failure<>(res.getType(), res.cause()));
            } else {
                logger.info("installUpgradeModules returns:\n" + Json.encodePrettily(res.result()));
                fut.handle(new Success<>(Json.encodePrettily(res.result())));
            }
        });
    } catch (DecodeException ex) {
        fut.handle(new Failure<>(USER, ex));
    }
}
Also used : DecodeException(io.vertx.core.json.DecodeException) Failure(org.folio.okapi.common.Failure) TenantInstallOptions(org.folio.okapi.util.TenantInstallOptions)

Aggregations

TenantInstallOptions (org.folio.okapi.util.TenantInstallOptions)3 DecodeException (io.vertx.core.json.DecodeException)2 Failure (org.folio.okapi.common.Failure)2 LinkedList (java.util.LinkedList)1 TenantModuleDescriptor (org.folio.okapi.bean.TenantModuleDescriptor)1