Commit 5eefb382 authored by PECQUOT's avatar PECQUOT
Browse files

[fix] Change reefdb.transcribingItemType.label.pmfmExtraction default value to...


[fix] Change reefdb.transcribingItemType.label.pmfmExtraction default value to REEFDB-PMFM-EXTRACTION.PMFM_NM (Mantis #51015)
[enh] Photo import can select multiple files (Mantis #50115)
[fix] Extraction: fix createCommonTable query (Mantis #50996)
[fix] Observation save: Postpone model modify state (Mantis #50915)
Signed-off-by: PECQUOT's avatarlp1ee9d <ludovic.pecquot@e-is.pro>
parent 76a01906
## Sprint 86 - v3.9.3
- Pas de mise à jour de modèle
## Sprint 83 - v3.9.2 ## Sprint 83 - v3.9.2
- Pas de mise à jour de modèle - Pas de mise à jour de modèle
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<groupId>fr.ifremer.reefdb</groupId> <groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId> <artifactId>reefdb</artifactId>
<version>3.9.2</version> <version>3.9.3-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Reef DB</name> <name>Reef DB</name>
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
<maven.compiler.debug>true</maven.compiler.debug> <maven.compiler.debug>true</maven.compiler.debug>
<!-- Quadrige3 Core version --> <!-- Quadrige3 Core version -->
<quadrige3-core.version>3.6.6</quadrige3-core.version> <quadrige3-core.version>3.6.8</quadrige3-core.version>
<!-- Last ReefDb launcher version --> <!-- Last ReefDb launcher version -->
<launcherVersion>3.0.3</launcherVersion> <launcherVersion>3.0.3</launcherVersion>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>fr.ifremer.reefdb</groupId> <groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId> <artifactId>reefdb</artifactId>
<version>3.9.2</version> <version>3.9.3-SNAPSHOT</version>
</parent> </parent>
<artifactId>reefdb-core</artifactId> <artifactId>reefdb-core</artifactId>
......
...@@ -43,7 +43,7 @@ pmfmId.PIT_ORIGIN=2326 ...@@ -43,7 +43,7 @@ pmfmId.PIT_ORIGIN=2326
UnitId.NO_UNIT=99 UnitId.NO_UNIT=99
TranscribingItemTypeLb.REEFDB_PMFM_NM=REEFDB-PMFM.PMFM_NM TranscribingItemTypeLb.REEFDB_PMFM_NM=REEFDB-PMFM.PMFM_NM
TranscribingItemTypeLb.REEFDB_PMFM_EXTRACTION=REEFDB-PMFM.PMFM_EXTRACTION TranscribingItemTypeLb.REEFDB_PMFM_EXTRACTION=REEFDB-PMFM-EXTRACTION.PMFM_NM
############################################ ############################################
# Alternative Taxon Code # # Alternative Taxon Code #
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<queries name="extractionCreateBaseTable"> <queries name="extractionCreateBaseTable">
<query type="create" temp="false" table="&amp;baseTableName"> <query type="create" temp="true" table="&amp;baseTableName">
<with alias="MLOI"> <with alias="MLOI">
<subquery> <subquery>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<queries name="extractionCreateCommonTable"> <queries name="extractionCreateCommonTable">
<query type="create" temp="false" table="&amp;commonTableName" option="DISTINCT"> <query type="create" temp="true" table="&amp;commonTableName" option="DISTINCT">
<select alias="SURVEY_ID" type="number">RAW.SURVEY_ID</select> <select alias="SURVEY_ID" type="number">RAW.SURVEY_ID</select>
<select alias="SAMPLING_OPER_ID" type="number">RAW.SAMPLING_OPER_ID</select> <select alias="SAMPLING_OPER_ID" type="number">RAW.SAMPLING_OPER_ID</select>
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<where><![CDATA[RAW.MEAS_INDIV_ID IS NOT NULL]]></where> <where><![CDATA[RAW.MEAS_INDIV_ID IS NOT NULL]]></where>
<union> <union>
<!-- add non individual measurements from sampling operations -->
<subquery option="DISTINCT"> <subquery option="DISTINCT">
<subselect alias="SURVEY_ID" type="number">RAW.SURVEY_ID</subselect> <subselect alias="SURVEY_ID" type="number">RAW.SURVEY_ID</subselect>
<subselect alias="SAMPLING_OPER_ID" type="number">RAW.SAMPLING_OPER_ID</subselect> <subselect alias="SAMPLING_OPER_ID" type="number">RAW.SAMPLING_OPER_ID</subselect>
...@@ -47,12 +48,37 @@ ...@@ -47,12 +48,37 @@
<subselect alias="TAXON_GROUP_NM" type="text">RAW.TAXON_GROUP_NM</subselect> <subselect alias="TAXON_GROUP_NM" type="text">RAW.TAXON_GROUP_NM</subselect>
<from alias="RAW"><![CDATA[&rawTableName]]></from> <from alias="RAW"><![CDATA[&rawTableName]]></from>
<where><![CDATA[RAW.MEAS_INDIV_ID IS NULL]]></where> <where><![CDATA[RAW.MEAS_INDIV_ID IS NULL]]></where>
<where operator="AND"><![CDATA[RAW.SAMPLING_OPER_ID IS NOT NULL]]></where>
<where operator="AND"><![CDATA[NOT EXISTS (SELECT RAW2.SURVEY_ID FROM &rawTableName RAW2 <where operator="AND"><![CDATA[NOT EXISTS (SELECT RAW2.SURVEY_ID FROM &rawTableName RAW2
WHERE RAW.SURVEY_ID = RAW2.SURVEY_ID WHERE RAW.SURVEY_ID = RAW2.SURVEY_ID
AND (RAW.SAMPLING_OPER_ID IS NULL OR RAW.SAMPLING_OPER_ID = RAW2.SAMPLING_OPER_ID) AND RAW.SAMPLING_OPER_ID = RAW2.SAMPLING_OPER_ID
AND RAW2.MEAS_INDIV_ID IS NOT NULL)]]></where> AND RAW2.MEAS_INDIV_ID IS NOT NULL
)]]></where>
</subquery> </subquery>
</union> </union>
<union>
<!-- add non individual measurements from surveys -->
<subquery option="DISTINCT">
<subselect alias="SURVEY_ID" type="number">RAW.SURVEY_ID</subselect>
<subselect alias="SAMPLING_OPER_ID" type="number">RAW.SAMPLING_OPER_ID</subselect>
<subselect alias="MEAS_INDIV_ID" type="number">RAW.MEAS_INDIV_ID</subselect>
<subselect alias="REF_TAXON_NM" type="text">RAW.REF_TAXON_NM</subselect>
<subselect alias="TAXON_NAME_ID" type="number" group="simple,complete,sinp">RAW.TAXON_NAME_ID</subselect>
<subselect alias="TAXON_NAME_NM" type="text" group="simple,complete,sinp">RAW.TAXON_NAME_NM</subselect>
<subselect alias="TAXON_PAMPA" type="text" group="pampa">RAW.TAXON_PAMPA</subselect>
<subselect alias="TAXON_GROUP_NM" type="text">RAW.TAXON_GROUP_NM</subselect>
<from alias="RAW"><![CDATA[&rawTableName]]></from>
<where><![CDATA[RAW.MEAS_INDIV_ID IS NULL]]></where>
<where operator="AND"><![CDATA[RAW.SAMPLING_OPER_ID IS NULL]]></where>
<where operator="AND"><![CDATA[NOT EXISTS (SELECT RAW2.SURVEY_ID FROM &rawTableName RAW2
WHERE RAW.SURVEY_ID = RAW2.SURVEY_ID
AND ( (RAW2.SAMPLING_OPER_ID IS NULL AND RAW2.MEAS_INDIV_ID IS NOT NULL)
OR (RAW2.SAMPLING_OPER_ID IS NOT NULL AND RAW2.MEAS_INDIV_ID IS NULL) )
)]]></where>
</subquery>
</union>
</query> </query>
</queries> </queries>
\ No newline at end of file
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<queries name="extractionCreatePmfmTable"> <queries name="extractionCreatePmfmTable">
<query type="create" temp="false" table="&amp;pmfmTableName" option="DISTINCT"> <query type="create" temp="true" table="&amp;pmfmTableName" option="DISTINCT">
<select alias="PARENT_ID" type="number"><![CDATA[&parentId]]></select> <select alias="PARENT_ID" type="number"><![CDATA[&parentId]]></select>
<select alias="IS_SURVEY_MEAS" type="number">IS_SURVEY_MEAS</select> <select alias="IS_SURVEY_MEAS" type="number">IS_SURVEY_MEAS</select>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<queries name="extractionCreateRawTable"> <queries name="extractionCreateRawTable">
<query type="create" temp="false" table="&amp;rawTableName"> <query type="create" temp="true" table="&amp;rawTableName">
<with alias="ALT" group="pampa"> <with alias="ALT" group="pampa">
<subquery> <subquery>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<queries name="extractionCreateResultTable"> <queries name="extractionCreateResultTable">
<query type="create" temp="false" table="&amp;resultTableName" option="DISTINCT"> <query type="create" temp="true" table="&amp;resultTableName" option="DISTINCT">
<select alias="SURVEY_PROG_CD" type="text">S.SURVEY_PROG_CD</select> <select alias="SURVEY_PROG_CD" type="text">S.SURVEY_PROG_CD</select>
<select alias="MON_LOC_NM" type="text">S.MON_LOC_NM</select> <select alias="MON_LOC_NM" type="text">S.MON_LOC_NM</select>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>fr.ifremer.reefdb</groupId> <groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId> <artifactId>reefdb</artifactId>
<version>3.9.2</version> <version>3.9.3-SNAPSHOT</version>
</parent> </parent>
<artifactId>reefdb-ui-swing</artifactId> <artifactId>reefdb-ui-swing</artifactId>
......
...@@ -23,7 +23,6 @@ package fr.ifremer.reefdb.ui.swing.content.home.operation; ...@@ -23,7 +23,6 @@ package fr.ifremer.reefdb.ui.swing.content.home.operation;
* #L% * #L%
*/ */
import fr.ifremer.quadrige3.core.dao.technical.AlphanumericComparator;
import fr.ifremer.quadrige3.core.dao.technical.StringIterator; import fr.ifremer.quadrige3.core.dao.technical.StringIterator;
import fr.ifremer.quadrige3.ui.swing.action.ActionFactory; import fr.ifremer.quadrige3.ui.swing.action.ActionFactory;
import fr.ifremer.quadrige3.ui.swing.component.coordinate.CoordinateEditor; import fr.ifremer.quadrige3.ui.swing.component.coordinate.CoordinateEditor;
...@@ -407,16 +406,6 @@ public class OperationsTableUIHandler extends AbstractReefDbTableUIHandler<Opera ...@@ -407,16 +406,6 @@ public class OperationsTableUIHandler extends AbstractReefDbTableUIHandler<Opera
addEditionPanelBorder(); addEditionPanelBorder();
} }
@Override
protected void installSortController() {
super.installSortController();
getSortController().setComparator(
getTable().getColumnModel().getColumnExt(OperationsTableModel.NAME).getModelIndex(),
new AlphanumericComparator()
);
}
private void createSamplingEquipmentCellEditor() { private void createSamplingEquipmentCellEditor() {
samplingEquipmentCellEditor = newExtendedComboBoxCellEditor(null, SamplingEquipmentDTO.class, false); samplingEquipmentCellEditor = newExtendedComboBoxCellEditor(null, SamplingEquipmentDTO.class, false);
......
...@@ -23,8 +23,8 @@ package fr.ifremer.reefdb.ui.swing.content.manage.rule.controlrule.precondition. ...@@ -23,8 +23,8 @@ package fr.ifremer.reefdb.ui.swing.content.manage.rule.controlrule.precondition.
* #L% * #L%
*/ */
import fr.ifremer.quadrige3.core.dao.technical.AlphanumericComparator;
import fr.ifremer.quadrige3.core.dao.technical.Assert; import fr.ifremer.quadrige3.core.dao.technical.Assert;
import fr.ifremer.quadrige3.ui.core.dto.referential.ReferentialNameAlphanumericComparator;
import fr.ifremer.quadrige3.ui.swing.table.AbstractTableModel; import fr.ifremer.quadrige3.ui.swing.table.AbstractTableModel;
import fr.ifremer.quadrige3.ui.swing.table.SwingTable; import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
import fr.ifremer.reefdb.decorator.DecoratorService; import fr.ifremer.reefdb.decorator.DecoratorService;
...@@ -83,7 +83,7 @@ public class RulePrecondNumUIHandler ...@@ -83,7 +83,7 @@ public class RulePrecondNumUIHandler
null, null,
newTableCellRender(RulePrecondNumTableModel.QUALITATIVE_VALUE), newTableCellRender(RulePrecondNumTableModel.QUALITATIVE_VALUE),
RulePrecondNumTableModel.QUALITATIVE_VALUE); RulePrecondNumTableModel.QUALITATIVE_VALUE);
// qvCol.setSortable(true); qvCol.setSortable(true);
qvCol.setEditable(false); qvCol.setEditable(false);
addColumn( addColumn(
...@@ -101,7 +101,7 @@ public class RulePrecondNumUIHandler ...@@ -101,7 +101,7 @@ public class RulePrecondNumUIHandler
initTable(getTable(), true); initTable(getTable(), true);
// Mantis #42541 Allow Qualitative value name sorting with enhanced sorting comparator // Mantis #42541 Allow Qualitative value name sorting with enhanced sorting comparator
getSortController().setComparator(qvCol.getModelIndex(), new AlphanumericComparator()); getSortController().setComparator(qvCol.getModelIndex(), ReferentialNameAlphanumericComparator.instance());
getTable().setSortOrder(RulePrecondNumTableModel.QUALITATIVE_VALUE, SortOrder.ASCENDING); getTable().setSortOrder(RulePrecondNumTableModel.QUALITATIVE_VALUE, SortOrder.ASCENDING);
getTable().setHorizontalScrollEnabled(false); getTable().setHorizontalScrollEnabled(false);
} }
......
...@@ -23,7 +23,6 @@ package fr.ifremer.reefdb.ui.swing.content.manage.rule.controlrule.precondition. ...@@ -23,7 +23,6 @@ package fr.ifremer.reefdb.ui.swing.content.manage.rule.controlrule.precondition.
* #L% * #L%
*/ */
import fr.ifremer.quadrige3.core.dao.technical.AlphanumericComparator;
import fr.ifremer.quadrige3.ui.swing.table.AbstractTableModel; import fr.ifremer.quadrige3.ui.swing.table.AbstractTableModel;
import fr.ifremer.quadrige3.ui.swing.table.SwingTable; import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
import fr.ifremer.reefdb.decorator.DecoratorService; import fr.ifremer.reefdb.decorator.DecoratorService;
...@@ -81,8 +80,6 @@ public class RulePrecondQualUIHandler ...@@ -81,8 +80,6 @@ public class RulePrecondQualUIHandler
initTable(getTable(), true); initTable(getTable(), true);
// Mantis #42541 Allow Qualitative value name sorting with enhanced sorting comparator
getSortController().setComparator(nameCol.getModelIndex(), new AlphanumericComparator());
getTable().setSortOrder(RulePrecondQualTableModel.NAME, SortOrder.ASCENDING); getTable().setSortOrder(RulePrecondQualTableModel.NAME, SortOrder.ASCENDING);
getTable().setHorizontalScrollEnabled(false); getTable().setHorizontalScrollEnabled(false);
getTable().setEditable(false); getTable().setEditable(false);
......
...@@ -31,6 +31,8 @@ import fr.ifremer.reefdb.ui.swing.action.AbstractReefDbSaveAction; ...@@ -31,6 +31,8 @@ import fr.ifremer.reefdb.ui.swing.action.AbstractReefDbSaveAction;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.OperationMeasurementsGroupedRowModel; import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.OperationMeasurementsGroupedRowModel;
import fr.ifremer.reefdb.ui.swing.content.observation.survey.measurement.grouped.SurveyMeasurementsGroupedRowModel; import fr.ifremer.reefdb.ui.swing.content.observation.survey.measurement.grouped.SurveyMeasurementsGroupedRowModel;
import javax.swing.SwingUtilities;
import static org.nuiton.i18n.I18n.t; import static org.nuiton.i18n.I18n.t;
/** /**
...@@ -140,13 +142,14 @@ public class SaveAction extends AbstractReefDbSaveAction<ObservationUIModel, Obs ...@@ -140,13 +142,14 @@ public class SaveAction extends AbstractReefDbSaveAction<ObservationUIModel, Obs
public void postSuccessAction() { public void postSuccessAction() {
super.postSuccessAction(); super.postSuccessAction();
getModel().setModify(false);
// show error messages // show error messages
showControlResult(controlMessages, false); showControlResult(controlMessages, false);
getHandler().refreshModels(); getHandler().refreshModels();
// Postpone model modify state (Mantis #50915)
SwingUtilities.invokeLater(() -> getModel().setModify(false));
} }
} }
...@@ -481,18 +481,12 @@ public class OperationMeasurementsGroupedTableUIHandler ...@@ -481,18 +481,12 @@ public class OperationMeasurementsGroupedTableUIHandler
static class SamplingOperationComparator implements Comparator<SamplingOperationDTO> { static class SamplingOperationComparator implements Comparator<SamplingOperationDTO> {
AlphanumericComparator delegate;
SamplingOperationComparator() {
delegate = new AlphanumericComparator();
}
@Override @Override
public int compare(SamplingOperationDTO o1, SamplingOperationDTO o2) { public int compare(SamplingOperationDTO o1, SamplingOperationDTO o2) {
if (o1 == o2) return 0; if (o1 == o2) return 0;
if (o1 == null) return -1; if (o1 == null) return -1;
if (o2 == null) return 1; if (o2 == null) return 1;
return delegate.compare(o1.getName(), o2.getName()); return AlphanumericComparator.instance().compare(o1.getName(), o2.getName());
} }
} }
} }
...@@ -23,7 +23,6 @@ package fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.ung ...@@ -23,7 +23,6 @@ package fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.ung
* #L% * #L%
*/ */
import fr.ifremer.quadrige3.core.dao.technical.AlphanumericComparator;
import fr.ifremer.quadrige3.ui.swing.table.SwingTable; import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
import fr.ifremer.quadrige3.ui.swing.table.editor.ExtendedComboBoxCellEditor; import fr.ifremer.quadrige3.ui.swing.table.editor.ExtendedComboBoxCellEditor;
import fr.ifremer.reefdb.decorator.DecoratorService; import fr.ifremer.reefdb.decorator.DecoratorService;
...@@ -286,17 +285,6 @@ public class OperationMeasurementsUngroupedTableUIHandler extends AbstractReefDb ...@@ -286,17 +285,6 @@ public class OperationMeasurementsUngroupedTableUIHandler extends AbstractReefDb
addEditionPanelBorder(); addEditionPanelBorder();
} }
@Override
protected void installSortController() {
super.installSortController();
getSortController().setComparator(
getTable().getColumnModel().getColumnExt(OperationMeasurementsUngroupedTableModel.NAME).getModelIndex(),
new AlphanumericComparator()
);
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
......
...@@ -12,12 +12,12 @@ package fr.ifremer.reefdb.ui.swing.content.observation.photo; ...@@ -12,12 +12,12 @@ package fr.ifremer.reefdb.ui.swing.content.observation.photo;
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
...@@ -29,9 +29,12 @@ import fr.ifremer.reefdb.dto.ReefDbBeanFactory; ...@@ -29,9 +29,12 @@ import fr.ifremer.reefdb.dto.ReefDbBeanFactory;
import fr.ifremer.reefdb.dto.data.photo.PhotoDTO; import fr.ifremer.reefdb.dto.data.photo.PhotoDTO;
import fr.ifremer.reefdb.dto.data.sampling.SamplingOperationDTO; import fr.ifremer.reefdb.dto.data.sampling.SamplingOperationDTO;
import fr.ifremer.reefdb.ui.swing.action.AbstractReefDbAction; import fr.ifremer.reefdb.ui.swing.action.AbstractReefDbAction;
import org.apache.commons.collections4.CollectionUtils;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import static org.nuiton.i18n.I18n.t; import static org.nuiton.i18n.I18n.t;
...@@ -41,8 +44,8 @@ import static org.nuiton.i18n.I18n.t; ...@@ -41,8 +44,8 @@ import static org.nuiton.i18n.I18n.t;
*/ */
public class ImportAction extends AbstractReefDbAction<PhotosTabUIModel, PhotosTabUI, PhotosTabUIHandler> { public class ImportAction extends AbstractReefDbAction<PhotosTabUIModel, PhotosTabUI, PhotosTabUIHandler> {
private File originalImage; private List<File> originalImages;
private PhotoDTO newPhoto; private List<PhotoDTO> newPhotos;
/** /**
* Constructor. * Constructor.
...@@ -53,80 +56,110 @@ public class ImportAction extends AbstractReefDbAction<PhotosTabUIModel, PhotosT ...@@ -53,80 +56,110 @@ public class ImportAction extends AbstractReefDbAction<PhotosTabUIModel, PhotosT
super(handler, false); super(handler, false);
} }
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public boolean prepareAction() throws Exception { public boolean prepareAction() throws Exception {
if (!super.prepareAction()) { if (!super.prepareAction()) {
return false; return false;
} }
originalImage = chooseFile( originalImages = chooseFiles(
t("reefdb.action.photo.import.chooseFile.title"), t("reefdb.action.photo.import.chooseFile.title"),
t("reefdb.action.photo.import.chooseFile.buttonLabel"), t("reefdb.action.photo.import.chooseFile.buttonLabel"),
"(.+(\\.(?i)(" + Images.AVAILABLE_EXTENSION + "))$)", "(.+(\\.(?i)(" + Images.AVAILABLE_EXTENSION + "))$)",
t("reefdb.action.photo.import.chooseFile.filterDescription", Images.AVAILABLE_EXTENSION_LIST.toString().toUpperCase())); t("reefdb.action.photo.import.chooseFile.filterDescription", Images.AVAILABLE_EXTENSION_LIST.toString().toUpperCase()));
if (CollectionUtils.isNotEmpty(originalImages)) {
if (originalImage != null) {
// get file size // get file size
long maxSize = getConfig().getSynchroPhotoMaxSize(); long maxSize = getConfig().getSynchroPhotoMaxSize();
if (maxSize > 0 && originalImage.length() > maxSize) { if (maxSize > 0 && originalImages.stream().anyMatch(file -> file.length() > maxSize)) {
displayErrorMessage(getActionDescription(), displayErrorMessage(getActionDescription(),
t("reefdb.action.photo.import.fileTooLarge.message", maxSize, Files.byteCountToDisplaySize(maxSize))); t("reefdb.action.photo.import.fileTooLarge.message", maxSize, Files.byteCountToDisplaySize(maxSize)));
originalImage = null; return false;
} }
}
return originalImage != null; return true;
} else {
// no selection
return false;
}
} }
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public void doAction() { public void doAction() {
getModel().setLoading(true); getModel().setLoading(true);
newPhotos = new ArrayList<>();
File tempFile = Images.importAndPrepareImageFile(originalImage, getConfig().getTempDirectory());
originalImages.forEach(originalImage -> {
newPhoto = ReefDbBeanFactory.newPhotoDTO();
newPhoto.setDirty(true); File tempFile = Images.importAndPrepareImageFile(originalImage, getConfig().getTempDirectory());
newPhoto.setDate(new Date());