branch feature/8180 updated (316dc33 -> 150c7e6)
This is an automated email from the git hooks/post-receive script. New change to branch feature/8180 in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git from 316dc33 Move migration to 3.907 version new c679de2 Update documentation for the mooring import new d9be6f1 Refactoring avoid copy/paste on acoustic import for voyage and mooring new 150c7e6 Fix delete import for mooring The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 150c7e63c7def9b070ac7344cbe07b38cae1049d Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Tue Jun 28 16:48:31 2016 +0200 Fix delete import for mooring commit d9be6f1937857d46ec774b0a1cba0f643adbc014 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Tue Jun 28 16:26:03 2016 +0200 Refactoring avoid copy/paste on acoustic import for voyage and mooring commit c679de263e647978b2ad41a0cfbc423dc7c266d2 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Mon Jun 27 17:37:47 2016 +0200 Update documentation for the mooring import Summary of changes: ...sticProvider.java => DataAcousticProvider.java} | 23 +- .../echobase/entities/data/MooringImpl.java | 16 +- .../echobase/entities/data/TransectImpl.java | 25 + .../ifremer/echobase/entities/data/VoyageImpl.java | 23 +- .../importdata/DuplicatedEsduCellException.java | 5 +- .../importdata/EsduCellNotFoundException.java | 12 +- ...tion.java => ImportAcousticsActionSupport.java} | 134 ++- .../actions/ImportDataActionSupport.java | 1 - .../actions/MooringAcousticsImportAction.java | 868 +------------------- .../MooringAcousticsImportDataActionSupport.java | 38 - .../actions/VoyageAcousticsImportAction.java | 901 +-------------------- ...tion.java => ImportAcousticsConfiguration.java} | 11 +- .../MooringAcousticsImportConfiguration.java | 188 +---- .../VoyageAcousticsImportConfiguration.java | 198 +---- .../contexts/ImportDataContextSupport.java | 13 +- .../MooringAcousticsImportDataContext.java | 7 +- .../contexts/MooringCommonsImportDataContext.java | 7 +- .../contexts/MooringImportDataContextSupport.java | 49 -- .../contexts/VoyageAcousticsImportDataContext.java | 30 +- .../contexts/VoyageImportDataContextSupport.java | 6 +- ...rtModel.java => AcousticImportExportModel.java} | 133 +-- ...ousticImportRow.java => AcousticImportRow.java} | 16 +- .../csv/VoyageAcousticImportExportModel.java | 225 ----- .../importdata/csv/VoyageAcousticImportRow.java | 485 ----------- .../strategy/AbstractImportDbStrategy.java | 13 +- .../importdb/strategy/FreeImportDbStrategy.java | 6 +- .../strategy/ReferentialImportDbStrategy.java | 5 +- .../service/removedata/RemoveDataService.java | 12 +- .../strategy/AbstractRemoveDataStrategy.java | 12 +- .../strategy/AcousticRemoveDataStrategy.java | 14 +- .../strategy/CatchesRemoveDataStrategy.java | 6 +- .../strategy/CommonAllRemoveDataStrategy.java | 8 +- .../strategy/CommonTransectRemoveDataStrategy.java | 10 +- .../strategy/CommonTransitRemoveDataStrategy.java | 10 +- .../strategy/CommonVoyageRemoveDataStrategy.java | 8 +- .../strategy/DummyMooringRemoveDataStrategy.java | 6 +- .../strategy/LegacyVoyageRemoveDataStrategy.java | 8 +- .../MooringAcousticRemoveDataStrategy.java | 16 +- .../strategy/MooringRemoveDataStrategy.java | 8 +- .../strategy/OperationRemoveDataStrategy.java | 6 +- .../strategy/ResultEsduRemoveDataStrategy.java | 6 +- .../strategy/ResultMapFishRemoveDataStrategy.java | 6 +- .../strategy/ResultMapOtherRemoveDataStrategy.java | 6 +- .../strategy/ResultRegionRemoveDataStrategy.java | 6 +- .../strategy/ResultVoyageRemoveDataStrategy.java | 8 +- .../ui/actions/removeData/ConfirmDelete.java | 15 +- src/site/en/rst/importData.rst | 67 +- src/site/rst/importData.rst | 68 +- 48 files changed, 566 insertions(+), 3178 deletions(-) rename echobase-domain/src/main/java/fr/ifremer/echobase/entities/{DataAccousticProvider.java => DataAcousticProvider.java} (68%) create mode 100644 echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransectImpl.java copy echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/{MooringAcousticsImportAction.java => ImportAcousticsActionSupport.java} (92%) delete mode 100644 echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportDataActionSupport.java copy echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/{MooringAcousticsImportConfiguration.java => ImportAcousticsConfiguration.java} (95%) delete mode 100644 echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringImportDataContextSupport.java rename echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/{MooringAcousticImportExportModel.java => AcousticImportExportModel.java} (63%) rename echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/{MooringAcousticImportRow.java => AcousticImportRow.java} (96%) delete mode 100644 echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageAcousticImportExportModel.java delete mode 100644 echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageAcousticImportRow.java -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/8180 in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git commit c679de263e647978b2ad41a0cfbc423dc7c266d2 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Mon Jun 27 17:37:47 2016 +0200 Update documentation for the mooring import --- src/site/en/rst/importData.rst | 67 +++++++++++++++++++++++++++++++++++++++-- src/site/rst/importData.rst | 68 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 131 insertions(+), 4 deletions(-) diff --git a/src/site/en/rst/importData.rst b/src/site/en/rst/importData.rst index fe91611..2f3352f 100644 --- a/src/site/en/rst/importData.rst +++ b/src/site/en/rst/importData.rst @@ -197,6 +197,69 @@ Example title;transectAbstract;stratum;comment;voyage;vesselName;dateCreated;timeCoverageStart;timeCoverageEnd;geospatialLonMin;geospatialLatMin;geospatialVerticalMin;geospatialLonMax;geospatialLatMax;geospatialVerticalMax;linestring Arlequin2 / la colombine942OBS01 SUR;942OBS;SUR;942OBS,P5001,SUR;PELGAS2011;Arlequin2 / la colombine;2011-04-27 09:10:00.0000;2011-04-27 09:10:00.0000;2011-04-27 10:39:00.0000;-1.5896666667;43.7055;110;-1.541;43.7606666667;110;-176453.0000037 4851310.5,-171051 4857434.0000037 + +Mooring +======= + +Mooring +~~~~~~~ + +Required columns +---------------- + +:: + + mission;code;description;depth;northLimit;eastLimit;southLimit;upLimit;downLimit;units;zunits;projection;deploymentDate;retrievalDate;siteName;operator;comments + +Columns formats +--------------- + ++-----------------------------+------------------------+ +| Colonne | Type | ++=============================+========================+ +| mission |FK(Mission#name) | ++-----------------------------+------------------------+ +| code |text | ++-----------------------------+------------------------+ +| description |text | ++-----------------------------+------------------------+ +| depth |(float) | ++-----------------------------+------------------------+ +| northLimit |(float) | ++-----------------------------+------------------------+ +| eastLimit |(float) | ++-----------------------------+------------------------+ +| southLimit |(float) | ++-----------------------------+------------------------+ +| upLimit |(float) | ++-----------------------------+------------------------+ +| downLimit |(float) | ++-----------------------------+------------------------+ +| units |text | ++-----------------------------+------------------------+ +| zunits |text | ++-----------------------------+------------------------+ +| projection |text | ++-----------------------------+------------------------+ +| deploymentDate |(date) | ++-----------------------------+------------------------+ +| retrievalDate |(date) | ++-----------------------------+------------------------+ +| siteName |text | ++-----------------------------+------------------------+ +| operator |text | ++-----------------------------+------------------------+ +| comments |text | ++-----------------------------+------------------------+ + +Example +------- + +:: + + mission;code;description;depth;northLimit;eastLimit;southLimit;upLimit;downLimit;units;zunits;projection;deploymentDate;retrievalDate;siteName;operator;comments + PELGAS;MOORING1;Mooring 1;1;1.1;1.2;1.3;1.4;1.5;m;m;None;26-04-2011 08:00:00.0000;04-06-2011 08:00:00.0000;CodeLutin;Moi;RAS + Operation / OperationMetadataValue / GearMetadataValue ====================================================== @@ -445,8 +508,8 @@ Example operationId;baracoudaCode;numFish;dataLabel;dataValue;name P5002;ENGR-ENC;9394;NA;-1;Age -Acoustic -~~~~~~~~ +Acoustic (voyage or mooring) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Required columns ---------------- diff --git a/src/site/rst/importData.rst b/src/site/rst/importData.rst index 0d3f8c0..9ecac81 100644 --- a/src/site/rst/importData.rst +++ b/src/site/rst/importData.rst @@ -23,6 +23,8 @@ Importer des données dans EchoBase ================================== +.. contents:: + Abstract ======== @@ -201,6 +203,68 @@ Exemple title;transectAbstract;stratum;comments;voyage;vesselName;dateCreated;timeCoverageStart;timeCoverageEnd;geospatialLonMin;geospatialLatMin;geospatialVerticalMin;geospatialLonMax;geospatialLatMax;geospatialVerticalMax;linestring Arlequin2 / la colombine942OBS01 SUR;942OBS;SUR;942OBS,P5001,SUR;PELGAS2011;Arlequin2 / la colombine;2011-04-27 09:10:00.0000;2011-04-27 09:10:00.0000;2011-04-27 10:39:00.0000;-1.5896666667;43.7055;110;-1.541;43.7606666667;110;-176453.0000037 4851310.5,-171051 4857434.0000037 +Bouée +===== + +Bouée +~~~~~ + +Colonnes requises +----------------- + +:: + + mission;code;description;depth;northLimit;eastLimit;southLimit;upLimit;downLimit;units;zunits;projection;deploymentDate;retrievalDate;siteName;operator;comments + +Format des colonnes +------------------- + ++-----------------------------+------------------------+ +| Colonne | Type | ++=============================+========================+ +| mission |FK(Mission#name) | ++-----------------------------+------------------------+ +| code |text | ++-----------------------------+------------------------+ +| description |text | ++-----------------------------+------------------------+ +| depth |(float) | ++-----------------------------+------------------------+ +| northLimit |(float) | ++-----------------------------+------------------------+ +| eastLimit |(float) | ++-----------------------------+------------------------+ +| southLimit |(float) | ++-----------------------------+------------------------+ +| upLimit |(float) | ++-----------------------------+------------------------+ +| downLimit |(float) | ++-----------------------------+------------------------+ +| units |text | ++-----------------------------+------------------------+ +| zunits |text | ++-----------------------------+------------------------+ +| projection |text | ++-----------------------------+------------------------+ +| deploymentDate |(date) | ++-----------------------------+------------------------+ +| retrievalDate |(date) | ++-----------------------------+------------------------+ +| siteName |text | ++-----------------------------+------------------------+ +| operator |text | ++-----------------------------+------------------------+ +| comments |text | ++-----------------------------+------------------------+ + +Exemple +------- + +:: + + mission;code;description;depth;northLimit;eastLimit;southLimit;upLimit;downLimit;units;zunits;projection;deploymentDate;retrievalDate;siteName;operator;comments + PELGAS;MOORING1;Mooring 1;1;1.1;1.2;1.3;1.4;1.5;m;m;None;26-04-2011 08:00:00.0000;04-06-2011 08:00:00.0000;CodeLutin;Moi;RAS + Operation / OperationMetadataValue / GearMetadataValue ====================================================== @@ -449,8 +513,8 @@ Exemple operationId;baracoudaCode;numFish;dataLabel;dataValue;name P5002;ENGR-ENC;9394;NA;-1;Age -Acoustic -~~~~~~~~ +Acoustic (voyage ou bouée) +~~~~~~~~~~~~~~~~~~~~~~~~~~ Colonnes requises ----------------- -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/8180 in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git commit d9be6f1937857d46ec774b0a1cba0f643adbc014 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Tue Jun 28 16:26:03 2016 +0200 Refactoring avoid copy/paste on acoustic import for voyage and mooring --- ...sticProvider.java => DataAcousticProvider.java} | 23 +- .../echobase/entities/data/MooringImpl.java | 16 +- .../echobase/entities/data/TransectImpl.java | 25 + .../ifremer/echobase/entities/data/VoyageImpl.java | 23 +- .../importdata/DuplicatedEsduCellException.java | 5 +- .../importdata/EsduCellNotFoundException.java | 12 +- ...tion.java => ImportAcousticsActionSupport.java} | 134 ++- .../actions/ImportDataActionSupport.java | 1 - .../actions/MooringAcousticsImportAction.java | 868 +------------------- .../MooringAcousticsImportDataActionSupport.java | 38 - .../actions/VoyageAcousticsImportAction.java | 901 +-------------------- ...tion.java => ImportAcousticsConfiguration.java} | 11 +- .../MooringAcousticsImportConfiguration.java | 188 +---- .../VoyageAcousticsImportConfiguration.java | 198 +---- .../contexts/ImportDataContextSupport.java | 13 +- .../MooringAcousticsImportDataContext.java | 7 +- .../contexts/MooringCommonsImportDataContext.java | 7 +- .../contexts/MooringImportDataContextSupport.java | 49 -- .../contexts/VoyageAcousticsImportDataContext.java | 30 +- .../contexts/VoyageImportDataContextSupport.java | 6 +- ...rtModel.java => AcousticImportExportModel.java} | 133 +-- ...ousticImportRow.java => AcousticImportRow.java} | 16 +- .../csv/VoyageAcousticImportExportModel.java | 225 ----- .../importdata/csv/VoyageAcousticImportRow.java | 485 ----------- .../strategy/AbstractImportDbStrategy.java | 13 +- .../importdb/strategy/FreeImportDbStrategy.java | 6 +- .../strategy/ReferentialImportDbStrategy.java | 5 +- .../service/removedata/RemoveDataService.java | 12 +- .../strategy/AbstractRemoveDataStrategy.java | 12 +- .../strategy/AcousticRemoveDataStrategy.java | 10 +- .../strategy/CatchesRemoveDataStrategy.java | 6 +- .../strategy/CommonAllRemoveDataStrategy.java | 8 +- .../strategy/CommonTransectRemoveDataStrategy.java | 10 +- .../strategy/CommonTransitRemoveDataStrategy.java | 10 +- .../strategy/CommonVoyageRemoveDataStrategy.java | 8 +- .../strategy/DummyMooringRemoveDataStrategy.java | 6 +- .../strategy/LegacyVoyageRemoveDataStrategy.java | 8 +- .../MooringAcousticRemoveDataStrategy.java | 10 +- .../strategy/MooringRemoveDataStrategy.java | 8 +- .../strategy/OperationRemoveDataStrategy.java | 6 +- .../strategy/ResultEsduRemoveDataStrategy.java | 6 +- .../strategy/ResultMapFishRemoveDataStrategy.java | 6 +- .../strategy/ResultMapOtherRemoveDataStrategy.java | 6 +- .../strategy/ResultRegionRemoveDataStrategy.java | 6 +- .../strategy/ResultVoyageRemoveDataStrategy.java | 8 +- 45 files changed, 421 insertions(+), 3163 deletions(-) diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DataAccousticProvider.java b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DataAcousticProvider.java similarity index 68% rename from echobase-domain/src/main/java/fr/ifremer/echobase/entities/DataAccousticProvider.java rename to echobase-domain/src/main/java/fr/ifremer/echobase/entities/DataAcousticProvider.java index 60e298e..2506b7d 100644 --- a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DataAccousticProvider.java +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DataAcousticProvider.java @@ -1,5 +1,7 @@ package fr.ifremer.echobase.entities; +import fr.ifremer.echobase.entities.data.DataAcquisition; +import java.util.Collection; import org.nuiton.topia.persistence.TopiaEntity; /* @@ -24,18 +26,19 @@ import org.nuiton.topia.persistence.TopiaEntity; */ /** + * Common part on Voyage or Mooring. + * * @author Julien Ruchaud - ruchaud@codelutin.com * @since 4.0 */ -public class DataAccousticProvider<E extends TopiaEntity> { - - protected E entity; +public interface DataAcousticProvider<E extends TopiaEntity> { + public String getName(); - public DataAccousticProvider(E entity) { - this.entity = entity; - } - - public E getEntity() { - return entity; - } + boolean isDataAcquisitionEmpty(); + + Collection<DataAcquisition> getDataAcquisition(); + + public void addDataAcquisition(DataAcquisition dataAcquisition); + + E getEntity(); } diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/MooringImpl.java b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/MooringImpl.java index 6adea21..6858c7d 100644 --- a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/MooringImpl.java +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/MooringImpl.java @@ -1,12 +1,14 @@ package fr.ifremer.echobase.entities.data; +import fr.ifremer.echobase.entities.DataAcousticProvider; + /** * Default implementation of {@link Mooring}. * * @author Julien Ruchaud - ruchaud@codelutin.com - * @since 0.5 + * @since 4.0 */ -public class MooringImpl extends MooringAbstract { +public class MooringImpl extends MooringAbstract implements DataAcousticProvider<Mooring> { private static final long serialVersionUID = 4049916052281439032L; @@ -15,4 +17,14 @@ public class MooringImpl extends MooringAbstract { this.projection = "WGS84"; } + @Override + public String getName() { + return this.getCode(); + } + + @Override + public Mooring getEntity() { + return this; + } + } //MooringImpl diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransectImpl.java b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransectImpl.java new file mode 100644 index 0000000..11405f7 --- /dev/null +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransectImpl.java @@ -0,0 +1,25 @@ +package fr.ifremer.echobase.entities.data; + +import fr.ifremer.echobase.entities.DataAcousticProvider; + +/** + * Default implementation of {@link Transect}. + * + * @author Julien Ruchaud - ruchaud@codelutin.com + * @since 4.0 + */ +public class TransectImpl extends TransectAbstract implements DataAcousticProvider<Transect> { + + private static final long serialVersionUID = 7016949489850474806L; + + @Override + public String getName() { + return getTransit().getVoyage().getName() + " - " + getVessel().getName(); + } + + @Override + public Transect getEntity() { + return this; + } + +} //TransectImpl diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java index 6c984b9..7e2e655 100644 --- a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java @@ -30,6 +30,7 @@ import fr.ifremer.echobase.entities.references.Vessel; import java.util.Collection; import java.util.Date; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Default implementation of {@link Voyage}. @@ -37,7 +38,7 @@ import java.util.Set; * @author Tony Chemit - chemit@codelutin.com * @since 0.3 */ -public class VoyageImpl extends VoyageAbstract { +public class VoyageImpl extends VoyageAbstract implements DataAcousticProvider<Voyage> { private static final long serialVersionUID = 1L; @@ -166,4 +167,24 @@ public class VoyageImpl extends VoyageAbstract { } return result; } + + @Override + public boolean isDataAcquisitionEmpty() { + throw new UnsupportedOperationException(); + } + + @Override + public Collection<DataAcquisition> getDataAcquisition() { + throw new UnsupportedOperationException(); + } + + @Override + public void addDataAcquisition(DataAcquisition dataAcquisition) { + throw new UnsupportedOperationException(); + } + + @Override + public Voyage getEntity() { + return this; + } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/DuplicatedEsduCellException.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/DuplicatedEsduCellException.java index 391fb8d..2e43f8b 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/DuplicatedEsduCellException.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/DuplicatedEsduCellException.java @@ -26,6 +26,7 @@ import org.nuiton.csv.ImportRuntimeException; import java.util.Locale; import static org.nuiton.i18n.I18n.l; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Created on 1/21/15. @@ -37,7 +38,7 @@ public class DuplicatedEsduCellException extends ImportRuntimeException { private static final long serialVersionUID = 1L; - public DuplicatedEsduCellException(Locale locale, int rowNumber, String cellName,String voyageName) { - super(l(locale, "echobase.importError.duplicate.esduCell", rowNumber, cellName, voyageName)); + public DuplicatedEsduCellException(Locale locale, int rowNumber, String cellName, DataAcousticProvider provider) { + super(l(locale, "echobase.importError.duplicate.esduCell", rowNumber, cellName, provider.getName())); } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/EsduCellNotFoundException.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/EsduCellNotFoundException.java index d40f3d3..5f9542f 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/EsduCellNotFoundException.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/EsduCellNotFoundException.java @@ -21,15 +21,13 @@ package fr.ifremer.echobase.services.service.importdata; * #L% */ -import fr.ifremer.echobase.entities.data.Mooring; -import fr.ifremer.echobase.entities.data.Voyage; import fr.ifremer.echobase.entities.references.AcousticInstrument; -import fr.ifremer.echobase.entities.references.Vessel; import org.nuiton.csv.ImportRuntimeException; import java.util.Locale; import static org.nuiton.i18n.I18n.l; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Created on 1/21/15. @@ -41,11 +39,7 @@ public class EsduCellNotFoundException extends ImportRuntimeException { private static final long serialVersionUID = 1L; - public EsduCellNotFoundException(Locale locale, Voyage voyage, Vessel vessel, AcousticInstrument instrument, int rowNumber) { - super(l(locale, "echobase.importError.esduCell.notfound", voyage.getName(), vessel.getName(), instrument.getId(), rowNumber)); - } - - public EsduCellNotFoundException(Locale locale, Mooring mooring, AcousticInstrument instrument, int rowNumber) { - super(l(locale, "echobase.importError.esduCellMooring.notfound", mooring.getCode(), instrument.getId(), rowNumber)); + public EsduCellNotFoundException(Locale locale, DataAcousticProvider provider, AcousticInstrument instrument, int rowNumber) { + super(l(locale, "echobase.importError.esduCell.notfound", provider.getName(), instrument.getId(), rowNumber)); } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportAction.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportAcousticsActionSupport.java similarity index 92% copy from echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportAction.java copy to echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportAcousticsActionSupport.java index 7da4f6a..85877d9 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportAction.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportAcousticsActionSupport.java @@ -33,7 +33,6 @@ import fr.ifremer.echobase.entities.data.Data; import fr.ifremer.echobase.entities.data.DataAcquisition; import fr.ifremer.echobase.entities.data.DataProcessing; import fr.ifremer.echobase.entities.data.Datas; -import fr.ifremer.echobase.entities.data.Mooring; import fr.ifremer.echobase.entities.references.AcousticInstrument; import fr.ifremer.echobase.entities.references.AcousticInstruments; import fr.ifremer.echobase.entities.references.CellType; @@ -47,16 +46,9 @@ import fr.ifremer.echobase.services.service.importdata.ElementaryCellWithoutDept import fr.ifremer.echobase.services.service.importdata.EsduCellNotFoundException; import fr.ifremer.echobase.services.service.importdata.EsduCellWithDepthEndFilledException; import fr.ifremer.echobase.services.service.importdata.ImportDataFileResult; -import fr.ifremer.echobase.services.service.importdata.configurations.MooringAcousticsImportConfiguration; -import fr.ifremer.echobase.services.service.importdata.contexts.MooringAcousticsImportDataContext; -import fr.ifremer.echobase.services.service.importdata.csv.MooringAcousticImportExportModel; -import fr.ifremer.echobase.services.service.importdata.csv.MooringAcousticImportRow; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.csv.Import; -import org.nuiton.csv.ImportRuntimeException; - +import fr.ifremer.echobase.services.service.importdata.configurations.ImportAcousticsConfiguration; +import fr.ifremer.echobase.services.service.importdata.contexts.ImportDataContextSupport; +import fr.ifremer.echobase.services.service.importdata.csv.AcousticImportRow; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -66,49 +58,42 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.csv.Import; +import org.nuiton.csv.ImportRuntimeException; +import fr.ifremer.echobase.entities.DataAcousticProvider; +import java.util.Collection; /** - * Do the import for acoustics data for the mooring. - * * @author Julien Ruchaud - ruchaud@codelutin.com - * @since 0.5 + * @since 4.0 */ -public class MooringAcousticsImportAction extends MooringAcousticsImportDataActionSupport<MooringAcousticImportRow> { +public abstract class ImportAcousticsActionSupport<M extends ImportAcousticsConfiguration, C extends ImportDataContextSupport<M>, E extends AcousticImportRow> extends ImportDataActionSupport<M, C, E> { /** Logger. */ - private static final Log log = LogFactory.getLog(MooringAcousticsImportAction.class); + private static final Log log = LogFactory.getLog(ImportAcousticsActionSupport.class); private final DateFormat cellDateFormat; private final DataMetadataProvider dataMetadataProvider; private String lastEsduId; - public MooringAcousticsImportAction(MooringAcousticsImportDataContext importDataContext) { + public ImportAcousticsActionSupport(C importDataContext) { super(importDataContext, importDataContext.getConfiguration().getMoviesFile()); + this.cellDateFormat = new SimpleDateFormat(EchoBaseCsvUtil.CELLULE_DATE_FORMAT); this.dataMetadataProvider = new DataMetadataProvider(importDataContext); } @Override - protected MooringAcousticImportExportModel createCsvImportModel(MooringAcousticsImportDataContext importDataContext) { - return MooringAcousticImportExportModel.forImport(importDataContext); - } - - @Override - protected MooringAcousticImportExportModel createCsvExportModel(MooringAcousticsImportDataContext importDataContext) { - return MooringAcousticImportExportModel.forExport(importDataContext); - } - - @Override - protected void performImport(MooringAcousticsImportDataContext importDataContext, InputFile inputFile, ImportDataFileResult result) { + protected void performImport(C importDataContext, InputFile inputFile, ImportDataFileResult result) { if (log.isInfoEnabled()) { log.info("Starts " + getImportMessage()); } - // get selected mooring - Mooring mooring = importDataContext.getMooring(); - CellType esduCellType = importDataContext.getEsduCellType(); CellType elementaryCellType = importDataContext.getElementaryCellType(); @@ -121,7 +106,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi String processingTemplate = getConfiguration().getProcessingTemplate(); - try (Import<MooringAcousticImportRow> importer = open()) { + try (Import<E> importer = open()) { DataAcquisition dataAcquisition = null; DataProcessing dataProcessing = null; @@ -132,7 +117,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi Set<String> createdDataAcquisitions = Sets.newHashSet(); - for (MooringAcousticImportRow row : importer) { + for (E row : importer) { doFlushTransaction(++rowNumber); @@ -145,6 +130,8 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi } Date endDate = row.getCellDateEnd(); + + DataAcousticProvider dataProvider = getDataProvider(importDataContext, row, rowNumber); AcousticInstrument instrument = row.getAcousticInstrument(); boolean isME70 = AcousticInstruments.IS_ACOUSTIC_INSTRUMENT_ME70.apply(instrument); @@ -161,7 +148,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi // means miss a esdu cell // can not find correct transect - throw new EsduCellNotFoundException(locale, mooring, instrument, rowNumber); + throw new EsduCellNotFoundException(locale, dataProvider, instrument, rowNumber); } String softwareVersion = getSoftwareVersion(isME70); @@ -169,7 +156,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi String soundSpeedCalculations = getSoundSpeedCalculations(isME70); // try to get existing data acquisition - dataAcquisition = getDataAcquisition(mooring, instrument, addDataAcquisition); + dataAcquisition = getDataAcquisition(dataProvider, instrument, addDataAcquisition); if (dataAcquisition == null) { @@ -181,7 +168,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi createdDataAcquisitions.add(dataAcquisition.getTopiaId()); // add dataAcquisition to mooring - mooring.addDataAcquisition(dataAcquisition); + dataProvider.addDataAcquisition(dataAcquisition); if (log.isDebugEnabled()) { log.debug("[row " + rowNumber + "] New dataAquisition to use (number: " + result.getNumberCreated(EchoBaseUserEntityEnum.DataAcquisition) + ")"); @@ -260,7 +247,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi // check name does not exist boolean exists = persistenceService.containsCellByName(esduCellId); if (exists) { - throw new DuplicatedEsduCellException(getLocale(), rowNumber, esduCellId, mooring.getCode()); + throw new DuplicatedEsduCellException(getLocale(), rowNumber, esduCellId, dataProvider); } // this is a esdu cell row @@ -334,8 +321,33 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi } + protected abstract DataAcousticProvider getDataProvider(C importDataContext, E row, int rowNumber); + + private DataAcquisition getDataAcquisition(DataAcousticProvider provider, AcousticInstrument instrument, boolean addDataAcquisition) { + + DataAcquisition result = null; + if (!addDataAcquisition && !provider.isDataAcquisitionEmpty()) { + + // try to obtain an existing data acquisiton + + Collection<DataAcquisition> dataAcquisition = provider.getDataAcquisition(); + for (DataAcquisition acquisition : dataAcquisition) { + + if (instrument.equals(acquisition.getAcousticInstrument())) { + + // found a matching dataAcquisition from his acoustic instrument + result = acquisition; + break; + } + } + } + + return result; + + } + @Override - protected void computeImportedExport(MooringAcousticsImportDataContext importDataContext, ImportDataFileResult result) { + protected void computeImportedExport(C importDataContext, ImportDataFileResult result) { String processingTemplate = getConfiguration().getProcessingTemplate(); @@ -377,7 +389,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi Preconditions.checkState(elementaryCells.isEmpty()); } - + private Date formatDate(String date) { try { return cellDateFormat.parse(date); @@ -396,7 +408,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi DataMetadata radialNumberDataMetadata = dataMetadataProvider.getRadialNumberDataMetadata(); Preconditions.checkNotNull(radialNumberDataMetadata); - MooringAcousticImportRow esduRow = MooringAcousticImportRow.ofEsduCell(processingTemplate, dataAcquisition, dataProcessing, esduCell, radialNumberDataMetadata); + E esduRow = (E) AcousticImportRow.ofEsduCell(processingTemplate, dataAcquisition, dataProcessing, esduCell, radialNumberDataMetadata); ImmutableMap<DataMetadata, Data> esduCellDataByMeta = Maps.uniqueIndex(esduCell.getData(), Datas.TO_DATA_METADATA); @@ -463,7 +475,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi for (Cell elementaryCell : elementaryCells) { - MooringAcousticImportRow elementaryRow = MooringAcousticImportRow.ofElementaryCell(processingTemplate, dataAcquisition, dataProcessing, elementaryCell, radialNumberDataMetadata); + E elementaryRow = (E) AcousticImportRow.ofElementaryCell(processingTemplate, dataAcquisition, dataProcessing, elementaryCell, radialNumberDataMetadata); ImmutableMap<DataMetadata, Data> elementaryCellDataByMeta = Maps.uniqueIndex(elementaryCell.getData(), Datas.TO_DATA_METADATA); @@ -539,33 +551,10 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi esduRow.setCellNum(esduRowCellNum); addImportedRow(result, esduRow); - - } - - private DataAcquisition getDataAcquisition(Mooring mooring, AcousticInstrument instrument, boolean addDataAcquisition) { - - DataAcquisition result = null; - if (!addDataAcquisition && !mooring.isDataAcquisitionEmpty()) { - - // try to obtain an existing data acquisiton - - for (DataAcquisition acquisition : mooring.getDataAcquisition()) { - - if (instrument.equals(acquisition.getAcousticInstrument())) { - - // found a matching dataAcquisition from his acoustic instrument - result = acquisition; - break; - } - } - } - - return result; - } private void createEsduCellData(Cell cell, - MooringAcousticImportRow row, + E row, DataQuality dataQuality, ImportDataFileResult importResult, int rowNumber) { @@ -632,7 +621,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi private void createElementaryCellData(Cell cell, boolean surface, - MooringAcousticImportRow row, + E row, DataQuality dataQuality, ImportDataFileResult importResult, int rowNumber) { @@ -695,9 +684,9 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi private DataAcquisition createDataAcquisition(AcousticInstrument instrument, String softwareVersion, String soundSpeedCalculations, - MooringAcousticImportRow row) { + E row) { - MooringAcousticsImportConfiguration configuration = getConfiguration(); + M configuration = getConfiguration(); String transceiverAcquisitionAbsorptionDescription = configuration.getTransceiverAcquisitionAbsorptionDescription(); String loggedDataFormat = configuration.getLoggedDataFormat(); @@ -740,9 +729,9 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi private DataProcessing createDataProcessing(String id, String softwareVersion, String soundSpeedCalculations, - MooringAcousticImportRow row) { + E row) { - MooringAcousticsImportConfiguration configuration = getConfiguration(); + M configuration = getConfiguration(); String transceiverAcquisitionAbsorptionDescription = configuration.getTransceiverAcquisitionAbsorptionDescription(); String processingTemplate = configuration.getProcessingTemplate(); @@ -807,8 +796,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi } return result; } - - public static class DataMetadataProvider { + public static class DataMetadataProvider<M extends ImportAcousticsConfiguration, C extends ImportDataContextSupport<M>> { private final DataMetadata radialNumberDataMetadata; private final DataMetadata latitudeDataMetadata; @@ -826,7 +814,7 @@ public class MooringAcousticsImportAction extends MooringAcousticsImportDataActi // private final DataMetadata depthRefBottomStartDataMetadata; private final DataMetadata depthRefBottomEndDataMetadata; - public DataMetadataProvider(MooringAcousticsImportDataContext importDataContext) { + public DataMetadataProvider(C importDataContext) { String suffix = importDataContext.getConfiguration().getCellPositionReference().getMetadataNameSuffix(); Map<String, DataMetadata> dataMetadatasByName = importDataContext.getDataMetadatasByName(); radialNumberDataMetadata= dataMetadatasByName.get(DataMetadataImpl.RADIAL_NUMBER); diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportDataActionSupport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportDataActionSupport.java index 6850bef..0039f23 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportDataActionSupport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportDataActionSupport.java @@ -26,7 +26,6 @@ import fr.ifremer.echobase.entities.EchoBaseUser; import fr.ifremer.echobase.entities.EchoBaseUserEntityEnum; import fr.ifremer.echobase.entities.ImportFile; import fr.ifremer.echobase.entities.ImportFileId; -import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.data.Cell; import fr.ifremer.echobase.entities.data.Data; import fr.ifremer.echobase.entities.references.DataMetadata; diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportAction.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportAction.java index 7da4f6a..4aff897 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportAction.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportAction.java @@ -21,883 +21,41 @@ package fr.ifremer.echobase.services.service.importdata.actions; * #L% */ -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.EchoBaseUserEntityEnum; -import fr.ifremer.echobase.entities.ImportedCell; -import fr.ifremer.echobase.entities.data.Cell; -import fr.ifremer.echobase.entities.data.Data; -import fr.ifremer.echobase.entities.data.DataAcquisition; -import fr.ifremer.echobase.entities.data.DataProcessing; -import fr.ifremer.echobase.entities.data.Datas; -import fr.ifremer.echobase.entities.data.Mooring; -import fr.ifremer.echobase.entities.references.AcousticInstrument; -import fr.ifremer.echobase.entities.references.AcousticInstruments; -import fr.ifremer.echobase.entities.references.CellType; -import fr.ifremer.echobase.entities.references.DataMetadata; -import fr.ifremer.echobase.entities.references.DataMetadataImpl; -import fr.ifremer.echobase.entities.references.DataQuality; -import fr.ifremer.echobase.io.InputFile; -import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; -import fr.ifremer.echobase.services.service.importdata.DuplicatedEsduCellException; -import fr.ifremer.echobase.services.service.importdata.ElementaryCellWithoutDepthEndException; -import fr.ifremer.echobase.services.service.importdata.EsduCellNotFoundException; -import fr.ifremer.echobase.services.service.importdata.EsduCellWithDepthEndFilledException; -import fr.ifremer.echobase.services.service.importdata.ImportDataFileResult; +import fr.ifremer.echobase.entities.DataAcousticProvider; import fr.ifremer.echobase.services.service.importdata.configurations.MooringAcousticsImportConfiguration; import fr.ifremer.echobase.services.service.importdata.contexts.MooringAcousticsImportDataContext; -import fr.ifremer.echobase.services.service.importdata.csv.MooringAcousticImportExportModel; -import fr.ifremer.echobase.services.service.importdata.csv.MooringAcousticImportRow; -import org.apache.commons.collections4.CollectionUtils; +import fr.ifremer.echobase.services.service.importdata.csv.AcousticImportExportModel; +import fr.ifremer.echobase.services.service.importdata.csv.AcousticImportRow; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.csv.Import; -import org.nuiton.csv.ImportRuntimeException; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; /** * Do the import for acoustics data for the mooring. * * @author Julien Ruchaud - ruchaud@codelutin.com - * @since 0.5 + * @since 4.0 */ -public class MooringAcousticsImportAction extends MooringAcousticsImportDataActionSupport<MooringAcousticImportRow> { - +public class MooringAcousticsImportAction extends ImportAcousticsActionSupport<MooringAcousticsImportConfiguration, MooringAcousticsImportDataContext, AcousticImportRow> { /** Logger. */ private static final Log log = LogFactory.getLog(MooringAcousticsImportAction.class); - private final DateFormat cellDateFormat; - private final DataMetadataProvider dataMetadataProvider; - - private String lastEsduId; - public MooringAcousticsImportAction(MooringAcousticsImportDataContext importDataContext) { - super(importDataContext, importDataContext.getConfiguration().getMoviesFile()); - this.cellDateFormat = new SimpleDateFormat(EchoBaseCsvUtil.CELLULE_DATE_FORMAT); - this.dataMetadataProvider = new DataMetadataProvider(importDataContext); - } - - @Override - protected MooringAcousticImportExportModel createCsvImportModel(MooringAcousticsImportDataContext importDataContext) { - return MooringAcousticImportExportModel.forImport(importDataContext); + super(importDataContext); } @Override - protected MooringAcousticImportExportModel createCsvExportModel(MooringAcousticsImportDataContext importDataContext) { - return MooringAcousticImportExportModel.forExport(importDataContext); + protected AcousticImportExportModel createCsvImportModel(MooringAcousticsImportDataContext importDataContext) { + return AcousticImportExportModel.forImport(importDataContext); } @Override - protected void performImport(MooringAcousticsImportDataContext importDataContext, InputFile inputFile, ImportDataFileResult result) { - - if (log.isInfoEnabled()) { - log.info("Starts " + getImportMessage()); - } - - // get selected mooring - Mooring mooring = importDataContext.getMooring(); - - CellType esduCellType = importDataContext.getEsduCellType(); - CellType elementaryCellType = importDataContext.getElementaryCellType(); - - boolean addDataAcquisition = getConfiguration().isAddDataAcquisition(); - - List<Cell> elementaryCells = Lists.newArrayList(); - - Locale locale = getLocale(); - String dataProcessingId = null; - - String processingTemplate = getConfiguration().getProcessingTemplate(); - - try (Import<MooringAcousticImportRow> importer = open()) { - DataAcquisition dataAcquisition = null; - DataProcessing dataProcessing = null; - - Cell elementaryCell; - int rowNumber = 0; - - incrementsProgress(); - - Set<String> createdDataAcquisitions = Sets.newHashSet(); - - for (MooringAcousticImportRow row : importer) { - - doFlushTransaction(++rowNumber); - - if (dataProcessingId == null) { - - // compute once for all the common dataprocessing id used - // for hole the movies file - - dataProcessingId = row.getEiLayer() + processingTemplate; - } - - Date endDate = row.getCellDateEnd(); - - AcousticInstrument instrument = row.getAcousticInstrument(); - boolean isME70 = AcousticInstruments.IS_ACOUSTIC_INSTRUMENT_ME70.apply(instrument); - - if (dataAcquisition == null || !instrument.equals(dataAcquisition.getAcousticInstrument())) { - - // need to use another data acquisition - - if (log.isDebugEnabled()) { - log.debug("[row " + rowNumber + "] New instrument to use (" + instrument.getId() + ")"); - } - - if (CollectionUtils.isNotEmpty(elementaryCells)) { - - // means miss a esdu cell - // can not find correct transect - throw new EsduCellNotFoundException(locale, mooring, instrument, rowNumber); - } - - String softwareVersion = getSoftwareVersion(isME70); - - String soundSpeedCalculations = getSoundSpeedCalculations(isME70); - - // try to get existing data acquisition - dataAcquisition = getDataAcquisition(mooring, instrument, addDataAcquisition); - - if (dataAcquisition == null) { - - // need to create the data acquisition - dataAcquisition = createDataAcquisition(instrument, softwareVersion, soundSpeedCalculations, row); - - // collect id of the import - addId(result, EchoBaseUserEntityEnum.DataAcquisition, dataAcquisition, rowNumber); - createdDataAcquisitions.add(dataAcquisition.getTopiaId()); - - // add dataAcquisition to mooring - mooring.addDataAcquisition(dataAcquisition); - - if (log.isDebugEnabled()) { - log.debug("[row " + rowNumber + "] New dataAquisition to use (number: " + result.getNumberCreated(EchoBaseUserEntityEnum.DataAcquisition) + ")"); - } - - // create data processing - dataProcessing = createDataProcessing(dataProcessingId, softwareVersion, soundSpeedCalculations, row); - - if (log.isDebugEnabled()) { - log.debug("[row " + rowNumber + "] New dataProcessing to use (" + dataProcessing.getId() + ")"); - } - - addId(result, EchoBaseUserEntityEnum.DataProcessing, dataProcessing, rowNumber); - - // add it to data acquisition - dataAcquisition.addDataProcessing(dataProcessing); - } - } - - int cellType = row.getCellType(); - - String esduCellId = cellDateFormat.format(endDate); - - String previousLastEsduId = lastEsduId; - - if (lastEsduId == null || !lastEsduId.equals(esduCellId)) { - - lastEsduId = esduCellId; - // find a new esdu cell id - if (log.isDebugEnabled()) { - log.debug("row: " + rowNumber + " - detects new esduCellId:" + lastEsduId); - } - - } - - boolean isEsduCell = cellType == 4; - - if (isEsduCell) { - - if (!esduCellId.equals(previousLastEsduId)) { - - // This should not happen ? - if (log.isWarnEnabled()) { - log.warn("row: " + rowNumber + " A previous esduCellId was detected (" + previousLastEsduId + "); but the esdu id was never found."); - } - } - if (log.isDebugEnabled()) { - log.debug("row: " + rowNumber + " - found esdu cell:" + lastEsduId); - } - } - - if (row.getCellNasc() == null) { - - // dead cell not to be imported - - String id = rowNumber + " - " + cellType + " : " + esduCellId; - if (log.isWarnEnabled()) { - log.warn("Will not import cell of row " + id); - } - result.addNotImportedId(EchoBaseUserEntityEnum.Cell, id); - - continue; - - } - - addProcessedRow(result, row); - - DataQuality dataQuality = row.getDataQuality(); - - if (isEsduCell) { - - if (log.isDebugEnabled()) { - log.debug("[row " + rowNumber + "] Esdu cell (" + esduCellId + ")"); - } - - // check name does not exist - boolean exists = persistenceService.containsCellByName(esduCellId); - if (exists) { - throw new DuplicatedEsduCellException(getLocale(), rowNumber, esduCellId, mooring.getCode()); - } - - // this is a esdu cell row - - // create esdu cell - Cell esduCell = persistenceService.createCell(esduCellType, esduCellId, dataQuality); - - if (row.getCellDepthEnd() != null) { - throw new EsduCellWithDepthEndFilledException(getLocale(), esduCell, rowNumber); - } - - // add all found elementary cells - esduCell.addAllChilds(elementaryCells); - - // clear elementary cells - elementaryCells.clear(); - - addId(result, EchoBaseUserEntityEnum.Cell, esduCell, rowNumber); - - Preconditions.checkNotNull(dataProcessing); - - // add it to data processing - dataProcessing.addCell(esduCell); - - // create esdu cell data - createEsduCellData(esduCell, row, dataQuality, result, rowNumber); - - } else { - - // this is a elementary cell row - - int cellNum = row.getCellNum(); - - boolean surface = cellType == 0; - - String elementaryCellId = cellNum + (surface ? "S" : "B"); - - // check name does not exist - boolean exists = persistenceService.containsCellByName(elementaryCellId); - if (exists) { - //FIXME Revoir ça (See #2246) - if (log.isErrorEnabled()) { - log.error("Duplicated ElementaryCellException: " + rowNumber + " → " + elementaryCellId); - } -// throw new DuplicatedElementaryCellException(getLocale(), rowNumber, elementaryCellId, voyage.getName()); - } - if (log.isTraceEnabled()) { - log.trace("[row " + rowNumber + "] elementary cell (" + elementaryCellId + ")"); - } - - // create the elementary cell - elementaryCell = persistenceService.createCell(elementaryCellType, elementaryCellId, dataQuality); - - if (row.getCellDepthEnd() == null) { - throw new ElementaryCellWithoutDepthEndException(getLocale(), elementaryCell, rowNumber); - } - - // keep (to attach them to esdu cell) - elementaryCells.add(elementaryCell); - - addId(result, EchoBaseUserEntityEnum.Cell, elementaryCell, rowNumber); - - // create datas of the elementary cell - createElementaryCellData(elementaryCell, surface, row, dataQuality, result, rowNumber); - - } - - } - - } - + protected AcousticImportExportModel createCsvExportModel(MooringAcousticsImportDataContext importDataContext) { + return AcousticImportExportModel.forExport(importDataContext); } @Override - protected void computeImportedExport(MooringAcousticsImportDataContext importDataContext, ImportDataFileResult result) { - - String processingTemplate = getConfiguration().getProcessingTemplate(); - - CellType esduCellType = importDataContext.getEsduCellType(); - - List<Cell> elementaryCells = new LinkedList<>(); - - for (ImportedCell importedCell : persistenceService.getImportedAcousticCells(result.getImportFile())) { - - if (log.isInfoEnabled()) { - log.info("(Line :" + importedCell.getLineNumber() + " - Imported id: " + importedCell.getCell()); - } - - Cell cell = importedCell.getCell(); - - if (esduCellType.equals(cell.getCellType())) { - - if (log.isDebugEnabled()) { - log.debug("Esdu Cell created: " + cell); - } - - // flush previous esdu cell - flushImportedEsduCell(result, processingTemplate, importedCell.getDataAcquisition(), importedCell.getDataProcessing(), cell, elementaryCells); - elementaryCells.clear(); - - } else { - - if (log.isDebugEnabled()) { - log.debug("Elementary Cell created: " + cell); - } - - elementaryCells.add(cell); - - } - - } - - // Should not have any remaining elementary cells - Preconditions.checkState(elementaryCells.isEmpty()); - - } - - private Date formatDate(String date) { - try { - return cellDateFormat.parse(date); - } catch (ParseException e) { - throw new ImportRuntimeException("Can't parse cell date: " + date); - } - } - - private void flushImportedEsduCell(ImportDataFileResult result, String processingTemplate, DataAcquisition dataAcquisition, DataProcessing dataProcessing, Cell esduCell, List<Cell> elementaryCells) { - - Preconditions.checkArgument(!elementaryCells.isEmpty(), "cant have esdu with no elementary cells"); - - Preconditions.checkNotNull(dataAcquisition); - Preconditions.checkNotNull(dataProcessing); - - DataMetadata radialNumberDataMetadata = dataMetadataProvider.getRadialNumberDataMetadata(); - Preconditions.checkNotNull(radialNumberDataMetadata); - - MooringAcousticImportRow esduRow = MooringAcousticImportRow.ofEsduCell(processingTemplate, dataAcquisition, dataProcessing, esduCell, radialNumberDataMetadata); - - ImmutableMap<DataMetadata, Data> esduCellDataByMeta = Maps.uniqueIndex(esduCell.getData(), Datas.TO_DATA_METADATA); - - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getLatitudeDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellLatitude(Float.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getLongitudeDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellLongitude(Float.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getEsduStartDepthDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setEsduCellDataDepth(data.getDataValue()); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getDepthRefSurfaceStartDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellDepthStart(Float.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getTimeStartDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellDateStart(formatDate(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getTimeEndDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellDateEnd(formatDate(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getSurfaceDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellSurface(Integer.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getNascDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellNasc(Float.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getVolumeDataMetadata()); - if (data != null) { - esduRow.setCellVolume(Float.valueOf(data.getDataValue())); - } - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getNumberOfSamplesRecordedDataMetadata()); - if (data != null) { - esduRow.setCellNumberOfSamplesRecorded(Integer.valueOf(data.getDataValue())); - } - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getNumberOfSamplesEchoIntegratedDataMetadata()); - if (data != null) { - esduRow.setCellNumberOfSamplesEchoIntegrated(Integer.valueOf(data.getDataValue())); - } - } - - int esduRowCellNum = 0; - - for (Cell elementaryCell : elementaryCells) { - - MooringAcousticImportRow elementaryRow = MooringAcousticImportRow.ofElementaryCell(processingTemplate, dataAcquisition, dataProcessing, elementaryCell, radialNumberDataMetadata); - - ImmutableMap<DataMetadata, Data> elementaryCellDataByMeta = Maps.uniqueIndex(elementaryCell.getData(), Datas.TO_DATA_METADATA); - - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getLatitudeDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellLatitude(Float.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getLongitudeDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellLongitude(Float.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getDepthRefSurfaceStartDataMetadata()); - Preconditions.checkState(data == null, "Elementary cell can't use depthRefSurface dataMeta"); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getDepthRefEndDataMetadata(true)); - if (data == null) { - data = elementaryCellDataByMeta.get(dataMetadataProvider.getDepthRefEndDataMetadata(false)); - } - Preconditions.checkNotNull(data); - elementaryRow.setCellDepthEnd(Float.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getTimeStartDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellDateStart(formatDate(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getTimeEndDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellDateEnd(formatDate(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getSurfaceDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellSurface(Integer.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getNascDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellNasc(Float.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getVolumeDataMetadata()); - if (data != null) { - elementaryRow.setCellVolume(Float.valueOf(data.getDataValue())); - } - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getNumberOfSamplesRecordedDataMetadata()); - if (data != null) { - elementaryRow.setCellNumberOfSamplesRecorded(Integer.valueOf(data.getDataValue())); - } - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getNumberOfSamplesEchoIntegratedDataMetadata()); - if (data != null) { - elementaryRow.setCellNumberOfSamplesEchoIntegrated(Integer.valueOf(data.getDataValue())); - } - } - - elementaryRow.setEsduCellDataDepth(esduRow.getEsduCellDataDepth()); - - addImportedRow(result, elementaryRow); - - esduRowCellNum = elementaryRow.getCellNum() + 1; - - } - - esduRow.setCellNum(esduRowCellNum); - - addImportedRow(result, esduRow); - - } - - private DataAcquisition getDataAcquisition(Mooring mooring, AcousticInstrument instrument, boolean addDataAcquisition) { - - DataAcquisition result = null; - if (!addDataAcquisition && !mooring.isDataAcquisitionEmpty()) { - - // try to obtain an existing data acquisiton - - for (DataAcquisition acquisition : mooring.getDataAcquisition()) { - - if (instrument.equals(acquisition.getAcousticInstrument())) { - - // found a matching dataAcquisition from his acoustic instrument - result = acquisition; - break; - } - } - } - - return result; - - } - - private void createEsduCellData(Cell cell, - MooringAcousticImportRow row, - DataQuality dataQuality, - ImportDataFileResult importResult, - int rowNumber) { - - String dataValue; - - // create Latitude data - dataValue = String.valueOf(row.getCellLatitude()); - createCellData(cell, dataMetadataProvider.getLatitudeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Longitude data - dataValue = String.valueOf(row.getCellLongitude()); - createCellData(cell, dataMetadataProvider.getLongitudeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Depth data - dataValue = row.getEsduCellDataDepth(); - createCellData(cell, dataMetadataProvider.getEsduStartDepthDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create depth start data - dataValue = String.valueOf(row.getCellDepthStart()); - createCellData(cell, dataMetadataProvider.getDepthRefSurfaceStartDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Time Start data - dataValue = cellDateFormat.format(row.getCellDateStart()); - createCellData(cell, dataMetadataProvider.getTimeStartDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Time end data - dataValue = cellDateFormat.format(row.getCellDateEnd()); - createCellData(cell, dataMetadataProvider.getTimeEndDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Surface data - dataValue = String.valueOf(row.getCellSurface()); - createCellData(cell, dataMetadataProvider.getSurfaceDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create NASC data - dataValue = String.valueOf(row.getCellNasc()); - createCellData(cell, dataMetadataProvider.getNascDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Volume data - if (row.getCellVolume() != null) { - dataValue = String.valueOf(row.getCellVolume()); - createCellData(cell, dataMetadataProvider.getVolumeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create NumberOfSamplesRecorded data - if (row.getCellNumberOfSamplesRecorded() != null) { - dataValue = String.valueOf(row.getCellNumberOfSamplesRecorded()); - createCellData(cell, dataMetadataProvider.getNumberOfSamplesRecordedDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create NumberOfSamplesEchoIntegrated data - if (row.getCellNumberOfSamplesEchoIntegrated() != null) { - dataValue = String.valueOf(row.getCellNumberOfSamplesEchoIntegrated()); - createCellData(cell, dataMetadataProvider.getNumberOfSamplesEchoIntegratedDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create RadialNumber data - if (row.getLabel() != null) { - dataValue = row.getLabel(); - createCellData(cell, dataMetadataProvider.getRadialNumberDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - } - - private void createElementaryCellData(Cell cell, - boolean surface, - MooringAcousticImportRow row, - DataQuality dataQuality, - ImportDataFileResult importResult, - int rowNumber) { - - String dataValue; - - // create Latitude data - dataValue = String.valueOf(row.getCellLatitude()); - createCellData(cell, dataMetadataProvider.getLatitudeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Longitude data - dataValue = String.valueOf(row.getCellLongitude()); - createCellData(cell, dataMetadataProvider.getLongitudeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create depth end data - dataValue = String.valueOf(row.getCellDepthEnd()); - createCellData(cell, dataMetadataProvider.getDepthRefEndDataMetadata(surface), dataValue, dataQuality, importResult, false, rowNumber); - - // create Time Start data - dataValue = cellDateFormat.format(row.getCellDateStart()); - createCellData(cell, dataMetadataProvider.getTimeStartDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Time end data - dataValue = cellDateFormat.format(row.getCellDateEnd()); - createCellData(cell, dataMetadataProvider.getTimeEndDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Surface data - dataValue = String.valueOf(row.getCellSurface()); - createCellData(cell, dataMetadataProvider.getSurfaceDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create acoustic density data - dataValue = String.valueOf(row.getCellNasc()); - createCellData(cell, dataMetadataProvider.getNascDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Volume data - if (row.getCellVolume() != null) { - dataValue = String.valueOf(row.getCellVolume()); - createCellData(cell, dataMetadataProvider.getVolumeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create NumberOfSamplesRecorded data - if (row.getCellNumberOfSamplesRecorded() != null) { - dataValue = String.valueOf(row.getCellNumberOfSamplesRecorded()); - createCellData(cell, dataMetadataProvider.getNumberOfSamplesRecordedDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - // create NumberOfSamplesEchoIntegrated data - if (row.getCellNumberOfSamplesEchoIntegrated() != null) { - dataValue = String.valueOf(row.getCellNumberOfSamplesEchoIntegrated()); - createCellData(cell, dataMetadataProvider.getNumberOfSamplesEchoIntegratedDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create RadialNumber data - if (row.getLabel() != null) { - dataValue = row.getLabel(); - createCellData(cell, dataMetadataProvider.getRadialNumberDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - } - - private DataAcquisition createDataAcquisition(AcousticInstrument instrument, - String softwareVersion, - String soundSpeedCalculations, - MooringAcousticImportRow row) { - - MooringAcousticsImportConfiguration configuration = getConfiguration(); - - String transceiverAcquisitionAbsorptionDescription = configuration.getTransceiverAcquisitionAbsorptionDescription(); - String loggedDataFormat = configuration.getLoggedDataFormat(); - String loggedDataDatatype = configuration.getLoggedDataDatatype(); - String pingDutyCycle = configuration.getPingDutyCycle(); - - DataAcquisition dataAcquisition = getPersistenceService().createDataAcquisition(instrument); - - // fill from manual configuration - dataAcquisition.setTransceiverAcquisitionAbsorptionDescription(transceiverAcquisitionAbsorptionDescription); - dataAcquisition.setAcquisitionSoftwareVersion(softwareVersion); - dataAcquisition.setLoggedDataFormat(loggedDataFormat); - dataAcquisition.setLoggedDataDatatype(loggedDataDatatype); - dataAcquisition.setPingDutyCycle(pingDutyCycle); - dataAcquisition.setEchosounderSoundSpeed(row.getSoundCelerity()); - dataAcquisition.setSoundSpeedCalculations(soundSpeedCalculations); - - // fill from csv file - float transceiverAcquisitionAbsorption = row.getTransceiverAcquisitionAbsorption(); - float transducerAcquisitionBeamAngleAthwartship = row.getTransducerAcquisitionBeamAngleAthwartship(); - float transducerAcquisitionBeamAngleAlongship = row.getTransducerAcquisitionBeamAngleAlongship(); - float transducerAcquisitionPsi = row.getTransducerAcquisitionPsi(); - float transceiverAcquisitionPower = row.getTransceiverAcquisitionPower(); - float transceiverAcquisitionPulseLength = row.getTransceiverAcquisitionPulseLength(); - float transceiverAcquisitionGain = row.getTransceiverAcquisitionGain(); - float transceiverAcquisitionSacorrection = row.getTransceiverAcquisitionSacorrection(); - - dataAcquisition.setTransceiverAcquisitionAbsorption(transceiverAcquisitionAbsorption); - dataAcquisition.setTransducerAcquisitionBeamAngleAthwartship(transducerAcquisitionBeamAngleAthwartship); - dataAcquisition.setTransducerAcquisitionBeamAngleAlongship(transducerAcquisitionBeamAngleAlongship); - dataAcquisition.setTransducerAcquisitionPsi(transducerAcquisitionPsi); - dataAcquisition.setTransceiverAcquisitionPower(transceiverAcquisitionPower); - dataAcquisition.setTransceiverAcquisitionPulseLength(transceiverAcquisitionPulseLength); - dataAcquisition.setTransceiverAcquisitionGain(transceiverAcquisitionGain); - dataAcquisition.setTransceiverAcquisitionSacorrection(transceiverAcquisitionSacorrection); - - return dataAcquisition; + protected DataAcousticProvider getDataProvider(MooringAcousticsImportDataContext importDataContext, AcousticImportRow row, int rowNumber) { + return (DataAcousticProvider) importDataContext.getMooring(); } - - private DataProcessing createDataProcessing(String id, - String softwareVersion, - String soundSpeedCalculations, - MooringAcousticImportRow row) { - - MooringAcousticsImportConfiguration configuration = getConfiguration(); - - String transceiverAcquisitionAbsorptionDescription = configuration.getTransceiverAcquisitionAbsorptionDescription(); - String processingTemplate = configuration.getProcessingTemplate(); - String processingDescription = configuration.getProcessingDescription(); - String sounderConstant = configuration.getSounderConstant(); - float digitThreshold = configuration.getDigitThreshold(); - String acousticDensityUnit = configuration.getAcousticDensityUnit(); - String notes = configuration.getNotes(); - - DataProcessing dataProcessing = getPersistenceService().createDataProcessing(id, processingTemplate); - - // fill from manual configuration - dataProcessing.setProcessingDescription(processingDescription); - dataProcessing.setSounderConstant(sounderConstant); - dataProcessing.setDigitThreshold(digitThreshold); - dataProcessing.setAcousticDensityUnit(acousticDensityUnit); - dataProcessing.setNotes(notes); - dataProcessing.setProcessingSoftwareVersion(softwareVersion); - dataProcessing.setTransceiverProcessingAbsorptionDescription(transceiverAcquisitionAbsorptionDescription); - dataProcessing.setEchosounderSoundSpeed(row.getSoundCelerity()); - dataProcessing.setSoundSpeedCalculations(soundSpeedCalculations); - - // fill from csv file - - float transceiverAcquisitionAbsorption = row.getTransceiverAcquisitionAbsorption(); - float transducerAcquisitionBeamAngleAthwartship = row.getTransducerAcquisitionBeamAngleAthwartship(); - float transducerAcquisitionBeamAngleAlongship = row.getTransducerAcquisitionBeamAngleAlongship(); - float transducerAcquisitionPsi = row.getTransducerAcquisitionPsi(); - float transceiverAcquisitionGain = row.getTransceiverAcquisitionGain(); - float transceiverAcquisitionSacorrection = row.getTransceiverAcquisitionSacorrection(); - int eIThresholdLow = row.geteIThresholdLow(); - int eIThresholdHigh = row.geteIThresholdHigh(); - - dataProcessing.seteIThresholdLow(eIThresholdLow); - dataProcessing.seteIThresholdHigh(eIThresholdHigh); - dataProcessing.setTransceiverProcessingSacorrection(transceiverAcquisitionSacorrection); - dataProcessing.setTransceiverProcessingAbsorption(transceiverAcquisitionAbsorption); - dataProcessing.setTransceiverProcessingGain(transceiverAcquisitionGain); - dataProcessing.setTransducerProcessingPsi(transducerAcquisitionPsi); - dataProcessing.setTransducerProcessingBeamAngleAthwartship(transducerAcquisitionBeamAngleAthwartship); - dataProcessing.setTransducerProcessingBeamAngleAlongship(transducerAcquisitionBeamAngleAlongship); - - return dataProcessing; - } - - private String getSoftwareVersion(boolean isME70) { - String result; - if (isME70) { - result = getConfiguration().getAcquisitionSoftwareVersionME70(); - } else { - result = getConfiguration().getAcquisitionSoftwareVersionER60(); - } - return result; - } - - private String getSoundSpeedCalculations(boolean isME70) { - String result; - if (isME70) { - result = getConfiguration().getSoundSpeedCalculationsME70(); - } else { - result = getConfiguration().getSoundSpeedCalculationsER60(); - } - return result; - } - - public static class DataMetadataProvider { - - private final DataMetadata radialNumberDataMetadata; - private final DataMetadata latitudeDataMetadata; - private final DataMetadata longitudeDataMetadata; - private final DataMetadata esduStartDepthDataMetadata; - private final DataMetadata timeStartDataMetadata; - private final DataMetadata timeEndDataMetadata; - private final DataMetadata nascDataMetadata; - private final DataMetadata volumeDataMetadata; - private final DataMetadata surfaceDataMetadata; - private final DataMetadata numberOfSamplesRecordedDataMetadata; - private final DataMetadata numberOfSamplesEchoIntegratedDataMetadata; - private final DataMetadata depthRefSurfaceStartDataMetadata; - private final DataMetadata depthRefSurfaceEndDataMetadata; - // private final DataMetadata depthRefBottomStartDataMetadata; - private final DataMetadata depthRefBottomEndDataMetadata; - - public DataMetadataProvider(MooringAcousticsImportDataContext importDataContext) { - String suffix = importDataContext.getConfiguration().getCellPositionReference().getMetadataNameSuffix(); - Map<String, DataMetadata> dataMetadatasByName = importDataContext.getDataMetadatasByName(); - radialNumberDataMetadata= dataMetadatasByName.get(DataMetadataImpl.RADIAL_NUMBER); - latitudeDataMetadata = dataMetadatasByName.get("Latitude" + suffix); - longitudeDataMetadata = dataMetadatasByName.get("Longitude" + suffix); - esduStartDepthDataMetadata = dataMetadatasByName.get("ESDUstartDepth"); - timeStartDataMetadata = dataMetadatasByName.get("TimeStart"); - timeEndDataMetadata = dataMetadatasByName.get("TimeEnd"); - nascDataMetadata = dataMetadatasByName.get("NASC"); - volumeDataMetadata = dataMetadatasByName.get("Volume"); - surfaceDataMetadata = dataMetadatasByName.get("Surface"); - numberOfSamplesRecordedDataMetadata = dataMetadatasByName.get("NumberOfSamplesRecorded"); - numberOfSamplesEchoIntegratedDataMetadata = dataMetadatasByName.get("NumberOfSamplesEchoIntegrated"); - depthRefSurfaceStartDataMetadata = dataMetadatasByName.get("DepthRefSurfaceStart"); - depthRefSurfaceEndDataMetadata = dataMetadatasByName.get("DepthRefSurfaceEnd"); -// depthRefBottomStartDataMetadata = dataMetadatasByName.get("DepthRefBottomStart"); - depthRefBottomEndDataMetadata = dataMetadatasByName.get("DepthRefBottomEnd"); - } - - public DataMetadata getRadialNumberDataMetadata() { - return radialNumberDataMetadata; - } - - public DataMetadata getLatitudeDataMetadata() { - return latitudeDataMetadata; - } - - public DataMetadata getLongitudeDataMetadata() { - return longitudeDataMetadata; - } - - public DataMetadata getEsduStartDepthDataMetadata() { - return esduStartDepthDataMetadata; - } - - public DataMetadata getTimeStartDataMetadata() { - return timeStartDataMetadata; - } - - public DataMetadata getTimeEndDataMetadata() { - return timeEndDataMetadata; - } - - public DataMetadata getNascDataMetadata() { - return nascDataMetadata; - } - - public DataMetadata getVolumeDataMetadata() { - return volumeDataMetadata; - } - - public DataMetadata getSurfaceDataMetadata() { - return surfaceDataMetadata; - } - - public DataMetadata getNumberOfSamplesRecordedDataMetadata() { - return numberOfSamplesRecordedDataMetadata; - } - - public DataMetadata getNumberOfSamplesEchoIntegratedDataMetadata() { - return numberOfSamplesEchoIntegratedDataMetadata; - } - - public DataMetadata getDepthRefSurfaceStartDataMetadata() { - return depthRefSurfaceStartDataMetadata; - } - - public DataMetadata getDepthRefEndDataMetadata(boolean surface) { - return surface ? depthRefSurfaceEndDataMetadata : depthRefBottomEndDataMetadata; - } - - } - + } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportDataActionSupport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportDataActionSupport.java deleted file mode 100644 index 8821d01..0000000 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/MooringAcousticsImportDataActionSupport.java +++ /dev/null @@ -1,38 +0,0 @@ -package fr.ifremer.echobase.services.service.importdata.actions; - -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2016 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import fr.ifremer.echobase.io.InputFile; -import fr.ifremer.echobase.services.service.importdata.configurations.MooringAcousticsImportConfiguration; -import fr.ifremer.echobase.services.service.importdata.contexts.MooringAcousticsImportDataContext; - -/** - * @author Julien Ruchaud - ruchaud@codelutin.com - * @since 0.5 - */ -public abstract class MooringAcousticsImportDataActionSupport<E> extends ImportDataActionSupport<MooringAcousticsImportConfiguration, MooringAcousticsImportDataContext, E> { - - protected MooringAcousticsImportDataActionSupport(MooringAcousticsImportDataContext importDataContext, InputFile inputFile) { - super(importDataContext, inputFile); - } - -} diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/VoyageAcousticsImportAction.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/VoyageAcousticsImportAction.java index f2049e6..6a82c50 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/VoyageAcousticsImportAction.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/VoyageAcousticsImportAction.java @@ -21,56 +21,21 @@ package fr.ifremer.echobase.services.service.importdata.actions; * #L% */ -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.EchoBaseUserEntityEnum; -import fr.ifremer.echobase.entities.ImportedCell; -import fr.ifremer.echobase.entities.data.Cell; -import fr.ifremer.echobase.entities.data.Data; -import fr.ifremer.echobase.entities.data.DataAcquisition; -import fr.ifremer.echobase.entities.data.DataProcessing; -import fr.ifremer.echobase.entities.data.Datas; +import fr.ifremer.echobase.entities.DataAcousticProvider; import fr.ifremer.echobase.entities.data.Transect; import fr.ifremer.echobase.entities.data.Transit; import fr.ifremer.echobase.entities.data.Voyage; -import fr.ifremer.echobase.entities.references.AcousticInstrument; -import fr.ifremer.echobase.entities.references.AcousticInstruments; -import fr.ifremer.echobase.entities.references.CellType; -import fr.ifremer.echobase.entities.references.DataMetadata; -import fr.ifremer.echobase.entities.references.DataMetadataImpl; -import fr.ifremer.echobase.entities.references.DataQuality; import fr.ifremer.echobase.entities.references.Vessel; -import fr.ifremer.echobase.io.InputFile; -import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; -import fr.ifremer.echobase.services.service.importdata.DuplicatedEsduCellException; -import fr.ifremer.echobase.services.service.importdata.ElementaryCellWithoutDepthEndException; -import fr.ifremer.echobase.services.service.importdata.EsduCellNotFoundException; -import fr.ifremer.echobase.services.service.importdata.EsduCellWithDepthEndFilledException; -import fr.ifremer.echobase.services.service.importdata.ImportDataFileResult; import fr.ifremer.echobase.services.service.importdata.TransectNotFoundException; import fr.ifremer.echobase.services.service.importdata.TransitNotFoundException; import fr.ifremer.echobase.services.service.importdata.configurations.VoyageAcousticsImportConfiguration; import fr.ifremer.echobase.services.service.importdata.contexts.VoyageAcousticsImportDataContext; -import fr.ifremer.echobase.services.service.importdata.csv.VoyageAcousticImportExportModel; -import fr.ifremer.echobase.services.service.importdata.csv.VoyageAcousticImportRow; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.csv.Import; -import org.nuiton.csv.ImportRuntimeException; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; +import fr.ifremer.echobase.services.service.importdata.csv.AcousticImportExportModel; +import fr.ifremer.echobase.services.service.importdata.csv.AcousticImportRow; import java.util.Date; -import java.util.LinkedList; -import java.util.List; import java.util.Locale; -import java.util.Map; -import java.util.Set; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * Created on 25/03/16. @@ -78,851 +43,47 @@ import java.util.Set; * @author Tony Chemit - chemit@codelutin.com * @since 4.0 */ -public class VoyageAcousticsImportAction extends VoyageAcousticsImportDataActionSupport<VoyageAcousticImportRow> { +public class VoyageAcousticsImportAction extends ImportAcousticsActionSupport<VoyageAcousticsImportConfiguration, VoyageAcousticsImportDataContext, AcousticImportRow> { /** Logger. */ private static final Log log = LogFactory.getLog(VoyageAcousticsImportAction.class); - private final DateFormat cellDateFormat; - private final DataMetadataProvider dataMetadataProvider; - - private String lastEsduId; - public VoyageAcousticsImportAction(VoyageAcousticsImportDataContext importDataContext) { - super(importDataContext, importDataContext.getConfiguration().getMoviesFile()); - this.cellDateFormat = new SimpleDateFormat(EchoBaseCsvUtil.CELLULE_DATE_FORMAT); - this.dataMetadataProvider = new DataMetadataProvider(importDataContext); + super(importDataContext); } @Override - protected VoyageAcousticImportExportModel createCsvImportModel(VoyageAcousticsImportDataContext importDataContext) { - return VoyageAcousticImportExportModel.forImport(importDataContext); + protected AcousticImportExportModel createCsvImportModel(VoyageAcousticsImportDataContext importDataContext) { + return AcousticImportExportModel.forImport(importDataContext); } @Override - protected VoyageAcousticImportExportModel createCsvExportModel(VoyageAcousticsImportDataContext importDataContext) { - return VoyageAcousticImportExportModel.forExport(importDataContext); + protected AcousticImportExportModel createCsvExportModel(VoyageAcousticsImportDataContext importDataContext) { + return AcousticImportExportModel.forExport(importDataContext); } - @Override - protected void performImport(VoyageAcousticsImportDataContext importDataContext, InputFile inputFile, ImportDataFileResult result) { - - if (log.isInfoEnabled()) { - log.info("Starts " + getImportMessage()); - } - - // get selected voyage - Voyage voyage = importDataContext.getVoyage(); - - // get selected vessel - Vessel vessel = persistenceService.getVessel(importDataContext.getConfiguration().getVesselId()); - - CellType esduCellType = importDataContext.getEsduCellType(); - CellType elementaryCellType = importDataContext.getElementaryCellType(); - - boolean addDataAcquisition = getConfiguration().isAddDataAcquisition(); - - List<Cell> elementaryCells = Lists.newArrayList(); - + protected DataAcousticProvider getDataProvider(VoyageAcousticsImportDataContext importDataContext, AcousticImportRow row, int rowNumber) { Locale locale = getLocale(); - String dataProcessingId = null; - - String processingTemplate = getConfiguration().getProcessingTemplate(); - - try (Import<VoyageAcousticImportRow> importer = open()) { - DataAcquisition dataAcquisition = null; - DataProcessing dataProcessing = null; - - Cell elementaryCell; - int rowNumber = 0; - - incrementsProgress(); - - Set<String> createdDataAcquisitions = Sets.newHashSet(); - - for (VoyageAcousticImportRow row : importer) { - - doFlushTransaction(++rowNumber); - - if (dataProcessingId == null) { - - // compute once for all the common dataprocessing id used - // for hole the movies file - - dataProcessingId = row.getEiLayer() + processingTemplate; - } - - Date startDate = row.getCellDateStart(); - Date endDate = row.getCellDateEnd(); - - // get transect to use - Transit transit = voyage.getTransit(startDate); - if (transit == null) { - - // can not find correct transit - throw new TransitNotFoundException(locale, voyage, startDate, rowNumber); - } - - Transect transect = transit.getTransect(vessel); - if (transect == null) { - - // can not find correct transect - throw new TransectNotFoundException(locale, voyage, vessel, startDate, rowNumber); - } - - AcousticInstrument instrument = row.getAcousticInstrument(); - boolean isME70 = AcousticInstruments.IS_ACOUSTIC_INSTRUMENT_ME70.apply(instrument); - - if (dataAcquisition == null || !instrument.equals(dataAcquisition.getAcousticInstrument())) { - - // need to use another data acquisition - - if (log.isDebugEnabled()) { - log.debug("[row " + rowNumber + "] New instrument to use (" + instrument.getId() + ")"); - } - - if (CollectionUtils.isNotEmpty(elementaryCells)) { - - // means miss a esdu cell - // can not find correct transect - throw new EsduCellNotFoundException(locale, voyage, vessel, instrument, rowNumber); - } - - String softwareVersion = getSoftwareVersion(isME70); - - String soundSpeedCalculations = getSoundSpeedCalculations(isME70); - - // try to get existing data acquisition - dataAcquisition = getDataAcquisition(transect, instrument, addDataAcquisition); - - if (dataAcquisition == null) { - - // need to create the data acquisition - dataAcquisition = createDataAcquisition(instrument, softwareVersion, soundSpeedCalculations, row); - - // collect id of the import - addId(result, EchoBaseUserEntityEnum.DataAcquisition, dataAcquisition, rowNumber); - createdDataAcquisitions.add(dataAcquisition.getTopiaId()); - - // add dataAcquisition to transect - transect.addDataAcquisition(dataAcquisition); - - if (log.isDebugEnabled()) { - log.debug("[row " + rowNumber + "] New dataAquisition to use (number: " + result.getNumberCreated(EchoBaseUserEntityEnum.DataAcquisition) + ")"); - } - - // create data processing - dataProcessing = createDataProcessing(dataProcessingId, softwareVersion, soundSpeedCalculations, row); - - if (log.isDebugEnabled()) { - log.debug("[row " + rowNumber + "] New dataProcessing to use (" + dataProcessing.getId() + ")"); - } - - addId(result, EchoBaseUserEntityEnum.DataProcessing, dataProcessing, rowNumber); - - // add it to data acquisition - dataAcquisition.addDataProcessing(dataProcessing); - } - } - - int cellType = row.getCellType(); - - String esduCellId = cellDateFormat.format(endDate); - - String previousLastEsduId = lastEsduId; - - if (lastEsduId == null || !lastEsduId.equals(esduCellId)) { - - lastEsduId = esduCellId; - // find a new esdu cell id - if (log.isDebugEnabled()) { - log.debug("row: " + rowNumber + " - detects new esduCellId:" + lastEsduId); - } - - } - - boolean isEsduCell = cellType == 4; - - if (isEsduCell) { - - if (!esduCellId.equals(previousLastEsduId)) { - - // This should not happen ? - if (log.isWarnEnabled()) { - log.warn("row: " + rowNumber + " A previous esduCellId was detected (" + previousLastEsduId + "); but the esdu id was never found."); - } - } - if (log.isDebugEnabled()) { - log.debug("row: " + rowNumber + " - found esdu cell:" + lastEsduId); - } - } - - if (row.getCellNasc() == null) { - - // dead cell not to be imported - - String id = rowNumber + " - " + cellType + " : " + esduCellId; - if (log.isWarnEnabled()) { - log.warn("Will not import cell of row " + id); - } - result.addNotImportedId(EchoBaseUserEntityEnum.Cell, id); - - continue; - - } - - addProcessedRow(result, row); - - DataQuality dataQuality = row.getDataQuality(); - - if (isEsduCell) { - - if (log.isDebugEnabled()) { - log.debug("[row " + rowNumber + "] Esdu cell (" + esduCellId + ")"); - } - - // check name does not exist - boolean exists = persistenceService.containsCellByName(esduCellId); - if (exists) { - throw new DuplicatedEsduCellException(getLocale(), rowNumber, esduCellId, voyage.getName()); - } - - // this is a esdu cell row - - // create esdu cell - Cell esduCell = persistenceService.createCell(esduCellType, esduCellId, dataQuality); - - if (row.getCellDepthEnd() != null) { - throw new EsduCellWithDepthEndFilledException(getLocale(), esduCell, rowNumber); - } - - // add all found elementary cells - esduCell.addAllChilds(elementaryCells); - - // clear elementary cells - elementaryCells.clear(); - - addId(result, EchoBaseUserEntityEnum.Cell, esduCell, rowNumber); - - Preconditions.checkNotNull(dataProcessing); - - // add it to data processing - dataProcessing.addCell(esduCell); - - // create esdu cell data - createEsduCellData(esduCell, row, dataQuality, result, rowNumber); - - } else { - - // this is a elementary cell row - - int cellNum = row.getCellNum(); - - boolean surface = cellType == 0; - - String elementaryCellId = cellNum + (surface ? "S" : "B"); - - // check name does not exist - boolean exists = persistenceService.containsCellByName(elementaryCellId); - if (exists) { - //FIXME Revoir ça (See #2246) - if (log.isErrorEnabled()) { - log.error("Duplicated ElementaryCellException: " + rowNumber + " → " + elementaryCellId); - } -// throw new DuplicatedElementaryCellException(getLocale(), rowNumber, elementaryCellId, voyage.getName()); - } - if (log.isTraceEnabled()) { - log.trace("[row " + rowNumber + "] elementary cell (" + elementaryCellId + ")"); - } - - // create the elementary cell - elementaryCell = persistenceService.createCell(elementaryCellType, elementaryCellId, dataQuality); - - if (row.getCellDepthEnd() == null) { - throw new ElementaryCellWithoutDepthEndException(getLocale(), elementaryCell, rowNumber); - } - - // keep (to attach them to esdu cell) - elementaryCells.add(elementaryCell); - - addId(result, EchoBaseUserEntityEnum.Cell, elementaryCell, rowNumber); - - // create datas of the elementary cell - createElementaryCellData(elementaryCell, surface, row, dataQuality, result, rowNumber); - - } - - } - - } - - } - - @Override - protected void computeImportedExport(VoyageAcousticsImportDataContext importDataContext, ImportDataFileResult result) { - - String processingTemplate = getConfiguration().getProcessingTemplate(); - - CellType esduCellType = importDataContext.getEsduCellType(); - - List<Cell> elementaryCells = new LinkedList<>(); - - for (ImportedCell importedCell : persistenceService.getImportedAcousticCells(result.getImportFile())) { - - if (log.isInfoEnabled()) { - log.info("(Line :" + importedCell.getLineNumber() + " - Imported id: " + importedCell.getCell()); - } - - Cell cell = importedCell.getCell(); - - if (esduCellType.equals(cell.getCellType())) { - - if (log.isDebugEnabled()) { - log.debug("Esdu Cell created: " + cell); - } - - // flush previous esdu cell - flushImportedEsduCell(result, processingTemplate, importedCell.getDataAcquisition(), importedCell.getDataProcessing(), cell, elementaryCells); - elementaryCells.clear(); - - } else { - - if (log.isDebugEnabled()) { - log.debug("Elementary Cell created: " + cell); - } - - elementaryCells.add(cell); - - } - - } - - // Should not have any remaining elementary cells - Preconditions.checkState(elementaryCells.isEmpty()); - - } - - private Date formatDate(String date) { - try { - return cellDateFormat.parse(date); - } catch (ParseException e) { - throw new ImportRuntimeException("Can't parse cell date: " + date); - } - } - - private void flushImportedEsduCell(ImportDataFileResult result, String processingTemplate, DataAcquisition dataAcquisition, DataProcessing dataProcessing, Cell esduCell, List<Cell> elementaryCells) { - - Preconditions.checkArgument(!elementaryCells.isEmpty(), "cant have esdu with no elementary cells"); - - Preconditions.checkNotNull(dataAcquisition); - Preconditions.checkNotNull(dataProcessing); - - DataMetadata radialNumberDataMetadata = dataMetadataProvider.getRadialNumberDataMetadata(); - Preconditions.checkNotNull(radialNumberDataMetadata); - - VoyageAcousticImportRow esduRow = VoyageAcousticImportRow.ofEsduCell(processingTemplate, dataAcquisition, dataProcessing, esduCell, radialNumberDataMetadata); - - ImmutableMap<DataMetadata, Data> esduCellDataByMeta = Maps.uniqueIndex(esduCell.getData(), Datas.TO_DATA_METADATA); - - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getLatitudeDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellLatitude(Float.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getLongitudeDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellLongitude(Float.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getEsduStartDepthDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setEsduCellDataDepth(data.getDataValue()); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getDepthRefSurfaceStartDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellDepthStart(Float.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getTimeStartDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellDateStart(formatDate(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getTimeEndDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellDateEnd(formatDate(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getSurfaceDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellSurface(Integer.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getNascDataMetadata()); - Preconditions.checkNotNull(data); - esduRow.setCellNasc(Float.valueOf(data.getDataValue())); - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getVolumeDataMetadata()); - if (data != null) { - esduRow.setCellVolume(Float.valueOf(data.getDataValue())); - } - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getNumberOfSamplesRecordedDataMetadata()); - if (data != null) { - esduRow.setCellNumberOfSamplesRecorded(Integer.valueOf(data.getDataValue())); - } - } - { - Data data = esduCellDataByMeta.get(dataMetadataProvider.getNumberOfSamplesEchoIntegratedDataMetadata()); - if (data != null) { - esduRow.setCellNumberOfSamplesEchoIntegrated(Integer.valueOf(data.getDataValue())); - } - } - - int esduRowCellNum = 0; - - for (Cell elementaryCell : elementaryCells) { - - VoyageAcousticImportRow elementaryRow = VoyageAcousticImportRow.ofElementaryCell(processingTemplate, dataAcquisition, dataProcessing, elementaryCell, radialNumberDataMetadata); - - ImmutableMap<DataMetadata, Data> elementaryCellDataByMeta = Maps.uniqueIndex(elementaryCell.getData(), Datas.TO_DATA_METADATA); - - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getLatitudeDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellLatitude(Float.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getLongitudeDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellLongitude(Float.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getDepthRefSurfaceStartDataMetadata()); - Preconditions.checkState(data == null, "Elementary cell can't use depthRefSurface dataMeta"); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getDepthRefEndDataMetadata(true)); - if (data == null) { - data = elementaryCellDataByMeta.get(dataMetadataProvider.getDepthRefEndDataMetadata(false)); - } - Preconditions.checkNotNull(data); - elementaryRow.setCellDepthEnd(Float.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getTimeStartDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellDateStart(formatDate(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getTimeEndDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellDateEnd(formatDate(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getSurfaceDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellSurface(Integer.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getNascDataMetadata()); - Preconditions.checkNotNull(data); - elementaryRow.setCellNasc(Float.valueOf(data.getDataValue())); - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getVolumeDataMetadata()); - if (data != null) { - elementaryRow.setCellVolume(Float.valueOf(data.getDataValue())); - } - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getNumberOfSamplesRecordedDataMetadata()); - if (data != null) { - elementaryRow.setCellNumberOfSamplesRecorded(Integer.valueOf(data.getDataValue())); - } - } - { - Data data = elementaryCellDataByMeta.get(dataMetadataProvider.getNumberOfSamplesEchoIntegratedDataMetadata()); - if (data != null) { - elementaryRow.setCellNumberOfSamplesEchoIntegrated(Integer.valueOf(data.getDataValue())); - } - } - - elementaryRow.setEsduCellDataDepth(esduRow.getEsduCellDataDepth()); - - addImportedRow(result, elementaryRow); - - esduRowCellNum = elementaryRow.getCellNum() + 1; - - } - - esduRow.setCellNum(esduRowCellNum); - - addImportedRow(result, esduRow); - - } - - private DataAcquisition getDataAcquisition(Transect transect, AcousticInstrument instrument, boolean addDataAcquisition) { - - DataAcquisition result = null; - if (!addDataAcquisition && !transect.isDataAcquisitionEmpty()) { - - // try to obtain an existing data acquisiton - - for (DataAcquisition acquisition : transect.getDataAcquisition()) { - - if (instrument.equals(acquisition.getAcousticInstrument())) { - - // found a matching dataAcquisition from his acoustic instrument - result = acquisition; - break; - } - } - } - - return result; - - } - - private void createEsduCellData(Cell cell, - VoyageAcousticImportRow row, - DataQuality dataQuality, - ImportDataFileResult importResult, - int rowNumber) { - - String dataValue; - - // create Latitude data - dataValue = String.valueOf(row.getCellLatitude()); - createCellData(cell, dataMetadataProvider.getLatitudeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Longitude data - dataValue = String.valueOf(row.getCellLongitude()); - createCellData(cell, dataMetadataProvider.getLongitudeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Depth data - dataValue = row.getEsduCellDataDepth(); - createCellData(cell, dataMetadataProvider.getEsduStartDepthDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create depth start data - dataValue = String.valueOf(row.getCellDepthStart()); - createCellData(cell, dataMetadataProvider.getDepthRefSurfaceStartDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Time Start data - dataValue = cellDateFormat.format(row.getCellDateStart()); - createCellData(cell, dataMetadataProvider.getTimeStartDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Time end data - dataValue = cellDateFormat.format(row.getCellDateEnd()); - createCellData(cell, dataMetadataProvider.getTimeEndDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Surface data - dataValue = String.valueOf(row.getCellSurface()); - createCellData(cell, dataMetadataProvider.getSurfaceDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create NASC data - dataValue = String.valueOf(row.getCellNasc()); - createCellData(cell, dataMetadataProvider.getNascDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Volume data - if (row.getCellVolume() != null) { - dataValue = String.valueOf(row.getCellVolume()); - createCellData(cell, dataMetadataProvider.getVolumeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create NumberOfSamplesRecorded data - if (row.getCellNumberOfSamplesRecorded() != null) { - dataValue = String.valueOf(row.getCellNumberOfSamplesRecorded()); - createCellData(cell, dataMetadataProvider.getNumberOfSamplesRecordedDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create NumberOfSamplesEchoIntegrated data - if (row.getCellNumberOfSamplesEchoIntegrated() != null) { - dataValue = String.valueOf(row.getCellNumberOfSamplesEchoIntegrated()); - createCellData(cell, dataMetadataProvider.getNumberOfSamplesEchoIntegratedDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create RadialNumber data - if (row.getLabel() != null) { - dataValue = row.getLabel(); - createCellData(cell, dataMetadataProvider.getRadialNumberDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - } - - private void createElementaryCellData(Cell cell, - boolean surface, - VoyageAcousticImportRow row, - DataQuality dataQuality, - ImportDataFileResult importResult, - int rowNumber) { - - String dataValue; - - // create Latitude data - dataValue = String.valueOf(row.getCellLatitude()); - createCellData(cell, dataMetadataProvider.getLatitudeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Longitude data - dataValue = String.valueOf(row.getCellLongitude()); - createCellData(cell, dataMetadataProvider.getLongitudeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create depth end data - dataValue = String.valueOf(row.getCellDepthEnd()); - createCellData(cell, dataMetadataProvider.getDepthRefEndDataMetadata(surface), dataValue, dataQuality, importResult, false, rowNumber); - - // create Time Start data - dataValue = cellDateFormat.format(row.getCellDateStart()); - createCellData(cell, dataMetadataProvider.getTimeStartDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Time end data - dataValue = cellDateFormat.format(row.getCellDateEnd()); - createCellData(cell, dataMetadataProvider.getTimeEndDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Surface data - dataValue = String.valueOf(row.getCellSurface()); - createCellData(cell, dataMetadataProvider.getSurfaceDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create acoustic density data - dataValue = String.valueOf(row.getCellNasc()); - createCellData(cell, dataMetadataProvider.getNascDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - - // create Volume data - if (row.getCellVolume() != null) { - dataValue = String.valueOf(row.getCellVolume()); - createCellData(cell, dataMetadataProvider.getVolumeDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create NumberOfSamplesRecorded data - if (row.getCellNumberOfSamplesRecorded() != null) { - dataValue = String.valueOf(row.getCellNumberOfSamplesRecorded()); - createCellData(cell, dataMetadataProvider.getNumberOfSamplesRecordedDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - // create NumberOfSamplesEchoIntegrated data - if (row.getCellNumberOfSamplesEchoIntegrated() != null) { - dataValue = String.valueOf(row.getCellNumberOfSamplesEchoIntegrated()); - createCellData(cell, dataMetadataProvider.getNumberOfSamplesEchoIntegratedDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - // create RadialNumber data - if (row.getLabel() != null) { - dataValue = row.getLabel(); - createCellData(cell, dataMetadataProvider.getRadialNumberDataMetadata(), dataValue, dataQuality, importResult, false, rowNumber); - } - - } - - private DataAcquisition createDataAcquisition(AcousticInstrument instrument, - String softwareVersion, - String soundSpeedCalculations, - VoyageAcousticImportRow row) { - - VoyageAcousticsImportConfiguration configuration = getConfiguration(); - - String transceiverAcquisitionAbsorptionDescription = configuration.getTransceiverAcquisitionAbsorptionDescription(); - String loggedDataFormat = configuration.getLoggedDataFormat(); - String loggedDataDatatype = configuration.getLoggedDataDatatype(); - String pingDutyCycle = configuration.getPingDutyCycle(); - - DataAcquisition dataAcquisition = getPersistenceService().createDataAcquisition(instrument); - - // fill from manual configuration - dataAcquisition.setTransceiverAcquisitionAbsorptionDescription(transceiverAcquisitionAbsorptionDescription); - dataAcquisition.setAcquisitionSoftwareVersion(softwareVersion); - dataAcquisition.setLoggedDataFormat(loggedDataFormat); - dataAcquisition.setLoggedDataDatatype(loggedDataDatatype); - dataAcquisition.setPingDutyCycle(pingDutyCycle); - dataAcquisition.setEchosounderSoundSpeed(row.getSoundCelerity()); - dataAcquisition.setSoundSpeedCalculations(soundSpeedCalculations); - - // fill from csv file - float transceiverAcquisitionAbsorption = row.getTransceiverAcquisitionAbsorption(); - float transducerAcquisitionBeamAngleAthwartship = row.getTransducerAcquisitionBeamAngleAthwartship(); - float transducerAcquisitionBeamAngleAlongship = row.getTransducerAcquisitionBeamAngleAlongship(); - float transducerAcquisitionPsi = row.getTransducerAcquisitionPsi(); - float transceiverAcquisitionPower = row.getTransceiverAcquisitionPower(); - float transceiverAcquisitionPulseLength = row.getTransceiverAcquisitionPulseLength(); - float transceiverAcquisitionGain = row.getTransceiverAcquisitionGain(); - float transceiverAcquisitionSacorrection = row.getTransceiverAcquisitionSacorrection(); - - dataAcquisition.setTransceiverAcquisitionAbsorption(transceiverAcquisitionAbsorption); - dataAcquisition.setTransducerAcquisitionBeamAngleAthwartship(transducerAcquisitionBeamAngleAthwartship); - dataAcquisition.setTransducerAcquisitionBeamAngleAlongship(transducerAcquisitionBeamAngleAlongship); - dataAcquisition.setTransducerAcquisitionPsi(transducerAcquisitionPsi); - dataAcquisition.setTransceiverAcquisitionPower(transceiverAcquisitionPower); - dataAcquisition.setTransceiverAcquisitionPulseLength(transceiverAcquisitionPulseLength); - dataAcquisition.setTransceiverAcquisitionGain(transceiverAcquisitionGain); - dataAcquisition.setTransceiverAcquisitionSacorrection(transceiverAcquisitionSacorrection); - - return dataAcquisition; - } - - private DataProcessing createDataProcessing(String id, - String softwareVersion, - String soundSpeedCalculations, - VoyageAcousticImportRow row) { - - VoyageAcousticsImportConfiguration configuration = getConfiguration(); - - String transceiverAcquisitionAbsorptionDescription = configuration.getTransceiverAcquisitionAbsorptionDescription(); - String processingTemplate = configuration.getProcessingTemplate(); - String processingDescription = configuration.getProcessingDescription(); - String sounderConstant = configuration.getSounderConstant(); - float digitThreshold = configuration.getDigitThreshold(); - String acousticDensityUnit = configuration.getAcousticDensityUnit(); - String notes = configuration.getNotes(); - - DataProcessing dataProcessing = getPersistenceService().createDataProcessing(id, processingTemplate); - - // fill from manual configuration - dataProcessing.setProcessingDescription(processingDescription); - dataProcessing.setSounderConstant(sounderConstant); - dataProcessing.setDigitThreshold(digitThreshold); - dataProcessing.setAcousticDensityUnit(acousticDensityUnit); - dataProcessing.setNotes(notes); - dataProcessing.setProcessingSoftwareVersion(softwareVersion); - dataProcessing.setTransceiverProcessingAbsorptionDescription(transceiverAcquisitionAbsorptionDescription); - dataProcessing.setEchosounderSoundSpeed(row.getSoundCelerity()); - dataProcessing.setSoundSpeedCalculations(soundSpeedCalculations); - - // fill from csv file - - float transceiverAcquisitionAbsorption = row.getTransceiverAcquisitionAbsorption(); - float transducerAcquisitionBeamAngleAthwartship = row.getTransducerAcquisitionBeamAngleAthwartship(); - float transducerAcquisitionBeamAngleAlongship = row.getTransducerAcquisitionBeamAngleAlongship(); - float transducerAcquisitionPsi = row.getTransducerAcquisitionPsi(); - float transceiverAcquisitionGain = row.getTransceiverAcquisitionGain(); - float transceiverAcquisitionSacorrection = row.getTransceiverAcquisitionSacorrection(); - int eIThresholdLow = row.geteIThresholdLow(); - int eIThresholdHigh = row.geteIThresholdHigh(); - - dataProcessing.seteIThresholdLow(eIThresholdLow); - dataProcessing.seteIThresholdHigh(eIThresholdHigh); - dataProcessing.setTransceiverProcessingSacorrection(transceiverAcquisitionSacorrection); - dataProcessing.setTransceiverProcessingAbsorption(transceiverAcquisitionAbsorption); - dataProcessing.setTransceiverProcessingGain(transceiverAcquisitionGain); - dataProcessing.setTransducerProcessingPsi(transducerAcquisitionPsi); - dataProcessing.setTransducerProcessingBeamAngleAthwartship(transducerAcquisitionBeamAngleAthwartship); - dataProcessing.setTransducerProcessingBeamAngleAlongship(transducerAcquisitionBeamAngleAlongship); - - return dataProcessing; - } - - private String getSoftwareVersion(boolean isME70) { - String result; - if (isME70) { - result = getConfiguration().getAcquisitionSoftwareVersionME70(); - } else { - result = getConfiguration().getAcquisitionSoftwareVersionER60(); - } - return result; - } - - private String getSoundSpeedCalculations(boolean isME70) { - String result; - if (isME70) { - result = getConfiguration().getSoundSpeedCalculationsME70(); - } else { - result = getConfiguration().getSoundSpeedCalculationsER60(); - } - return result; - } - - public static class DataMetadataProvider { - - private final DataMetadata radialNumberDataMetadata; - private final DataMetadata latitudeDataMetadata; - private final DataMetadata longitudeDataMetadata; - private final DataMetadata esduStartDepthDataMetadata; - private final DataMetadata timeStartDataMetadata; - private final DataMetadata timeEndDataMetadata; - private final DataMetadata nascDataMetadata; - private final DataMetadata volumeDataMetadata; - private final DataMetadata surfaceDataMetadata; - private final DataMetadata numberOfSamplesRecordedDataMetadata; - private final DataMetadata numberOfSamplesEchoIntegratedDataMetadata; - private final DataMetadata depthRefSurfaceStartDataMetadata; - private final DataMetadata depthRefSurfaceEndDataMetadata; - // private final DataMetadata depthRefBottomStartDataMetadata; - private final DataMetadata depthRefBottomEndDataMetadata; - - public DataMetadataProvider(VoyageAcousticsImportDataContext importDataContext) { - String suffix = importDataContext.getConfiguration().getCellPositionReference().getMetadataNameSuffix(); - Map<String, DataMetadata> dataMetadatasByName = importDataContext.getDataMetadatasByName(); - radialNumberDataMetadata= dataMetadatasByName.get(DataMetadataImpl.RADIAL_NUMBER); - latitudeDataMetadata = dataMetadatasByName.get("Latitude" + suffix); - longitudeDataMetadata = dataMetadatasByName.get("Longitude" + suffix); - esduStartDepthDataMetadata = dataMetadatasByName.get("ESDUstartDepth"); - timeStartDataMetadata = dataMetadatasByName.get("TimeStart"); - timeEndDataMetadata = dataMetadatasByName.get("TimeEnd"); - nascDataMetadata = dataMetadatasByName.get("NASC"); - volumeDataMetadata = dataMetadatasByName.get("Volume"); - surfaceDataMetadata = dataMetadatasByName.get("Surface"); - numberOfSamplesRecordedDataMetadata = dataMetadatasByName.get("NumberOfSamplesRecorded"); - numberOfSamplesEchoIntegratedDataMetadata = dataMetadatasByName.get("NumberOfSamplesEchoIntegrated"); - depthRefSurfaceStartDataMetadata = dataMetadatasByName.get("DepthRefSurfaceStart"); - depthRefSurfaceEndDataMetadata = dataMetadatasByName.get("DepthRefSurfaceEnd"); -// depthRefBottomStartDataMetadata = dataMetadatasByName.get("DepthRefBottomStart"); - depthRefBottomEndDataMetadata = dataMetadatasByName.get("DepthRefBottomEnd"); - } - - public DataMetadata getRadialNumberDataMetadata() { - return radialNumberDataMetadata; - } - - public DataMetadata getLatitudeDataMetadata() { - return latitudeDataMetadata; - } - - public DataMetadata getLongitudeDataMetadata() { - return longitudeDataMetadata; - } - - public DataMetadata getEsduStartDepthDataMetadata() { - return esduStartDepthDataMetadata; - } - - public DataMetadata getTimeStartDataMetadata() { - return timeStartDataMetadata; - } - - public DataMetadata getTimeEndDataMetadata() { - return timeEndDataMetadata; - } - - public DataMetadata getNascDataMetadata() { - return nascDataMetadata; - } - - public DataMetadata getVolumeDataMetadata() { - return volumeDataMetadata; - } - - public DataMetadata getSurfaceDataMetadata() { - return surfaceDataMetadata; - } - - public DataMetadata getNumberOfSamplesRecordedDataMetadata() { - return numberOfSamplesRecordedDataMetadata; - } - - public DataMetadata getNumberOfSamplesEchoIntegratedDataMetadata() { - return numberOfSamplesEchoIntegratedDataMetadata; - } - - public DataMetadata getDepthRefSurfaceStartDataMetadata() { - return depthRefSurfaceStartDataMetadata; - } - - public DataMetadata getDepthRefEndDataMetadata(boolean surface) { - return surface ? depthRefSurfaceEndDataMetadata : depthRefBottomEndDataMetadata; - } - + + Voyage voyage = importDataContext.getVoyage(); + Vessel vessel = importDataContext.getVessel(); + + Date startDate = row.getCellDateStart(); + + // get transect to use + Transit transit = voyage.getTransit(startDate); + if (transit == null) { + // can not find correct transit + throw new TransitNotFoundException(locale, voyage, startDate, rowNumber); + } + + Transect transect = transit.getTransect(vessel); + if (transect == null) { + // can not find correct transect + throw new TransectNotFoundException(locale, voyage, vessel, startDate, rowNumber); + } + return (DataAcousticProvider) transect; } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/MooringAcousticsImportConfiguration.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/ImportAcousticsConfiguration.java similarity index 95% copy from echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/MooringAcousticsImportConfiguration.java copy to echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/ImportAcousticsConfiguration.java index 2f57da4..c0a89e5 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/MooringAcousticsImportConfiguration.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/ImportAcousticsConfiguration.java @@ -20,7 +20,6 @@ */ package fr.ifremer.echobase.services.service.importdata.configurations; -import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.io.InputFile; import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; import fr.ifremer.echobase.services.service.importdata.CellPositionReference; @@ -30,12 +29,12 @@ import java.util.Locale; import static org.nuiton.i18n.I18n.l; /** - * Configuration of a "accoustic datas" import for mooring. + * Configuration of a "accoustic datas" import. * * @author Julien Ruchaud - ruchaud@codelutin.com - * @since 0.5 + * @since 4.0 */ -public class MooringAcousticsImportConfiguration extends MooringImportDataConfigurationSupport { +public class ImportAcousticsConfiguration extends ImportDataConfigurationSupport { private static final long serialVersionUID = 1L; /** Movies file to import. */ @@ -73,10 +72,8 @@ public class MooringAcousticsImportConfiguration extends MooringImportDataConfig /** Cell position reference for esdu cell datas. */ protected CellPositionReference cellPositionReference; - - public MooringAcousticsImportConfiguration(Locale locale) { + public ImportAcousticsConfiguration(Locale locale) { moviesFile = InputFile.newFile(l(locale, "echobase.common.moviesFile")); - importType = ImportType.MOORING_ACOUSTIC; } public boolean isAddDataAcquisition() { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/MooringAcousticsImportConfiguration.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/MooringAcousticsImportConfiguration.java index 2f57da4..ba820c1 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/MooringAcousticsImportConfiguration.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/MooringAcousticsImportConfiguration.java @@ -21,198 +21,30 @@ package fr.ifremer.echobase.services.service.importdata.configurations; import fr.ifremer.echobase.entities.ImportType; -import fr.ifremer.echobase.io.InputFile; -import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; -import fr.ifremer.echobase.services.service.importdata.CellPositionReference; - import java.util.Locale; -import static org.nuiton.i18n.I18n.l; - /** * Configuration of a "accoustic datas" import for mooring. * * @author Julien Ruchaud - ruchaud@codelutin.com - * @since 0.5 + * @since 4.0 */ -public class MooringAcousticsImportConfiguration extends MooringImportDataConfigurationSupport { - - private static final long serialVersionUID = 1L; - /** Movies file to import. */ - protected final InputFile moviesFile; - /** Flag to always add new dataAcquisition when a new instrument is found in movies file. */ - protected boolean addDataAcquisition = true; - /** Manual transceiverAcquisitionAbsorptionDescription. */ - protected String transceiverAcquisitionAbsorptionDescription = "(i) Equation: Francois and garrison 1982,(ii) CTD, (iii) nominal value for entire data set"; - /** Manual acquisitionSoftwareVersion (ER60 instrument). */ - protected String acquisitionSoftwareVersionER60; - /** Manual acquisitionSoftwareVersion (ME70 instrument). */ - protected String acquisitionSoftwareVersionME70; - /** Manual loggedDataFormat. */ - protected String loggedDataFormat = ".hac and .raw formats"; - /** Manual loggedDataDatatype. */ - protected String loggedDataDatatype = "‘raw’ digitisation samples"; - /** Manual pingDutyCycle. */ - protected String pingDutyCycle = "Ifremer's standard ping duty cycle"; - /** Manual soundSpeedCalculations (ER60 instrument). */ - protected String soundSpeedCalculationsER60 = "(i) Equation: Mackenzie (1980), (ii) CTD, (iii) nominal value for entire data set"; - /** Manual soundSpeedCalculations (ME70 instrument). */ - protected String soundSpeedCalculationsME70 = "(i) Equation: Mackenzie (1980), (ii) Hull-mounted thermosalinometer, (iii) surface absorption value recomputed every 30s and applied to the entire data set"; - /** Manual sounderConstant. */ - protected String sounderConstant = EchoBaseCsvUtil.NA; - /** Manual processingTemplate. */ - protected String processingTemplate; - /** Manual processingDescription. */ - protected String processingDescription; - /** Manual digitThreshold. */ - protected float digitThreshold = -100f; - /** Manual acousticDensityUnit. */ - protected String acousticDensityUnit = "sA"; - /** Manual notes. */ - protected String notes; - /** Cell position reference for esdu cell datas. */ - protected CellPositionReference cellPositionReference; +public class MooringAcousticsImportConfiguration extends ImportAcousticsConfiguration { + /** Selected mooring id where to import datas. */ + protected String mooringId; public MooringAcousticsImportConfiguration(Locale locale) { - moviesFile = InputFile.newFile(l(locale, "echobase.common.moviesFile")); + super(locale); importType = ImportType.MOORING_ACOUSTIC; } - - public boolean isAddDataAcquisition() { - return addDataAcquisition; - } - - public void setAddDataAcquisition(boolean addDataAcquisition) { - this.addDataAcquisition = addDataAcquisition; - } - - public String getTransceiverAcquisitionAbsorptionDescription() { - return transceiverAcquisitionAbsorptionDescription; - } - - public void setTransceiverAcquisitionAbsorptionDescription(String transceiverAcquisitionAbsorptionDescription) { - this.transceiverAcquisitionAbsorptionDescription = transceiverAcquisitionAbsorptionDescription; - } - - public String getAcquisitionSoftwareVersionER60() { - return acquisitionSoftwareVersionER60; - } - - public void setAcquisitionSoftwareVersionER60(String acquisitionSoftwareVersionER60) { - this.acquisitionSoftwareVersionER60 = acquisitionSoftwareVersionER60; - } - - public String getAcquisitionSoftwareVersionME70() { - return acquisitionSoftwareVersionME70; - } - - public void setAcquisitionSoftwareVersionME70(String acquisitionSoftwareVersionME70) { - this.acquisitionSoftwareVersionME70 = acquisitionSoftwareVersionME70; - } - - public String getLoggedDataFormat() { - return loggedDataFormat; - } - - public void setLoggedDataFormat(String loggedDataFormat) { - this.loggedDataFormat = loggedDataFormat; - } - - public String getLoggedDataDatatype() { - return loggedDataDatatype; - } - - public void setLoggedDataDatatype(String loggedDataDatatype) { - this.loggedDataDatatype = loggedDataDatatype; - } - - public String getPingDutyCycle() { - return pingDutyCycle; - } - - public void setPingDutyCycle(String pingDutyCycle) { - this.pingDutyCycle = pingDutyCycle; - } - - public String getSoundSpeedCalculationsER60() { - return soundSpeedCalculationsER60; - } - - public void setSoundSpeedCalculationsER60(String soundSpeedCalculationsER60) { - this.soundSpeedCalculationsER60 = soundSpeedCalculationsER60; + + public String getMooringId() { + return mooringId; } - public String getSoundSpeedCalculationsME70() { - return soundSpeedCalculationsME70; + public void setMooringId(String mooringId) { + this.mooringId = mooringId; } - public void setSoundSpeedCalculationsME70(String soundSpeedCalculationsME70) { - this.soundSpeedCalculationsME70 = soundSpeedCalculationsME70; - } - - public String getSounderConstant() { - return sounderConstant; - } - - public void setSounderConstant(String sounderConstant) { - this.sounderConstant = sounderConstant; - } - - public float getDigitThreshold() { - return digitThreshold; - } - - public void setDigitThreshold(float digitThreshold) { - this.digitThreshold = digitThreshold; - } - - public String getAcousticDensityUnit() { - return acousticDensityUnit; - } - - public void setAcousticDensityUnit(String acousticDensityUnit) { - this.acousticDensityUnit = acousticDensityUnit; - } - - public String getNotes() { - return notes; - } - - public void setNotes(String notes) { - this.notes = notes; - } - - public InputFile getMoviesFile() { - return moviesFile; - } - - public String getProcessingTemplate() { - return processingTemplate; - } - - public void setProcessingTemplate(String processingTemplate) { - this.processingTemplate = processingTemplate; - } - - public String getProcessingDescription() { - return processingDescription; - } - - public void setProcessingDescription(String processingDescription) { - this.processingDescription = processingDescription; - } - - public CellPositionReference getCellPositionReference() { - return cellPositionReference; - } - - public void setCellPositionReference(CellPositionReference cellPositionReference) { - this.cellPositionReference = cellPositionReference; - } - - @Override - public InputFile[] getInputFiles() { - return new InputFile[]{moviesFile}; - } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/VoyageAcousticsImportConfiguration.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/VoyageAcousticsImportConfiguration.java index 2be11af..38bcaef 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/VoyageAcousticsImportConfiguration.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/configurations/VoyageAcousticsImportConfiguration.java @@ -21,208 +21,40 @@ package fr.ifremer.echobase.services.service.importdata.configurations; import fr.ifremer.echobase.entities.ImportType; -import fr.ifremer.echobase.io.InputFile; -import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; -import fr.ifremer.echobase.services.service.importdata.CellPositionReference; - import java.util.Locale; -import static org.nuiton.i18n.I18n.l; - /** * Configuration of a "accoustic datas" import. * - * @author Tony Chemit - chemit@codelutin.com - * @since 0.3 + * @author Julien Ruchaud - ruchaud@codelutin.com + * @since 4.0 */ -public class VoyageAcousticsImportConfiguration extends VoyageImportDataConfigurationSupport { +public class VoyageAcousticsImportConfiguration extends ImportAcousticsConfiguration { - private static final long serialVersionUID = 1L; - /** Movies file to import. */ - protected final InputFile moviesFile; + /** Selected voyage id where to import datas. */ + protected String voyageId; + /** Selected vessel id to find out transect where to import datas. */ protected String vesselId; - /** Flag to always add new dataAcquisition when a new instrument is found in movies file. */ - protected boolean addDataAcquisition = true; - /** Manual transceiverAcquisitionAbsorptionDescription. */ - protected String transceiverAcquisitionAbsorptionDescription = "(i) Equation: Francois and garrison 1982,(ii) CTD, (iii) nominal value for entire data set"; - /** Manual acquisitionSoftwareVersion (ER60 instrument). */ - protected String acquisitionSoftwareVersionER60; - /** Manual acquisitionSoftwareVersion (ME70 instrument). */ - protected String acquisitionSoftwareVersionME70; - /** Manual loggedDataFormat. */ - protected String loggedDataFormat = ".hac and .raw formats"; - /** Manual loggedDataDatatype. */ - protected String loggedDataDatatype = "‘raw’ digitisation samples"; - /** Manual pingDutyCycle. */ - protected String pingDutyCycle = "Ifremer's standard ping duty cycle"; - /** Manual soundSpeedCalculations (ER60 instrument). */ - protected String soundSpeedCalculationsER60 = "(i) Equation: Mackenzie (1980), (ii) CTD, (iii) nominal value for entire data set"; - /** Manual soundSpeedCalculations (ME70 instrument). */ - protected String soundSpeedCalculationsME70 = "(i) Equation: Mackenzie (1980), (ii) Hull-mounted thermosalinometer, (iii) surface absorption value recomputed every 30s and applied to the entire data set"; - /** Manual sounderConstant. */ - protected String sounderConstant = EchoBaseCsvUtil.NA; - /** Manual processingTemplate. */ - protected String processingTemplate; - /** Manual processingDescription. */ - protected String processingDescription; - /** Manual digitThreshold. */ - protected float digitThreshold = -100f; - /** Manual acousticDensityUnit. */ - protected String acousticDensityUnit = "sA"; - /** Manual notes. */ - protected String notes; - /** Cell position reference for esdu cell datas. */ - protected CellPositionReference cellPositionReference; - public VoyageAcousticsImportConfiguration(Locale locale) { - moviesFile = InputFile.newFile(l(locale, "echobase.common.moviesFile")); + super(locale); importType = ImportType.ACOUSTIC; } - public String getVesselId() { - return vesselId; - } - - public void setVesselId(String vesselId) { - this.vesselId = vesselId; - } - - public boolean isAddDataAcquisition() { - return addDataAcquisition; - } - - public void setAddDataAcquisition(boolean addDataAcquisition) { - this.addDataAcquisition = addDataAcquisition; - } - - public String getTransceiverAcquisitionAbsorptionDescription() { - return transceiverAcquisitionAbsorptionDescription; - } - - public void setTransceiverAcquisitionAbsorptionDescription(String transceiverAcquisitionAbsorptionDescription) { - this.transceiverAcquisitionAbsorptionDescription = transceiverAcquisitionAbsorptionDescription; - } - - public String getAcquisitionSoftwareVersionER60() { - return acquisitionSoftwareVersionER60; + public final String getVoyageId() { + return voyageId; } - public void setAcquisitionSoftwareVersionER60(String acquisitionSoftwareVersionER60) { - this.acquisitionSoftwareVersionER60 = acquisitionSoftwareVersionER60; + public final void setVoyageId(String voyageId) { + this.voyageId = voyageId; } - public String getAcquisitionSoftwareVersionME70() { - return acquisitionSoftwareVersionME70; - } - - public void setAcquisitionSoftwareVersionME70(String acquisitionSoftwareVersionME70) { - this.acquisitionSoftwareVersionME70 = acquisitionSoftwareVersionME70; - } - - public String getLoggedDataFormat() { - return loggedDataFormat; - } - - public void setLoggedDataFormat(String loggedDataFormat) { - this.loggedDataFormat = loggedDataFormat; - } - - public String getLoggedDataDatatype() { - return loggedDataDatatype; - } - - public void setLoggedDataDatatype(String loggedDataDatatype) { - this.loggedDataDatatype = loggedDataDatatype; - } - - public String getPingDutyCycle() { - return pingDutyCycle; - } - - public void setPingDutyCycle(String pingDutyCycle) { - this.pingDutyCycle = pingDutyCycle; - } - - public String getSoundSpeedCalculationsER60() { - return soundSpeedCalculationsER60; - } - - public void setSoundSpeedCalculationsER60(String soundSpeedCalculationsER60) { - this.soundSpeedCalculationsER60 = soundSpeedCalculationsER60; - } - - public String getSoundSpeedCalculationsME70() { - return soundSpeedCalculationsME70; - } - - public void setSoundSpeedCalculationsME70(String soundSpeedCalculationsME70) { - this.soundSpeedCalculationsME70 = soundSpeedCalculationsME70; - } - - public String getSounderConstant() { - return sounderConstant; - } - - public void setSounderConstant(String sounderConstant) { - this.sounderConstant = sounderConstant; - } - - public float getDigitThreshold() { - return digitThreshold; - } - - public void setDigitThreshold(float digitThreshold) { - this.digitThreshold = digitThreshold; - } - - public String getAcousticDensityUnit() { - return acousticDensityUnit; - } - - public void setAcousticDensityUnit(String acousticDensityUnit) { - this.acousticDensityUnit = acousticDensityUnit; - } - - public String getNotes() { - return notes; - } - - public void setNotes(String notes) { - this.notes = notes; - } - - public InputFile getMoviesFile() { - return moviesFile; - } - - public String getProcessingTemplate() { - return processingTemplate; - } - - public void setProcessingTemplate(String processingTemplate) { - this.processingTemplate = processingTemplate; - } - - public String getProcessingDescription() { - return processingDescription; - } - - public void setProcessingDescription(String processingDescription) { - this.processingDescription = processingDescription; - } - - public CellPositionReference getCellPositionReference() { - return cellPositionReference; - } - - public void setCellPositionReference(CellPositionReference cellPositionReference) { - this.cellPositionReference = cellPositionReference; + public String getVesselId() { + return vesselId; } - @Override - public InputFile[] getInputFiles() { - return new InputFile[]{moviesFile}; + public void setVesselId(String vesselId) { + this.vesselId = vesselId; } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/ImportDataContextSupport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/ImportDataContextSupport.java index 64ad8e7..4beb532 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/ImportDataContextSupport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/ImportDataContextSupport.java @@ -300,11 +300,16 @@ public abstract class ImportDataContextSupport<C extends ImportDataConfiguration if (StringUtils.isNotEmpty(configuration.getImportNotes())) { importText.append(configuration.getImportNotes()); } + + ImportLog importLog = persistenceService.createImportLog(configuration.getImportType(), + user.getEmail(), + importDate, + importText.toString()); - return persistenceService.createImportLog(configuration.getImportType(), - user.getEmail(), - importDate, - importText.toString()); + importLog.setEntityId(getEntityId()); + return importLog; } + + public abstract String getEntityId(); } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringAcousticsImportDataContext.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringAcousticsImportDataContext.java index c5e1295..6fbee32 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringAcousticsImportDataContext.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringAcousticsImportDataContext.java @@ -33,7 +33,7 @@ import java.util.Locale; * @author Julien Ruchaud - ruchaud@codelutin.com * @since 0.5 */ -public class MooringAcousticsImportDataContext extends MooringImportDataContextSupport<MooringAcousticsImportConfiguration> { +public class MooringAcousticsImportDataContext extends ImportDataContextSupport<MooringAcousticsImportConfiguration> { private Mooring mooring; @@ -48,4 +48,9 @@ public class MooringAcousticsImportDataContext extends MooringImportDataContextS return mooring; } + @Override + public String getEntityId() { + return configuration.getMooringId(); + } + } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringCommonsImportDataContext.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringCommonsImportDataContext.java index 8dbb9eb..2fae937 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringCommonsImportDataContext.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringCommonsImportDataContext.java @@ -32,10 +32,15 @@ import java.util.Locale; * @author Julien Ruchaud - ruchaud@codelutin.com * @since 0.4 */ -public class MooringCommonsImportDataContext extends MooringImportDataContextSupport<MooringCommonsImportConfiguration> { +public class MooringCommonsImportDataContext extends ImportDataContextSupport<MooringCommonsImportConfiguration> { public MooringCommonsImportDataContext(UserDbPersistenceService persistenceService, Locale locale, char csvSeparator, MooringCommonsImportConfiguration configuration, EchoBaseUser user, Date importDate) { super(persistenceService, locale, csvSeparator, configuration, user, importDate); } + @Override + public String getEntityId() { + return null; + } + } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringImportDataContextSupport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringImportDataContextSupport.java deleted file mode 100644 index 5b7e825..0000000 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/MooringImportDataContextSupport.java +++ /dev/null @@ -1,49 +0,0 @@ -package fr.ifremer.echobase.services.service.importdata.contexts; - -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2016 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import fr.ifremer.echobase.entities.EchoBaseUser; -import fr.ifremer.echobase.entities.ImportLog; -import fr.ifremer.echobase.services.service.UserDbPersistenceService; -import fr.ifremer.echobase.services.service.importdata.configurations.MooringImportDataConfigurationSupport; - -import java.util.Date; -import java.util.Locale; - -/** - * - * @author Julien Ruchaud - ruchaud@codelutin.com - */ -class MooringImportDataContextSupport<C extends MooringImportDataConfigurationSupport> extends ImportDataContextSupport<C> { - - public MooringImportDataContextSupport(UserDbPersistenceService persistenceService, Locale locale, char csvSeparator, C configuration, EchoBaseUser user, Date importDate) { - super(persistenceService, locale, csvSeparator, configuration, user, importDate); - } - - @Override - protected final ImportLog createImportLog(Date importDate) { - ImportLog importLog = super.createImportLog(importDate); - importLog.setEntityId(configuration.getMooringId()); - return importLog; - } - -} diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/VoyageAcousticsImportDataContext.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/VoyageAcousticsImportDataContext.java index 52a5498..20a2979 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/VoyageAcousticsImportDataContext.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/VoyageAcousticsImportDataContext.java @@ -22,6 +22,8 @@ package fr.ifremer.echobase.services.service.importdata.contexts; */ import fr.ifremer.echobase.entities.EchoBaseUser; +import fr.ifremer.echobase.entities.data.Voyage; +import fr.ifremer.echobase.entities.references.Vessel; import fr.ifremer.echobase.services.service.UserDbPersistenceService; import fr.ifremer.echobase.services.service.importdata.configurations.VoyageAcousticsImportConfiguration; @@ -29,14 +31,34 @@ import java.util.Date; import java.util.Locale; /** - * Created on 30/03/16. - * - * @author Tony Chemit - chemit@codelutin.com + * @author Julien Ruchaud - ruchaud@codelutin.com */ -public class VoyageAcousticsImportDataContext extends VoyageImportDataContextSupport<VoyageAcousticsImportConfiguration> { +public class VoyageAcousticsImportDataContext extends ImportDataContextSupport<VoyageAcousticsImportConfiguration> { + + private Voyage voyage; + private Vessel vessel; public VoyageAcousticsImportDataContext(UserDbPersistenceService persistenceService, Locale locale, char csvSeparator, VoyageAcousticsImportConfiguration configuration, EchoBaseUser user, Date importDate) { super(persistenceService, locale, csvSeparator, configuration, user, importDate); } + + public final Voyage getVoyage() { + if (voyage == null) { + voyage = persistenceService.getVoyage(configuration.getVoyageId()); + } + return voyage; + } + + public final Vessel getVessel() { + if (vessel == null) { + vessel = persistenceService.getVessel(configuration.getVesselId()); + } + return vessel; + } + + @Override + public String getEntityId() { + return configuration.getVoyageId(); + } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/VoyageImportDataContextSupport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/VoyageImportDataContextSupport.java index c2c2f92..8022e64 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/VoyageImportDataContextSupport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/contexts/VoyageImportDataContextSupport.java @@ -70,10 +70,8 @@ class VoyageImportDataContextSupport<C extends VoyageImportDataConfigurationSupp } @Override - protected final ImportLog createImportLog(Date importDate) { - ImportLog importLog = super.createImportLog(importDate); - importLog.setEntityId(configuration.getVoyageId()); - return importLog; + public String getEntityId() { + return configuration.getVoyageId(); } public final Map<String, Cell> getVoyageRegionsByName() { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/MooringAcousticImportExportModel.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/AcousticImportExportModel.java similarity index 63% rename from echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/MooringAcousticImportExportModel.java rename to echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/AcousticImportExportModel.java index f74646c..abe9a68 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/MooringAcousticImportExportModel.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/AcousticImportExportModel.java @@ -27,6 +27,7 @@ import fr.ifremer.echobase.entities.data.DataProcessing; import fr.ifremer.echobase.entities.references.AcousticInstrument; import fr.ifremer.echobase.entities.references.DataQuality; import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; +import fr.ifremer.echobase.services.service.importdata.contexts.ImportDataContextSupport; import fr.ifremer.echobase.services.service.importdata.contexts.MooringAcousticsImportDataContext; /** @@ -36,21 +37,21 @@ import fr.ifremer.echobase.services.service.importdata.contexts.MooringAcoustics * @author Julien Ruchaud - ruchaud@codelutin.com * @since 0.5 */ -public class MooringAcousticImportExportModel extends EchoBaseImportExportModelSupport<MooringAcousticImportRow> { +public class AcousticImportExportModel extends EchoBaseImportExportModelSupport<AcousticImportRow> { - private MooringAcousticImportExportModel(char separator) { + private AcousticImportExportModel(char separator) { super(separator); } - public static MooringAcousticImportExportModel forImport(MooringAcousticsImportDataContext importDataContext) { + public static AcousticImportExportModel forImport(ImportDataContextSupport importDataContext) { - MooringAcousticImportExportModel model = new MooringAcousticImportExportModel(importDataContext.getCsvSeparator()); + AcousticImportExportModel model = new AcousticImportExportModel(importDataContext.getCsvSeparator()); - model.newMandatoryColumn("MOVIES_EILayer", VoyageAcousticImportRow.PROPERTY_EI_LAYER);//A + model.newMandatoryColumn("MOVIES_EILayer", AcousticImportRow.PROPERTY_EI_LAYER);//A model.newIgnoredColumn("MOVIES_EILayer\\sndset");//B model.newIgnoredColumn("MOVIES_EILayer\\sndset\\sndname");//C model.newIgnoredColumn("MOVIES_EILayer\\sndset\\sndident");//D - model.newForeignKeyColumn("MOVIES_EILayer\\sndset\\softChannelId", VoyageAcousticImportRow.PROPERTY_ACOUSTIC_INSTRUMENT, AcousticInstrument.class, AcousticInstrument.PROPERTY_ID, importDataContext.getInstrumentsById()); //E + model.newForeignKeyColumn("MOVIES_EILayer\\sndset\\softChannelId", AcousticImportRow.PROPERTY_ACOUSTIC_INSTRUMENT, AcousticInstrument.class, AcousticInstrument.PROPERTY_ID, importDataContext.getInstrumentsById()); //E model.newIgnoredColumn("MOVIES_EILayer\\sndset\\channelName");//F model.newIgnoredColumn("MOVIES_EILayer\\sndset\\dataType");//G model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beamType");//H @@ -58,15 +59,15 @@ public class MooringAcousticImportExportModel extends EchoBaseImportExportModelS model.newIgnoredColumn("MOVIES_EILayer\\sndset\\startSample");//J model.newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAlongSteeringAngle");//K model.newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAthwartSteeringAngle");//L - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\absorptionCoef", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_ABSORPTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//M - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\transmissionPower", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_POWER, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//N - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamAlongAngleSensitivity", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ALONGSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//O - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamAthwartAngleSensitivity", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ATHWARTSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//P + model.newMandatoryColumn("MOVIES_EILayer\\sndset\\absorptionCoef", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_ABSORPTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//M + model.newMandatoryColumn("MOVIES_EILayer\\sndset\\transmissionPower", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_POWER, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//N + model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamAlongAngleSensitivity", AcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ALONGSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//O + model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamAthwartAngleSensitivity", AcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ATHWARTSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//P model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAlong");//Q model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAthwart");//R - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamEquTwoWayAngle", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_PSI, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//S - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamGain", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_GAIN, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//T - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamSACorrection", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_SACORRECTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//U + model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamEquTwoWayAngle", AcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_PSI, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//S + model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamGain", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_GAIN, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//T + model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamSACorrection", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_SACORRECTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//U model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinDepth");//V model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMaxDepth");//W model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinLevel");//X @@ -77,7 +78,7 @@ public class MooringAcousticImportExportModel extends EchoBaseImportExportModelS model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bandWidth");//AC model.newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgminrange");//AD model.newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgmaxrange");//AE - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\pulseduration", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_PULSE_LENGTH, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//AF + model.newMandatoryColumn("MOVIES_EILayer\\sndset\\pulseduration", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_PULSE_LENGTH, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//AF model.newIgnoredColumn("MOVIES_EILayer\\shipnav");//AG model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\lat");//AH model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\long");//AI @@ -92,53 +93,53 @@ public class MooringAcousticImportExportModel extends EchoBaseImportExportModelS model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\roll");//AR model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\pitch");//AS model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\heave");//AT - model.newMandatoryColumn("MOVIES_EILayer\\shipnav\\depth", VoyageAcousticImportRow.PROPERTY_ESDU_CELL_DATA_DEPTH);//AU + model.newMandatoryColumn("MOVIES_EILayer\\shipnav\\depth", AcousticImportRow.PROPERTY_ESDU_CELL_DATA_DEPTH);//AU model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\draught");//AV // Cell elementary Datas model.newIgnoredColumn("MOVIES_EILayer\\cellset");//AW - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\cellnum", VoyageAcousticImportRow.PROPERTY_CELL_NUM, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AX - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\celltype", VoyageAcousticImportRow.PROPERTY_CELL_TYPE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AY - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\depthstart", VoyageAcousticImportRow.PROPERTY_CELL_DEPTH_START, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//AZ - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\depthend", VoyageAcousticImportRow.PROPERTY_CELL_DEPTH_END, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BA + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\cellnum", AcousticImportRow.PROPERTY_CELL_NUM, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AX + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\celltype", AcousticImportRow.PROPERTY_CELL_TYPE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AY + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\depthstart", AcousticImportRow.PROPERTY_CELL_DEPTH_START, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//AZ + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\depthend", AcousticImportRow.PROPERTY_CELL_DEPTH_END, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BA model.newIgnoredColumn("MOVIES_EILayer\\cellset\\indexstart");//BB model.newIgnoredColumn("MOVIES_EILayer\\cellset\\indexend");//BC - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\datestart", VoyageAcousticImportRow.PROPERTY_CELL_DATE_START, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BD - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\dateend", VoyageAcousticImportRow.PROPERTY_CELL_DATE_END, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BE + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\datestart", AcousticImportRow.PROPERTY_CELL_DATE_START, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BD + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\dateend", AcousticImportRow.PROPERTY_CELL_DATE_END, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BE - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\lat", VoyageAcousticImportRow.PROPERTY_CELL_LATITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BF - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\long", VoyageAcousticImportRow.PROPERTY_CELL_LONGITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BG - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\volume", VoyageAcousticImportRow.PROPERTY_CELL_VOLUME, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BH - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\area", VoyageAcousticImportRow.PROPERTY_CELL_SURFACE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BI + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\lat", AcousticImportRow.PROPERTY_CELL_LATITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BF + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\long", AcousticImportRow.PROPERTY_CELL_LONGITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BG + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\volume", AcousticImportRow.PROPERTY_CELL_VOLUME, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BH + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\area", AcousticImportRow.PROPERTY_CELL_SURFACE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BI model.newIgnoredColumn("MOVIES_EILayer\\cellset\\diststart");//BJ model.newIgnoredColumn("MOVIES_EILayer\\cellset\\distend");//BK - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\thresholdup", VoyageAcousticImportRow.PROPERTY_E_ITHRESHOLD_HIGH, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BL - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\thresholdlow", VoyageAcousticImportRow.PROPERTY_E_ITHRESHOLD_LOW, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BM + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\thresholdup", AcousticImportRow.PROPERTY_E_ITHRESHOLD_HIGH, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BL + model.newMandatoryColumn("MOVIES_EILayer\\cellset\\thresholdlow", AcousticImportRow.PROPERTY_E_ITHRESHOLD_LOW, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BM model.newIgnoredColumn("MOVIES_EILayer\\eilayer");//BN - model.newMandatoryColumn("MOVIES_EILayer\\eilayer\\sa", VoyageAcousticImportRow.PROPERTY_CELL_NASC, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BO + model.newMandatoryColumn("MOVIES_EILayer\\eilayer\\sa", AcousticImportRow.PROPERTY_CELL_NASC, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BO model.newIgnoredColumn("MOVIES_EILayer\\eilayer\\sv");//BP - model.newMandatoryColumn("MOVIES_EILayer\\eilayer\\ni", VoyageAcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_ECHO_INTEGRATED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BQ - model.newMandatoryColumn("MOVIES_EILayer\\eilayer\\nt", VoyageAcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_RECORDED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BR + model.newMandatoryColumn("MOVIES_EILayer\\eilayer\\ni", AcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_ECHO_INTEGRATED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BQ + model.newMandatoryColumn("MOVIES_EILayer\\eilayer\\nt", AcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_RECORDED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BR model.newIgnoredColumn("MOVIES_EILayer\\boterr");//BR model.newIgnoredColumn("MOVIES_EILayer\\boterr\\sa");//BT model.newIgnoredColumn("MOVIES_EILayer\\boterr\\ni");//BU - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\soundcelerity", VoyageAcousticImportRow.PROPERTY_SOUND_CELERITY);//BV + model.newMandatoryColumn("MOVIES_EILayer\\sndset\\soundcelerity", AcousticImportRow.PROPERTY_SOUND_CELERITY);//BV - model.newForeignKeyColumn(VoyageAcousticImportRow.PROPERTY_DATA_QUALITY, DataQuality.class, DataQuality.PROPERTY_QUALITY_DATA_FLAG_VALUES, importDataContext.getDataQualitiesByName()); //BW - model.newMandatoryColumn(VoyageAcousticImportRow.PROPERTY_LABEL, EchoBaseCsvUtil.NA_TO_STRING_PARSER_FORMATTER); //BX + model.newForeignKeyColumn(AcousticImportRow.PROPERTY_DATA_QUALITY, DataQuality.class, DataQuality.PROPERTY_QUALITY_DATA_FLAG_VALUES, importDataContext.getDataQualitiesByName()); //BW + model.newMandatoryColumn(AcousticImportRow.PROPERTY_LABEL, EchoBaseCsvUtil.NA_TO_STRING_PARSER_FORMATTER); //BX return model; } - public static MooringAcousticImportExportModel forExport(MooringAcousticsImportDataContext importDataContext) { + public static AcousticImportExportModel forExport(ImportDataContextSupport importDataContext) { - MooringAcousticImportExportModel model = new MooringAcousticImportExportModel(importDataContext.getCsvSeparator()); + AcousticImportExportModel model = new AcousticImportExportModel(importDataContext.getCsvSeparator()); - model.newColumnForExport("MOVIES_EILayer", VoyageAcousticImportRow.PROPERTY_EI_LAYER);//A + model.newColumnForExport("MOVIES_EILayer", AcousticImportRow.PROPERTY_EI_LAYER);//A // model.newIgnoredColumn("MOVIES_EILayer\\sndset");//B // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\sndname");//C // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\sndident");//D - model.newColumnForExport("MOVIES_EILayer\\sndset\\softChannelId", VoyageAcousticImportRow.PROPERTY_ACOUSTIC_INSTRUMENT, EchoBaseCsvUtil.ACOUSTIC_INSTRUMENT_FORMATTER); //E + model.newColumnForExport("MOVIES_EILayer\\sndset\\softChannelId", AcousticImportRow.PROPERTY_ACOUSTIC_INSTRUMENT, EchoBaseCsvUtil.ACOUSTIC_INSTRUMENT_FORMATTER); //E // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\channelName");//F // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\dataType");//G // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beamType");//H @@ -146,15 +147,15 @@ public class MooringAcousticImportExportModel extends EchoBaseImportExportModelS // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\startSample");//J // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAlongSteeringAngle");//K // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAthwartSteeringAngle");//L - model.newColumnForExport("MOVIES_EILayer\\sndset\\absorptionCoef", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_ABSORPTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//M - model.newColumnForExport("MOVIES_EILayer\\sndset\\transmissionPower", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_POWER, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//N - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamAlongAngleSensitivity", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ALONGSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//O - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamAthwartAngleSensitivity", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ATHWARTSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//P + model.newColumnForExport("MOVIES_EILayer\\sndset\\absorptionCoef", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_ABSORPTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//M + model.newColumnForExport("MOVIES_EILayer\\sndset\\transmissionPower", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_POWER, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//N + model.newColumnForExport("MOVIES_EILayer\\sndset\\beamAlongAngleSensitivity", AcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ALONGSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//O + model.newColumnForExport("MOVIES_EILayer\\sndset\\beamAthwartAngleSensitivity", AcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ATHWARTSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//P // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAlong");//Q // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAthwart");//R - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamEquTwoWayAngle", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_PSI, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//S - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamGain", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_GAIN, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//T - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamSACorrection", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_SACORRECTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//U + model.newColumnForExport("MOVIES_EILayer\\sndset\\beamEquTwoWayAngle", AcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_PSI, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//S + model.newColumnForExport("MOVIES_EILayer\\sndset\\beamGain", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_GAIN, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//T + model.newColumnForExport("MOVIES_EILayer\\sndset\\beamSACorrection", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_SACORRECTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//U // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinDepth");//V // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMaxDepth");//W // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinLevel");//X @@ -165,7 +166,7 @@ public class MooringAcousticImportExportModel extends EchoBaseImportExportModelS // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bandWidth");//AC // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgminrange");//AD // model.newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgmaxrange");//AE - model.newColumnForExport("MOVIES_EILayer\\sndset\\pulseduration", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_PULSE_LENGTH, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//AF + model.newColumnForExport("MOVIES_EILayer\\sndset\\pulseduration", AcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_PULSE_LENGTH, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//AF // model.newIgnoredColumn("MOVIES_EILayer\\shipnav");//AG // model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\lat");//AH // model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\long");//AI @@ -180,46 +181,46 @@ public class MooringAcousticImportExportModel extends EchoBaseImportExportModelS // model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\roll");//AR // model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\pitch");//AS // model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\heave");//AT - model.newColumnForExport("MOVIES_EILayer\\shipnav\\depth", VoyageAcousticImportRow.PROPERTY_ESDU_CELL_DATA_DEPTH);//AU + model.newColumnForExport("MOVIES_EILayer\\shipnav\\depth", AcousticImportRow.PROPERTY_ESDU_CELL_DATA_DEPTH);//AU // model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\draught");//AV // Cell elementary Datas // model.newIgnoredColumn("MOVIES_EILayer\\cellset");//AW - model.newColumnForExport("MOVIES_EILayer\\cellset\\cellnum", VoyageAcousticImportRow.PROPERTY_CELL_NUM, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AX - model.newColumnForExport("MOVIES_EILayer\\cellset\\celltype", VoyageAcousticImportRow.PROPERTY_CELL_TYPE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AY - model.newColumnForExport("MOVIES_EILayer\\cellset\\depthstart", VoyageAcousticImportRow.PROPERTY_CELL_DEPTH_START, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//AZ - model.newColumnForExport("MOVIES_EILayer\\cellset\\depthend", VoyageAcousticImportRow.PROPERTY_CELL_DEPTH_END, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BA + model.newColumnForExport("MOVIES_EILayer\\cellset\\cellnum", AcousticImportRow.PROPERTY_CELL_NUM, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AX + model.newColumnForExport("MOVIES_EILayer\\cellset\\celltype", AcousticImportRow.PROPERTY_CELL_TYPE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AY + model.newColumnForExport("MOVIES_EILayer\\cellset\\depthstart", AcousticImportRow.PROPERTY_CELL_DEPTH_START, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//AZ + model.newColumnForExport("MOVIES_EILayer\\cellset\\depthend", AcousticImportRow.PROPERTY_CELL_DEPTH_END, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BA // model.newIgnoredColumn("MOVIES_EILayer\\cellset\\indexstart");//BB // model.newIgnoredColumn("MOVIES_EILayer\\cellset\\indexend");//BC - model.newColumnForExport("MOVIES_EILayer\\cellset\\datestart", VoyageAcousticImportRow.PROPERTY_CELL_DATE_START, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BD - model.newColumnForExport("MOVIES_EILayer\\cellset\\dateend", VoyageAcousticImportRow.PROPERTY_CELL_DATE_END, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BE + model.newColumnForExport("MOVIES_EILayer\\cellset\\datestart", AcousticImportRow.PROPERTY_CELL_DATE_START, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BD + model.newColumnForExport("MOVIES_EILayer\\cellset\\dateend", AcousticImportRow.PROPERTY_CELL_DATE_END, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BE - model.newColumnForExport("MOVIES_EILayer\\cellset\\lat", VoyageAcousticImportRow.PROPERTY_CELL_LATITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BF - model.newColumnForExport("MOVIES_EILayer\\cellset\\long", VoyageAcousticImportRow.PROPERTY_CELL_LONGITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BG - model.newColumnForExport("MOVIES_EILayer\\cellset\\volume", VoyageAcousticImportRow.PROPERTY_CELL_VOLUME, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BH - model.newColumnForExport("MOVIES_EILayer\\cellset\\area", VoyageAcousticImportRow.PROPERTY_CELL_SURFACE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BI + model.newColumnForExport("MOVIES_EILayer\\cellset\\lat", AcousticImportRow.PROPERTY_CELL_LATITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BF + model.newColumnForExport("MOVIES_EILayer\\cellset\\long", AcousticImportRow.PROPERTY_CELL_LONGITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BG + model.newColumnForExport("MOVIES_EILayer\\cellset\\volume", AcousticImportRow.PROPERTY_CELL_VOLUME, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BH + model.newColumnForExport("MOVIES_EILayer\\cellset\\area", AcousticImportRow.PROPERTY_CELL_SURFACE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BI // model.newIgnoredColumn("MOVIES_EILayer\\cellset\\diststart");//BJ // model.newIgnoredColumn("MOVIES_EILayer\\cellset\\distend");//BK - model.newColumnForExport("MOVIES_EILayer\\cellset\\thresholdup", VoyageAcousticImportRow.PROPERTY_E_ITHRESHOLD_HIGH, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BL - model.newColumnForExport("MOVIES_EILayer\\cellset\\thresholdlow", VoyageAcousticImportRow.PROPERTY_E_ITHRESHOLD_LOW, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BM + model.newColumnForExport("MOVIES_EILayer\\cellset\\thresholdup", AcousticImportRow.PROPERTY_E_ITHRESHOLD_HIGH, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BL + model.newColumnForExport("MOVIES_EILayer\\cellset\\thresholdlow", AcousticImportRow.PROPERTY_E_ITHRESHOLD_LOW, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BM // model.newIgnoredColumn("MOVIES_EILayer\\eilayer");//BN - model.newColumnForExport("MOVIES_EILayer\\eilayer\\sa", VoyageAcousticImportRow.PROPERTY_CELL_NASC, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BO + model.newColumnForExport("MOVIES_EILayer\\eilayer\\sa", AcousticImportRow.PROPERTY_CELL_NASC, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BO // model.newIgnoredColumn("MOVIES_EILayer\\eilayer\\sv");//BP - model.newColumnForExport("MOVIES_EILayer\\eilayer\\ni", VoyageAcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_ECHO_INTEGRATED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BQ - model.newColumnForExport("MOVIES_EILayer\\eilayer\\nt", VoyageAcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_RECORDED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BR + model.newColumnForExport("MOVIES_EILayer\\eilayer\\ni", AcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_ECHO_INTEGRATED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BQ + model.newColumnForExport("MOVIES_EILayer\\eilayer\\nt", AcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_RECORDED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BR // model.newIgnoredColumn("MOVIES_EILayer\\boterr");//BR // model.newIgnoredColumn("MOVIES_EILayer\\boterr\\sa");//BT // model.newIgnoredColumn("MOVIES_EILayer\\boterr\\ni");//BU - model.newColumnForExport("MOVIES_EILayer\\sndset\\soundcelerity", VoyageAcousticImportRow.PROPERTY_SOUND_CELERITY);//BV + model.newColumnForExport("MOVIES_EILayer\\sndset\\soundcelerity", AcousticImportRow.PROPERTY_SOUND_CELERITY);//BV - model.newColumnForExport(VoyageAcousticImportRow.PROPERTY_DATA_QUALITY, EchoBaseCsvUtil.DATA_QUALITY_FORMATTER); //BW - model.newColumnForExport(VoyageAcousticImportRow.PROPERTY_LABEL, EchoBaseCsvUtil.NA_TO_STRING_PARSER_FORMATTER); //BX + model.newColumnForExport(AcousticImportRow.PROPERTY_DATA_QUALITY, EchoBaseCsvUtil.DATA_QUALITY_FORMATTER); //BW + model.newColumnForExport(AcousticImportRow.PROPERTY_LABEL, EchoBaseCsvUtil.NA_TO_STRING_PARSER_FORMATTER); //BX return model; } @Override - public MooringAcousticImportRow newEmptyInstance() { - return new MooringAcousticImportRow(); + public AcousticImportRow newEmptyInstance() { + return new AcousticImportRow(); } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/MooringAcousticImportRow.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/AcousticImportRow.java similarity index 96% rename from echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/MooringAcousticImportRow.java rename to echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/AcousticImportRow.java index 5f49516..d8c4ee3 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/MooringAcousticImportRow.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/AcousticImportRow.java @@ -37,9 +37,9 @@ import java.util.Optional; * Bean of a row for {@link MooringAcousticImportExportModel} import. * * @author Julien Ruchaud - ruchaud@codelutin.com - * @since 0.5 + * @since 4.0 */ -public class MooringAcousticImportRow { +public class AcousticImportRow { public static final String PROPERTY_ACOUSTIC_INSTRUMENT = "acousticInstrument"; @@ -162,13 +162,13 @@ public class MooringAcousticImportRow { */ protected String label; - public static MooringAcousticImportRow ofEsduCell(String processingTemplate, + public static AcousticImportRow ofEsduCell(String processingTemplate, DataAcquisition dataAcquisition, DataProcessing dataProcessing, Cell esduCell, DataMetadata radialNumberDataMetadata) { - MooringAcousticImportRow row = of(processingTemplate, dataAcquisition, dataProcessing, esduCell, radialNumberDataMetadata); + AcousticImportRow row = of(processingTemplate, dataAcquisition, dataProcessing, esduCell, radialNumberDataMetadata); // esdu cell row.setCellType(4); @@ -177,12 +177,12 @@ public class MooringAcousticImportRow { return row; } - public static MooringAcousticImportRow ofElementaryCell(String processingTemplate, + public static AcousticImportRow ofElementaryCell(String processingTemplate, DataAcquisition dataAcquisition, DataProcessing dataProcessing, Cell elementaryCell, DataMetadata radialNumberDataMetadata) { - MooringAcousticImportRow row = of(processingTemplate, dataAcquisition, dataProcessing, elementaryCell, radialNumberDataMetadata); + AcousticImportRow row = of(processingTemplate, dataAcquisition, dataProcessing, elementaryCell, radialNumberDataMetadata); // elementary cell String elementaryCellName = elementaryCell.getName(); @@ -205,12 +205,12 @@ public class MooringAcousticImportRow { return row; } - private static MooringAcousticImportRow of(String processingTemplate, + private static AcousticImportRow of(String processingTemplate, DataAcquisition dataAcquisition, DataProcessing dataProcessing, Cell cell, DataMetadata radialNumberDataMetadata) { - MooringAcousticImportRow row = new MooringAcousticImportRow(); + AcousticImportRow row = new AcousticImportRow(); row.setAcousticInstrument(dataAcquisition.getAcousticInstrument()); row.setDataQuality(cell.getDataQuality()); diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageAcousticImportExportModel.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageAcousticImportExportModel.java deleted file mode 100644 index c3b4a93..0000000 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageAcousticImportExportModel.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2012 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package fr.ifremer.echobase.services.service.importdata.csv; - -import fr.ifremer.echobase.entities.data.Cell; -import fr.ifremer.echobase.entities.data.Data; -import fr.ifremer.echobase.entities.data.DataAcquisition; -import fr.ifremer.echobase.entities.data.DataProcessing; -import fr.ifremer.echobase.entities.references.AcousticInstrument; -import fr.ifremer.echobase.entities.references.DataQuality; -import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; -import fr.ifremer.echobase.services.service.importdata.contexts.VoyageAcousticsImportDataContext; - -/** - * To import acoustic datas (says {@link DataAcquisition}, - * {@link DataProcessing}, {@link Cell} and {@link Data}. - * - * @author Tony Chemit - chemit@codelutin.com - * @since 0.3 - */ -public class VoyageAcousticImportExportModel extends EchoBaseImportExportModelSupport<VoyageAcousticImportRow> { - - private VoyageAcousticImportExportModel(char separator) { - super(separator); - } - - public static VoyageAcousticImportExportModel forImport(VoyageAcousticsImportDataContext importDataContext) { - - VoyageAcousticImportExportModel model = new VoyageAcousticImportExportModel(importDataContext.getCsvSeparator()); - - model.newMandatoryColumn("MOVIES_EILayer", VoyageAcousticImportRow.PROPERTY_EI_LAYER);//A - model.newIgnoredColumn("MOVIES_EILayer\\sndset");//B - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\sndname");//C - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\sndident");//D - model.newForeignKeyColumn("MOVIES_EILayer\\sndset\\softChannelId", VoyageAcousticImportRow.PROPERTY_ACOUSTIC_INSTRUMENT, AcousticInstrument.class, AcousticInstrument.PROPERTY_ID, importDataContext.getInstrumentsById()); //E - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\channelName");//F - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\dataType");//G - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beamType");//H - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\acousticFrequency");//I - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\startSample");//J - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAlongSteeringAngle");//K - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAthwartSteeringAngle");//L - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\absorptionCoef", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_ABSORPTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//M - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\transmissionPower", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_POWER, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//N - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamAlongAngleSensitivity", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ALONGSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//O - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamAthwartAngleSensitivity", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ATHWARTSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//P - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAlong");//Q - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAthwart");//R - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamEquTwoWayAngle", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_PSI, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//S - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamGain", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_GAIN, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//T - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\beamSACorrection", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_SACORRECTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//U - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinDepth");//V - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMaxDepth");//W - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinLevel");//X - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\AlongTXRXWeightId");//Y - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\AthwartTXRXWeightId");//Z - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\SplitBeamAlongTXRXWeightId");//AA - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\SplitBeamAthwartTXRXWeightId");//AB - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bandWidth");//AC - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgminrange");//AD - model.newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgmaxrange");//AE - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\pulseduration", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_PULSE_LENGTH, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//AF - model.newIgnoredColumn("MOVIES_EILayer\\shipnav");//AG - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\lat");//AH - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\long");//AI - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\alt");//AJ - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\gndspeed");//AK - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\gndcourse");//AL - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\surfspeed");//AM - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\surfcourse");//AN - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\driftspeed");//AO - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\driftcourse");//AP - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\heading");//AQ - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\roll");//AR - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\pitch");//AS - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\heave");//AT - model.newMandatoryColumn("MOVIES_EILayer\\shipnav\\depth", VoyageAcousticImportRow.PROPERTY_ESDU_CELL_DATA_DEPTH);//AU - model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\draught");//AV - - // Cell elementary Datas - model.newIgnoredColumn("MOVIES_EILayer\\cellset");//AW - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\cellnum", VoyageAcousticImportRow.PROPERTY_CELL_NUM, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AX - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\celltype", VoyageAcousticImportRow.PROPERTY_CELL_TYPE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AY - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\depthstart", VoyageAcousticImportRow.PROPERTY_CELL_DEPTH_START, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//AZ - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\depthend", VoyageAcousticImportRow.PROPERTY_CELL_DEPTH_END, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BA - model.newIgnoredColumn("MOVIES_EILayer\\cellset\\indexstart");//BB - model.newIgnoredColumn("MOVIES_EILayer\\cellset\\indexend");//BC - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\datestart", VoyageAcousticImportRow.PROPERTY_CELL_DATE_START, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BD - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\dateend", VoyageAcousticImportRow.PROPERTY_CELL_DATE_END, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BE - - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\lat", VoyageAcousticImportRow.PROPERTY_CELL_LATITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BF - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\long", VoyageAcousticImportRow.PROPERTY_CELL_LONGITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BG - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\volume", VoyageAcousticImportRow.PROPERTY_CELL_VOLUME, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BH - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\area", VoyageAcousticImportRow.PROPERTY_CELL_SURFACE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BI - model.newIgnoredColumn("MOVIES_EILayer\\cellset\\diststart");//BJ - model.newIgnoredColumn("MOVIES_EILayer\\cellset\\distend");//BK - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\thresholdup", VoyageAcousticImportRow.PROPERTY_E_ITHRESHOLD_HIGH, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BL - model.newMandatoryColumn("MOVIES_EILayer\\cellset\\thresholdlow", VoyageAcousticImportRow.PROPERTY_E_ITHRESHOLD_LOW, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BM - model.newIgnoredColumn("MOVIES_EILayer\\eilayer");//BN - model.newMandatoryColumn("MOVIES_EILayer\\eilayer\\sa", VoyageAcousticImportRow.PROPERTY_CELL_NASC, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BO - model.newIgnoredColumn("MOVIES_EILayer\\eilayer\\sv");//BP - model.newMandatoryColumn("MOVIES_EILayer\\eilayer\\ni", VoyageAcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_ECHO_INTEGRATED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BQ - model.newMandatoryColumn("MOVIES_EILayer\\eilayer\\nt", VoyageAcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_RECORDED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BR - model.newIgnoredColumn("MOVIES_EILayer\\boterr");//BR - model.newIgnoredColumn("MOVIES_EILayer\\boterr\\sa");//BT - model.newIgnoredColumn("MOVIES_EILayer\\boterr\\ni");//BU - model.newMandatoryColumn("MOVIES_EILayer\\sndset\\soundcelerity", VoyageAcousticImportRow.PROPERTY_SOUND_CELERITY);//BV - - model.newForeignKeyColumn(VoyageAcousticImportRow.PROPERTY_DATA_QUALITY, DataQuality.class, DataQuality.PROPERTY_QUALITY_DATA_FLAG_VALUES, importDataContext.getDataQualitiesByName()); //BW - model.newMandatoryColumn(VoyageAcousticImportRow.PROPERTY_LABEL, EchoBaseCsvUtil.NA_TO_STRING_PARSER_FORMATTER); //BX - - return model; - } - - public static VoyageAcousticImportExportModel forExport(VoyageAcousticsImportDataContext importDataContext) { - - VoyageAcousticImportExportModel model = new VoyageAcousticImportExportModel(importDataContext.getCsvSeparator()); - - model.newColumnForExport("MOVIES_EILayer", VoyageAcousticImportRow.PROPERTY_EI_LAYER);//A -// model.newIgnoredColumn("MOVIES_EILayer\\sndset");//B -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\sndname");//C -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\sndident");//D - model.newColumnForExport("MOVIES_EILayer\\sndset\\softChannelId", VoyageAcousticImportRow.PROPERTY_ACOUSTIC_INSTRUMENT, EchoBaseCsvUtil.ACOUSTIC_INSTRUMENT_FORMATTER); //E -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\channelName");//F -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\dataType");//G -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beamType");//H -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\acousticFrequency");//I -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\startSample");//J -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAlongSteeringAngle");//K -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAthwartSteeringAngle");//L - model.newColumnForExport("MOVIES_EILayer\\sndset\\absorptionCoef", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_ABSORPTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//M - model.newColumnForExport("MOVIES_EILayer\\sndset\\transmissionPower", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_POWER, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//N - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamAlongAngleSensitivity", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ALONGSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//O - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamAthwartAngleSensitivity", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ATHWARTSHIP, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//P -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAlong");//Q -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAthwart");//R - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamEquTwoWayAngle", VoyageAcousticImportRow.PROPERTY_TRANSDUCER_ACQUISITION_PSI, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//S - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamGain", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_GAIN, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//T - model.newColumnForExport("MOVIES_EILayer\\sndset\\beamSACorrection", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_SACORRECTION, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//U -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinDepth");//V -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMaxDepth");//W -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinLevel");//X -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\AlongTXRXWeightId");//Y -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\AthwartTXRXWeightId");//Z -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\SplitBeamAlongTXRXWeightId");//AA -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\SplitBeamAthwartTXRXWeightId");//AB -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\bandWidth");//AC -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgminrange");//AD -// model.newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgmaxrange");//AE - model.newColumnForExport("MOVIES_EILayer\\sndset\\pulseduration", VoyageAcousticImportRow.PROPERTY_TRANSCEIVER_ACQUISITION_PULSE_LENGTH, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//AF -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav");//AG -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\lat");//AH -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\long");//AI -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\alt");//AJ -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\gndspeed");//AK -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\gndcourse");//AL -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\surfspeed");//AM -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\surfcourse");//AN -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\driftspeed");//AO -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\driftcourse");//AP -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\heading");//AQ -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\roll");//AR -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\pitch");//AS -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\heave");//AT - model.newColumnForExport("MOVIES_EILayer\\shipnav\\depth", VoyageAcousticImportRow.PROPERTY_ESDU_CELL_DATA_DEPTH);//AU -// model.newIgnoredColumn("MOVIES_EILayer\\shipnav\\draught");//AV - - // Cell elementary Datas -// model.newIgnoredColumn("MOVIES_EILayer\\cellset");//AW - model.newColumnForExport("MOVIES_EILayer\\cellset\\cellnum", VoyageAcousticImportRow.PROPERTY_CELL_NUM, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AX - model.newColumnForExport("MOVIES_EILayer\\cellset\\celltype", VoyageAcousticImportRow.PROPERTY_CELL_TYPE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//AY - model.newColumnForExport("MOVIES_EILayer\\cellset\\depthstart", VoyageAcousticImportRow.PROPERTY_CELL_DEPTH_START, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//AZ - model.newColumnForExport("MOVIES_EILayer\\cellset\\depthend", VoyageAcousticImportRow.PROPERTY_CELL_DEPTH_END, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BA -// model.newIgnoredColumn("MOVIES_EILayer\\cellset\\indexstart");//BB -// model.newIgnoredColumn("MOVIES_EILayer\\cellset\\indexend");//BC - model.newColumnForExport("MOVIES_EILayer\\cellset\\datestart", VoyageAcousticImportRow.PROPERTY_CELL_DATE_START, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BD - model.newColumnForExport("MOVIES_EILayer\\cellset\\dateend", VoyageAcousticImportRow.PROPERTY_CELL_DATE_END, EchoBaseCsvUtil.IMPORT_DAY_TIME_ECHOBASE);//BE - - model.newColumnForExport("MOVIES_EILayer\\cellset\\lat", VoyageAcousticImportRow.PROPERTY_CELL_LATITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BF - model.newColumnForExport("MOVIES_EILayer\\cellset\\long", VoyageAcousticImportRow.PROPERTY_CELL_LONGITUDE, EchoBaseCsvUtil.PRIMITIVE_FLOAT);//BG - model.newColumnForExport("MOVIES_EILayer\\cellset\\volume", VoyageAcousticImportRow.PROPERTY_CELL_VOLUME, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BH - model.newColumnForExport("MOVIES_EILayer\\cellset\\area", VoyageAcousticImportRow.PROPERTY_CELL_SURFACE, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BI -// model.newIgnoredColumn("MOVIES_EILayer\\cellset\\diststart");//BJ -// model.newIgnoredColumn("MOVIES_EILayer\\cellset\\distend");//BK - model.newColumnForExport("MOVIES_EILayer\\cellset\\thresholdup", VoyageAcousticImportRow.PROPERTY_E_ITHRESHOLD_HIGH, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BL - model.newColumnForExport("MOVIES_EILayer\\cellset\\thresholdlow", VoyageAcousticImportRow.PROPERTY_E_ITHRESHOLD_LOW, EchoBaseCsvUtil.PRIMITIVE_INTEGER);//BM -// model.newIgnoredColumn("MOVIES_EILayer\\eilayer");//BN - model.newColumnForExport("MOVIES_EILayer\\eilayer\\sa", VoyageAcousticImportRow.PROPERTY_CELL_NASC, EchoBaseCsvUtil.NA_TO_FLOAT_PARSER_FORMATTER);//BO -// model.newIgnoredColumn("MOVIES_EILayer\\eilayer\\sv");//BP - model.newColumnForExport("MOVIES_EILayer\\eilayer\\ni", VoyageAcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_ECHO_INTEGRATED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BQ - model.newColumnForExport("MOVIES_EILayer\\eilayer\\nt", VoyageAcousticImportRow.PROPERTY_CELL_NUMBER_OF_SAMPLES_RECORDED, EchoBaseCsvUtil.NA_TO_INTEGER_PARSER_FORMATTER);//BR -// model.newIgnoredColumn("MOVIES_EILayer\\boterr");//BR -// model.newIgnoredColumn("MOVIES_EILayer\\boterr\\sa");//BT -// model.newIgnoredColumn("MOVIES_EILayer\\boterr\\ni");//BU - model.newColumnForExport("MOVIES_EILayer\\sndset\\soundcelerity", VoyageAcousticImportRow.PROPERTY_SOUND_CELERITY);//BV - - model.newColumnForExport(VoyageAcousticImportRow.PROPERTY_DATA_QUALITY, EchoBaseCsvUtil.DATA_QUALITY_FORMATTER); //BW - model.newColumnForExport(VoyageAcousticImportRow.PROPERTY_LABEL, EchoBaseCsvUtil.NA_TO_STRING_PARSER_FORMATTER); //BX - - return model; - } - - @Override - public VoyageAcousticImportRow newEmptyInstance() { - return new VoyageAcousticImportRow(); - } -} diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageAcousticImportRow.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageAcousticImportRow.java deleted file mode 100644 index cd526a8..0000000 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageAcousticImportRow.java +++ /dev/null @@ -1,485 +0,0 @@ -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2012 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package fr.ifremer.echobase.services.service.importdata.csv; - -import fr.ifremer.echobase.entities.data.Cell; -import fr.ifremer.echobase.entities.data.Data; -import fr.ifremer.echobase.entities.data.DataAcquisition; -import fr.ifremer.echobase.entities.data.DataProcessing; -import fr.ifremer.echobase.entities.references.AcousticInstrument; -import fr.ifremer.echobase.entities.references.DataMetadata; -import fr.ifremer.echobase.entities.references.DataQuality; -import org.apache.commons.lang3.StringUtils; - -import java.util.Collection; -import java.util.Date; -import java.util.Optional; - -/** - * Bean of a row for {@link VoyageAcousticImportExportModel} import. - * - * @author Tony Chemit - chemit@codelutin.com - * @since 0.3 - */ -public class VoyageAcousticImportRow { - - public static final String PROPERTY_ACOUSTIC_INSTRUMENT = "acousticInstrument"; - - public static final String PROPERTY_EI_LAYER = "eiLayer"; - - public static final String PROPERTY_CELL_TYPE = "cellType"; - - public static final String PROPERTY_CELL_NUM = "cellNum"; - - public static final String PROPERTY_ESDU_CELL_DATA_DEPTH = "esduCellDataDepth"; - - public static final String PROPERTY_CELL_DATE_START = "cellDateStart"; - - public static final String PROPERTY_CELL_DATE_END = "cellDateEnd"; - - public static final String PROPERTY_CELL_DEPTH_START = "cellDepthStart"; - - public static final String PROPERTY_CELL_DEPTH_END = "cellDepthEnd"; - - public static final String PROPERTY_CELL_NASC = "cellNasc"; - - public static final String PROPERTY_TRANSCEIVER_ACQUISITION_PULSE_LENGTH = "transceiverAcquisitionPulseLength"; - - public static final String PROPERTY_TRANSCEIVER_ACQUISITION_GAIN = "transceiverAcquisitionGain"; - - public static final String PROPERTY_TRANSCEIVER_ACQUISITION_ABSORPTION = "transceiverAcquisitionAbsorption"; - - public static final String PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ATHWARTSHIP = "transducerAcquisitionBeamAngleAthwartship"; - - public static final String PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ALONGSHIP = "transducerAcquisitionBeamAngleAlongship"; - - public static final String PROPERTY_TRANSDUCER_ACQUISITION_PSI = "transducerAcquisitionPsi"; - - public static final String PROPERTY_TRANSCEIVER_ACQUISITION_POWER = "transceiverAcquisitionPower"; - - public static final String PROPERTY_TRANSCEIVER_ACQUISITION_SACORRECTION = "transceiverAcquisitionSacorrection"; - - public static final String PROPERTY_E_ITHRESHOLD_LOW = "eIThresholdLow"; - - public static final String PROPERTY_E_ITHRESHOLD_HIGH = "eIThresholdHigh"; - - public static final String PROPERTY_CELL_VOLUME = "cellVolume"; - - public static final String PROPERTY_CELL_SURFACE = "cellSurface"; - - public static final String PROPERTY_CELL_NUMBER_OF_SAMPLES_RECORDED = "cellNumberOfSamplesRecorded"; - - public static final String PROPERTY_CELL_NUMBER_OF_SAMPLES_ECHO_INTEGRATED = "cellNumberOfSamplesEchoIntegrated"; - - public static final String PROPERTY_SOUND_CELERITY = "soundCelerity"; - - public static final String PROPERTY_CELL_LATITUDE = "cellLatitude"; - - public static final String PROPERTY_CELL_LONGITUDE = "cellLongitude"; - - public static final String PROPERTY_DATA_QUALITY = "dataQuality"; - - public static final String PROPERTY_LABEL = "label"; - - protected String eiLayer; - - protected String esduCellDataDepth; - - protected Date cellDateStart; - - protected Date cellDateEnd; - - protected float cellLatitude; - - protected float cellLongitude; - - protected Float cellVolume; - - protected int cellSurface; - - protected Integer cellNumberOfSamplesRecorded; - - protected Integer cellNumberOfSamplesEchoIntegrated; - - protected int cellType; - - protected int cellNum; - - protected Float cellDepthStart; - - protected Float cellDepthEnd; - - protected Float cellNasc; - - protected float transceiverAcquisitionPulseLength; - - protected float transceiverAcquisitionGain; - - protected float transceiverAcquisitionAbsorption; - - protected float transceiverAcquisitionPower; - - protected float transceiverAcquisitionSacorrection; - - protected float transducerAcquisitionBeamAngleAthwartship; - - protected float transducerAcquisitionBeamAngleAlongship; - - protected float transducerAcquisitionPsi; - - protected int eIThresholdLow; - - protected int eIThresholdHigh; - - protected String soundCelerity; - - protected DataQuality dataQuality; - - protected AcousticInstrument acousticInstrument; - - /** - * Radial number data (See https://forge.codelutin.com/issues/8222) - * - * @since 4.0 - */ - protected String label; - - public static VoyageAcousticImportRow ofEsduCell(String processingTemplate, - DataAcquisition dataAcquisition, - DataProcessing dataProcessing, - Cell esduCell, - DataMetadata radialNumberDataMetadata) { - - VoyageAcousticImportRow row = of(processingTemplate, dataAcquisition, dataProcessing, esduCell, radialNumberDataMetadata); - - // esdu cell - row.setCellType(4); - row.setDataQuality(esduCell.getDataQuality()); - - return row; - } - - public static VoyageAcousticImportRow ofElementaryCell(String processingTemplate, - DataAcquisition dataAcquisition, - DataProcessing dataProcessing, - Cell elementaryCell, - DataMetadata radialNumberDataMetadata) { - VoyageAcousticImportRow row = of(processingTemplate, dataAcquisition, dataProcessing, elementaryCell, radialNumberDataMetadata); - - // elementary cell - String elementaryCellName = elementaryCell.getName(); - - int cellType; - if (elementaryCellName.endsWith("S")) { - - // surface - cellType = 0; - } else { - - // bottom - cellType = 1; - } - - Integer cellNum = Integer.valueOf(elementaryCellName.substring(0, elementaryCellName.length() - 1)); - row.setCellType(cellType); - row.setCellNum(cellNum); - row.setDataQuality(elementaryCell.getDataQuality()); - return row; - } - - private static VoyageAcousticImportRow of(String processingTemplate, - DataAcquisition dataAcquisition, - DataProcessing dataProcessing, - Cell cell, - DataMetadata radialNumberDataMetadata) { - VoyageAcousticImportRow row = new VoyageAcousticImportRow(); - row.setAcousticInstrument(dataAcquisition.getAcousticInstrument()); - row.setDataQuality(cell.getDataQuality()); - - // dataAcquisition - row.setTransceiverAcquisitionAbsorption(dataAcquisition.getTransceiverAcquisitionAbsorption()); - row.setTransceiverAcquisitionPower(dataAcquisition.getTransceiverAcquisitionPower()); - row.setTransceiverAcquisitionPulseLength(dataAcquisition.getTransceiverAcquisitionPulseLength()); - row.setTransceiverAcquisitionGain(dataAcquisition.getTransceiverAcquisitionGain()); - row.setTransceiverAcquisitionSacorrection(dataAcquisition.getTransceiverAcquisitionSacorrection()); - - row.setTransducerAcquisitionBeamAngleAthwartship(dataAcquisition.getTransducerAcquisitionBeamAngleAthwartship()); - row.setTransducerAcquisitionBeamAngleAlongship(dataAcquisition.getTransducerAcquisitionBeamAngleAlongship()); - row.setTransducerAcquisitionPsi(dataAcquisition.getTransducerAcquisitionPsi()); - - // dataProcessing - row.seteIThresholdLow(dataProcessing.geteIThresholdLow()); - row.seteIThresholdHigh(dataProcessing.geteIThresholdHigh()); - - row.setTransceiverAcquisitionSacorrection(dataProcessing.getTransceiverProcessingSacorrection()); - row.setTransceiverAcquisitionAbsorption(dataProcessing.getTransceiverProcessingAbsorption()); - row.setTransceiverAcquisitionGain(dataProcessing.getTransceiverProcessingGain()); - - row.setTransducerAcquisitionPsi(dataProcessing.getTransducerProcessingPsi()); - row.setTransducerAcquisitionBeamAngleAthwartship(dataProcessing.getTransducerProcessingBeamAngleAthwartship()); - row.setTransducerAcquisitionBeamAngleAlongship(dataProcessing.getTransducerProcessingBeamAngleAlongship()); - - String dataProcessingId = dataProcessing.getId(); - row.setEiLayer(StringUtils.substring(dataProcessingId, 0, -processingTemplate.length())); - row.setSoundCelerity(dataProcessing.getEchosounderSoundSpeed()); - - Collection<Data> cellData = cell.getData(); - Optional<Data> optionalRadialNumberData = cellData.stream().filter(data -> data.getDataMetadata().equals(radialNumberDataMetadata)).findFirst(); - if (optionalRadialNumberData.isPresent()) { - Data data = optionalRadialNumberData.get(); - String dataValue = data.getDataValue(); - row.setLabel(dataValue); - } - return row; - } - - public String getEiLayer() { - return eiLayer; - } - - public void setEiLayer(String eiLayer) { - this.eiLayer = eiLayer; - } - - public AcousticInstrument getAcousticInstrument() { - return acousticInstrument; - } - - public void setAcousticInstrument(AcousticInstrument acousticInstrument) { - this.acousticInstrument = acousticInstrument; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public Date getCellDateStart() { - return cellDateStart; - } - - public void setCellDateStart(Date cellDateStart) { - this.cellDateStart = cellDateStart; - } - - public int getCellType() { - return cellType; - } - - public void setCellType(int cellType) { - this.cellType = cellType; - } - - public int getCellNum() { - return cellNum; - } - - public void setCellNum(int cellNum) { - this.cellNum = cellNum; - } - - public String getEsduCellDataDepth() { - return esduCellDataDepth; - } - - public void setEsduCellDataDepth(String esduCellDataDepth) { - this.esduCellDataDepth = esduCellDataDepth; - } - - public Float getCellDepthStart() { - return cellDepthStart; - } - - public void setCellDepthStart(Float cellDepthStart) { - this.cellDepthStart = cellDepthStart; - } - - public Float getCellDepthEnd() { - return cellDepthEnd; - } - - public void setCellDepthEnd(Float cellDepthEnd) { - this.cellDepthEnd = cellDepthEnd; - } - - public Float getCellNasc() { - return cellNasc; - } - - public void setCellNasc(Float cellNasc) { - this.cellNasc = cellNasc; - } - - public float getTransceiverAcquisitionPulseLength() { - return transceiverAcquisitionPulseLength; - } - - public void setTransceiverAcquisitionPulseLength(float transceiverAcquisitionPulseLength) { - this.transceiverAcquisitionPulseLength = transceiverAcquisitionPulseLength; - } - - public float getTransceiverAcquisitionGain() { - return transceiverAcquisitionGain; - } - - public void setTransceiverAcquisitionGain(float transceiverAcquisitionGain) { - this.transceiverAcquisitionGain = transceiverAcquisitionGain; - } - - public float getTransceiverAcquisitionAbsorption() { - return transceiverAcquisitionAbsorption; - } - - public void setTransceiverAcquisitionAbsorption(float transceiverAcquisitionAbsorption) { - this.transceiverAcquisitionAbsorption = transceiverAcquisitionAbsorption; - } - - public float getTransceiverAcquisitionPower() { - return transceiverAcquisitionPower; - } - - public void setTransceiverAcquisitionPower(float transceiverAcquisitionPower) { - this.transceiverAcquisitionPower = transceiverAcquisitionPower; - } - - public float getTransceiverAcquisitionSacorrection() { - return transceiverAcquisitionSacorrection; - } - - public void setTransceiverAcquisitionSacorrection(float transceiverAcquisitionSacorrection) { - this.transceiverAcquisitionSacorrection = transceiverAcquisitionSacorrection; - } - - public float getTransducerAcquisitionBeamAngleAthwartship() { - return transducerAcquisitionBeamAngleAthwartship; - } - - public void setTransducerAcquisitionBeamAngleAthwartship(float transducerAcquisitionBeamAngleAthwartship) { - this.transducerAcquisitionBeamAngleAthwartship = transducerAcquisitionBeamAngleAthwartship; - } - - public float getTransducerAcquisitionBeamAngleAlongship() { - return transducerAcquisitionBeamAngleAlongship; - } - - public void setTransducerAcquisitionBeamAngleAlongship(float transducerAcquisitionBeamAngleAlongship) { - this.transducerAcquisitionBeamAngleAlongship = transducerAcquisitionBeamAngleAlongship; - } - - public float getTransducerAcquisitionPsi() { - return transducerAcquisitionPsi; - } - - public void setTransducerAcquisitionPsi(float transducerAcquisitionPsi) { - this.transducerAcquisitionPsi = transducerAcquisitionPsi; - } - - public float getCellLatitude() { - return cellLatitude; - } - - public void setCellLatitude(float cellLatitude) { - this.cellLatitude = cellLatitude; - } - - public float getCellLongitude() { - return cellLongitude; - } - - public void setCellLongitude(float cellLongitude) { - this.cellLongitude = cellLongitude; - } - - public int geteIThresholdLow() { - return eIThresholdLow; - } - - public void seteIThresholdLow(int eIThresholdLow) { - this.eIThresholdLow = eIThresholdLow; - } - - public int geteIThresholdHigh() { - return eIThresholdHigh; - } - - public void seteIThresholdHigh(int eIThresholdHigh) { - this.eIThresholdHigh = eIThresholdHigh; - } - - public Date getCellDateEnd() { - return cellDateEnd; - } - - public void setCellDateEnd(Date cellDateEnd) { - this.cellDateEnd = cellDateEnd; - } - - public Float getCellVolume() { - return cellVolume; - } - - public void setCellVolume(Float cellVolume) { - this.cellVolume = cellVolume; - } - - public int getCellSurface() { - return cellSurface; - } - - public void setCellSurface(int cellSurface) { - this.cellSurface = cellSurface; - } - - public Integer getCellNumberOfSamplesRecorded() { - return cellNumberOfSamplesRecorded; - } - - public void setCellNumberOfSamplesRecorded(Integer cellNumberOfSamplesRecorded) { - this.cellNumberOfSamplesRecorded = cellNumberOfSamplesRecorded; - } - - public Integer getCellNumberOfSamplesEchoIntegrated() { - return cellNumberOfSamplesEchoIntegrated; - } - - public void setCellNumberOfSamplesEchoIntegrated(Integer cellNumberOfSamplesEchoIntegrated) { - this.cellNumberOfSamplesEchoIntegrated = cellNumberOfSamplesEchoIntegrated; - } - - public String getSoundCelerity() { - return soundCelerity; - } - - public void setSoundCelerity(String soundCelerity) { - this.soundCelerity = soundCelerity; - } - - public DataQuality getDataQuality() { - return dataQuality; - } - - public void setDataQuality(DataQuality dataQuality) { - this.dataQuality = dataQuality; - } -} diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/AbstractImportDbStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/AbstractImportDbStrategy.java index 31131e1..ab1c28c 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/AbstractImportDbStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/AbstractImportDbStrategy.java @@ -23,11 +23,10 @@ package fr.ifremer.echobase.services.service.importdb.strategy; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; -import fr.ifremer.echobase.entities.DataAccousticProvider; +import fr.ifremer.echobase.entities.DataAcousticProvider; import fr.ifremer.echobase.entities.EchoBaseUser; import fr.ifremer.echobase.entities.EchoBaseUserEntityEnum; import fr.ifremer.echobase.entities.EchoBaseUserPersistenceContext; -import fr.ifremer.echobase.entities.data.Voyage; import fr.ifremer.echobase.io.EchoBaseIOUtil; import fr.ifremer.echobase.persistence.EchoBaseDbMeta; import fr.ifremer.echobase.services.EchoBaseServiceSupport; @@ -140,7 +139,7 @@ public abstract class AbstractImportDbStrategy extends EchoBaseServiceSupport { 1000 ); - List<DataAccousticProvider> importedEntities = importTables(strategy, + List<DataAcousticProvider> importedEntities = importTables(strategy, model, zipFile, tables @@ -178,19 +177,19 @@ public abstract class AbstractImportDbStrategy extends EchoBaseServiceSupport { protected abstract void createImportLogEntry(EchoBaseUser user, File file, - List<DataAccousticProvider> importedEntities) throws TopiaException; + List<DataAcousticProvider> importedEntities) throws TopiaException; protected abstract void createLogBookEntry(EchoBaseUser user, File file) throws TopiaException; - protected List<DataAccousticProvider> importTables(ImportStrategy<EchoBaseUserEntityEnum> strategy, + protected List<DataAcousticProvider> importTables(ImportStrategy<EchoBaseUserEntityEnum> strategy, ImportDbConfiguration model, ZipFile zipFile, Map<TableMeta<EchoBaseUserEntityEnum>, ZipEntry> entriestoConsume) throws IOException, TopiaException { boolean commitAfterEachFile = model.isCommitAfterEachFile(); - List<DataAccousticProvider> result = new ArrayList<>(); + List<DataAcousticProvider> result = new ArrayList<>(); for (Map.Entry<TableMeta<EchoBaseUserEntityEnum>, ZipEntry> entry : entriestoConsume.entrySet()) { @@ -219,7 +218,7 @@ public abstract class AbstractImportDbStrategy extends EchoBaseServiceSupport { if (EchoBaseUserEntityEnum.Voyage == source || EchoBaseUserEntityEnum.Mooring == source) { Iterable<TopiaEntity> importEntities = TopiaCsvImports.importTableAndReturn(reader, strategy, entryDef, csvResult); for (TopiaEntity importEntity : importEntities) { - DataAccousticProvider dataAccousticProvider = new DataAccousticProvider(importEntity); + DataAcousticProvider dataAccousticProvider = (DataAcousticProvider) importEntity; result.add(dataAccousticProvider); } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/FreeImportDbStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/FreeImportDbStrategy.java index b48e2c4..0070c1c 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/FreeImportDbStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/FreeImportDbStrategy.java @@ -21,7 +21,7 @@ package fr.ifremer.echobase.services.service.importdb.strategy; * #L% */ -import fr.ifremer.echobase.entities.DataAccousticProvider; +import fr.ifremer.echobase.entities.DataAcousticProvider; import fr.ifremer.echobase.entities.EchoBaseUser; import fr.ifremer.echobase.entities.EchoBaseUserEntityEnum; import fr.ifremer.echobase.entities.ImportLog; @@ -69,11 +69,11 @@ public class FreeImportDbStrategy extends AbstractImportDbStrategy { @Override protected void createImportLogEntry(EchoBaseUser user, File file, - List<DataAccousticProvider> importedEntities) throws TopiaException { + List<DataAcousticProvider> importedEntities) throws TopiaException { Date date = newDate(); Decorator<Voyage> decorator = decoratorService.getDecorator(Voyage.class, null); - for (DataAccousticProvider provider : importedEntities) { + for (DataAcousticProvider provider : importedEntities) { TopiaEntity entity = provider.getEntity(); String topiaId = entity.getTopiaId(); diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/ReferentialImportDbStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/ReferentialImportDbStrategy.java index 1f23900..e1d3fa6 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/ReferentialImportDbStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdb/strategy/ReferentialImportDbStrategy.java @@ -22,10 +22,9 @@ package fr.ifremer.echobase.services.service.importdb.strategy; */ import com.google.common.collect.Lists; -import fr.ifremer.echobase.entities.DataAccousticProvider; +import fr.ifremer.echobase.entities.DataAcousticProvider; import fr.ifremer.echobase.entities.EchoBaseUser; import fr.ifremer.echobase.entities.EchoBaseUserEntityEnum; -import fr.ifremer.echobase.entities.data.Voyage; import fr.ifremer.echobase.persistence.EchoBaseDbMeta; import fr.ifremer.echobase.services.service.importdata.ImportException; import org.nuiton.topia.persistence.TopiaException; @@ -87,7 +86,7 @@ public class ReferentialImportDbStrategy extends AbstractImportDbStrategy { @Override protected void createImportLogEntry(EchoBaseUser user, File file, - List<DataAccousticProvider> importedEntities) { + List<DataAcousticProvider> importedEntities) { // no importLog entry to add } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/RemoveDataService.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/RemoveDataService.java index b35ab68..63c16da 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/RemoveDataService.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/RemoveDataService.java @@ -26,7 +26,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import fr.ifremer.echobase.EchoBaseTechnicalException; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.EchoBaseUser; import fr.ifremer.echobase.entities.ImportFile; import fr.ifremer.echobase.entities.ImportFileId; @@ -64,7 +63,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; -import org.nuiton.topia.persistence.TopiaEntity; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Service to remove an import data. @@ -109,12 +108,12 @@ public class RemoveDataService extends EchoBaseServiceSupport { final AbstractRemoveDataStrategy strategy; - final DataAccousticProvider provider; + final DataAcousticProvider provider; public ImportContext(String importLogId, long nbSteps, AbstractRemoveDataStrategy strategy, - DataAccousticProvider provider) { + DataAcousticProvider provider) { this.importLogId = importLogId; this.nbSteps = nbSteps; this.strategy = strategy; @@ -146,11 +145,10 @@ public class RemoveDataService extends EchoBaseServiceSupport { AbstractRemoveDataStrategy strategy = newService(strategyType); strategy.setProgressModel(model); - DataAccousticProvider provider = null; + DataAcousticProvider provider = null; String entityId = importLog.getEntityId(); if (entityId != null) { - TopiaEntity entity = persistenceService.getEntity(entityId); - provider = new DataAccousticProvider(entity); + provider = (DataAcousticProvider) persistenceService.getEntity(entityId); } long l = strategy.computeNbSteps(provider, importLog); diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AbstractRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AbstractRemoveDataStrategy.java index c6e56ab..01f47dc 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AbstractRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AbstractRemoveDataStrategy.java @@ -24,7 +24,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; import com.google.common.base.Optional; import com.google.common.collect.Sets; import fr.ifremer.echobase.EchoBaseTechnicalException; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportFile; import fr.ifremer.echobase.entities.ImportFileId; import fr.ifremer.echobase.entities.ImportLog; @@ -46,6 +45,7 @@ import java.util.Collection; import java.util.List; import java.util.Set; import org.nuiton.topia.persistence.TopiaEntity; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Abstract service to remove import data. @@ -91,14 +91,14 @@ public abstract class AbstractRemoveDataStrategy<E extends TopiaEntity> extends this.progressModel = progressModel; } - public abstract long computeNbSteps(DataAccousticProvider<E> provider, ImportLog importLog); + public abstract long computeNbSteps(DataAcousticProvider<E> provider, ImportLog importLog); - protected abstract void removeImportData(DataAccousticProvider<E> provider, + protected abstract void removeImportData(DataAcousticProvider<E> provider, String id) throws TopiaException; public abstract Set<ImportType> getPossibleSubImportType(); - public void doRemove(DataAccousticProvider<E> provider, ImportLog importLog) throws TopiaException { + public void doRemove(DataAcousticProvider<E> provider, ImportLog importLog) throws TopiaException { removePreData(provider); @@ -135,11 +135,11 @@ public abstract class AbstractRemoveDataStrategy<E extends TopiaEntity> extends long opIndex; - protected void removePreData(DataAccousticProvider<E> provider) throws TopiaException { + protected void removePreData(DataAcousticProvider<E> provider) throws TopiaException { // by default nothing to remove } - protected void removePostData(DataAccousticProvider<E> provider) throws TopiaException { + protected void removePostData(DataAcousticProvider<E> provider) throws TopiaException { // by default nothing to remove } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AcousticRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AcousticRemoveDataStrategy.java index ad7ff0a..4288f31 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AcousticRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AcousticRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Cell; @@ -35,6 +34,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#ACOUSTIC} import. @@ -51,7 +51,7 @@ public class AcousticRemoveDataStrategy extends AbstractRemoveDataStrategy<Voyag LogFactory.getLog(AcousticRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { Voyage voyage = provider.getEntity(); long result = getImportFileIdsCount(importLog); @@ -68,7 +68,7 @@ public class AcousticRemoveDataStrategy extends AbstractRemoveDataStrategy<Voyag } @Override - protected void removePreData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePreData(DataAcousticProvider<Voyage> provider) throws TopiaException { Voyage voyage = provider.getEntity(); // remove all cell results @@ -79,13 +79,13 @@ public class AcousticRemoveDataStrategy extends AbstractRemoveDataStrategy<Voyag } @Override - protected void removePostData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePostData(DataAcousticProvider<Voyage> provider) throws TopiaException { // remove orphans cells removeOrphanCells(); } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { if (id.startsWith(DataAcquisition.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CatchesRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CatchesRemoveDataStrategy.java index e912f11..9cba239 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CatchesRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CatchesRemoveDataStrategy.java @@ -21,7 +21,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; * #L% */ -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Operation; @@ -33,6 +32,7 @@ import org.nuiton.topia.persistence.TopiaException; import java.util.Collections; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#CATCHES} import. @@ -49,12 +49,12 @@ public class CatchesRemoveDataStrategy extends AbstractRemoveDataStrategy<Voyage LogFactory.getLog(CatchesRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { return getImportFileIdsCount(importLog); } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { if (id.startsWith(Sample.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonAllRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonAllRemoveDataStrategy.java index 831b352..0215b56 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonAllRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonAllRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Voyage; @@ -31,6 +30,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#COMMON_ALL} import. @@ -47,13 +47,13 @@ public class CommonAllRemoveDataStrategy extends AbstractRemoveDataStrategy<Voya LogFactory.getLog(CommonAllRemoveDataStrategy.class); @Override - protected void removePostData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePostData(DataAcousticProvider<Voyage> provider) throws TopiaException { // remove orphans cells removeOrphanCells(); } @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { Voyage voyage = provider.getEntity(); long result = getImportFileIdsCount(importLog); @@ -67,7 +67,7 @@ public class CommonAllRemoveDataStrategy extends AbstractRemoveDataStrategy<Voya } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { if (id.startsWith(Voyage.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonTransectRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonTransectRemoveDataStrategy.java index be5548e..d9a45b7 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonTransectRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonTransectRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Transect; @@ -33,6 +32,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#COMMON_TRANSECT} import. @@ -49,7 +49,7 @@ public class CommonTransectRemoveDataStrategy extends AbstractRemoveDataStrategy LogFactory.getLog(CommonTransectRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { Voyage voyage = provider.getEntity(); long result = getImportFileIdsCount(importLog); @@ -66,7 +66,7 @@ public class CommonTransectRemoveDataStrategy extends AbstractRemoveDataStrategy } @Override - protected void removePreData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePreData(DataAcousticProvider<Voyage> provider) throws TopiaException { Voyage voyage = provider.getEntity(); // remove all cell results @@ -77,13 +77,13 @@ public class CommonTransectRemoveDataStrategy extends AbstractRemoveDataStrategy } @Override - protected void removePostData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePostData(DataAcousticProvider<Voyage> provider) throws TopiaException { // remove orphans cells removeOrphanCells(); } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { if (id.startsWith(Transect.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonTransitRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonTransitRemoveDataStrategy.java index 4d5b1c0..16ff621 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonTransitRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonTransitRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Transit; @@ -32,6 +31,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#COMMON_TRANSIT} import. @@ -48,7 +48,7 @@ public class CommonTransitRemoveDataStrategy extends AbstractRemoveDataStrategy< LogFactory.getLog(CommonTransectRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { Voyage voyage = provider.getEntity(); long result = getImportFileIdsCount(importLog); @@ -65,7 +65,7 @@ public class CommonTransitRemoveDataStrategy extends AbstractRemoveDataStrategy< } @Override - protected void removePreData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePreData(DataAcousticProvider<Voyage> provider) throws TopiaException { Voyage voyage = provider.getEntity(); // remove all cell results @@ -76,13 +76,13 @@ public class CommonTransitRemoveDataStrategy extends AbstractRemoveDataStrategy< } @Override - protected void removePostData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePostData(DataAcousticProvider<Voyage> provider) throws TopiaException { // remove orphans cells removeOrphanCells(); } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { Voyage voyage = provider.getEntity(); if (id.startsWith(Transit.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonVoyageRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonVoyageRemoveDataStrategy.java index cf00718..74b396c 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonVoyageRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/CommonVoyageRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Transit; @@ -32,6 +31,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#COMMON_VOYAGE} import. @@ -48,13 +48,13 @@ public class CommonVoyageRemoveDataStrategy extends AbstractRemoveDataStrategy<V LogFactory.getLog(CommonTransectRemoveDataStrategy.class); @Override - protected void removePostData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePostData(DataAcousticProvider<Voyage> provider) throws TopiaException { // remove orphans cells removeOrphanCells(); } @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { Voyage voyage = provider.getEntity(); long result = getImportFileIdsCount(importLog); @@ -68,7 +68,7 @@ public class CommonVoyageRemoveDataStrategy extends AbstractRemoveDataStrategy<V } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { if (id.startsWith(Voyage.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/DummyMooringRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/DummyMooringRemoveDataStrategy.java index 794fb40..cfd3412 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/DummyMooringRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/DummyMooringRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Mooring; @@ -31,6 +30,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * @author Julien Ruchaud - ruchaud@codelutin.com @@ -43,13 +43,13 @@ public class DummyMooringRemoveDataStrategy extends AbstractRemoveDataStrategy<M @Override - public long computeNbSteps(DataAccousticProvider<Mooring> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Mooring> provider, ImportLog importLog) { long result = getImportFileIdsCount(importLog); return result; } @Override - protected void removeImportData(DataAccousticProvider<Mooring> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Mooring> provider, String id) throws TopiaException { } @Override diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/LegacyVoyageRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/LegacyVoyageRemoveDataStrategy.java index ec8ac99..da0086e 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/LegacyVoyageRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/LegacyVoyageRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Voyage; @@ -31,6 +30,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#VOYAGE} import. @@ -47,13 +47,13 @@ public class LegacyVoyageRemoveDataStrategy extends AbstractRemoveDataStrategy<V LogFactory.getLog(LegacyVoyageRemoveDataStrategy.class); @Override - protected void removePostData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePostData(DataAcousticProvider<Voyage> provider) throws TopiaException { // remove orphans cells removeOrphanCells(); } @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { Voyage voyage = provider.getEntity(); long result = getImportFileIdsCount(importLog); @@ -67,7 +67,7 @@ public class LegacyVoyageRemoveDataStrategy extends AbstractRemoveDataStrategy<V } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { if (id.startsWith(Voyage.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringAcousticRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringAcousticRemoveDataStrategy.java index 89d07d5..8befac9 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringAcousticRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringAcousticRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Cell; @@ -36,6 +35,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#MOORING_ACOUSTIC} import. @@ -51,7 +51,7 @@ public class MooringAcousticRemoveDataStrategy extends AbstractRemoveDataStrateg private static final Log log = LogFactory.getLog(MooringAcousticRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Mooring> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Mooring> provider, ImportLog importLog) { Mooring mooring = provider.getEntity(); long result = getImportFileIdsCount(importLog); @@ -66,7 +66,7 @@ public class MooringAcousticRemoveDataStrategy extends AbstractRemoveDataStrateg } @Override - protected void removePreData(DataAccousticProvider<Mooring> provider) throws TopiaException { + protected void removePreData(DataAcousticProvider<Mooring> provider) throws TopiaException { Mooring mooring = provider.getEntity(); // remove all cell results @@ -74,13 +74,13 @@ public class MooringAcousticRemoveDataStrategy extends AbstractRemoveDataStrateg } @Override - protected void removePostData(DataAccousticProvider<Mooring> provider) throws TopiaException { + protected void removePostData(DataAcousticProvider<Mooring> provider) throws TopiaException { // remove orphans cells removeOrphanCells(); } @Override - protected void removeImportData(DataAccousticProvider<Mooring> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Mooring> provider, String id) throws TopiaException { if (id.startsWith(DataAcquisition.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringRemoveDataStrategy.java index 68cca93..19f8591 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Mooring; @@ -32,6 +31,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#MOORING_COMMONS} import. @@ -50,19 +50,19 @@ public class MooringRemoveDataStrategy extends AbstractRemoveDataStrategy<Moorin @Override - public long computeNbSteps(DataAccousticProvider<Mooring> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Mooring> provider, ImportLog importLog) { long result = getImportFileIdsCount(importLog); return result; } @Override - protected void removePostData(DataAccousticProvider<Mooring> provider) throws TopiaException { + protected void removePostData(DataAcousticProvider<Mooring> provider) throws TopiaException { // remove orphans cells removeOrphanCells(); } @Override - protected void removeImportData(DataAccousticProvider<Mooring> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Mooring> provider, String id) throws TopiaException { if (id.startsWith(Mooring.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/OperationRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/OperationRemoveDataStrategy.java index 05d8115..6b86b21 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/OperationRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/OperationRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.GearMetadataValue; @@ -35,6 +34,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#OPERATION} import. @@ -51,13 +51,13 @@ public class OperationRemoveDataStrategy extends AbstractRemoveDataStrategy<Voya LogFactory.getLog(OperationRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { return getImportFileIdsCount(importLog); } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { if (id.startsWith(OperationMetadataValue.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultEsduRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultEsduRemoveDataStrategy.java index 3d7ee95..787b01e 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultEsduRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultEsduRemoveDataStrategy.java @@ -21,7 +21,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; * #L% */ -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Cell; @@ -33,6 +32,7 @@ import org.nuiton.topia.persistence.TopiaException; import java.util.Collections; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#RESULT_ESDU} import. @@ -49,13 +49,13 @@ public class ResultEsduRemoveDataStrategy extends AbstractRemoveDataStrategy<Voy LogFactory.getLog(ResultEsduRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { return getImportFileIdsCount(importLog); } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { if (id.startsWith(Result.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultMapFishRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultMapFishRemoveDataStrategy.java index b202f1b..d8658fe 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultMapFishRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultMapFishRemoveDataStrategy.java @@ -21,7 +21,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; * #L% */ -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Cell; @@ -32,6 +31,7 @@ import org.nuiton.topia.persistence.TopiaException; import java.util.Collections; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#RESULT_MAP_FISH} import. @@ -48,13 +48,13 @@ public class ResultMapFishRemoveDataStrategy extends AbstractRemoveDataStrategy< LogFactory.getLog(ResultMapFishRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { return getImportFileIdsCount(importLog); } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { Voyage voyage = provider.getEntity(); if (id.startsWith(Cell.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultMapOtherRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultMapOtherRemoveDataStrategy.java index f797603..dd6e56a 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultMapOtherRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultMapOtherRemoveDataStrategy.java @@ -21,7 +21,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; * #L% */ -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Cell; @@ -32,6 +31,7 @@ import org.nuiton.topia.persistence.TopiaException; import java.util.Collections; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#RESULT_MAP_OTHER} import. @@ -48,13 +48,13 @@ public class ResultMapOtherRemoveDataStrategy extends AbstractRemoveDataStrategy LogFactory.getLog(ResultMapFishRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { return getImportFileIdsCount(importLog); } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { Voyage voyage = provider.getEntity(); if (id.startsWith(Cell.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultRegionRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultRegionRemoveDataStrategy.java index ba1192d..fe58a94 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultRegionRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultRegionRemoveDataStrategy.java @@ -21,7 +21,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; * #L% */ -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Cell; @@ -32,6 +31,7 @@ import org.nuiton.topia.persistence.TopiaException; import java.util.Collections; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#RESULT_REGION} import. @@ -48,13 +48,13 @@ public class ResultRegionRemoveDataStrategy extends AbstractRemoveDataStrategy<V LogFactory.getLog(ResultRegionRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { return getImportFileIdsCount(importLog); } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { Voyage voyage = provider.getEntity(); if (id.startsWith(Cell.class.getName())) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultVoyageRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultVoyageRemoveDataStrategy.java index 607be3e..2ef51a9 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultVoyageRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/ResultVoyageRemoveDataStrategy.java @@ -22,7 +22,6 @@ package fr.ifremer.echobase.services.service.removedata.strategy; */ import com.google.common.collect.Sets; -import fr.ifremer.echobase.entities.DataAccousticProvider; import fr.ifremer.echobase.entities.ImportLog; import fr.ifremer.echobase.entities.ImportType; import fr.ifremer.echobase.entities.data.Category; @@ -36,6 +35,7 @@ import org.nuiton.topia.persistence.TopiaException; import java.util.List; import java.util.Set; +import fr.ifremer.echobase.entities.DataAcousticProvider; /** * Remove a {@link ImportType#OPERATION} import. @@ -53,7 +53,7 @@ public class ResultVoyageRemoveDataStrategy extends AbstractRemoveDataStrategy<V LogFactory.getLog(ResultVoyageRemoveDataStrategy.class); @Override - public long computeNbSteps(DataAccousticProvider<Voyage> provider, ImportLog importLog) { + public long computeNbSteps(DataAcousticProvider<Voyage> provider, ImportLog importLog) { Voyage voyage = provider.getEntity(); long result = getImportFileIdsCount(importLog); @@ -67,7 +67,7 @@ public class ResultVoyageRemoveDataStrategy extends AbstractRemoveDataStrategy<V } @Override - protected void removePreData(DataAccousticProvider<Voyage> provider) throws TopiaException { + protected void removePreData(DataAcousticProvider<Voyage> provider) throws TopiaException { Voyage voyage = provider.getEntity(); removeVoyageCellResults(voyage); @@ -75,7 +75,7 @@ public class ResultVoyageRemoveDataStrategy extends AbstractRemoveDataStrategy<V } @Override - protected void removeImportData(DataAccousticProvider<Voyage> provider, String id) throws TopiaException { + protected void removeImportData(DataAcousticProvider<Voyage> provider, String id) throws TopiaException { Voyage voyage = provider.getEntity(); if (id.startsWith(Echotype.class.getName())) { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/8180 in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git commit 150c7e63c7def9b070ac7344cbe07b38cae1049d Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Tue Jun 28 16:48:31 2016 +0200 Fix delete import for mooring --- .../removedata/strategy/AcousticRemoveDataStrategy.java | 4 +++- .../strategy/MooringAcousticRemoveDataStrategy.java | 6 +++--- .../echobase/ui/actions/removeData/ConfirmDelete.java | 15 ++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AcousticRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AcousticRemoveDataStrategy.java index 4288f31..98710e2 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AcousticRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/AcousticRemoveDataStrategy.java @@ -111,7 +111,9 @@ public class AcousticRemoveDataStrategy extends AbstractRemoveDataStrategy<Voyag } // remove it from the dataAcquisition DataProcessing dataProcessing = persistenceService.getDataProcessingContainsCell(cell); - dataProcessing.removeCell(cell); + if (dataProcessing != null) { + dataProcessing.removeCell(cell); + } // remove cell persistenceService.deleteCell(cell); diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringAcousticRemoveDataStrategy.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringAcousticRemoveDataStrategy.java index 8befac9..155f0b4 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringAcousticRemoveDataStrategy.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/removedata/strategy/MooringAcousticRemoveDataStrategy.java @@ -28,8 +28,6 @@ import fr.ifremer.echobase.entities.data.Cell; import fr.ifremer.echobase.entities.data.DataAcquisition; import fr.ifremer.echobase.entities.data.DataProcessing; import fr.ifremer.echobase.entities.data.Mooring; -import fr.ifremer.echobase.entities.data.Transect; -import fr.ifremer.echobase.entities.data.Voyage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaException; @@ -106,7 +104,9 @@ public class MooringAcousticRemoveDataStrategy extends AbstractRemoveDataStrateg } // remove it from the dataAcquisition DataProcessing dataProcessing = persistenceService.getDataProcessingContainsCell(cell); - dataProcessing.removeCell(cell); + if (dataProcessing != null) { + dataProcessing.removeCell(cell); + } // remove cell persistenceService.deleteCell(cell); diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/removeData/ConfirmDelete.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/removeData/ConfirmDelete.java index 5cc6d86..8d75a31 100644 --- a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/removeData/ConfirmDelete.java +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/removeData/ConfirmDelete.java @@ -77,11 +77,8 @@ public class ConfirmDelete extends AbstractConfigureAction<RemoveDataConfigurati protected void prepareInputAction(RemoveDataConfiguration model) { importTypes = decoratorService.decorateEnums(ImportType.values()); - importLogs = Lists.newArrayList(); - Decorator<Voyage> decorator = decoratorService.getDecorator(Voyage.class, null); - for (String id : model.getImportLogIds()) { if (log.isInfoEnabled()) { log.info("Load import log " + id); @@ -89,14 +86,18 @@ public class ConfirmDelete extends AbstractConfigureAction<RemoveDataConfigurati Optional<ImportLog> optionalImportLog = userDbPersistenceService.getOptionalImportLog(id); if (optionalImportLog.isPresent()) { - ImportLog importLog = optionalImportLog.get(); - TopiaEntity entity = userDbPersistenceService.getEntity(importLog.getEntityId()); - String voyage = decorator.toString(entity); + String entityDecorated = ""; + String entityId = importLog.getEntityId(); + if (entityId != null) { + TopiaEntity entity = userDbPersistenceService.getEntity(entityId); + entityDecorated = decoratorService.decorate(entity, null); + } + String importType = importTypes.get(importLog.getImportType().name()); String result = t("echobase.common.importLogToDelete", - voyage, + entityDecorated, importType, importLog.getImportDate()); importLogs.add(result); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm