Author: kmorin Date: 2013-04-29 18:47:02 +0200 (Mon, 29 Apr 2013) New Revision: 884 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/884 Log: fixes #2378 [Captures] - Macro-d?\195?\169chets - Erreur ?\195?\160 l'?\195?\169l?\195?\169vation des poids Removed: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/MarineLitterBatch-warning-validation.xml 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-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeWeightsAction.java 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-04-29 16:22:40 UTC (rev 883) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java 2013-04-29 16:47:02 UTC (rev 884) @@ -121,7 +121,8 @@ BatchContainer<MarineLitterBatch> rootMarineLitterBatch; try { - rootMarineLitterBatch = getComputedMarineLitterBatches(fishingOperation); + rootMarineLitterBatch = getComputedMarineLitterBatches(fishingOperation, + catchBatch.getMarineLitterTotalWeight()); } catch (TuttiBusinessException e) { result.put(fishingOperationId, e.getMessage()); @@ -590,19 +591,22 @@ return result; } - public BatchContainer<MarineLitterBatch> getComputedMarineLitterBatches(FishingOperation operation) { + public BatchContainer<MarineLitterBatch> getComputedMarineLitterBatches(FishingOperation operation, + Float marineLitterweight) { + String fishingOperationId = operation.getId(); BatchContainer<MarineLitterBatch> rootMarineLitterBatch = - persistenceService.getRootMarineLitterBatch(operation.getId()); + persistenceService.getRootMarineLitterBatch(fishingOperationId); if (rootMarineLitterBatch != null) { + boolean checkWeight = marineLitterweight == null; + List<MarineLitterBatch> children = rootMarineLitterBatch.getChildren(); for (int i = 0; i < children.size(); i++) { MarineLitterBatch batch = children.get(i); - NuitonValidatorResult validator = validationService.validateMarineLitterBatch(batch); - if (validator.hasWarningMessages()) { + if (checkWeight && batch.getWeight() == null) { throw new TuttiWeightComputingException( - _(validator.getMessagesForScope(NuitonValidatorScope.WARNING).get(0)), + _("tutti.validator.warning.marineLitter.weight.required"), TuttiWeightComputingException.CatchType.MARINE_LITTER, i); } 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-04-29 16:22:40 UTC (rev 883) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ValidateCruiseOperationsService.java 2013-04-29 16:47:02 UTC (rev 884) @@ -204,7 +204,8 @@ BatchContainer<MarineLitterBatch> rootMarineLitterBatch; try { - rootMarineLitterBatch = tuttiWeightComputingService.getComputedMarineLitterBatches(fishingOperation); + rootMarineLitterBatch = tuttiWeightComputingService.getComputedMarineLitterBatches(fishingOperation, + catchBatch.getMarineLitterTotalWeight()); } catch (TuttiBusinessException e) { errors.add(e.getMessage()); Deleted: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/MarineLitterBatch-warning-validation.xml =================================================================== --- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/MarineLitterBatch-warning-validation.xml 2013-04-29 16:22:40 UTC (rev 883) +++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/MarineLitterBatch-warning-validation.xml 2013-04-29 16:47:02 UTC (rev 884) @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - Tutti :: Service - $Id$ - $HeadURL$ - %% - Copyright (C) 2012 - 2013 Ifremer - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> -<validators> - - <field name="weight"> - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.warning.marineLitter.weight.required</message> - </field-validator> - </field> - -</validators> \ No newline at end of file Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeWeightsAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeWeightsAction.java 2013-04-29 16:22:40 UTC (rev 883) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeWeightsAction.java 2013-04-29 16:47:02 UTC (rev 884) @@ -91,7 +91,8 @@ BatchContainer<MarineLitterBatch> computedMarineLitterBatches; try { computedMarineLitterBatches = - tuttiWeightComputingService.getComputedMarineLitterBatches(model.getFishingOperation()); + tuttiWeightComputingService.getComputedMarineLitterBatches(model.getFishingOperation(), + model.getMarineLitterTotalWeight()); } catch (TuttiWeightComputingException e) { getUI().getTabPane().setSelectedIndex(3);