Author: tchemit Date: 2014-04-29 10:14:10 +0200 (Tue, 29 Apr 2014) New Revision: 1741 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1741 Log: refs #4995 (some location were lost) Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2014-04-29 07:45:29 UTC (rev 1740) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2014-04-29 08:14:10 UTC (rev 1741) @@ -105,6 +105,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; /** @@ -1322,9 +1323,11 @@ * @param fishingArea * @param regulationLocationId * @param createIfNotExists - * @return a entity FishingArea2RegulationLocation, or null if not found and createIfNotExists=false + * @return a entity FishingArea2RegulationLocation, or {@code null} if not found and createIfNotExists=false */ - private FishingArea2RegulationLocation getFishingArea2RegulationLocation(FishingArea fishingArea, int regulationLocationId, boolean createIfNotExists) { + protected FishingArea2RegulationLocation getFishingArea2RegulationLocation(FishingArea fishingArea, + int regulationLocationId, + boolean createIfNotExists) { Preconditions.checkNotNull(fishingArea); // Create the PK @@ -1332,13 +1335,14 @@ pk.setFishingArea((FishingAreaImpl) fishingArea); pk.setLocation(load(LocationImpl.class, regulationLocationId)); - // Retrieve exiting regulation location + // Retrieve existing regulation location FishingArea2RegulationLocation fa2rl = null; if (CollectionUtils.isNotEmpty(fishingArea.getRegulationLocations())) { for(FishingArea2RegulationLocation existingFa2rl: fishingArea.getRegulationLocations()) { FishingArea2RegulationLocationPK existingPk = existingFa2rl.getFishingArea2RegulationLocationPk(); - if (ObjectUtils.equals(existingPk, pk)) { - return fa2rl; + if (Objects.equals(existingPk, pk)) { + fa2rl = existingFa2rl; + break; } } }