This is an automated email from the git hooks/post-receive script. New commit to branch feature/merge_species_benthos in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit ddeea47392e1c59d79716c2eae9dc56f4d67b3e9 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Mar 17 09:13:35 2016 +0100 suppression de BenthosBatch, BenthosBatchFrequency et des contrat SpeciesBatchAble et SpeciesFrequencyBatchAble dans le module swing --- .../src/main/filtered-resources/log4j.properties | 2 +- .../catches/SpeciesAbleBatchRowHelper.java | 24 ++++----- .../operation/catches/SpeciesBatchDecorator.java | 14 ++--- .../catches/SpeciesBatchDecoratorComparator.java | 6 +-- .../SpeciesBatchNaturalOrderComparator.java | 16 +++--- .../catches/actions/ComputeBatchWeightsAction.java | 11 ++-- .../catches/benthos/BenthosBatchRowModel.java | 60 +++++++++++++--------- .../catches/benthos/BenthosBatchUIHandler.java | 30 +++++------ .../actions/ImportMultiPostBenthosAction.java | 8 +-- .../frequency/BenthosFrequencyRowModel.java | 54 +++++++++++-------- .../catches/species/SpeciesBatchRowModel.java | 10 ++++ .../frequency/SpeciesFrequencyRowModel.java | 10 ++++ 12 files changed, 142 insertions(+), 103 deletions(-) diff --git a/tutti-ui-swing/src/main/filtered-resources/log4j.properties b/tutti-ui-swing/src/main/filtered-resources/log4j.properties index a8f69d0..4f2f96c 100644 --- a/tutti-ui-swing/src/main/filtered-resources/log4j.properties +++ b/tutti-ui-swing/src/main/filtered-resources/log4j.properties @@ -33,7 +33,7 @@ log4j.appender.stdout.layout.ConversionPattern=[%20t] %d{ISO8601} %5p (%c:%L) - log4j.logger.fr.ifremer=INFO log4j.logger.fr.ifremer.tutti.ui.swing.util.SoundUtil=DEBUG # Keep this one to Info to show batch tree -log4j.logger.fr.ifremer.tutti.persistence.service.util.BatchTreeHelper=INFO +log4j.logger.fr.ifremer.tutti.persistence.service.util.tree=INFO log4j.logger.fr.ifremer.tutti.service.toconfirmreport=DEBUG log4j.logger.fr.ifremer.tutti.persistence.service.util.SynchronizationStatusHelper=WARN diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesAbleBatchRowHelper.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesAbleBatchRowHelper.java index 358e53b..b43ca44 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesAbleBatchRowHelper.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesAbleBatchRowHelper.java @@ -25,8 +25,8 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches; import com.google.common.base.Joiner; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch; -import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatchFrequency; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.TuttiDecorator; import jaxx.runtime.SwingUtil; @@ -74,10 +74,10 @@ public class SpeciesAbleBatchRowHelper { public static final String SPECIES_DECORATOR_INDEX = "decoratorIndex"; - public static <E extends SpeciesAbleBatch> int getIndexToInsert(List<E> rows, - E newRow, - SpeciesSortMode sortMode, - SpeciesBatchDecorator decorator) { + public static <E extends SpeciesBatch> int getIndexToInsert(List<E> rows, + E newRow, + SpeciesSortMode sortMode, + SpeciesBatchDecorator decorator) { int result; @@ -192,10 +192,10 @@ public class SpeciesAbleBatchRowHelper { } - public static <R extends SpeciesAbleBatch> void sortSpeciesRows(SpeciesBatchDecoratorComparator comparator, - SpeciesBatchDecorator decorator, - List<R> rows, - SpeciesSortMode speciesSortMode) { + public static <R extends SpeciesBatch> void sortSpeciesRows(SpeciesBatchDecoratorComparator<R> comparator, + SpeciesBatchDecorator decorator, + List<R> rows, + SpeciesSortMode speciesSortMode) { comparator.setSpeciesSortMode(speciesSortMode); comparator.init(decorator, rows); @@ -220,7 +220,7 @@ public class SpeciesAbleBatchRowHelper { * @return la somme des poids des mensurations * @since 3.10 */ - public static <F extends SpeciesAbleBatchFrequency> Float getFrequenciesTotalWeight(Collection<F> frequency) { + public static <F extends SpeciesBatchFrequency> Float getFrequenciesTotalWeight(Collection<F> frequency) { if (CollectionUtils.isEmpty(frequency)) { @@ -230,7 +230,7 @@ public class SpeciesAbleBatchRowHelper { } float frequencyTotalWeight = 0; - for (F aFrequency : frequency) { + for (SpeciesBatchFrequency aFrequency : frequency) { if (aFrequency.getWeight() == null) { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchDecorator.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchDecorator.java index 2f1c304..533cc11 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchDecorator.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchDecorator.java @@ -22,24 +22,24 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches; * #L% */ -import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.DecoratorService; import static org.nuiton.i18n.I18n.t; /** - * To decorate some {@link SpeciesAbleBatch} as a {@link Species}. + * To decorate some {@link SpeciesBatch} as a {@link Species}. * * Used to be able to keep the hole speciesBatch in the cell. * * @since 2.8 */ -public class SpeciesBatchDecorator<R extends SpeciesAbleBatch> extends DecoratorService.SpeciesFromProtocolDecorator { +public class SpeciesBatchDecorator<R extends SpeciesBatch> extends DecoratorService.SpeciesFromProtocolDecorator { private static final long serialVersionUID = 1L; - public static <R extends SpeciesAbleBatch> SpeciesBatchDecorator<R> newDecorator() { + public static <R extends SpeciesBatch> SpeciesBatchDecorator<R> newDecorator() { return new SpeciesBatchDecorator<>(); } @@ -55,14 +55,14 @@ public class SpeciesBatchDecorator<R extends SpeciesAbleBatch> extends Decorator TuttiDecoratorComparator comparator = (TuttiDecoratorComparator<?>) context.getComparator(0); originalComparators[i] = comparator; Context context = contexts[i]; - context.setComparator(new SpeciesBatchDecoratorComparator<R>(comparator.getExpression())); + context.setComparator(new SpeciesBatchDecoratorComparator<>(comparator.getExpression())); } } @Override public String toString(Object bean) { - if (bean instanceof SpeciesAbleBatch) { - bean = ((SpeciesAbleBatch) bean).getSpecies(); + if (bean instanceof SpeciesBatch) { + bean = ((SpeciesBatch) bean).getSpecies(); } return super.toString(bean); } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchDecoratorComparator.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchDecoratorComparator.java index fae8599..4d5a209 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchDecoratorComparator.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchDecoratorComparator.java @@ -22,14 +22,14 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches; * #L% */ -import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import fr.ifremer.tutti.service.TuttiDecorator; import org.nuiton.decorator.JXPathDecorator; import java.util.List; /** - * To decorate a {@link SpeciesAbleBatch} as a species + keeping the logic of batchs childs. + * To decorate a {@link SpeciesBatch} as a species + keeping the logic of batchs childs. * * first sort on species, then always keep the row index order. * @@ -38,7 +38,7 @@ import java.util.List; * @author Tony Chemit - chemit@codelutin.com * @since 2.8 */ -public class SpeciesBatchDecoratorComparator<R extends SpeciesAbleBatch> extends TuttiDecorator.TuttiDecoratorComparator<R> { +public class SpeciesBatchDecoratorComparator<R extends SpeciesBatch> extends TuttiDecorator.TuttiDecoratorComparator<R> { class RowComparatorContext implements Comparable<RowComparatorContext> { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchNaturalOrderComparator.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchNaturalOrderComparator.java index 01a5759..6c9a926 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchNaturalOrderComparator.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SpeciesBatchNaturalOrderComparator.java @@ -24,7 +24,7 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches; * #L% */ -import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import java.io.Serializable; import java.util.Collections; @@ -36,7 +36,7 @@ import java.util.Map; /** * To compare some rows on their natural order. Means the order the data were stored. * - * For this we use the {@link SpeciesAbleBatch#getRankOrder()} for the parents and keep using the + * For this we use the {@link SpeciesBatch#getRankOrder()} for the parents and keep using the * rowIndex for the children. * * Created on 8/30/14. @@ -44,11 +44,11 @@ import java.util.Map; * @author Tony Chemit - chemit@codelutin.com * @since 3.7 */ -public class SpeciesBatchNaturalOrderComparator<R extends SpeciesAbleBatch> implements Comparator<R>, Serializable { +public class SpeciesBatchNaturalOrderComparator<R extends SpeciesBatch> implements Comparator<R>, Serializable { private static final long serialVersionUID = 1L; - public static <R extends SpeciesAbleBatch> void sort(List<R> data) { + public static <R extends SpeciesBatch> void sort(List<R> data) { SpeciesBatchNaturalOrderComparator<R> comparator = new SpeciesBatchNaturalOrderComparator<>(data); Collections.sort(data, comparator); @@ -70,8 +70,8 @@ public class SpeciesBatchNaturalOrderComparator<R extends SpeciesAbleBatch> impl @Override public int compare(R o1, R o2) { - SpeciesAbleBatch o1ParentBatch = getRootBatch(o1); - SpeciesAbleBatch o2ParentBatch = getRootBatch(o2); + SpeciesBatch o1ParentBatch = getRootBatch(o1); + SpeciesBatch o2ParentBatch = getRootBatch(o2); int result = o1ParentBatch.getRankOrder() - o2ParentBatch.getRankOrder(); @@ -88,9 +88,9 @@ public class SpeciesBatchNaturalOrderComparator<R extends SpeciesAbleBatch> impl return result; } - protected SpeciesAbleBatch getRootBatch(SpeciesAbleBatch o) { + protected SpeciesBatch getRootBatch(SpeciesBatch o) { - SpeciesAbleBatch root; + SpeciesBatch root; if (o.getParentBatch() == null) { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/actions/ComputeBatchWeightsAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/actions/ComputeBatchWeightsAction.java index e474cb9..f525224 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/actions/ComputeBatchWeightsAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/actions/ComputeBatchWeightsAction.java @@ -25,7 +25,6 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.actions; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import fr.ifremer.tutti.persistence.entities.data.BatchContainer; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; import fr.ifremer.tutti.persistence.entities.data.CatchBatch; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch; @@ -35,7 +34,6 @@ import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.catches.TuttiWeightComputingException; import fr.ifremer.tutti.service.catches.WeightCleaningService; import fr.ifremer.tutti.service.catches.WeightComputingService; -import fr.ifremer.tutti.ui.swing.util.actions.LongActionSupport; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel; @@ -50,6 +48,7 @@ import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchR import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchTableModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel; import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler; +import fr.ifremer.tutti.ui.swing.util.actions.LongActionSupport; import fr.ifremer.tutti.util.Numbers; import jaxx.runtime.swing.JTables; import org.jdesktop.swingx.JXTable; @@ -159,7 +158,7 @@ public class ComputeBatchWeightsAction extends LongActionSupport<EditCatchesUIMo // --------- Float totalBenthosSortedWeight; - BatchContainer<BenthosBatch> computedBenthosBatches; + BatchContainer<SpeciesBatch> computedBenthosBatches; try { computedBenthosBatches = weightComputingService.getComputedBenthosBatches(operationId); @@ -421,13 +420,13 @@ public class ComputeBatchWeightsAction extends LongActionSupport<EditCatchesUIMo return totalSortedWeight; } - protected Float computeBenthosBatches(PersistenceService persistenceService, BatchContainer<BenthosBatch> computedBenthosBatches) { + protected Float computeBenthosBatches(PersistenceService persistenceService, BatchContainer<SpeciesBatch> computedBenthosBatches) { Float totalSortedWeight = 0f; if (computedBenthosBatches != null) { benthosBatchRows = Lists.newArrayList(); - List<BenthosBatch> children = computedBenthosBatches.getChildren(); - for (BenthosBatch batch : children) { + List<SpeciesBatch> children = computedBenthosBatches.getChildren(); + for (SpeciesBatch batch : children) { BenthosBatchRowModel row = getUI().getBenthosTabContent().getHandler().loadBatch(batch, null, benthosBatchRows); if (persistenceService.isVracBatch(row)) { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java index 52d0df9..1fe6bec 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java @@ -26,13 +26,13 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import fr.ifremer.adagio.core.dao.referential.ObjectTypeCode; import fr.ifremer.tutti.persistence.entities.data.Attachment; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequency; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatchs; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.SampleCategory; import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchs; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.type.WeightUnit; import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryAble; @@ -60,7 +60,7 @@ import java.util.Set; * @author Tony Chemit - chemit@codelutin.com * @since 0.2 */ -public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, BenthosBatchRowModel> implements BenthosBatch, AttachmentModelAware, SampleCategoryAble<BenthosBatchRowModel> { +public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, BenthosBatchRowModel> implements SpeciesBatch, AttachmentModelAware, SampleCategoryAble<BenthosBatchRowModel> { private static final long serialVersionUID = 1L; @@ -101,7 +101,7 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, * * @since 1.3 */ - protected final BenthosBatch editObject = BenthosBatchs.newBenthosBatch(); + protected final SpeciesBatch editObject = SpeciesBatchs.newBenthosBatch(); /** * All categories(can not be null). @@ -162,13 +162,13 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, */ protected final WeightUnit weightUnit; - protected static final Binder<BenthosBatch, BenthosBatchRowModel> fromBeanBinder = - BinderFactory.newBinder(BenthosBatch.class, + protected static final Binder<SpeciesBatch, BenthosBatchRowModel> fromBeanBinder = + BinderFactory.newBinder(SpeciesBatch.class, BenthosBatchRowModel.class); - protected static final Binder<BenthosBatchRowModel, BenthosBatch> toBeanBinder = + protected static final Binder<BenthosBatchRowModel, SpeciesBatch> toBeanBinder = BinderFactory.newBinder(BenthosBatchRowModel.class, - BenthosBatch.class); + SpeciesBatch.class); public BenthosBatchRowModel(WeightUnit weightUnit, SampleCategoryModel sampleCategoryModel) { @@ -193,8 +193,8 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, public BenthosBatchRowModel(WeightUnit weightUnit, SampleCategoryModel sampleCategoryModel, - BenthosBatch entity, - List<BenthosBatchFrequency> frequencies) { + SpeciesBatch entity, + List<SpeciesBatchFrequency> frequencies) { this(weightUnit, sampleCategoryModel); fromEntity(entity); @@ -215,12 +215,12 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, //------------------------------------------------------------------------// @Override - protected BenthosBatch newEntity() { - return BenthosBatchs.newBenthosBatch(); + protected SpeciesBatch newEntity() { + return SpeciesBatchs.newBenthosBatch(); } @Override - public void fromEntity(BenthosBatch entity) { + public void fromEntity(SpeciesBatch entity) { super.fromEntity(entity); // convert weight @@ -229,8 +229,8 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, } @Override - public BenthosBatch toEntity() { - BenthosBatch result = super.toEntity(); + public SpeciesBatch toEntity() { + SpeciesBatch result = super.toEntity(); // convert weight result.setWeight(weightUnit.toEntity(getWeight())); @@ -327,7 +327,7 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, } @Override - public void setParentBatch(BenthosBatch parentBatch) { + public void setParentBatch(SpeciesBatch parentBatch) { Object oldValue = getParentBatch(); editObject.setParentBatch(parentBatch); firePropertyChange(PROPERTY_PARENT_BATCH, oldValue, parentBatch); @@ -391,7 +391,7 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, } @Override - public BenthosBatch getChildBatchs(int index) { + public SpeciesBatch getChildBatchs(int index) { return childBatch.get(index); } @@ -406,35 +406,35 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, } @Override - public void addChildBatchs(BenthosBatch childBatchs) { + public void addChildBatchs(SpeciesBatch childBatchs) { } @Override - public void addAllChildBatchs(Collection<BenthosBatch> childBatchs) { + public void addAllChildBatchs(Collection<SpeciesBatch> childBatchs) { } @Override - public boolean removeChildBatchs(BenthosBatch childBatchs) { + public boolean removeChildBatchs(SpeciesBatch childBatchs) { return false; } @Override - public boolean removeAllChildBatchs(Collection<BenthosBatch> childBatchs) { + public boolean removeAllChildBatchs(Collection<SpeciesBatch> childBatchs) { return false; } @Override - public boolean containsChildBatchs(BenthosBatch childBatchs) { + public boolean containsChildBatchs(SpeciesBatch childBatchs) { return false; } @Override - public boolean containsAllChildBatchs(Collection<BenthosBatch> childBatchs) { + public boolean containsAllChildBatchs(Collection<SpeciesBatch> childBatchs) { return false; } @Override - public List<BenthosBatch> getChildBatchs() { + public List<SpeciesBatch> getChildBatchs() { return null; } @@ -452,6 +452,16 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, editObject.setRankOrder(rankOrder); } + @Override + public boolean isBenthosBatch() { + return editObject.isBenthosBatch(); + } + + @Override + public void setBenthosBatch(boolean benthosBatch) { + // NEVER! + } + //------------------------------------------------------------------------// //-- SampleCategoryAble --// //------------------------------------------------------------------------// diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java index 545b927..b00fb96 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java @@ -29,8 +29,8 @@ import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueId; import fr.ifremer.tutti.persistence.entities.TuttiEntities; import fr.ifremer.tutti.persistence.entities.data.Attachment; import fr.ifremer.tutti.persistence.entities.data.BatchContainer; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequency; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.SampleCategory; import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; @@ -174,16 +174,16 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent if (!TuttiEntities.isNew(bean)) { // get all batch species root (says the one with only a species sample category) - BatchContainer<BenthosBatch> rootBenthosBatch = + BatchContainer<SpeciesBatch> rootBenthosBatch = getPersistenceService().getRootBenthosBatch( bean.getIdAsInt(), true); - List<BenthosBatch> catches = rootBenthosBatch.getChildren(); + List<SpeciesBatch> catches = rootBenthosBatch.getChildren(); // use first category from configuration Integer firstCategoryId = sampleCategoryModel.getFirstCategoryId(); - for (BenthosBatch aBatch : catches) { + for (SpeciesBatch aBatch : catches) { // root batch sample categroy is species Preconditions.checkState( @@ -232,7 +232,7 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent @Override protected boolean isRowValid(BenthosBatchRowModel row) { - BenthosBatch batch = convertRowToEntity(row, true); + SpeciesBatch batch = convertRowToEntity(row, true); NuitonValidatorResult validator = getValidationService().validateEditBenthosBatch(batch); boolean result = !validator.hasErrorMessagess(); @@ -240,7 +240,7 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent && ValidationService.VALIDATION_CONTEXT_VALIDATE.equals( getContext().getValidationContext()) && row.isBatchLeaf()) { - List<BenthosBatchFrequency> frequencies = + List<SpeciesBatchFrequency> frequencies = BenthosFrequencyRowModel.toEntity( row.getFrequency(), batch); @@ -1113,13 +1113,13 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent } } - public BenthosBatchRowModel loadBatch(BenthosBatch aBatch, + public BenthosBatchRowModel loadBatch(SpeciesBatch aBatch, BenthosBatchRowModel parentRow, List<BenthosBatchRowModel> rows) { Integer id = aBatch.getIdAsInt(); - List<BenthosBatchFrequency> frequencies = + List<SpeciesBatchFrequency> frequencies = getPersistenceService().getAllBenthosBatchFrequency(id); BenthosBatchRowModel newRow = @@ -1168,7 +1168,7 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent newArrayListWithCapacity(aBatch.sizeChildBatchs()); Float childrenWeights = 0f; - for (BenthosBatch childBatch : aBatch.getChildBatchs()) { + for (SpeciesBatch childBatch : aBatch.getChildBatchs()) { BenthosBatchRowModel childRow = loadBatch(childBatch, newRow, rows); if (childrenWeights != null) { Float weight = childRow.getFinestCategory().getNotNullWeight(); @@ -1227,7 +1227,7 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent Preconditions.checkNotNull(row.getFinestCategory().getCategoryId()); Preconditions.checkNotNull(row.getFinestCategory().getCategoryValue()); - BenthosBatch entityToSave = row.toEntity(); + SpeciesBatch entityToSave = row.toEntity(); entityToSave.setFishingOperation(fishingOperation); @@ -1264,7 +1264,7 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent List<BenthosFrequencyRowModel> frequencyRows = row.getFrequency(); - List<BenthosBatchFrequency> frequency = + List<SpeciesBatchFrequency> frequency = BenthosFrequencyRowModel.toEntity( frequencyRows, entityToSave); @@ -1398,13 +1398,13 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent model.setRootNumber(model.getRootNumber() + 1); } - protected BenthosBatch convertRowToEntity(BenthosBatchRowModel row, boolean convertParent) { + protected SpeciesBatch convertRowToEntity(BenthosBatchRowModel row, boolean convertParent) { SampleCategory<?> sampleCategory = row.getFinestCategory(); Preconditions.checkNotNull(sampleCategory); Preconditions.checkNotNull(sampleCategory.getCategoryId()); Preconditions.checkNotNull(sampleCategory.getCategoryValue()); - BenthosBatch catchBean = row.toEntity(); + SpeciesBatch catchBean = row.toEntity(); // convert weight Float weight = catchBean.getWeight(); @@ -1419,7 +1419,7 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent catchBean.setSampleCategoryWeight(weightUnit.toEntity(categoryWeight)); if (convertParent && row.getParentBatch() != null) { - BenthosBatch parent = convertRowToEntity(row.getParentBatch(), true); + SpeciesBatch parent = convertRowToEntity(row.getParentBatch(), true); catchBean.setParentBatch(parent); } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/actions/ImportMultiPostBenthosAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/actions/ImportMultiPostBenthosAction.java index 19ff54f..3427a8a 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/actions/ImportMultiPostBenthosAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/actions/ImportMultiPostBenthosAction.java @@ -22,7 +22,7 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.actions; * #L% */ -import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import fr.ifremer.tutti.persistence.entities.data.CatchBatch; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.service.catches.multipost.MultiPostImportService; @@ -98,10 +98,10 @@ public class ImportMultiPostBenthosAction extends ImportMultiPostActionSupport<B (Float) notImportedData.get(CatchBatch.PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT); addNotImportedWeightToReport(builder, livingNotItemizedWeight, benthosWeightUnit, n("tutti.multiPostImportLog.livingNotItemizedWeight")); - Collection<BenthosBatch> notImportedBenthosBatches = - (Collection<BenthosBatch>) notImportedData.get(MultiPostImportService.BATCHES_KEY); + Collection<SpeciesBatch> notImportedBenthosBatches = + (Collection<SpeciesBatch>) notImportedData.get(MultiPostImportService.BATCHES_KEY); - for (BenthosBatch sb : notImportedBenthosBatches) { + for (SpeciesBatch sb : notImportedBenthosBatches) { builder.append("- ").append(decorate(sb.getSpecies())).append(" / ").append(decorate(sb.getSampleCategoryValue())).append("\n"); } return builder.toString(); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java index 0ab08a0..85eeb3f 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java @@ -24,9 +24,9 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.frequency; import com.google.common.collect.Lists; import com.google.common.collect.Ordering; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequency; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequencys; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequencys; import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; import fr.ifremer.tutti.type.WeightUnit; import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel; @@ -41,7 +41,7 @@ import java.util.List; * @author Tony Chemit - chemit@codelutin.com * @since 0.2 */ -public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<BenthosBatchFrequency, BenthosFrequencyRowModel> implements Comparable<BenthosFrequencyRowModel>, BenthosBatchFrequency { +public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, BenthosFrequencyRowModel> implements Comparable<BenthosFrequencyRowModel>, SpeciesBatchFrequency { private static final long serialVersionUID = 1L; @@ -88,13 +88,13 @@ public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<BenthosBa */ protected final WeightUnit weightUnit; - protected static final Binder<BenthosBatchFrequency, BenthosFrequencyRowModel> fromBeanBinder = - BinderFactory.newBinder(BenthosBatchFrequency.class, + protected static final Binder<SpeciesBatchFrequency, BenthosFrequencyRowModel> fromBeanBinder = + BinderFactory.newBinder(SpeciesBatchFrequency.class, BenthosFrequencyRowModel.class); - protected static final Binder<BenthosFrequencyRowModel, BenthosBatchFrequency> toBeanBinder = + protected static final Binder<BenthosFrequencyRowModel, SpeciesBatchFrequency> toBeanBinder = BinderFactory.newBinder(BenthosFrequencyRowModel.class, - BenthosBatchFrequency.class); + SpeciesBatchFrequency.class); private static final Ordering<Float> ordering = Ordering.natural().nullsFirst(); @@ -103,9 +103,9 @@ public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<BenthosBa //------------------------------------------------------------------------// public static List<BenthosFrequencyRowModel> fromEntity(WeightUnit weightUnit, - List<BenthosBatchFrequency> entities) { + List<SpeciesBatchFrequency> entities) { List<BenthosFrequencyRowModel> result = Lists.newArrayList(); - for (BenthosBatchFrequency entity : entities) { + for (SpeciesBatchFrequency entity : entities) { BenthosFrequencyRowModel row = new BenthosFrequencyRowModel(weightUnit); @@ -115,11 +115,11 @@ public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<BenthosBa return result; } - public static List<BenthosBatchFrequency> toEntity(List<BenthosFrequencyRowModel> rows, - BenthosBatch batch) { - List<BenthosBatchFrequency> result = Lists.newArrayList(); + public static List<SpeciesBatchFrequency> toEntity(List<BenthosFrequencyRowModel> rows, + SpeciesBatch batch) { + List<SpeciesBatchFrequency> result = Lists.newArrayList(); for (BenthosFrequencyRowModel row : rows) { - BenthosBatchFrequency model = row.toEntity(); + SpeciesBatchFrequency model = row.toEntity(); model.setBatch(batch); result.add(model); @@ -137,12 +137,12 @@ public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<BenthosBa //------------------------------------------------------------------------// @Override - protected BenthosBatchFrequency newEntity() { - return BenthosBatchFrequencys.newBenthosBatchFrequency(); + protected SpeciesBatchFrequency newEntity() { + return SpeciesBatchFrequencys.newBenthosBatchFrequency(); } @Override - public void fromEntity(BenthosBatchFrequency entity) { + public void fromEntity(SpeciesBatchFrequency entity) { super.fromEntity(entity); // convert weight @@ -150,8 +150,8 @@ public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<BenthosBa } @Override - public BenthosBatchFrequency toEntity() { - BenthosBatchFrequency result = super.toEntity(); + public SpeciesBatchFrequency toEntity() { + SpeciesBatchFrequency result = super.toEntity(); // convert weight result.setWeight(weightUnit.toEntity(getWeight())); @@ -159,7 +159,7 @@ public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<BenthosBa } //------------------------------------------------------------------------// - //-- BenthosBatchFrequency --// + //-- SpeciesBatchFrequency --// //------------------------------------------------------------------------// @Override @@ -211,12 +211,12 @@ public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<BenthosBa } @Override - public BenthosBatch getBatch() { + public SpeciesBatch getBatch() { return null; } @Override - public void setBatch(BenthosBatch batch) { + public void setBatch(SpeciesBatch batch) { } @Override @@ -233,6 +233,16 @@ public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<BenthosBa public void setRankOrder(Integer rankOrder) { } + @Override + public boolean isBenthosFrequencyBatch() { + return true; + } + + @Override + public void setBenthosFrequencyBatch(boolean benthosFrequencyBatch) { + //NEVER! + } + public boolean isEmpty() { return lengthStep == null && (weight == null || number == null); } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java index dd3876b..1a3654a 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java @@ -474,6 +474,16 @@ public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, editObject.setRankOrder(rankOrder); } + @Override + public boolean isBenthosBatch() { + return editObject.isBenthosBatch(); + } + + @Override + public void setBenthosBatch(boolean benthosBatch) { + //NEVER! + } + //------------------------------------------------------------------------// //-- SampleCategoryAble --// //------------------------------------------------------------------------// diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java index 51976ae..65d6e83 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java @@ -294,6 +294,16 @@ public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBa public void setRankOrder(Integer rankOrder) { } + @Override + public boolean isBenthosFrequencyBatch() { + return false; + } + + @Override + public void setBenthosFrequencyBatch(boolean benthosFrequencyBatch) { + //Never! + } + public boolean isEmpty() { return lengthStep == null && (weight == null || number == null); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.