Tutti-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
May 2013
- 4 participants
- 180 discussions
r975 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches: benthos species
by kmorin@users.forge.codelutin.com 21 May '13
by kmorin@users.forge.codelutin.com 21 May '13
21 May '13
Author: kmorin
Date: 2013-05-21 19:12:55 +0200 (Tue, 21 May 2013)
New Revision: 975
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/975
Log:
fixes #2480 [ESPECES] Suppression d'un lot cat?\195?\169goris?\195?\169 : tous les lots du m?\195?\170me niveau sont supprim?\195?\169s
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosBatchAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesBatchAction.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosBatchAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosBatchAction.java 2013-05-21 17:06:00 UTC (rev 974)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosBatchAction.java 2013-05-21 17:12:55 UTC (rev 975)
@@ -76,57 +76,41 @@
Preconditions.checkState(!TuttiEntities.isNew(selectedBatch),
"Can't remove batch if batch is not persisted");
- if (!selectedBatch.isBatchRoot()) {
+ // remove selected batch and all his children
- // remove all sub batches of his parent
- BenthosBatchRowModel parentBatch = selectedBatch.getParentBatch();
+ // remove parent batch (will destroy all his childs from db)
+ persistenceService.deleteBenthosBatch(selectedBatch.getId());
- // get parent row index
- int parentIndex = tableModel.getRowIndex(parentBatch);
-
- // select it
- table.setRowSelectionInterval(parentIndex, parentIndex);
-
- // remove all his children
- TuttiActionHelper.runInternalAction(removeSpeciesSubBatchAction);
-
- } else {
-
- // remove selected batch and all his children
-
- // remove parent batch (will destroy all his childs from db)
- persistenceService.deleteBenthosBatch(selectedBatch.getId());
-
+ if (selectedBatch.isBatchRoot()) {
// update speciesUsed
handler.removeFromSpeciesUsed(selectedBatch);
+ }
- // collect of rows to remove from model
- Set<BenthosBatchRowModel> rowToRemove =
- Sets.newHashSet(selectedBatch);
+ // collect of rows to remove from model
+ Set<BenthosBatchRowModel> rowToRemove =
+ Sets.newHashSet(selectedBatch);
- handler.collectChildren(selectedBatch, rowToRemove);
+ handler.collectChildren(selectedBatch, rowToRemove);
- table.clearSelection();
+ table.clearSelection();
- // remove all rows from the model
- getModel().getRows().removeAll(rowToRemove);
+ // remove all rows from the model
+ getModel().getRows().removeAll(rowToRemove);
- // refresh table from parent batch row index to the end
- tableModel.fireTableDataChanged();
+ // refresh table from parent batch row index to the end
+ tableModel.fireTableDataChanged();
- if (!getModel().getRows().isEmpty()) {
+ if (!getModel().getRows().isEmpty()) {
- // select first row
- AbstractSelectTableAction.doSelectCell(table, 0, 0);
+ // select first row
+ AbstractSelectTableAction.doSelectCell(table, 0, 0);
- }
+ }
- if (table.isEditing()) {
+ if (table.isEditing()) {
- // but no edit it
- table.getCellEditor().stopCellEditing();
- }
-
+ // but no edit it
+ table.getCellEditor().stopCellEditing();
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesBatchAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesBatchAction.java 2013-05-21 17:06:00 UTC (rev 974)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesBatchAction.java 2013-05-21 17:12:55 UTC (rev 975)
@@ -76,58 +76,43 @@
Preconditions.checkState(!TuttiEntities.isNew(selectedBatch),
"Can't remove batch if batch is not persisted");
- if (!selectedBatch.isBatchRoot()) {
+ // remove selected batch and all his children
- // remove all sub batches of his parent
- SpeciesBatchRowModel parentBatch = selectedBatch.getParentBatch();
+ // remove parent batch (will destroy all his childs from db)
+ persistenceService.deleteSpeciesBatch(selectedBatch.getId());
- // get parent row index
- int parentIndex = tableModel.getRowIndex(parentBatch);
-
- // select it
- table.setRowSelectionInterval(parentIndex, parentIndex);
-
- // remove all his children
- TuttiActionHelper.runInternalAction(removeSpeciesSubBatchAction);
-
- } else {
-
- // remove selected batch and all his children
-
- // remove parent batch (will destroy all his childs from db)
- persistenceService.deleteSpeciesBatch(selectedBatch.getId());
-
+ if (selectedBatch.isBatchRoot()) {
// update speciesUsed
handler.removeFromSpeciesUsed(selectedBatch);
+ }
- // collect of rows to remove from model
- Set<SpeciesBatchRowModel> rowToRemove =
- Sets.newHashSet(selectedBatch);
+ // collect of rows to remove from model
+ Set<SpeciesBatchRowModel> rowToRemove =
+ Sets.newHashSet(selectedBatch);
- handler.collectChildren(selectedBatch, rowToRemove);
+ handler.collectChildren(selectedBatch, rowToRemove);
- table.clearSelection();
+ table.clearSelection();
- // remove all rows from the model
- getModel().getRows().removeAll(rowToRemove);
+ // remove all rows from the model
+ getModel().getRows().removeAll(rowToRemove);
- // refresh table from parent batch row index to the end
- tableModel.fireTableDataChanged();
+ // refresh table from parent batch row index to the end
+ tableModel.fireTableDataChanged();
- if (!getModel().getRows().isEmpty()) {
+ if (!getModel().getRows().isEmpty()) {
- // select first row
- AbstractSelectTableAction.doSelectCell(table, 0, 0);
+ // select first row
+ AbstractSelectTableAction.doSelectCell(table, 0, 0);
- }
+ }
- if (table.isEditing()) {
+ if (table.isEditing()) {
- // but no edit it
- table.getCellEditor().stopCellEditing();
- }
-
+ // but no edit it
+ table.getCellEditor().stopCellEditing();
}
+
}
}
1
0
r974 - in trunk/tutti-ui-swing/src/main: filtered-resources java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency resources/i18n
by kmorin@users.forge.codelutin.com 21 May '13
by kmorin@users.forge.codelutin.com 21 May '13
21 May '13
Author: kmorin
Date: 2013-05-21 19:06:00 +0200 (Tue, 21 May 2013)
New Revision: 974
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/974
Log:
fixes #2472 [MENSURATIONS] ajouter somme des individus et des poids saisis
Modified:
trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties
trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-05-21 17:06:00 UTC (rev 974)
@@ -1,5 +1,5 @@
#Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo
-#Tue May 07 16:11:30 CEST 2013
+#Tue May 21 18:54:28 CEST 2013
tutti.config.help=config.html
tutti.createAccidentalBatch.action.cancel.help=createAccidentalBatch.html\#actions
tutti.createAccidentalBatch.action.save.help=createAccidentalBatch.html\#actions
@@ -86,6 +86,8 @@
tutti.editBenthosFrequencies.field.rafaleStep.help=editBenthosFrequencies.html\#fields
tutti.editBenthosFrequencies.field.simpleCounting.help=editBenthosFrequencies.html\#fields
tutti.editBenthosFrequencies.field.step.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.totalNumber.help=
+tutti.editBenthosFrequencies.field.totalWeight.help=
tutti.editBenthosFrequencies.help=editBenthosFrequencies.html
tutti.editCatchBatch.action.cancelEditCatchBatch.help=editCatchBatch.html\#actions
tutti.editCatchBatch.action.computeWeights.help=editCatchBatch.html\#actions
@@ -232,6 +234,8 @@
tutti.editSpeciesFrequencies.field.rafaleStep.help=editSpeciesFrequencies.html\#fields
tutti.editSpeciesFrequencies.field.simpleCounting.help=editSpeciesFrequencies.html\#fields
tutti.editSpeciesFrequencies.field.step.help=editSpeciesFrequencies.html\#fields
+tutti.editSpeciesFrequencies.field.totalNumber.help=
+tutti.editSpeciesFrequencies.field.totalWeight.help=
tutti.editSpeciesFrequencies.help=editSpeciesFrequencies.html
tutti.fishingOperations.action.deleteFishingOperation.help=
tutti.fishingOperations.action.newFishingOperation.help=fishingOperations.html\#actions
Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-05-21 17:06:00 UTC (rev 974)
@@ -1,5 +1,5 @@
#Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo
-#Tue May 07 16:11:30 CEST 2013
+#Tue May 21 18:54:28 CEST 2013
tutti.config.help=config.html
tutti.createAccidentalBatch.action.cancel.help=createAccidentalBatch.html\#actions
tutti.createAccidentalBatch.action.save.help=createAccidentalBatch.html\#actions
@@ -86,6 +86,8 @@
tutti.editBenthosFrequencies.field.rafaleStep.help=editBenthosFrequencies.html\#fields
tutti.editBenthosFrequencies.field.simpleCounting.help=editBenthosFrequencies.html\#fields
tutti.editBenthosFrequencies.field.step.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.totalNumber.help=
+tutti.editBenthosFrequencies.field.totalWeight.help=
tutti.editBenthosFrequencies.help=editBenthosFrequencies.html
tutti.editCatchBatch.action.cancelEditCatchBatch.help=editCatchBatch.html\#actions
tutti.editCatchBatch.action.computeWeights.help=editCatchBatch.html\#actions
@@ -232,6 +234,8 @@
tutti.editSpeciesFrequencies.field.rafaleStep.help=editSpeciesFrequencies.html\#fields
tutti.editSpeciesFrequencies.field.simpleCounting.help=editSpeciesFrequencies.html\#fields
tutti.editSpeciesFrequencies.field.step.help=editSpeciesFrequencies.html\#fields
+tutti.editSpeciesFrequencies.field.totalNumber.help=
+tutti.editSpeciesFrequencies.field.totalWeight.help=
tutti.editSpeciesFrequencies.help=editSpeciesFrequencies.html
tutti.fishingOperations.action.deleteFishingOperation.help=
tutti.fishingOperations.action.newFishingOperation.help=fishingOperations.html\#actions
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2013-05-21 17:06:00 UTC (rev 974)
@@ -72,8 +72,37 @@
numberPattern: {DECIMAL1_PATTERN};
bean: {model};
enabled: {!model.isSimpleCountingMode()};
+ _selectOnFocus: true;
}
+#totalNumberLabel {
+ text: "tutti.editBenthosFrequencies.field.totalNumber";
+ toolTipText: "tutti.editBenthosFrequencies.field.totalNumber.tip";
+ labelFor: {totalNumberField};
+ enabled: {!model.isSimpleCountingMode()};
+ _help: {"tutti.editBenthosFrequencies.field.totalNumber.help"};
+}
+
+#totalNumberField {
+ text: {getStringValue(model.getTotalNumber())};
+ enabled: false;
+ _computed: true;
+}
+
+#totalWeightLabel {
+ text: "tutti.editBenthosFrequencies.field.totalWeight";
+ toolTipText: "tutti.editBenthosFrequencies.field.totalWeight.tip";
+ labelFor: {totalWeightField};
+ enabled: {model.getTotalWeight() != null};
+ _help: {"tutti.editBenthosFrequencies.field.totalWeight.help"};
+}
+
+#totalWeightField {
+ text: {getStringValue(model.getTotalWeight())};
+ enabled: false;
+ _computed: true;
+}
+
#lengthStepCaracteristicLabel {
text: "tutti.editBenthosFrequencies.field.lengthStepCaracteristic";
toolTipText: "tutti.editBenthosFrequencies.field.lengthStepCaracteristic.tip";
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx 2013-05-21 17:06:00 UTC (rev 974)
@@ -196,7 +196,7 @@
<cell anchor='west'>
<JLabel id='lengthStepCaracteristicLabel'/>
</cell>
- <cell weightx='1.0'>
+ <cell weightx='1.0' columns='5'>
<BeanFilterableComboBox id='lengthStepCaracteristicComboBox'
constructorParams='this'
genericType='Caracteristic'/>
@@ -210,6 +210,18 @@
<cell weightx='1.0'>
<NumberEditor id='stepField' constructorParams='this'/>
</cell>
+ <cell anchor='west'>
+ <JLabel id='totalNumberLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='totalNumberField'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='totalWeightField'/>
+ </cell>
</row>
</Table>
</JPanel>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-05-21 17:06:00 UTC (rev 974)
@@ -133,12 +133,27 @@
// the other ones do not need to have a weight to be valid
recomputeAllRows = withWeightRows.isEmpty();
}
- if (recomputeAllRows) {
- List<BenthosFrequencyRowModel> rows = getModel().getRows();
- for (BenthosFrequencyRowModel r : rows) {
+
+
+ List<BenthosFrequencyRowModel> rows = getModel().getRows();
+ Integer totalNumber = 0;
+ Float totalWeight = 0f;
+ for (BenthosFrequencyRowModel r : rows) {
+ if (recomputeAllRows) {
recomputeRowValidState(r);
}
- } else {
+ if (r.isValid()) {
+ totalNumber += r.getNumber();
+ Float weight = r.getWeight();
+ if (weight != null) {
+ totalWeight += weight;
+ }
+ }
+ }
+ getModel().setTotalNumber(totalNumber);
+ getModel().setTotalWeight(totalWeight);
+
+ if (!recomputeAllRows) {
recomputeRowValidState(row);
}
}
@@ -427,6 +442,7 @@
tableModel.addNewRow(rowIndex, row);
}
+ model.setTotalNumber(model.getTotalNumber() + 1);
getTable().scrollRowToVisible(rowIndex);
}
@@ -434,6 +450,10 @@
public void editBatch(BenthosBatchRowModel speciesBatch, BenthosFrequencyCellComponent.FrequencyCellEditor editor) {
withWeightRows.clear();
+ BenthosFrequencyUIModel model = getModel();
+ model.setTotalNumber(null);
+ model.setTotalWeight(null);
+
frequencyEditor = editor;
Caracteristic lengthStepCaracteristic = null;
@@ -450,6 +470,9 @@
if (CollectionUtils.isNotEmpty(frequency)) {
+ Integer totalNumber = 0;
+ Float totalWeight = 0f;
+
BenthosFrequencyTableModel tableModel = getTableModel();
for (BenthosFrequencyRowModel rowModel : frequency) {
@@ -463,8 +486,14 @@
if (newRow.getWeight() != null) {
withWeightRows.add(newRow);
+ totalWeight += newRow.getWeight();
+ } else {
+ totalWeight = null;
}
+ totalNumber += newRow.getNumber();
}
+ model.setTotalNumber(totalNumber);
+ model.setTotalWeight(totalWeight);
// use first frequency row length step caracteristics
@@ -511,8 +540,6 @@
editFrequency.size() + " frequency");
}
- BenthosFrequencyUIModel model = getModel();
-
BenthosFrequencyUIModel.ConfigurationMode mode = BenthosFrequencyUIModel.ConfigurationMode.SIMPLE;
if (lengthStepCaracteristic == null && protocol != null) {
Integer taxonId = speciesBatch.getSpecies().getReferenceTaxonId();
@@ -521,9 +548,10 @@
mode = BenthosFrequencyUIModel.ConfigurationMode.SIMPLE_COUNTING;
}
}
- if (speciesBatch.getNumber() != null && editFrequency.isEmpty()) {
+ Integer number = speciesBatch.getNumber();
+ if (number != null && editFrequency.isEmpty()) {
mode = BenthosFrequencyUIModel.ConfigurationMode.SIMPLE_COUNTING;
- model.setSimpleCount(speciesBatch.getNumber());
+ model.setSimpleCount(number);
}
model.setConfigurationMode(mode);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java 2013-05-21 17:06:00 UTC (rev 974)
@@ -61,6 +61,10 @@
public static final String PROPERTY_LENGHT_STEP_CARACTERISTIC = "lengthStepCaracteristic";
+ public static final String PROPERTY_TOTAL_NUMBER = "totalNumber";
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
public static enum ConfigurationMode {
SIMPLE,
AUTO_GEN,
@@ -117,6 +121,18 @@
*/
protected Integer simpleCount;
+ /**
+ * Sum of the number of each valid row
+ * @since 2.3
+ */
+ protected Integer totalNumber;
+
+ /**
+ * Sum of the weight of each valid row
+ * @since 2.3
+ */
+ protected Float totalWeight;
+
public BenthosFrequencyUIModel() {
super(SpeciesBatchRowModel.class, null, null);
}
@@ -225,20 +241,26 @@
return result;
}
- public boolean isOneRowValid() {
- boolean result = getRowCount() > 0;
- if (result) {
- result = false;
- for (BenthosFrequencyRowModel row : rows) {
- if (row.isValid()) {
- result = true;
- break;
- }
- }
- }
- return result;
+ public Integer getTotalNumber() {
+ return totalNumber;
}
+ public void setTotalNumber(Integer totalNumber) {
+ Object oldValue = getTotalNumber();
+ this.totalNumber = totalNumber;
+ firePropertyChange(PROPERTY_TOTAL_NUMBER, oldValue, totalNumber);
+ }
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
@Override
protected SpeciesBatchRowModel newEntity() {
return new SpeciesBatchRowModel();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2013-05-21 17:06:00 UTC (rev 974)
@@ -72,8 +72,37 @@
numberPattern: {DECIMAL1_PATTERN};
bean: {model};
enabled: {!model.isSimpleCountingMode()};
+ _selectOnFocus: true;
}
+#totalNumberLabel {
+ text: "tutti.editSpeciesFrequencies.field.totalNumber";
+ toolTipText: "tutti.editSpeciesFrequencies.field.totalNumber.tip";
+ labelFor: {totalNumberField};
+ enabled: {!model.isSimpleCountingMode()};
+ _help: {"tutti.editSpeciesFrequencies.field.totalNumber.help"};
+}
+
+#totalNumberField {
+ text: {getStringValue(model.getTotalNumber())};
+ enabled: false;
+ _computed: true;
+}
+
+#totalWeightLabel {
+ text: "tutti.editSpeciesFrequencies.field.totalWeight";
+ toolTipText: "tutti.editSpeciesFrequencies.field.totalWeight.tip";
+ labelFor: {totalWeightField};
+ enabled: {model.getTotalWeight() != null};
+ _help: {"tutti.editSpeciesFrequencies.field.totalWeight.help"};
+}
+
+#totalWeightField {
+ text: {getStringValue(model.getTotalWeight())};
+ enabled: false;
+ _computed: true;
+}
+
#lengthStepCaracteristicLabel {
text: "tutti.editSpeciesFrequencies.field.lengthStepCaracteristic";
toolTipText: "tutti.editSpeciesFrequencies.field.lengthStepCaracteristic.tip";
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx 2013-05-21 17:06:00 UTC (rev 974)
@@ -196,7 +196,7 @@
<cell anchor='west'>
<JLabel id='lengthStepCaracteristicLabel'/>
</cell>
- <cell weightx='1.0'>
+ <cell weightx='1.0' columns='5'>
<BeanFilterableComboBox id='lengthStepCaracteristicComboBox'
constructorParams='this'
genericType='Caracteristic'/>
@@ -210,6 +210,18 @@
<cell weightx='1.0'>
<NumberEditor id='stepField' constructorParams='this'/>
</cell>
+ <cell anchor='west'>
+ <JLabel id='totalNumberLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='totalNumberField'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='totalWeightField'/>
+ </cell>
</row>
</Table>
</JPanel>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-05-21 17:06:00 UTC (rev 974)
@@ -38,10 +38,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyCellComponent.FrequencyCellEditor;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.*;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -134,12 +131,26 @@
// the other ones do not need to have a weight to be valid
recomputeAllRows = withWeightRows.isEmpty();
}
- if (recomputeAllRows) {
- List<SpeciesFrequencyRowModel> rows = getModel().getRows();
- for (SpeciesFrequencyRowModel r : rows) {
+
+ List<SpeciesFrequencyRowModel> rows = getModel().getRows();
+ Integer totalNumber = 0;
+ Float totalWeight = 0f;
+ for (SpeciesFrequencyRowModel r : rows) {
+ if (recomputeAllRows) {
recomputeRowValidState(r);
}
- } else {
+ if (r.isValid()) {
+ totalNumber += r.getNumber();
+ Float weight = r.getWeight();
+ if (weight != null) {
+ totalWeight += weight;
+ }
+ }
+ }
+ getModel().setTotalNumber(totalNumber);
+ getModel().setTotalWeight(totalWeight);
+
+ if (!recomputeAllRows) {
recomputeRowValidState(row);
}
}
@@ -428,6 +439,7 @@
tableModel.addNewRow(rowIndex, row);
}
+ model.setTotalNumber(model.getTotalNumber() + 1);
getTable().scrollRowToVisible(rowIndex);
}
@@ -435,6 +447,10 @@
public void editBatch(SpeciesBatchRowModel speciesBatch, FrequencyCellEditor editor) {
withWeightRows.clear();
+ SpeciesFrequencyUIModel model = getModel();
+ model.setTotalNumber(null);
+ model.setTotalWeight(null);
+
frequencyEditor = editor;
Caracteristic lengthStepCaracteristic = null;
@@ -451,6 +467,9 @@
if (CollectionUtils.isNotEmpty(frequency)) {
+ Integer totalNumber = 0;
+ Float totalWeight = 0f;
+
SpeciesFrequencyTableModel tableModel = getTableModel();
for (SpeciesFrequencyRowModel rowModel : frequency) {
@@ -464,8 +483,15 @@
if (newRow.getWeight() != null) {
withWeightRows.add(newRow);
+ totalWeight += newRow.getWeight();
+
+ } else {
+ totalWeight = null;
}
+ totalNumber += newRow.getNumber();
}
+ model.setTotalNumber(totalNumber);
+ model.setTotalWeight(totalWeight);
// use first frequency row length step caracteristics
@@ -512,8 +538,6 @@
editFrequency.size() + " frequency");
}
- SpeciesFrequencyUIModel model = getModel();
-
SpeciesFrequencyUIModel.ConfigurationMode mode = SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE;
if (lengthStepCaracteristic == null && protocol != null) {
Integer taxonId = speciesBatch.getSpecies().getReferenceTaxonId();
@@ -522,9 +546,10 @@
mode = SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE_COUNTING;
}
}
- if (speciesBatch.getNumber() != null && editFrequency.isEmpty()) {
+ Integer number = speciesBatch.getNumber();
+ if (number != null && editFrequency.isEmpty()) {
mode = SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE_COUNTING;
- model.setSimpleCount(speciesBatch.getNumber());
+ model.setSimpleCount(number);
}
model.setConfigurationMode(mode);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java 2013-05-21 17:06:00 UTC (rev 974)
@@ -26,6 +26,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import java.util.List;
@@ -62,6 +63,10 @@
public static final String PROPERTY_LENGHT_STEP_CARACTERISTIC = "lengthStepCaracteristic";
+ public static final String PROPERTY_TOTAL_NUMBER = "totalNumber";
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
public static enum ConfigurationMode {
SIMPLE,
AUTO_GEN,
@@ -112,6 +117,18 @@
protected Caracteristic lengthStepCaracteristic;
/**
+ * Sum of the number of each valid row
+ * @since 2.3
+ */
+ protected Integer totalNumber;
+
+ /**
+ * Sum of the weight of each valid row
+ * @since 2.3
+ */
+ protected Float totalWeight;
+
+ /**
* Number in case of simple counting mode
*
* @since 1.0
@@ -226,25 +243,26 @@
return result;
}
- public boolean isOneRowValid() {
- boolean result = getRowCount() > 0;
- if (result) {
- result = false;
- for (SpeciesFrequencyRowModel row : rows) {
- if (row.isValid()) {
- result = true;
- break;
- }
- }
- }
- return result;
+ public Integer getTotalNumber() {
+ return totalNumber;
}
- // method with an argument for the binding
- public boolean isOneRowValid(List<SpeciesFrequencyRowModel> frequencies) {
- return isOneRowValid();
+ public void setTotalNumber(Integer totalNumber) {
+ Object oldValue = getTotalNumber();
+ this.totalNumber = totalNumber;
+ firePropertyChange(PROPERTY_TOTAL_NUMBER, oldValue, totalNumber);
}
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
@Override
protected SpeciesBatchRowModel newEntity() {
return new SpeciesBatchRowModel();
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-05-21 17:06:00 UTC (rev 974)
@@ -404,6 +404,10 @@
tutti.editBenthosFrequencies.field.simpleCounting.tip=
tutti.editBenthosFrequencies.field.step=
tutti.editBenthosFrequencies.field.step.tip=
+tutti.editBenthosFrequencies.field.totalNumber=
+tutti.editBenthosFrequencies.field.totalNumber.tip=
+tutti.editBenthosFrequencies.field.totalWeight=
+tutti.editBenthosFrequencies.field.totalWeight.tip=
tutti.editBenthosFrequencies.label.no.configuration=
tutti.editBenthosFrequencies.simpleCountingAndFrequencies=
tutti.editBenthosFrequencies.title=
@@ -924,6 +928,10 @@
tutti.editSpeciesFrequencies.field.simpleCounting.tip=
tutti.editSpeciesFrequencies.field.step=
tutti.editSpeciesFrequencies.field.step.tip=
+tutti.editSpeciesFrequencies.field.totalNumber=
+tutti.editSpeciesFrequencies.field.totalNumber.tip=
+tutti.editSpeciesFrequencies.field.totalWeight=
+tutti.editSpeciesFrequencies.field.totalWeight.tip=
tutti.editSpeciesFrequencies.label.no.configuration=
tutti.editSpeciesFrequencies.simpleCountingAndFrequencies=
tutti.editSpeciesFrequencies.table.header.lengthStep=
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-05-21 15:44:35 UTC (rev 973)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-05-21 17:06:00 UTC (rev 974)
@@ -398,6 +398,10 @@
tutti.editBenthosFrequencies.field.simpleCounting.tip=Saisir le nombre d'individus dans le lot
tutti.editBenthosFrequencies.field.step=Pas de la classe de taille
tutti.editBenthosFrequencies.field.step.tip=Pas de la classe de taille pour cette espèce (ex. \: 1 cm, 0,5 cm, 1 mm etc.)
+tutti.editBenthosFrequencies.field.totalNumber=Nombre total
+tutti.editBenthosFrequencies.field.totalNumber.tip=Nombre total d'individus des lignes valides
+tutti.editBenthosFrequencies.field.totalWeight=Poids total
+tutti.editBenthosFrequencies.field.totalWeight.tip=Poids total des lignes valides
tutti.editBenthosFrequencies.label.no.configuration=< Pas de configuration >
tutti.editBenthosFrequencies.simpleCountingAndFrequencies=Des mensurations ont été saisies dans le tableau. Saisir un simple dénombrement les effacera.
tutti.editBenthosFrequencies.title=Mensuration
@@ -888,6 +892,10 @@
tutti.editSpeciesFrequencies.field.simpleCounting.tip=Saisir le nombre d'individus dans le lot
tutti.editSpeciesFrequencies.field.step=Pas de la classe de taille
tutti.editSpeciesFrequencies.field.step.tip=Pas de la classe de taille pour cette espèce (ex. \: 1 cm, 0,5 cm, 1 mm etc.)
+tutti.editSpeciesFrequencies.field.totalNumber=Nombre total
+tutti.editSpeciesFrequencies.field.totalNumber.tip=Nombre total d'individus des lignes valides
+tutti.editSpeciesFrequencies.field.totalWeight=Poids total
+tutti.editSpeciesFrequencies.field.totalWeight.tip=Poids total des lignes valides
tutti.editSpeciesFrequencies.label.no.configuration=< Pas de configuration >
tutti.editSpeciesFrequencies.simpleCountingAndFrequencies=Des mensurations ont été saisies dans le tableau. Saisir un simple dénombrement les effacera.
tutti.editSpeciesFrequencies.table.header.lengthStep=Classe de taille
1
0
r973 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches: benthos/frequency species/frequency
by kmorin@users.forge.codelutin.com 21 May '13
by kmorin@users.forge.codelutin.com 21 May '13
21 May '13
Author: kmorin
Date: 2013-05-21 17:44:35 +0200 (Tue, 21 May 2013)
New Revision: 973
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/973
Log:
fixes #2467 [MESNURATIONS] Indication de la ligne active
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-05-21 15:43:00 UTC (rev 972)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-05-21 15:44:35 UTC (rev 973)
@@ -40,6 +40,7 @@
import fr.ifremer.tutti.ui.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -47,6 +48,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
import javax.swing.*;
@@ -296,6 +299,20 @@
}
@Override
+ protected void addHighlighters(JXTable table) {
+ super.addHighlighters(table);
+
+ // highlight only the lengthstep column if the row is selected
+ Highlighter selectedHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(
+ HighlightPredicate.IS_SELECTED,
+ new HighlightPredicate.IdentifierHighlightPredicate(BenthosFrequencyTableModel.LENGTH_STEP)),
+ UIManager.getColor("Table[Enabled+Selected].textBackground"));
+
+ table.addHighlighter(selectedHighlighter);
+ }
+
+ @Override
protected JComponent getComponentToFocus() {
return getUI().getLengthStepCaracteristicComboBox();
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-05-21 15:43:00 UTC (rev 972)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-05-21 15:44:35 UTC (rev 973)
@@ -29,7 +29,6 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
@@ -38,7 +37,6 @@
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.species.SpeciesBatchRowModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchTableModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyCellComponent.FrequencyCellEditor;
import fr.ifremer.tutti.ui.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
@@ -304,7 +302,8 @@
@Override
protected void addHighlighters(JXTable table) {
super.addHighlighters(table);
- // highlight only the species column if the row is selected
+
+ // highlight only the lengthstep column if the row is selected
Highlighter selectedHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
new HighlightPredicate.AndHighlightPredicate(
HighlightPredicate.IS_SELECTED,
1
0
r972 - in trunk: tutti-service/src/test/java/fr/ifremer/tutti/service tutti-service/src/test/java/fr/ifremer/tutti/service/catches tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency
by kmorin@users.forge.codelutin.com 21 May '13
by kmorin@users.forge.codelutin.com 21 May '13
21 May '13
Author: kmorin
Date: 2013-05-21 17:43:00 +0200 (Tue, 21 May 2013)
New Revision: 972
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/972
Log:
fixes #2467 [MESNURATIONS] Indication de la ligne active
Added:
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingServiceTest.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
Added: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingServiceTest.java (rev 0)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingServiceTest.java 2013-05-21 15:43:00 UTC (rev 972)
@@ -0,0 +1,8 @@
+package fr.ifremer.tutti.service.catches;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since x.x
+ */
+public class TuttiWeightComputingServiceTest {
+}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyTableModel.java 2013-05-21 14:58:05 UTC (rev 971)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyTableModel.java 2013-05-21 15:43:00 UTC (rev 972)
@@ -131,9 +131,6 @@
// add new row to cache
Float lengthStep = newValue.getLengthStep();
- Preconditions.checkNotNull(lengthStep,
- "can't add a null lengthStep row");
-
float roundLenghtValue = uiModel.getLengthStep(lengthStep);
if (!rowCache.containsKey(roundLenghtValue)) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-05-21 14:58:05 UTC (rev 971)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-05-21 15:43:00 UTC (rev 972)
@@ -38,10 +38,12 @@
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.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchTableModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyCellComponent.FrequencyCellEditor;
import fr.ifremer.tutti.ui.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -49,10 +51,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import javax.swing.JComponent;
-import javax.swing.JTextField;
+import javax.swing.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
@@ -299,6 +302,19 @@
}
@Override
+ protected void addHighlighters(JXTable table) {
+ super.addHighlighters(table);
+ // highlight only the species column if the row is selected
+ Highlighter selectedHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(
+ HighlightPredicate.IS_SELECTED,
+ new HighlightPredicate.IdentifierHighlightPredicate(SpeciesFrequencyTableModel.LENGTH_STEP)),
+ UIManager.getColor("Table[Enabled+Selected].textBackground"));
+
+ table.addHighlighter(selectedHighlighter);
+ }
+
+ @Override
protected JComponent getComponentToFocus() {
return getUI().getLengthStepCaracteristicComboBox();
}
1
0
r971 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches: benthos/frequency species/frequency
by kmorin@users.forge.codelutin.com 21 May '13
by kmorin@users.forge.codelutin.com 21 May '13
21 May '13
Author: kmorin
Date: 2013-05-21 16:58:05 +0200 (Tue, 21 May 2013)
New Revision: 971
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/971
Log:
fixes #2466 [MENSURATIONS] Saisie des mensurations : Am?\195?\169liorations de la saisie
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2013-05-21 14:44:45 UTC (rev 970)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2013-05-21 14:58:05 UTC (rev 971)
@@ -102,6 +102,7 @@
showReset: true;
numberPattern: {DECIMAL1_PATTERN};
bean: {model};
+ _selectOnFocus: true;
}
#maxStepLabel {
@@ -118,6 +119,7 @@
showReset: true;
numberPattern: {DECIMAL1_PATTERN};
bean: {model};
+ _selectOnFocus: true;
}
#rafaleStepLabel {
@@ -133,6 +135,7 @@
showReset: true;
numberPattern: {DECIMAL1_PATTERN};
enabled: {model.getLengthStepCaracteristic() != null};
+ _selectOnFocus: true;
}
#configurationPanel {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2013-05-21 14:44:45 UTC (rev 970)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2013-05-21 14:58:05 UTC (rev 971)
@@ -102,6 +102,7 @@
showReset: true;
numberPattern: {DECIMAL1_PATTERN};
bean: {model};
+ _selectOnFocus: true;
}
#maxStepLabel {
@@ -118,6 +119,7 @@
showReset: true;
numberPattern: {DECIMAL1_PATTERN};
bean: {model};
+ _selectOnFocus: true;
}
#rafaleStepLabel {
@@ -133,6 +135,7 @@
showReset: true;
numberPattern: {DECIMAL1_PATTERN};
enabled: {model.getLengthStepCaracteristic() != null};
+ _selectOnFocus: true;
}
#configurationPanel {
1
0
r970 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util
by kmorin@users.forge.codelutin.com 21 May '13
by kmorin@users.forge.codelutin.com 21 May '13
21 May '13
Author: kmorin
Date: 2013-05-21 16:44:45 +0200 (Tue, 21 May 2013)
New Revision: 970
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/970
Log:
fixes #2456 [ERGO] Format num?\195?\169rique : pouvoir saisir sans mettre de 0 devant la virgule
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUI.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUI.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUI.java 2013-05-21 14:01:33 UTC (rev 969)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUI.java 2013-05-21 14:44:45 UTC (rev 970)
@@ -103,7 +103,7 @@
*
* @since 0.1
*/
- public static final String DECIMAL1_PATTERN = "\\d{0,6}|\\d{1,6}\\.\\d{0,1}";
+ public static final String DECIMAL1_PATTERN = "\\d{0,6}(\\.\\d{0,1})?";
/**
* Pattern to use for decimal numeric values with 2 decimal digits in
@@ -111,7 +111,7 @@
*
* @since 0.1
*/
- public static final String DECIMAL2_PATTERN = "\\d{0,6}|\\d{1,6}\\.\\d{0,2}";
+ public static final String DECIMAL2_PATTERN = "\\d{0,6}(\\.\\d{0,2})?";
/**
* Pattern to use for decimal numeric values with 3 decimal digits in
@@ -119,7 +119,7 @@
*
* @since 0.1
*/
- public static final String DECIMAL3_PATTERN = "\\d{0,6}|\\d{1,6}\\.\\d{0,3}";
+ public static final String DECIMAL3_PATTERN = "\\d{0,6}(\\.\\d{0,3})?";
/**
* Pattern to use for decimal numeric values with 2 digits + 3 decimal digits in
@@ -127,7 +127,7 @@
*
* @since 1.0
*/
- public static final String DECIMAL2_DIGITS_PATTERN = "\\d{0,2}|\\d{1,2}\\.\\d*";
+ public static final String DECIMAL2_DIGITS_PATTERN = "\\d{0,2}(\\.\\d*)?";
public static final Font TEXTFIELD_NORMAL_FONT = UIManager.getDefaults().getFont("TextField.font");
1
0
r969 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action
by tchemit@users.forge.codelutin.com 21 May '13
by tchemit@users.forge.codelutin.com 21 May '13
21 May '13
Author: tchemit
Date: 2013-05-21 16:01:33 +0200 (Tue, 21 May 2013)
New Revision: 969
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/969
Log:
fix NPE
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIHandler.java 2013-05-21 11:59:13 UTC (rev 968)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIHandler.java 2013-05-21 14:01:33 UTC (rev 969)
@@ -94,8 +94,8 @@
MainUI mainUI = getContext().getMainUI();
if (mainUI != null) {
Container component = mainUI.getBody();
- int width = component.getWidth();
- int height = component.getHeight();
+ int width = component == null ? 0 : component.getWidth();
+ int height = component == null ? 0 : component.getHeight();
int x;
int y;
if (height == 0) {
1
0
r968 - in trunk: tutti-service/src/main/java/fr/ifremer/tutti/service/export tutti-service/src/main/resources/i18n tutti-service/src/test/java/fr/ifremer/tutti/service/export tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home
by tchemit@users.forge.codelutin.com 21 May '13
by tchemit@users.forge.codelutin.com 21 May '13
21 May '13
Author: tchemit
Date: 2013-05-21 13:59:13 +0200 (Tue, 21 May 2013)
New Revision: 968
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/968
Log:
fixes #2419: [EXPORT GENERIQUE] il manque le poids total macro-d?\195?\169chets dans l'export marineLitter.csv
fixes #2439: [EXPORT GENERIQUE] ajouter un fichier de transcodage des code esp?\195?\169ces vers nom scientifique + code rubin + code campagne
Added:
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportModel.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportRow.java
Modified:
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/MarineLitterExportModel.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/MarineLitterExportRow.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/TuttiExportService.java
trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/TuttiExportServiceTest.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/MarineLitterExportModel.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/MarineLitterExportModel.java 2013-05-21 10:06:05 UTC (rev 967)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/MarineLitterExportModel.java 2013-05-21 11:59:13 UTC (rev 968)
@@ -25,6 +25,7 @@
*/
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
@@ -62,6 +63,7 @@
newColumnForExport("Number", MarineLitterBatch.PROPERTY_NUMBER, TuttiCsvUtil.INTEGER);
newColumnForExport("Weight", MarineLitterBatch.PROPERTY_WEIGHT, TuttiCsvUtil.FLOAT);
newColumnForExport("Comment", MarineLitterBatch.PROPERTY_COMMENT);
+ newColumnForExport("TotalWeight", MarineLitterExportRow.PROPERTY_TOTAL_WEIGHT, TuttiCsvUtil.FLOAT);
}
public void prepareRows(PersistenceService persistenceService,
@@ -69,6 +71,9 @@
Cruise cruise,
FishingOperation operation) {
+ CatchBatch catchBatch =
+ persistenceService.getCatchBatchFromFishingOperation(operation.getId());
+
BatchContainer<MarineLitterBatch> rootMarineLitterBatch =
persistenceService.getRootMarineLitterBatch(operation.getId());
@@ -79,6 +84,7 @@
row.setCruise(cruise);
row.setFishingOperation(operation);
row.setBatch(child);
+ row.setTotalWeight(catchBatch.getMarineLitterTotalWeight());
rows.add(row);
}
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/MarineLitterExportRow.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/MarineLitterExportRow.java 2013-05-21 10:06:05 UTC (rev 967)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/MarineLitterExportRow.java 2013-05-21 11:59:13 UTC (rev 968)
@@ -43,6 +43,8 @@
*/
public class MarineLitterExportRow implements Serializable {
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
public static final String PROPERTY_BATCH= "batch";
private static final long serialVersionUID = 1L;
@@ -53,6 +55,16 @@
protected MarineLitterBatch batch;
+ protected Float totalWeight;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ this.totalWeight = totalWeight;
+ }
+
public void setCruise(Cruise cruise) {
this.cruise = cruise;
}
Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportModel.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportModel.java (rev 0)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportModel.java 2013-05-21 11:59:13 UTC (rev 968)
@@ -0,0 +1,53 @@
+package fr.ifremer.tutti.service.export;
+
+import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.TuttiCsvUtil;
+
+import java.util.List;
+
+/**
+ * To export a species used in data to export.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.3
+ */
+public class SpeciesExportModel extends TuttiCsvUtil.AbstractTuttiExportModel<SpeciesExportRow> {
+
+ public SpeciesExportModel(char separator) {
+ super(separator);
+ newColumnForExport("Id", SpeciesExportRow.SPECIES + "." + Species.PROPERTY_REFERENCE_TAXON_ID, TuttiCsvUtil.PRIMITIVE_INTEGER);
+ newColumnForExport("Code_Rubin", SpeciesExportRow.SPECIES + "." + Species.PROPERTY_REF_TAX_CODE);
+ newColumnForExport("Nom Scientifique", SpeciesExportRow.SPECIES + "." + Species.PROPERTY_NAME);
+ newColumnForExport("Code campagne", SpeciesExportRow.SPECIES + "." + Species.PROPERTY_SURVEY_CODE);
+ }
+
+ public void prepareBatchRows(TuttiExportService.ExportContext exportContext,
+ BatchContainer<SpeciesBatch> rootSpeciesBatch,
+ BatchContainer<BenthosBatch> rootBenthosBatch) {
+
+ for (SpeciesBatch speciesBatch : rootSpeciesBatch.getChildren()) {
+
+ exportContext.addSpecies(speciesBatch.getSpecies());
+ }
+ for (BenthosBatch benthosBatch : rootBenthosBatch.getChildren()) {
+ exportContext.addSpecies(benthosBatch.getSpecies());
+ }
+ }
+
+ public void prepareIndividualRowsRows(TuttiExportService.ExportContext exportContext,
+ List<IndividualObservationExportRow> rows) {
+ for (IndividualObservationExportRow row : rows) {
+ exportContext.addSpecies(row.getSpecies());
+ }
+ }
+
+ public void prepareAccidentalRows(TuttiExportService.ExportContext exportContext,
+ List<AccidentalCatchExportRow> rows) {
+ for (AccidentalCatchExportRow row : rows) {
+ exportContext.addSpecies(row.getSpecies());
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportRow.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportRow.java (rev 0)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportRow.java 2013-05-21 11:59:13 UTC (rev 968)
@@ -0,0 +1,28 @@
+package fr.ifremer.tutti.service.export;
+
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+
+import java.io.Serializable;
+
+/**
+ * A species in a export.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.3
+ */
+public class SpeciesExportRow implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String SPECIES = "species";
+
+ protected Species species;
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(Species species) {
+ this.species = species;
+ }
+}
Property changes on: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/SpeciesExportRow.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/TuttiExportService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/TuttiExportService.java 2013-05-21 10:06:05 UTC (rev 967)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/TuttiExportService.java 2013-05-21 11:59:13 UTC (rev 968)
@@ -28,6 +28,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import com.google.common.io.Files;
import fr.ifremer.tutti.TuttiBusinessException;
import fr.ifremer.tutti.TuttiIOUtil;
@@ -43,7 +44,9 @@
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.service.AbstractTuttiService;
import fr.ifremer.tutti.service.DecoratorService;
@@ -62,8 +65,11 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import static org.nuiton.i18n.I18n._;
@@ -162,6 +168,7 @@
}
public void exportProgram(String programId,
+ TuttiProtocol protocol,
File exportFile,
ProgressionModel progressionModel) {
Preconditions.checkNotNull(programId);
@@ -183,7 +190,7 @@
TuttiIOUtil.forceMkdir(basedir, _("tutti.service.mkDir.error", basedir));
- ExportContext exportContext = createExportContext(basedir);
+ ExportContext exportContext = createExportContext(basedir, protocol);
try {
for (Cruise cruise : allCruise) {
@@ -204,6 +211,7 @@
}
public void exportCruise(String cruiseId,
+ TuttiProtocol protocol,
File exportFile,
ProgressionModel progressionModel) {
@@ -225,7 +233,7 @@
TuttiIOUtil.forceMkdir(basedir, _("tutti.service.mkDir.error", basedir));
- ExportContext exportContext = createExportContext(basedir);
+ ExportContext exportContext = createExportContext(basedir, protocol);
try {
exportCruise(cruise, exportContext, progressionModel);
@@ -241,7 +249,13 @@
}
}
- protected ExportContext createExportContext(File basedir) {
+ protected ExportContext createExportContext(File basedir,
+ TuttiProtocol protocol) {
+
+
+ List<Species> allReferentSpecies = persistenceService.getAllReferentSpecies(protocol);
+ Map<String, Species> speciesById = TuttiEntities.splitById(allReferentSpecies);
+
return new ExportContext(
basedir,
csvSeparator,
@@ -256,7 +270,8 @@
genderCaracteristic,
pmfmIdCaracteristic,
samplingOrder,
- samplingToCaracteristic);
+ samplingToCaracteristic,
+ speciesById);
}
protected void checkCruise(ProgressionModel progressionModel, Cruise cruise) {
@@ -345,6 +360,12 @@
_("tutti.service.exportCruise.exportCatches", cruiseName));
exportCatches(exportContext, cruise, loadedOperations);
progressionModel.increments(1);
+
+ progressionModel.setMessage(
+ _("tutti.service.exportCruise.exportSpecies", cruiseName));
+
+ exportSpecies(exportContext, exportContext.getSpeciesToExport());
+ progressionModel.increments(1);
}
protected void exportSurvey(ExportContext exportContext,
@@ -424,6 +445,9 @@
}
List<IndividualObservationExportRow> rows = Lists.newArrayList();
exportContext.individualObservationModel.prepareRows(persistenceService, rows, cruise, operation);
+ exportContext.speciesModel.prepareIndividualRowsRows(
+ exportContext,
+ rows);
exportContext.individualObservationExport.write(rows, exportContext.individualObservationWriter);
}
@@ -440,6 +464,9 @@
for (FishingOperation operation : operations) {
List<AccidentalCatchExportRow> rows = Lists.newArrayList();
exportContext.accidentalCatchModel.prepareRows(persistenceService, rows, cruise, operation);
+ exportContext.speciesModel.prepareAccidentalRows(
+ exportContext,
+ rows);
exportContext.accidentalCatchExport.write(rows, exportContext.accidentalCatchWriter);
}
@@ -479,6 +506,11 @@
rootBenthosBatch,
rootMarineLitterBatch);
+ exportContext.speciesModel.prepareBatchRows(
+ exportContext,
+ rootSpeciesBatch,
+ rootBenthosBatch);
+
List<CatchExportRow> rows = Lists.newArrayList();
exportContext.catchModel.prepareRows(persistenceService,
rows,
@@ -496,6 +528,19 @@
}
}
+ protected void exportSpecies(ExportContext exportContext,
+ List<SpeciesExportRow> rows) {
+
+ try {
+
+ exportContext.speciesExport.write(rows, exportContext.speciesWriter);
+
+ } catch (Exception e) {
+ throw new TuttiTechnicalException(
+ _("tutti.service.export.catches.error"), e);
+ }
+ }
+
protected boolean withCatch(FishingOperation operation) {
String operationId = operation.getId();
@@ -528,6 +573,8 @@
File accidentalCatchFile;
+ File speciesFile;
+
BufferedWriter surveyWriter;
BufferedWriter operationWriter;
@@ -542,6 +589,8 @@
BufferedWriter individualObservationWriter;
+ BufferedWriter speciesWriter;
+
SurveyExportModel surveyModel;
OperationExportModel operationModel;
@@ -556,6 +605,10 @@
IndividualObservationExportModel individualObservationModel;
+ SpeciesExportModel speciesModel;
+
+ final Set<SpeciesExportRow> speciesToExport = Sets.newHashSet();
+
TuttiCsvUtil.TuttiRepeatableExport<SurveyExportRow> surveyExport;
TuttiCsvUtil.TuttiRepeatableExport<OperationExportRow> operationExport;
@@ -570,6 +623,10 @@
TuttiCsvUtil.TuttiRepeatableExport<IndividualObservationExportRow> individualObservationExport;
+ TuttiCsvUtil.TuttiRepeatableExport<SpeciesExportRow> speciesExport;
+
+ Map<String, Species> speciesById;
+
ExportContext(File basedir,
char csvSeparator,
DecoratorService decoratorService,
@@ -583,8 +640,10 @@
Caracteristic genderCaracteristic,
Caracteristic pmfmIdCaracteristic,
List<SampleCategoryEnum> samplingOrder,
- Map<SampleCategoryEnum, Caracteristic> samplingToCaracteristic) {
+ Map<SampleCategoryEnum, Caracteristic> samplingToCaracteristic,
+ Map<String, Species> speciesById) {
+ this.speciesById = speciesById;
try {
surveyFile = new File(basedir, "survey.csv");
@@ -608,6 +667,9 @@
individualObservationFile = new File(basedir, "individualObservation.csv");
individualObservationWriter = Files.newWriter(individualObservationFile, Charsets.UTF_8);
+ speciesFile = new File(basedir, "species.csv");
+ speciesWriter = Files.newWriter(speciesFile, Charsets.UTF_8);
+
} catch (FileNotFoundException e) {
// should never happen
@@ -643,6 +705,9 @@
weightMeasuredCaracteristic,
pmfmIdCaracteristic);
+ speciesModel = new SpeciesExportModel(
+ csvSeparator);
+
surveyExport = TuttiCsvUtil.newRepeatableExport(
surveyModel);
@@ -658,8 +723,16 @@
catchExport = TuttiCsvUtil.newRepeatableExport(catchModel);
accidentalCatchExport = TuttiCsvUtil.newRepeatableExport(accidentalCatchModel);
individualObservationExport = TuttiCsvUtil.newRepeatableExport(individualObservationModel);
+ speciesExport = TuttiCsvUtil.newRepeatableExport(speciesModel);
}
+ protected void addSpecies(Species species) {
+ Species fullSpecies = speciesById.get(species.getId());
+ SpeciesExportRow row = new SpeciesExportRow();
+ row.setSpecies(fullSpecies);
+ speciesToExport.add(row);
+ }
+
@Override
public void close() throws IOException {
IOUtils.closeQuietly(surveyWriter);
@@ -669,7 +742,21 @@
IOUtils.closeQuietly(accidentalCatchWriter);
IOUtils.closeQuietly(marineLitterWriter);
IOUtils.closeQuietly(individualObservationWriter);
+ IOUtils.closeQuietly(speciesWriter);
}
+
+ public List<SpeciesExportRow> getSpeciesToExport() {
+ List<SpeciesExportRow> result =
+ Lists.newArrayList(speciesToExport);
+
+ Collections.sort(result, new Comparator<SpeciesExportRow>() {
+ @Override
+ public int compare(SpeciesExportRow o1, SpeciesExportRow o2) {
+ return o1.getSpecies().getReferenceTaxonId().compareTo(o2.getSpecies().getReferenceTaxonId());
+ }
+ });
+ return result;
+ }
}
}
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-21 10:06:05 UTC (rev 967)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-05-21 11:59:13 UTC (rev 968)
@@ -69,6 +69,7 @@
tutti.service.exportCruise.checkCruise=Vérification de la campagne %s
tutti.service.exportCruise.exportAccidentalCatches=Export du fichier <strong>accidentalCatch.csv</strong> pour la campagne %s
tutti.service.exportCruise.exportCatches=Export du fichier <strong>catch.csv</strong> pour la campagne %s
+tutti.service.exportCruise.exportSpecies=Export du fichier <strong>species.csv</strong> pour la campagne %s
tutti.service.exportCruise.exportIndividualObservations=Export du fichier <strong>individualObservation.csv</strong> pour la campagne %s
tutti.service.exportCruise.exportMarineLitters=Export du fichier <strong>marineLitter.csv</strong> pour la campagne %s
tutti.service.exportCruise.exportOperations=Export du fichier <strong>operations.csv</strong> pour la campagne %s
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/TuttiExportServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/TuttiExportServiceTest.java 2013-05-21 10:06:05 UTC (rev 967)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/TuttiExportServiceTest.java 2013-05-21 11:59:13 UTC (rev 968)
@@ -33,6 +33,7 @@
import fr.ifremer.tutti.persistence.entities.data.IndividualObservationBatch;
import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.ServiceDbResource;
@@ -48,6 +49,7 @@
import java.io.File;
import java.io.IOException;
import java.util.List;
+import java.util.Map;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -103,9 +105,9 @@
"2013;Campagne CGFS;;GOV 19.7/25.9;1;A;1;GWEN DREZ;11242;Hors Vrac;1;20.0;;Poids;;NA;;;;;;NA;;;;;;NA;;;;;;NA;;;;;;;;;;;;;";
public static final String MARINE_LITTER_CONTENT =
- "Annee;Serie;Serie_Partielle;Engin;Poche;Id_Operation;NumOrdre_Station;Navire;MarineLitterCategory;MarineLitterSizeCategory;Number;Weight;Comment\n" +
- "2013;Campagne CGFS;;GOV 19.7/25.9;1;A;1;GWEN DREZ;L1 PLASTIQUE;A: <5*5 cm= 25 cm2;2;5.0;S1;\n" +
- "2013;Campagne CGFS;;GOV 19.7/25.9;1;A;1;GWEN DREZ;L1a Sacs;B: <10*10 cm= 100 cm2;3;1.0;S2;";
+ "Annee;Serie;Serie_Partielle;Engin;Poche;Id_Operation;NumOrdre_Station;Navire;MarineLitterCategory;MarineLitterSizeCategory;Number;Weight;Comment;TotalWeight\n" +
+ "2013;Campagne CGFS;;GOV 19.7/25.9;1;A;1;GWEN DREZ;L1 PLASTIQUE;A: <5*5 cm= 25 cm2;2;5.0;S1;;\n" +
+ "2013;Campagne CGFS;;GOV 19.7/25.9;1;A;1;GWEN DREZ;L1a Sacs;B: <10*10 cm= 100 cm2;3;1.0;S2;;";
public static final String INDIVIDUAL_OBSERVATION_CONTENT =
"Annee;Serie;Serie_Partielle;Engin;Poche;Id_Operation;NumOrdre_Station;Navire;BatchId;ReferenceTaxonId;ReferenceTaxonName;Comment;CaracteristicId;CaracteristicValue\n" +
@@ -126,6 +128,12 @@
"2013;Campagne CGFS;;GOV 19.7/25.9;1;A;1;GWEN DREZ;100001;3835;Abalistes;;1433;1425;\n" +
"2013;Campagne CGFS;;GOV 19.7/25.9;1;A;1;GWEN DREZ;100001;3835;Abalistes;;1425;4.0;";
+ public static final String SPECIES_CONTENT =
+ "Id;Code_Rubin;Nom Scientifique;Code campagne\n" +
+ "3835;ABAL;Abalistes;;\n" +
+ "11242;AAPT;Aaptos;;\n" +
+ "11243;AAPTAAP;Aaptos aaptos;;";
+
protected TuttiExportService service;
protected PersistenceService persistenceService;
@@ -187,7 +195,7 @@
operations = loadedOperations;
progressionModel = new ProgressionModel();
- progressionModel.setTotal(7);
+ progressionModel.setTotal(8);
}
@Test
@@ -199,7 +207,7 @@
Assert.assertFalse(exportFile.exists());
- service.exportProgram(program.getId(), exportFile, progressionModel);
+ service.exportProgram(program.getId(), null, exportFile, progressionModel);
Assert.assertTrue(exportFile.exists());
}
@@ -212,7 +220,7 @@
Assert.assertFalse(exportFile.exists());
- service.exportCruise(cruise.getId(), exportFile, progressionModel);
+ service.exportCruise(cruise.getId(), null, exportFile, progressionModel);
Assert.assertTrue(exportFile.exists());
}
@@ -220,7 +228,7 @@
public void exportSurvey() throws Exception {
TuttiExportService.ExportContext exportContext =
- service.createExportContext(dataDirectory);
+ service.createExportContext(dataDirectory, null);
try {
service.exportSurvey(exportContext, cruise);
@@ -236,7 +244,7 @@
public void exportOperations() throws Exception {
TuttiExportService.ExportContext exportContext =
- service.createExportContext(dataDirectory);
+ service.createExportContext(dataDirectory, null);
try {
service.exportOperations(exportContext, cruise, operations);
@@ -252,7 +260,7 @@
public void exportParameters() throws Exception {
TuttiExportService.ExportContext exportContext =
- service.createExportContext(dataDirectory);
+ service.createExportContext(dataDirectory, null);
try {
service.exportParameters(exportContext, cruise, operations);
@@ -268,7 +276,7 @@
public void exportCatches() throws Exception {
TuttiExportService.ExportContext exportContext =
- service.createExportContext(dataDirectory);
+ service.createExportContext(dataDirectory, null);
try {
service.exportCatches(exportContext, cruise, operations);
@@ -284,7 +292,7 @@
public void exportMarineLitters() throws Exception {
TuttiExportService.ExportContext exportContext =
- service.createExportContext(dataDirectory);
+ service.createExportContext(dataDirectory, null);
try {
service.exportMarineLitters(exportContext, cruise, operations);
@@ -300,7 +308,7 @@
public void exportIndividualObservations() throws Exception {
TuttiExportService.ExportContext exportContext =
- service.createExportContext(dataDirectory);
+ service.createExportContext(dataDirectory, null);
try {
service.exportIndividualObservations(exportContext, cruise, operations);
@@ -316,7 +324,7 @@
public void exportAccidentalCatch() throws Exception {
TuttiExportService.ExportContext exportContext =
- service.createExportContext(dataDirectory);
+ service.createExportContext(dataDirectory, null);
try {
service.exportAccidentalCatch(exportContext, cruise, operations);
@@ -328,6 +336,33 @@
ACCIDENTAL_CATCH_CONTENT);
}
+
+ @Test
+ public void exportSpecies() throws Exception {
+
+ TuttiExportService.ExportContext exportContext =
+ service.createExportContext(dataDirectory, null);
+
+ try {
+ List<Species> allReferentSpecies =
+ persistenceService.getAllReferentSpecies();
+
+ Map<String, Species> allReferentSpeciesById =
+ TuttiEntities.splitById(allReferentSpecies);
+ exportContext.addSpecies(allReferentSpeciesById.get("35883"));
+ exportContext.addSpecies(allReferentSpeciesById.get("35884"));
+ exportContext.addSpecies(allReferentSpeciesById.get("19279"));
+
+ service.exportSpecies(exportContext,
+ exportContext.getSpeciesToExport());
+ } finally {
+ exportContext.close();
+ }
+ assertFileContent("species export:\n",
+ exportContext.speciesFile,
+ SPECIES_CONTENT);
+ }
+
protected void assertFileContent(String message,
File actualFile,
String expectedContent) throws IOException {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java 2013-05-21 10:06:05 UTC (rev 967)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java 2013-05-21 11:59:13 UTC (rev 968)
@@ -28,6 +28,7 @@
import fr.ifremer.tutti.TuttiIOUtil;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.service.export.TuttiExportService;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
@@ -102,11 +103,16 @@
ProgressionModel progressionModel = new ProgressionModel();
setProgressionModel(progressionModel);
- // (check cruise / export cruise / operation / parameter / accidental catches / catches / individual observation) / zip
- progressionModel.setTotal(8);
+ // (check cruise / export cruise / operation / parameter / accidental catches / catches / individual observation / species) / zip
+ progressionModel.setTotal(9);
+ TuttiProtocol protocol = null;
+ if (getContext().isProtocolFilled()) {
+ protocol = getDataContext().getProtocol();
+ }
+
TuttiExportService service = getContext().getTuttiExportService();
- service.exportCruise(cruise.getId(), file, progressionModel);
+ service.exportCruise(cruise.getId(), protocol, file, progressionModel);
getHandler().resetEditCruiseAction();
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java 2013-05-21 10:06:05 UTC (rev 967)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java 2013-05-21 11:59:13 UTC (rev 968)
@@ -29,6 +29,7 @@
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.service.export.TuttiExportService;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
@@ -101,16 +102,20 @@
" to file: " + file);
}
- // nbCruise * (check cruise / export cruise / operation / parameter / catches / individual observation / accidental catches) + zip
+ // nbCruise * (check cruise / export cruise / operation / parameter / catches / individual observation / accidental catches / species) + zip
List<Cruise> allCruise =
getContext().getPersistenceService().getAllCruise(program.getId());
ProgressionModel progressionModel = new ProgressionModel();
setProgressionModel(progressionModel);
- progressionModel.setTotal(7 * allCruise.size() + 1);
+ progressionModel.setTotal(8 * allCruise.size() + 1);
+ TuttiProtocol protocol = null;
+ if (getContext().isProtocolFilled()) {
+ protocol = getDataContext().getProtocol();
+ }
TuttiExportService service = getContext().getTuttiExportService();
- service.exportProgram(program.getId(), file, progressionModel);
+ service.exportProgram(program.getId(), protocol, file, progressionModel);
getHandler().resetEditProgramAction();
}
1
0
r967 - in trunk: tutti-service/src/main/java/fr/ifremer/tutti/service/catches tutti-service/src/main/java/fr/ifremer/tutti/service/sumatra tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches
by kmorin@users.forge.codelutin.com 21 May '13
by kmorin@users.forge.codelutin.com 21 May '13
21 May '13
Author: kmorin
Date: 2013-05-21 12:06:05 +0200 (Tue, 21 May 2013)
New Revision: 967
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/967
Log:
fixes #2420 [EXPORT SUMATRA] intitul?\195?\169 ?\195?\160 revoir et erreur
Modified:
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ExportCatchesReportService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/sumatra/TuttiCatchesSumatraExportService.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/ExportCatchesReportService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ExportCatchesReportService.java 2013-05-21 10:01:49 UTC (rev 966)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ExportCatchesReportService.java 2013-05-21 10:06:05 UTC (rev 967)
@@ -136,11 +136,11 @@
}
CatchBatch catchBatch = persistenceService.getCatchBatchFromFishingOperation(fishingOperationId);
- BatchContainer<SpeciesBatch> rootSpeciesBatch;
- rootSpeciesBatch = tuttiWeightComputingService.getComputedSpeciesBatches(fishingOperation);
+ BatchContainer<SpeciesBatch> rootSpeciesBatch =
+ tuttiWeightComputingService.getComputedSpeciesBatches(fishingOperation);
- BatchContainer<BenthosBatch> rootBenthosBatch;
- rootBenthosBatch = tuttiWeightComputingService.getComputedBenthosBatches(fishingOperation);
+ BatchContainer<BenthosBatch> rootBenthosBatch =
+ tuttiWeightComputingService.getComputedBenthosBatches(fishingOperation);
tuttiWeightComputingService.computeCatchBatchWeights(catchBatch, rootSpeciesBatch, rootBenthosBatch, null);
@@ -162,17 +162,21 @@
Float ratio = totalWeight / totalSortedWeight;
// create catches rows
- List<SpeciesBatch> speciesBatches = rootSpeciesBatch.getChildren();
- for (SpeciesBatch batch : speciesBatches) {
- createSpeciesCatch(batch, catches, ratio, totalWeight);
+ if (rootSpeciesBatch != null) {
+ List<SpeciesBatch> speciesBatches = rootSpeciesBatch.getChildren();
+ for (SpeciesBatch batch : speciesBatches) {
+ createSpeciesCatch(batch, catches, ratio, totalWeight);
+ }
}
List<Map<String, Object>> catchList = Lists.newArrayList(catches.values());
// add the benthos row
- if (CollectionUtils.isNotEmpty(rootBenthosBatch.getChildren())) {
- Map<String, Object> benthosCatch =
- createBenthosCatch(rootBenthosBatch, catchBatch.getBenthosTotalComputedWeight(), totalWeight);
- catchList.add(benthosCatch);
+ if (rootBenthosBatch != null) {
+ if (CollectionUtils.isNotEmpty(rootBenthosBatch.getChildren())) {
+ Map<String, Object> benthosCatch =
+ createBenthosCatch(rootBenthosBatch, catchBatch.getBenthosTotalComputedWeight(), totalWeight);
+ catchList.add(benthosCatch);
+ }
}
op.put("catches", catchList);
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-21 10:01:49 UTC (rev 966)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java 2013-05-21 10:06:05 UTC (rev 967)
@@ -336,15 +336,18 @@
public BatchContainer<SpeciesBatch> getComputedSpeciesBatches(FishingOperation operation) {
- BatchContainer<SpeciesBatch> rootSpeciesBatch =
- persistenceService.getRootSpeciesBatch(operation.getId());
+ BatchContainer<SpeciesBatch> rootSpeciesBatch = null;
- currentSpeciesRowIndex = 0;
- if (rootSpeciesBatch != null) {
- List<SpeciesBatch> roots = rootSpeciesBatch.getChildren();
+ if (persistenceService.isFishingOperationWithCatchBatch(operation.getId())) {
+ rootSpeciesBatch = persistenceService.getRootSpeciesBatch(operation.getId());
- for (SpeciesBatch batch : roots) {
- computeSpeciesBatch(batch);
+ currentSpeciesRowIndex = 0;
+ if (rootSpeciesBatch != null) {
+ List<SpeciesBatch> roots = rootSpeciesBatch.getChildren();
+
+ for (SpeciesBatch batch : roots) {
+ computeSpeciesBatch(batch);
+ }
}
}
@@ -469,15 +472,18 @@
public BatchContainer<BenthosBatch> getComputedBenthosBatches(FishingOperation operation) {
- BatchContainer<BenthosBatch> rootBenthosBatch =
- persistenceService.getRootBenthosBatch(operation.getId());
+ BatchContainer<BenthosBatch> rootBenthosBatch = null;
- currentBenthosRowIndex = 0;
- if (rootBenthosBatch != null) {
- List<BenthosBatch> roots = rootBenthosBatch.getChildren();
+ if (persistenceService.isFishingOperationWithCatchBatch(operation.getId())) {
+ rootBenthosBatch = persistenceService.getRootBenthosBatch(operation.getId());
- for (BenthosBatch batch : roots) {
- computeBenthosBatch(batch);
+ currentBenthosRowIndex = 0;
+ if (rootBenthosBatch != null) {
+ List<BenthosBatch> roots = rootBenthosBatch.getChildren();
+
+ for (BenthosBatch batch : roots) {
+ computeBenthosBatch(batch);
+ }
}
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/sumatra/TuttiCatchesSumatraExportService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/sumatra/TuttiCatchesSumatraExportService.java 2013-05-21 10:01:49 UTC (rev 966)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/sumatra/TuttiCatchesSumatraExportService.java 2013-05-21 10:06:05 UTC (rev 967)
@@ -96,39 +96,41 @@
tuttiWeightComputingService.getComputedSpeciesBatches(operation);
Map<Species, CatchRow> rowMap = Maps.newHashMap();
- List<SpeciesBatch> speciesBatches = speciesBatchContainer.getChildren();
- for (SpeciesBatch batch : speciesBatches) {
- Species sp = batch.getSpecies();
+ if (speciesBatchContainer != null) {
+ List<SpeciesBatch> speciesBatches = speciesBatchContainer.getChildren();
+ for (SpeciesBatch batch : speciesBatches) {
+ Species sp = batch.getSpecies();
- Float weight = batch.getSampleCategoryWeight();
- if (weight == null) {
- weight = batch.getSampleCategoryComputedWeight();
- }
+ Float weight = batch.getSampleCategoryWeight();
+ if (weight == null) {
+ weight = batch.getSampleCategoryComputedWeight();
+ }
- Integer nb = batch.getNumber();
- if (nb == null) {
- nb = batch.getComputedNumber();
- }
- if (nb == null) {
- nb = 0;
- }
+ Integer nb = batch.getNumber();
+ if (nb == null) {
+ nb = batch.getComputedNumber();
+ }
+ if (nb == null) {
+ nb = 0;
+ }
- CatchRow row = rowMap.get(sp);
- if (row == null) {
- row = new CatchRow();
- row.setFishingOperation(operation);
- row.setSpecies(sp);
- row.setWeight(weight);
- row.setNumber(nb);
+ CatchRow row = rowMap.get(sp);
+ if (row == null) {
+ row = new CatchRow();
+ row.setFishingOperation(operation);
+ row.setSpecies(sp);
+ row.setWeight(weight);
+ row.setNumber(nb);
- } else {
- row.setWeight(row.getWeight() + weight);
- row.setNumber(row.getNumber() + nb);
+ } else {
+ row.setWeight(row.getWeight() + weight);
+ row.setNumber(row.getNumber() + nb);
+ }
+ rowMap.put(sp, row);
}
- rowMap.put(sp, row);
+ rows.addAll(rowMap.values());
}
- rows.addAll(rowMap.values());
// add benthos rows
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-05-21 10:01:49 UTC (rev 966)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeWeightsAction.java 2013-05-21 10:06:05 UTC (rev 967)
@@ -179,25 +179,22 @@
protected Float computeSpeciesBatches(BatchContainer<SpeciesBatch> computedSpeciesBatches) {
Float totalSortedWeight = 0f;
- List<SpeciesBatchRowModel> rows = Lists.newArrayList();
- List<SpeciesBatch> children = computedSpeciesBatches.getChildren();
- int rowIndex = 0;
- for (SpeciesBatch batch : children) {
- SpeciesBatchRowModel row = getUI().getSpeciesTabContent().getHandler().loadBatch(batch, null, rows);
- Float weight = row.getSortedUnsortedCategoryWeight();
- if (weight == null) {
- weight = row.getSortedUnsortedCategoryComputedWeight();
+ if (computedSpeciesBatches != null) {
+ List<SpeciesBatchRowModel> rows = Lists.newArrayList();
+ List<SpeciesBatch> children = computedSpeciesBatches.getChildren();
+ for (SpeciesBatch batch : children) {
+ SpeciesBatchRowModel row = getUI().getSpeciesTabContent().getHandler().loadBatch(batch, null, rows);
+ Float weight = row.getSortedUnsortedCategoryWeight();
+ if (weight == null) {
+ weight = row.getSortedUnsortedCategoryComputedWeight();
+ }
+ if (SortedUnsortedEnum.SORTED.matchValue(
+ row.getSortedUnsortedCategoryValue())) {
+ totalSortedWeight += weight;
+ }
}
- if (SortedUnsortedEnum.SORTED.matchValue(
- row.getSortedUnsortedCategoryValue())) {
- totalSortedWeight += weight;
- }
- rowIndex++;
- if (row.getChildBatch() != null) {
- rowIndex += row.getChildBatch().size();
- }
+ getUI().getSpeciesTabContent().getModel().setRows(rows);
}
- getUI().getSpeciesTabContent().getModel().setRows(rows);
return totalSortedWeight;
}
@@ -205,27 +202,24 @@
protected Float computeBenthosBatches(BatchContainer<BenthosBatch> computedBenthosBatches) {
Float totalSortedWeight = 0f;
- List<BenthosBatchRowModel> rows = Lists.newArrayList();
- List<BenthosBatch> children = computedBenthosBatches.getChildren();
- int rowIndex = 0;
- for (BenthosBatch batch : children) {
- BenthosBatchRowModel row = getUI().getBenthosTabContent().getHandler().loadBatch(batch, null, rows);
- Float weight = row.getSortedUnsortedCategoryWeight();
- if (weight == null) {
- weight = row.getSortedUnsortedCategoryComputedWeight();
+ if (computedBenthosBatches != null) {
+ List<BenthosBatchRowModel> rows = Lists.newArrayList();
+ List<BenthosBatch> children = computedBenthosBatches.getChildren();
+ for (BenthosBatch batch : children) {
+ BenthosBatchRowModel row = getUI().getBenthosTabContent().getHandler().loadBatch(batch, null, rows);
+ Float weight = row.getSortedUnsortedCategoryWeight();
+ if (weight == null) {
+ weight = row.getSortedUnsortedCategoryComputedWeight();
+ }
+ if (SortedUnsortedEnum.SORTED.matchValue(
+ row.getSortedUnsortedCategoryValue())) {
+ totalSortedWeight += weight;
+ }
}
- if (SortedUnsortedEnum.SORTED.matchValue(
- row.getSortedUnsortedCategoryValue())) {
- totalSortedWeight += weight;
- }
- rowIndex++;
- if (row.getChildBatch() != null) {
- rowIndex += row.getChildBatch().size();
- }
- }
- getUI().getBenthosTabContent().getModel().setRows(rows);
+ getUI().getBenthosTabContent().getModel().setRows(rows);
+ }
return totalSortedWeight;
}
}
1
0
r966 - in trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service: . batch
by tchemit@users.forge.codelutin.com 21 May '13
by tchemit@users.forge.codelutin.com 21 May '13
21 May '13
Author: tchemit
Date: 2013-05-21 12:01:49 +0200 (Tue, 21 May 2013)
New Revision: 966
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/966
Log:
fixes #2469: [CAPTURE] Impossible de supprimer le poids total non tri?\195?\169
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java 2013-05-21 09:42:32 UTC (rev 965)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java 2013-05-21 10:01:49 UTC (rev 966)
@@ -321,44 +321,99 @@
quantificationMeasurements.removeAll(notChangedQuantificationMeasurements);
}
- boolean needVracSpeciesAliveNotItemized =
- source.getSpeciesTotalLivingNotItemizedWeight() != null;
- boolean needVracSpeciesInert =
- source.getSpeciesTotalInertWeight() != null;
- boolean needVracSpeciesAliveItemized = false;
+ SortingBatch vracBatch = batchHelper.getVracBatch(target);
- boolean needVracSpecies = source.getSpeciesTotalSortedWeight() != null ||
+ SortingBatch horsVracBatch = batchHelper.getHorsVracBatch(target);
+
+ SortingBatch horsVracSpeciesRootBatch = null;
+ SortingBatch horsVracBenthosRootBatch = null;
+ SortingBatch horsVracMarineLitterRootBatch = null;
+
+ if (horsVracBatch != null) {
+
+ horsVracSpeciesRootBatch = batchHelper.getSpeciesHorsVracRootBatch(
+ horsVracBatch);
+ horsVracBenthosRootBatch = batchHelper.getBenthosHorsVracRootBatch(
+ horsVracBatch);
+ horsVracMarineLitterRootBatch = batchHelper.getMarineLitterRootBatch(
+ horsVracBatch);
+ }
+
+ SortingBatch speciesVracBatch = null;
+ SortingBatch benthosVracBatch = null;
+
+ SortingBatch speciesVracAliveNotItemizeRootBatch = null;
+ SortingBatch speciesVracInertRootBatch = null;
+ SortingBatch speciesVracAliveItemizeRootBatch = null;
+ SortingBatch benthosVracAliveNotItemizeRootBatch = null;
+ SortingBatch benthosVracInertRootBatch = null;
+ SortingBatch benthosVracAliveItemizeRootBatch = null;
+
+ if (vracBatch != null) {
+ speciesVracBatch = batchHelper.getSpeciesVracRootBatch(
+ vracBatch);
+
+ if (speciesVracBatch != null) {
+ speciesVracAliveNotItemizeRootBatch = batchHelper.getSpeciesVracAliveNotItemizeRootBatch(
+ speciesVracBatch);
+ speciesVracInertRootBatch = batchHelper.getSpeciesVracInertRootBatch(
+ speciesVracBatch);
+ speciesVracAliveItemizeRootBatch = batchHelper.getSpeciesVracAliveItemizeRootBatch(
+ speciesVracBatch);
+ }
+
+ benthosVracBatch = batchHelper.getBenthosVracRootBatch(vracBatch);
+ if (benthosVracBatch != null) {
+ benthosVracAliveNotItemizeRootBatch = batchHelper.getBenthosVracAliveNotItemizeRootBatch(
+ benthosVracBatch);
+ benthosVracInertRootBatch = batchHelper.getBenthosVracInertRootBatch(
+ benthosVracBatch);
+ benthosVracAliveItemizeRootBatch = batchHelper.getBenthosVracAliveItemizeRootBatch(
+ benthosVracBatch);
+ }
+ }
+
+ boolean needVracSpeciesAliveNotItemized = speciesVracAliveNotItemizeRootBatch != null ||
+ source.getSpeciesTotalLivingNotItemizedWeight() != null;
+ boolean needVracSpeciesInert = speciesVracInertRootBatch != null ||
+ source.getSpeciesTotalInertWeight() != null;
+ boolean needVracSpeciesAliveItemized = speciesVracAliveItemizeRootBatch != null;
+
+ boolean needVracSpecies = speciesVracBatch != null ||
+ source.getSpeciesTotalSortedWeight() != null ||
needVracSpeciesAliveNotItemized ||
needVracSpeciesInert ||
needVracSpeciesAliveItemized;
- boolean needVracBenthosAliveNotItemized =
- source.getBenthosTotalLivingNotItemizedWeight() != null;
- boolean needVracBenthosInert =
- source.getBenthosTotalInertWeight() != null;
- boolean needVracBenthosAliveItemized = false;
+ boolean needVracBenthosAliveNotItemized = benthosVracAliveNotItemizeRootBatch != null ||
+ source.getBenthosTotalLivingNotItemizedWeight() != null;
+ boolean needVracBenthosInert = benthosVracInertRootBatch != null ||
+ source.getBenthosTotalInertWeight() != null;
+ boolean needVracBenthosAliveItemized = benthosVracAliveItemizeRootBatch != null;
- boolean needVracBenthos = source.getBenthosTotalSortedWeight() != null ||
+ boolean needVracBenthos = benthosVracBatch != null ||
+ source.getBenthosTotalSortedWeight() != null ||
needVracBenthosAliveNotItemized ||
needVracBenthosInert ||
needVracBenthosAliveItemized;
- boolean needVrac =
- source.getCatchTotalSortedCarousselWeight() != null ||
- source.getCatchTotalSortedTremisWeight() != null ||
- needVracSpecies ||
- needVracBenthos;
+ boolean needVrac = vracBatch != null ||
+ source.getCatchTotalSortedCarousselWeight() != null ||
+ source.getCatchTotalSortedTremisWeight() != null ||
+ needVracSpecies ||
+ needVracBenthos;
- boolean needHorsVracSpecies = false;
- boolean needHorsVracBenthos = false;
- boolean needHorsVracMarineLitter =
- source.getMarineLitterTotalWeight() != null;
+ boolean needHorsVracSpecies = horsVracSpeciesRootBatch != null;
+ boolean needHorsVracBenthos = horsVracBenthosRootBatch != null;
+ boolean needHorsVracMarineLitter = horsVracMarineLitterRootBatch != null ||
+ source.getMarineLitterTotalWeight() != null;
boolean needHorsVrac = needHorsVracSpecies ||
needHorsVracBenthos ||
needHorsVracMarineLitter;
- boolean needUnsorted = source.getCatchTotalRejectedWeight() != null;
+ boolean needUnsorted = batchHelper.getRejectedBatch(target) != null ||
+ source.getCatchTotalRejectedWeight() != null;
// ---------------------------------------------------------------------
// Vrac
@@ -366,7 +421,7 @@
if (needVrac) {
- SortingBatch vracBatch = batchHelper.getOrCreateVracBatch(
+ vracBatch = batchHelper.getOrCreateVracBatch(
target,
source.getCatchTotalSortedCarousselWeight(),
source.getCatchTotalSortedTremisWeight());
@@ -376,7 +431,7 @@
// ---------------------------------------------------------------------
// Vrac / Species
// ---------------------------------------------------------------------
- SortingBatch speciesBatch = batchHelper.getOrCreateSpeciesVracRootBatch(
+ speciesVracBatch = batchHelper.getOrCreateSpeciesVracRootBatch(
target,
vracBatch,
source.getSpeciesTotalSortedWeight());
@@ -387,7 +442,7 @@
// ---------------------------------------------------------------------
batchHelper.getOrCreateSpeciesVracAliveNotItemizeRootBatch(
target,
- speciesBatch,
+ speciesVracBatch,
source.getSpeciesTotalLivingNotItemizedWeight());
}
@@ -397,7 +452,7 @@
// ---------------------------------------------------------------------
batchHelper.getOrCreateSpeciesVracInertRootBatch(
target,
- speciesBatch,
+ speciesVracBatch,
source.getSpeciesTotalInertWeight());
}
@@ -407,7 +462,7 @@
// ---------------------------------------------------------------------
batchHelper.getOrCreateSpeciesVracAliveItemizeRootBatch(
target,
- speciesBatch);
+ speciesVracBatch);
}
}
@@ -416,7 +471,7 @@
// ---------------------------------------------------------------------
// Vrac > Benthos
// ---------------------------------------------------------------------
- SortingBatch benthosBatch = batchHelper.getOrCreateBenthosVracRootBatch(
+ benthosVracBatch = batchHelper.getOrCreateBenthosVracRootBatch(
target,
vracBatch,
source.getBenthosTotalSortedWeight());
@@ -427,7 +482,7 @@
// ---------------------------------------------------------------------
batchHelper.getOrCreateBenthosVracAliveNotItemizeRootBatch(
target,
- benthosBatch,
+ benthosVracBatch,
source.getBenthosTotalLivingNotItemizedWeight());
}
@@ -437,7 +492,7 @@
// ---------------------------------------------------------------------
batchHelper.getOrCreateBenthosVracInertRootBatch(
target,
- benthosBatch,
+ benthosVracBatch,
source.getBenthosTotalInertWeight());
}
@@ -447,7 +502,7 @@
// ---------------------------------------------------------------------
batchHelper.getOrCreateBenthosVracAliveItemizeRootBatch(
target,
- benthosBatch);
+ benthosVracBatch);
}
}
@@ -458,8 +513,7 @@
// ---------------------------------------------------------------------
// Hors Vrac
// ---------------------------------------------------------------------
- SortingBatch horsVracBatch =
- batchHelper.getOrCreateHorsVracBatch(target);
+ horsVracBatch = batchHelper.getOrCreateHorsVracBatch(target);
if (needHorsVracSpecies) {
// ---------------------------------------------------------------------
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java 2013-05-21 09:42:32 UTC (rev 965)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java 2013-05-21 10:01:49 UTC (rev 966)
@@ -511,6 +511,14 @@
return result;
}
+ public SortingBatch getVracBatch(CatchBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_VRAC_ID
+ );
+ }
+
public SortingBatch getOrCreateVracBatch(CatchBatch batch,
Float weight,
Float weightBeforeSampling) {
@@ -525,6 +533,14 @@
);
}
+ public SortingBatch getSpeciesVracRootBatch(SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES
+ );
+ }
+
public SortingBatch getOrCreateSpeciesVracRootBatch(CatchBatch target,
SortingBatch batch,
Float totalWeight) {
@@ -538,6 +554,14 @@
);
}
+ public SortingBatch getSpeciesVracAliveNotItemizeRootBatch(SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED
+ );
+ }
+
public SortingBatch getOrCreateSpeciesVracAliveNotItemizeRootBatch(CatchBatch target,
SortingBatch batch,
Float totalWeight) {
@@ -551,6 +575,14 @@
);
}
+ public SortingBatch getSpeciesVracInertRootBatch(SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT
+ );
+ }
+
public SortingBatch getOrCreateSpeciesVracInertRootBatch(CatchBatch target,
SortingBatch batch,
Float totalWeight) {
@@ -564,6 +596,15 @@
);
}
+ public SortingBatch getSpeciesVracAliveItemizeRootBatch(
+ SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+ );
+ }
+
public SortingBatch getOrCreateSpeciesVracAliveItemizeRootBatch(CatchBatch target,
SortingBatch batch) {
return getOrCreate(
@@ -576,6 +617,15 @@
);
}
+ public SortingBatch getBenthosVracRootBatch(
+ SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
+ );
+ }
+
public SortingBatch getOrCreateBenthosVracRootBatch(CatchBatch target,
SortingBatch batch,
Float totalWeight) {
@@ -589,6 +639,15 @@
);
}
+ public SortingBatch getBenthosVracAliveNotItemizeRootBatch(
+ SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED
+ );
+ }
+
public SortingBatch getOrCreateBenthosVracAliveNotItemizeRootBatch(CatchBatch target,
SortingBatch batch,
Float totalWeight) {
@@ -602,6 +661,14 @@
);
}
+ public SortingBatch getBenthosVracInertRootBatch(SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT
+ );
+ }
+
public SortingBatch getOrCreateBenthosVracInertRootBatch(fr.ifremer.adagio.core.dao.data.batch.CatchBatch target,
SortingBatch batch,
Float totalWeight) {
@@ -615,6 +682,14 @@
);
}
+ public SortingBatch getBenthosVracAliveItemizeRootBatch(SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+ );
+ }
+
public SortingBatch getOrCreateBenthosVracAliveItemizeRootBatch(CatchBatch target,
SortingBatch batch) {
return getOrCreate(
@@ -627,6 +702,14 @@
);
}
+ public SortingBatch getHorsVracBatch(CatchBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_HORS_VRAC_ID
+ );
+ }
+
public SortingBatch getOrCreateHorsVracBatch(CatchBatch batch) {
return getOrCreate(
batch,
@@ -638,6 +721,14 @@
);
}
+ public SortingBatch getSpeciesHorsVracRootBatch(SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES
+ );
+ }
+
public SortingBatch getOrCreateSpeciesHorsVracRootBatch(CatchBatch target,
SortingBatch batch) {
return getOrCreate(
@@ -650,6 +741,14 @@
);
}
+ public SortingBatch getBenthosHorsVracRootBatch(SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
+ );
+ }
+
public SortingBatch getOrCreateBenthosHorsVracRootBatch(CatchBatch target,
SortingBatch batch) {
return getOrCreate(
@@ -662,6 +761,14 @@
);
}
+ public SortingBatch getMarineLitterRootBatch(SortingBatch batch) {
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER
+ );
+ }
+
public SortingBatch getOrCreateMarineLitterRootBatch(CatchBatch target,
SortingBatch batch,
Float totalWeight) {
@@ -675,6 +782,15 @@
);
}
+ public SortingBatch getRejectedBatch(CatchBatch batch) {
+
+ return get(
+ batch,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_UNSORTED_ID
+ );
+ }
+
public SortingBatch getOrCreateRejectedBatch(CatchBatch batch,
Float weight) {
@@ -807,11 +923,11 @@
Float weight,
Float weightBeforeSampling,
short rankOrder) {
- SortingBatch result = getSortingBatch(
+ SortingBatch result = get(
parentBatch,
- null,
sortingPmfmId,
sortingQualitativeValueId);
+
if (result == null) {
result = SortingBatch.Factory.newInstance();
@@ -892,4 +1008,15 @@
return result;
}
+
+ protected SortingBatch get(Batch parentBatch,
+ Integer sortingPmfmId,
+ Integer sortingQualitativeValueId) {
+ SortingBatch result = getSortingBatch(
+ parentBatch,
+ null,
+ sortingPmfmId,
+ sortingQualitativeValueId);
+ return result;
+ }
}
1
0