use of org.folio.okapi.common.GenericCompositeFuture in project mod-source-record-manager by folio-org.
the class JobExecutionServiceImpl method saveJobExecutions.
/**
* Performs save for received JobExecution entities using {@link JobExecutionDao}
*
* @param jobExecutions list on JobExecution entities
* @return future
*/
private Future<List<String>> saveJobExecutions(List<JobExecution> jobExecutions, String tenantId) {
List<Future<String>> savedJobExecutionFutures = new ArrayList<>();
for (JobExecution jobExecution : jobExecutions) {
Future<String> savedJobExecutionFuture = jobExecutionDao.save(jobExecution, tenantId);
savedJobExecutionFutures.add(savedJobExecutionFuture);
}
return GenericCompositeFuture.all(savedJobExecutionFutures).map(genericCompositeFuture -> genericCompositeFuture.result().list());
}
use of org.folio.okapi.common.GenericCompositeFuture in project mod-source-record-manager by folio-org.
the class JobExecutionServiceImpl method saveSnapshots.
/**
* Performs save for received Snapshot entities.
* For each Snapshot posts the request to mod-source-record-manager.
*
* @param snapshots list of Snapshot entities
* @param params object-wrapper with params necessary to connect to OKAPI
* @return future
*/
private Future<List<String>> saveSnapshots(List<Snapshot> snapshots, OkapiConnectionParams params) {
List<Future<String>> postedSnapshotFutures = new ArrayList<>();
for (Snapshot snapshot : snapshots) {
Future<String> postedSnapshotFuture = postSnapshot(snapshot, params);
postedSnapshotFutures.add(postedSnapshotFuture);
}
return GenericCompositeFuture.all(postedSnapshotFutures).map(genericCompositeFuture -> genericCompositeFuture.result().list());
}
Aggregations