Search in sources :

Example 6 with CompList

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

the class TenantManager method loadTenants2.

private void loadTenants2(Handler<ExtendedAsyncResult<Void>> fut) {
    tenantStore.listTenants(lres -> {
        if (lres.failed()) {
            fut.handle(new Failure<>(lres.getType(), lres.cause()));
        } else {
            CompList<List<Void>> futures = new CompList<>(INTERNAL);
            for (Tenant t : lres.result()) {
                Future<Void> f = Future.future();
                tenants.add(t.getId(), t, f::handle);
                futures.add(f);
            }
            futures.all(fut);
        }
    });
}
Also used : Tenant(org.folio.okapi.bean.Tenant) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) PermissionList(org.folio.okapi.bean.PermissionList) CompList(org.folio.okapi.util.CompList) CompList(org.folio.okapi.util.CompList)

Example 7 with CompList

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

the class ModuleManager method createList2.

private void createList2(List<ModuleDescriptor> list, Handler<ExtendedAsyncResult<Void>> fut) {
    CompList<Void> futures = new CompList<>(INTERNAL);
    for (ModuleDescriptor md : list) {
        Future<Void> f = Future.future();
        createList3(md, f::handle);
        futures.add(f);
    }
    futures.all(fut);
}
Also used : ModuleDescriptor(org.folio.okapi.bean.ModuleDescriptor) TenantModuleDescriptor(org.folio.okapi.bean.TenantModuleDescriptor) CompList(org.folio.okapi.util.CompList)

Example 8 with CompList

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

the class ModuleManager method loadModules.

/**
 * Load the modules from the database, if not already loaded.
 *
 * @param fut
 */
private void loadModules(Handler<ExtendedAsyncResult<Void>> fut) {
    if (moduleStore == null) {
        logger.debug("No ModuleStorage to load from, starting with empty");
        fut.handle(new Success<>());
        return;
    }
    modules.size(kres -> {
        if (kres.failed()) {
            fut.handle(new Failure<>(INTERNAL, kres.cause()));
            return;
        }
        if (kres.result() > 0) {
            logger.debug("Not loading modules, looks like someone already did");
            fut.handle(new Success<>());
            return;
        }
        moduleStore.getAll(mres -> {
            if (mres.failed()) {
                fut.handle(new Failure<>(mres.getType(), mres.cause()));
                return;
            }
            CompList<Void> futures = new CompList<>(INTERNAL);
            for (ModuleDescriptor md : mres.result()) {
                Future<Void> f = Future.future();
                modules.add(md.getId(), md, f::handle);
                futures.add(f);
            }
            futures.all(fut);
        });
    });
}
Also used : ModuleDescriptor(org.folio.okapi.bean.ModuleDescriptor) TenantModuleDescriptor(org.folio.okapi.bean.TenantModuleDescriptor) CompList(org.folio.okapi.util.CompList)

Aggregations

CompList (org.folio.okapi.util.CompList)8 LinkedList (java.util.LinkedList)6 List (java.util.List)6 DeploymentDescriptor (org.folio.okapi.bean.DeploymentDescriptor)4 ModuleDescriptor (org.folio.okapi.bean.ModuleDescriptor)2 TenantModuleDescriptor (org.folio.okapi.bean.TenantModuleDescriptor)2 ArrayList (java.util.ArrayList)1 EnvEntry (org.folio.okapi.bean.EnvEntry)1 HealthDescriptor (org.folio.okapi.bean.HealthDescriptor)1 LaunchDescriptor (org.folio.okapi.bean.LaunchDescriptor)1 PermissionList (org.folio.okapi.bean.PermissionList)1 Tenant (org.folio.okapi.bean.Tenant)1