r1067 - in trunk/tutti-service/src/main: java/fr/ifremer/tutti/service/catches resources/i18n
Author: kmorin Date: 2013-05-31 18:47:10 +0200 (Fri, 31 May 2013) New Revision: 1067 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1067 Log: fixes #2487 [VALIDATION] alertes r?\195?\169p?\195?\169t?\195?\169es et pas d'identification des donn?\195?\169es / lots concern?\195?\169s Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ValidateCruiseOperationsService.java trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java 2013-05-31 16:20:21 UTC (rev 1066) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java 2013-05-31 16:47:10 UTC (rev 1067) @@ -363,7 +363,7 @@ return rootSpeciesBatch; } - protected Float computeSpeciesBatch(SpeciesBatch batch) { + public Float computeSpeciesBatch(SpeciesBatch batch) { Float result = null; int thisIndex = currentSpeciesRowIndex++; Float categoryWeight = batch.getSampleCategoryWeight(); @@ -517,7 +517,7 @@ return rootBenthosBatch; } - protected Float computeBenthosBatch(BenthosBatch batch) { + public Float computeBenthosBatch(BenthosBatch batch) { Float result = null; int thisIndex = currentBenthosRowIndex++; Float categoryWeight = batch.getSampleCategoryWeight(); Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ValidateCruiseOperationsService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ValidateCruiseOperationsService.java 2013-05-31 16:20:21 UTC (rev 1066) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ValidateCruiseOperationsService.java 2013-05-31 16:47:10 UTC (rev 1067) @@ -235,21 +235,51 @@ List<String> errors = Lists.newArrayList(); String fishingOperationId = fishingOperation.getId(); - BatchContainer<SpeciesBatch> rootSpeciesBatch; - try { - rootSpeciesBatch = tuttiWeightComputingService.getComputedSpeciesBatches(fishingOperation); + BatchContainer<SpeciesBatch> rootSpeciesBatch = null; + boolean isCatchBatch = !persistenceService.isFishingOperationWithCatchBatch(fishingOperationId); + boolean error = !isCatchBatch; - } catch (TuttiBusinessException e) { - errors.add(e.getMessage()); + if (isCatchBatch) { rootSpeciesBatch = persistenceService.getRootSpeciesBatch(fishingOperationId); + + if (rootSpeciesBatch != null) { + List<SpeciesBatch> roots = rootSpeciesBatch.getChildren(); + + for (SpeciesBatch batch : roots) { + try { + tuttiWeightComputingService.computeSpeciesBatch(batch); + + } catch (TuttiBusinessException e) { + errors.add(e.getMessage()); + error = true; + } + } + } } + if (error) { + rootSpeciesBatch = persistenceService.getRootSpeciesBatch(fishingOperationId); + } - BatchContainer<BenthosBatch> rootBenthosBatch; - try { - rootBenthosBatch = tuttiWeightComputingService.getComputedBenthosBatches(fishingOperation); + BatchContainer<BenthosBatch> rootBenthosBatch = null; + error = false; + if (isCatchBatch) { + rootBenthosBatch = persistenceService.getRootBenthosBatch(fishingOperationId); - } catch (TuttiBusinessException e) { - errors.add(e.getMessage()); + if (rootBenthosBatch != null) { + List<BenthosBatch> roots = rootBenthosBatch.getChildren(); + + for (BenthosBatch batch : roots) { + try { + rootBenthosBatch = tuttiWeightComputingService.getComputedBenthosBatches(fishingOperation); + + } catch (TuttiBusinessException e) { + errors.add(e.getMessage()); + error = true; + } + } + } + } + if (error) { rootBenthosBatch = persistenceService.getRootBenthosBatch(fishingOperationId); } Modified: trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties =================================================================== --- trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-05-31 16:20:21 UTC (rev 1066) +++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-05-31 16:47:10 UTC (rev 1067) @@ -206,10 +206,10 @@ tutti.validator.export.message.error=\t- [ERREUR] %s tutti.validator.export.message.warning=\t- [WARNING] %s tutti.validator.export.operation=* %s \: -tutti.validator.warning.benthos.protocolNotRespected=[Benthos] le lot de %s / %s ne suit pas les recommandations du protocole +tutti.validator.warning.benthos.protocolNotRespected=Benthos - le lot de %s / %s ne suit pas les recommandations du protocole tutti.validator.warning.fishingOperation.batch.notFound=Pas d'arbre d’échantillonnage trouvé tutti.validator.warning.fishingOperation.invalid.batch.model=Arbre d’échantillonnage non compatible avec l'application tutti.validator.warning.latitude.outOfBounds=La Latitude doit être comprise entre -90.0 et 90.0 tutti.validator.warning.longitude.outOfBounds=La longitude doit être comprise entre -180.0 et 180.0 tutti.validator.warning.marineLitter.weight.required=Vous devez saisir la valeur du poids total des déchets<br/>ou le poids de chacune des catégories observées. -tutti.validator.warning.species.protocolNotRespected=[Espèces] le lot de %s / %s ne suit pas les recommandations du protocole +tutti.validator.warning.species.protocolNotRespected=Espèces - le lot de %s / %s ne suit pas les recommandations du protocole
participants (1)
-
kmorin@users.forge.codelutin.com