public List < Entity > getBatch ( Repository < Entity > repository , Iterable < Object > ids ) { try { return getEntityCache ( repository ) . getAll ( ids ) . values ( ) . stream ( ) . filter ( Optional :: isPresent ) . map ( Optional :: get ) . map ( e -> entityHydration . hydrate ( e , repository . getEntityType ( ) ) ) . collect ( Collectors . toList ( ) ) ; } catch ( ExecutionException exception ) { // rethrow unchecked if ( exception . getCause ( ) instanceof RuntimeException ) { throw ( RuntimeException ) exception . getCause ( ) ; } throw new MolgenisDataException ( exception ) ; } }
Retrieves a list of entities from the cache . If the cache doesn t yet exist will create the cache .