branch feature/8145-2 updated (5df204e -> 364af86)
This is an automated email from the git hooks/post-receive script. New change to branch feature/8145-2 in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git from 5df204e Revue du chargement du cache d'échantillon au niveau de l'ui et des actions d'édition des captures d'une campagne new 68c508a Ajout méthode pour récupérer les ids des batchs enfants new 364af86 Gestion du nettoyage du cache avant la suppresion de lot ou de trait The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 364af86b567dbca3862c7b366b7698dd0c90f8fb Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Mar 20 22:16:01 2016 +0100 Gestion du nettoyage du cache avant la suppresion de lot ou de trait commit 68c508a494b5c30ed39f4c4ab058cbfd06b6ae31 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Mar 20 22:15:08 2016 +0100 Ajout méthode pour récupérer les ids des batchs enfants Summary of changes: .../tutti/persistence/TuttiPersistenceImpl.java | 5 +++ .../persistence/TuttiPersistenceNoDbImpl.java | 5 +++ .../service/BenthosBatchPersistenceService.java | 9 ++++ .../service/SpeciesBatchPersistenceService.java | 9 ++++ .../SpeciesBatchPersistenceServiceSupport.java | 7 ++- .../ifremer/tutti/service/PersistenceService.java | 51 +++++++++++++++++++--- 6 files changed, 79 insertions(+), 7 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/8145-2 in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit 68c508a494b5c30ed39f4c4ab058cbfd06b6ae31 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Mar 20 22:15:08 2016 +0100 Ajout méthode pour récupérer les ids des batchs enfants --- .../java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java | 5 +++++ .../fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java | 5 +++++ .../persistence/service/BenthosBatchPersistenceService.java | 9 +++++++++ .../persistence/service/SpeciesBatchPersistenceService.java | 9 +++++++++ .../service/SpeciesBatchPersistenceServiceSupport.java | 7 ++++++- 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java index 6d9d10b..bad70b6 100644 --- a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java +++ b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java @@ -1165,6 +1165,11 @@ public class TuttiPersistenceImpl implements TuttiPersistence { } @Override + public Set<Integer> getBatchChildIds(Integer id) { + return getSpeciesBatchService().getBatchChildIds(id); + } + + @Override public SpeciesBatch createSpeciesBatch(SpeciesBatch bean, Integer parentBatchId, boolean computeRankOrder) { return getSpeciesBatchService().createSpeciesBatch(bean, parentBatchId, computeRankOrder); } diff --git a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java index c851073..f5f9e14 100644 --- a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java +++ b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java @@ -689,6 +689,11 @@ public class TuttiPersistenceNoDbImpl implements TuttiPersistence { } @Override + public Set<Integer> getBatchChildIds(Integer id) { + throw notImplemented(); + } + + @Override public SpeciesBatch createSpeciesBatch(SpeciesBatch bean, Integer parentBatchId, boolean computeRankOrder) { throw notImplemented(); } diff --git a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java index 93003b1..01e74d4 100644 --- a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java +++ b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java @@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Collection; import java.util.List; +import java.util.Set; /** * Service to persist {@link SpeciesBatch}. @@ -62,6 +63,14 @@ public interface BenthosBatchPersistenceService extends TuttiPersistenceServiceI */ BatchContainer<SpeciesBatch> getRootBenthosBatch(Integer fishingOperationId, boolean validateTree) throws InvalidBatchModelException; + /** + * Récupérer les identifiants de tous les lots de la descendance du lot donné. + * + * @param id identifiant du lot parent + * @return l'ensemble des identifiants de toute la descendance d'un lot + */ + Set<Integer> getBatchChildIds(Integer id); + @Transactional(readOnly = false) SpeciesBatch createBenthosBatch(SpeciesBatch bean, Integer parentBatchId, boolean computeRankOrder); diff --git a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java index f122907..4a2eebb 100644 --- a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java +++ b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java @@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Collection; import java.util.List; +import java.util.Set; /** * Service to persist {@link SpeciesBatch}. @@ -62,6 +63,14 @@ public interface SpeciesBatchPersistenceService extends TuttiPersistenceServiceI BatchContainer<SpeciesBatch> getRootSpeciesBatch(Integer fishingOperationId, boolean validateTree) throws InvalidBatchModelException; + /** + * Récupérer les identifiants de tous les lots de la descendance du lot donné. + * + * @param id identifiant du lot parent + * @return l'ensemble des identifiants de toute la descendance d'un lot + */ + Set<Integer> getBatchChildIds(Integer id); + @Transactional(readOnly = false) SpeciesBatch createSpeciesBatch(SpeciesBatch bean, Integer parentBatchId, boolean computeRankOrder); diff --git a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceSupport.java b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceSupport.java index cdd6351..1fa4c87 100644 --- a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceSupport.java +++ b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceSupport.java @@ -98,7 +98,7 @@ public abstract class SpeciesBatchPersistenceServiceSupport extends AbstractPers private CaracteristicPersistenceService caracteristicService; @Resource(name = "batchPersistenceHelper") - private BatchPersistenceHelper batchHelper; + protected BatchPersistenceHelper batchHelper; @Resource(name = "measurementPersistenceHelper") protected MeasurementPersistenceHelper measurementPersistenceHelper; @@ -116,6 +116,11 @@ public abstract class SpeciesBatchPersistenceServiceSupport extends AbstractPers this.batchFactory = batchFactory; this.frequencyFactory = frequencyFactory; } + + public Set<Integer> getBatchChildIds(Integer id) { + return batchHelper.getBatchIds(id); + } + //------------------------------------------------------------------------// //-- SpeciesBatch methods --// //------------------------------------------------------------------------// -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/8145-2 in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit 364af86b567dbca3862c7b366b7698dd0c90f8fb Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Mar 20 22:16:01 2016 +0100 Gestion du nettoyage du cache avant la suppresion de lot ou de trait --- .../ifremer/tutti/service/PersistenceService.java | 51 +++++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java index 2362184..4312a55 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java @@ -65,6 +65,7 @@ import fr.ifremer.tutti.persistence.entities.referential.Vessels; import fr.ifremer.tutti.persistence.model.ProgramDataModel; import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator; import fr.ifremer.tutti.persistence.service.UpdateSchemaContextSupport; +import fr.ifremer.tutti.service.samplingCache.CruiseSamplingCache; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; @@ -86,9 +87,11 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.concurrent.Callable; @@ -1083,8 +1086,7 @@ public class PersistenceService extends AbstractTuttiService implements TuttiPer //------------------------------------------------------------------------// @Override - public List<Attachment> getAllAttachments(ObjectTypeCode objectType, - Integer objectId) { + public List<Attachment> getAllAttachments(ObjectTypeCode objectType, Integer objectId) { return driver.getAllAttachments(objectType, objectId); } @@ -1282,7 +1284,6 @@ public class PersistenceService extends AbstractTuttiService implements TuttiPer @Override public FishingOperation getFishingOperation(Integer id) { - FishingOperation bean = driver.getFishingOperation(id); // see http://forge.codelutin.com/issues/2014 if (bean.getGearShootingEndDate() == null) { @@ -1303,7 +1304,9 @@ public class PersistenceService extends AbstractTuttiService implements TuttiPer if (Objects.equals(bean.getGearShootingStartDate(), bean.getGearShootingEndDate())) { bean.setGearShootingEndDate(null); } - return driver.createFishingOperation(bean); + FishingOperation fishingOperation = driver.createFishingOperation(bean); + //FIXME Update samplingCache + return fishingOperation; } @Override @@ -1312,16 +1315,25 @@ public class PersistenceService extends AbstractTuttiService implements TuttiPer if (Objects.equals(bean.getGearShootingStartDate(), bean.getGearShootingEndDate())) { bean.setGearShootingEndDate(null); } - return driver.saveFishingOperation(bean); + FishingOperation fishingOperation = driver.saveFishingOperation(bean); + //FIXME Update samplingCache + return fishingOperation; } @Override public Collection<FishingOperation> saveFishingOperations(Collection<FishingOperation> beans) { - return driver.saveFishingOperations(beans); + Collection<FishingOperation> fishingOperations = driver.saveFishingOperations(beans); + //FIXME Update samplingCache + return fishingOperations; } @Override public void deleteFishingOperation(Integer id) { + Optional<CruiseSamplingCache> optionalCruiseSamplingCache = context.getDataContext().getOptionalCruiseSamplingCache(); + if (optionalCruiseSamplingCache.isPresent()) { + FishingOperation fishingOperation = getFishingOperation(id); + optionalCruiseSamplingCache.get().removeFishingOperation(fishingOperation); + } driver.deleteFishingOperation(id); } @@ -1370,6 +1382,11 @@ public class PersistenceService extends AbstractTuttiService implements TuttiPer } @Override + public Set<Integer> getBatchChildIds(Integer id) { + return driver.getBatchChildIds(id); + } + + @Override public SpeciesBatch createSpeciesBatch(SpeciesBatch bean, Integer parentBatchId, boolean computeRankOrder) { return driver.createSpeciesBatch(bean, parentBatchId, computeRankOrder); } @@ -1386,11 +1403,13 @@ public class PersistenceService extends AbstractTuttiService implements TuttiPer @Override public void deleteSpeciesBatch(Integer id) { + beforeDeleteBatch(id, true); driver.deleteSpeciesBatch(id); } @Override public void deleteSpeciesSubBatch(Integer id) { + beforeDeleteBatch(id, false); driver.deleteSpeciesSubBatch(id); } @@ -1446,11 +1465,13 @@ public class PersistenceService extends AbstractTuttiService implements TuttiPer @Override public void deleteBenthosBatch(Integer id) { + beforeDeleteBatch(id, true); driver.deleteBenthosBatch(id); } @Override public void deleteBenthosSubBatch(Integer id) { + beforeDeleteBatch(id, false); driver.deleteBenthosSubBatch(id); } @@ -1583,4 +1604,22 @@ public class PersistenceService extends AbstractTuttiService implements TuttiPer driver.deleteAllIndividualObservationsForBatch(speciesBatchId); } + protected void beforeDeleteBatch(Integer id, boolean addBatchId) { + Optional<CruiseSamplingCache> optionalCruiseSamplingCache = context.getDataContext().getOptionalCruiseSamplingCache(); + if (optionalCruiseSamplingCache.isPresent()) { + FishingOperation fishingOperation = context.getDataContext().getFishingOperation(); + CruiseSamplingCache cruiseSamplingCache = optionalCruiseSamplingCache.get(); + Set<Integer> batchIds = new LinkedHashSet<>(); + if (addBatchId) { + batchIds.add(id); + } + batchIds.addAll(getBatchChildIds(id)); + batchIds.forEach(speciesBatchId -> { + List<IndividualObservationBatch> allIndividualObservationBatchsForBatch = getAllIndividualObservationBatchsForBatch(id); + cruiseSamplingCache.removeIndividualObservations(fishingOperation, allIndividualObservationBatchsForBatch); + }); + + } + } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm