From 26917b9282a1ac61e1eb42a460318d72bbce20e3 Mon Sep 17 00:00:00 2001 From: Barbara Date: Fri, 29 Nov 2019 15:09:58 +0100 Subject: [PATCH] Minor changes, comments --- .../java/at/technikumwien/movies/MoviesService.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/MoviesWebApp/src/main/java/at/technikumwien/movies/MoviesService.java b/MoviesWebApp/src/main/java/at/technikumwien/movies/MoviesService.java index 070e8d8..65826d2 100644 --- a/MoviesWebApp/src/main/java/at/technikumwien/movies/MoviesService.java +++ b/MoviesWebApp/src/main/java/at/technikumwien/movies/MoviesService.java @@ -81,9 +81,10 @@ public class MoviesService { .setParameter("postcode", movieStudio.getPostcode()) .getResultList(); - if (!studioListResult.isEmpty() && studioListResult.size() > 0) { - Long actorId = studioListResult.get(0).getId(); - movieStudio.setId(actorId); + if (!studioListResult.isEmpty()) { + // Take the first element in the list + Long studioId = studioListResult.get(0).getId(); + movieStudio.setId(studioId); } else { @@ -92,7 +93,6 @@ public class MoviesService { return; } - // TODO use also birthday // Get actor for the movie from the database for (Actors movieActor : movie.getActors()) { LOGGER.info("Get an actor " + movieActor); @@ -103,7 +103,8 @@ public class MoviesService { .setParameter("birthdate", movieActor.getBirthdate()) .getResultList(); - if (!actorListResult.isEmpty() && actorListResult.size() > 0) { + if (!actorListResult.isEmpty()) { + // Take the first element in the list Long actorId = actorListResult.get(0).getId(); movieActor.setId(actorId); }