Skip to content

Commit

Permalink
PokemonService template fixed in SE Database Archetype. (#2701)
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Kraus <Tomas.Kraus@oracle.com>
  • Loading branch information
Tomas-Kraus authored Jan 29, 2021
1 parent 16fb9f4 commit 32cc140
Showing 1 changed file with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,17 @@ public class PokemonService implements Service {
}

private void listTypes(ServerRequest request, ServerResponse response) {
try {
List<PokemonType> pokemonTypes =
dbClient.execute(exec -> exec.namedQuery("select-all-types"))
.map(row -> row.as(PokemonType.class)).collectList().get();
response.send(pokemonTypes);
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
dbClient.execute(exec -> exec.namedQuery("select-all-types"))
.map(row -> row.as(PokemonType.class))
.collectList()
.forSingle(response::send);
}

private void listPokemons(ServerRequest request, ServerResponse response) {
try {
List<Pokemon> pokemons =
dbClient.execute(exec -> exec.namedQuery("select-all-pokemons"))
.map(it -> it.as(Pokemon.class)).collectList().get();
response.send(pokemons);
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
dbClient.execute(exec -> exec.namedQuery("select-all-pokemons"))
.map(it -> it.as(Pokemon.class))
.collectList()
.forSingle(response::send);
}

private void getPokemonById(ServerRequest request, ServerResponse response) {
Expand Down

0 comments on commit 32cc140

Please sign in to comment.