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);
}
});
}
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);
}
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);
});
});
}
Aggregations