branch develop updated (fda974b -> 8ff27cb)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository echobase. See http://git.codelutin.com/echobase.git from fda974b fixes #6261: Updates some dependencies new e4d47d7 refs-70 #6054: (ajout des cellules esdu non importées dans les logs et dans le resumé de l'import) new 8ff27cb fixes #6056: Impossible d'exporter une table depuis le menu "modifier données" d'Echobase The 2 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 8ff27cb07aa85357b363dbace02bb47ff3ef62d8 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Dec 8 14:37:53 2014 +0100 fixes #6056: Impossible d'exporter une table depuis le menu "modifier données" d'Echobase commit e4d47d7d7b4db189ce9171b0dcce851dc47b73c4 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Dec 8 12:06:01 2014 +0100 refs-70 #6054: (ajout des cellules esdu non importées dans les logs et dans le resumé de l'import) Summary of changes: ...ImportResult.java => AcousticImportResult.java} | 27 ++++---- .../service/importdata/AcousticImportService.java | 78 ++++++++++++++++------ .../i18n/echobase-services_en_GB.properties | 1 + .../i18n/echobase-services_fr_FR.properties | 1 + .../echobase/ui/actions/dbeditor/ExportTable.java | 13 +++- .../exportQuery/DownloadExportQueryResult.java | 5 +- .../ui/actions/workingDb/DownloadDriver.java | 3 +- 7 files changed, 86 insertions(+), 42 deletions(-) copy echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/{EchoBaseCsvFileImportResult.java => AcousticImportResult.java} (63%) -- 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 develop in repository echobase. See http://git.codelutin.com/echobase.git commit e4d47d7d7b4db189ce9171b0dcce851dc47b73c4 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Dec 8 12:06:01 2014 +0100 refs-70 #6054: (ajout des cellules esdu non importées dans les logs et dans le resumé de l'import) --- .../service/importdata/AcousticImportResult.java | 57 ++++++++++++++++ .../service/importdata/AcousticImportService.java | 78 ++++++++++++++++------ .../i18n/echobase-services_en_GB.properties | 1 + .../i18n/echobase-services_fr_FR.properties | 1 + 4 files changed, 117 insertions(+), 20 deletions(-) diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/AcousticImportResult.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/AcousticImportResult.java new file mode 100644 index 0000000..74f291a --- /dev/null +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/AcousticImportResult.java @@ -0,0 +1,57 @@ +package fr.ifremer.echobase.services.service.importdata; + +/* + * #%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% + */ + +import com.google.common.collect.ImmutableSet; +import fr.ifremer.echobase.entities.ImportLog; +import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.service.csv.in.CsvFileImportResult; + +import java.util.HashSet; +import java.util.Set; + +/** + * {@link CsvFileImportResult} with support for ids to keep in the + * {@link ImportLog#getImportId()}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2 + */ +public class AcousticImportResult extends EchoBaseCsvFileImportResult { + + private static final long serialVersionUID = 1L; + + protected final Set<String> notImportedEsduCellIds = new HashSet<String>(); + + public AcousticImportResult(String importFileName) { + super(importFileName); + } + + public <E extends TopiaEntity> void addNotImportedEsduCellId(String id) { + notImportedEsduCellIds.add(id); + } + + public Set<String> getNotImportedEsduCellIds() { + return ImmutableSet.copyOf(notImportedEsduCellIds); + } + +} diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/AcousticImportService.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/AcousticImportService.java index 339543d..b98526c 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/AcousticImportService.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/AcousticImportService.java @@ -20,6 +20,7 @@ */ package fr.ifremer.echobase.services.service.importdata; +import com.google.common.base.Joiner; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import fr.ifremer.echobase.EchoBaseFunctions; @@ -137,7 +138,7 @@ public class AcousticImportService extends AbstractImportDataService<AcousticImp log.info("Starts " + getImportMessage(configuration, inputFile)); } - EchoBaseCsvFileImportResult importResult = newImportResult(inputFile); + AcousticImportResult importResult = newImportResult(inputFile); Map<String, AcousticInstrument> instrumentsById = persistenceService.getEntitiesMap(AcousticInstrument.class, @@ -198,9 +199,9 @@ public class AcousticImportService extends AbstractImportDataService<AcousticImp // can not find correct transit throw new ImportException( l(locale, "echobase.importError.transit.notfound", - voyage.getName(), - startDate, - rowNumber)); + voyage.getName(), + startDate, + rowNumber)); } Transect transect = transit.getTransect(vessel); @@ -209,10 +210,10 @@ public class AcousticImportService extends AbstractImportDataService<AcousticImp // can not find correct transect throw new ImportException( l(locale, "echobase.importError.transect.notfound", - voyage.getName(), - startDate, - vessel.getName(), - rowNumber)); + voyage.getName(), + startDate, + vessel.getName(), + rowNumber)); } AcousticInstrument instrument = row.getAcousticInstrument(); @@ -236,10 +237,10 @@ public class AcousticImportService extends AbstractImportDataService<AcousticImp // can not find correct transect throw new ImportException( l(locale, "echobase.importError.esduCell.notfound", - voyage.getName(), - vessel.getName(), - instrument.getId(), - rowNumber)); + voyage.getName(), + vessel.getName(), + instrument.getId(), + rowNumber)); } String softwareVersion = @@ -303,27 +304,43 @@ public class AcousticImportService extends AbstractImportDataService<AcousticImp } } + int cellType = row.getCellType(); + + String esduCellId = cellDateFormat.format(endDate); + + boolean isEsduCell = cellType == 4; + if (!row.isCellToAdd()) { // dead cell not to be imported - if (log.isDebugEnabled()) { - log.debug("Will not import cell of row " + rowNumber); + + String id = rowNumber + " - " + cellType + " : " + esduCellId; + if (isEsduCell) { + + // keep this fact into import result + if (log.isWarnEnabled()) { + log.warn("Will not import esdu cell of row " + id); + } + importResult.addNotImportedEsduCellId(id); + } else { + + // just a debug log + if (log.isDebugEnabled()) { + log.debug("Will not import cell of row " + id); + } } + continue; } - int cellType = row.getCellType(); - - String esduCellId = cellDateFormat.format(endDate); - DataQuality dataQuality = row.getDataQuality(); - // collect Esdu cellIds only if dataAcquisitions was not created here boolean collectCellIds = !createdDataAcquisitions.contains( dataAcquisition.getTopiaId()); - if (cellType == 4) { + + if (isEsduCell) { if (log.isDebugEnabled()) { log.debug("[row " + rowNumber + "] Esdu cell (" + @@ -407,6 +424,23 @@ public class AcousticImportService extends AbstractImportDataService<AcousticImp } } + @Override + protected String computeResultAndLogBookEntry(AcousticImportConfiguration configuration, + EchoBaseUser user) { + String resultText = super.computeResultAndLogBookEntry(configuration, user); + List<EchoBaseCsvFileImportResult> importResults = configuration.getImportResults(); + if (!importResults.isEmpty()) { + AcousticImportResult acousticImportResult = (AcousticImportResult) importResults.get(0); + Set<String> notImportedCellIds = acousticImportResult.getNotImportedEsduCellIds(); + if (!notImportedCellIds.isEmpty()) { + + // add a log of not imported cells + resultText += "\n\n" + l(getLocale(), "echobase.acousticImport.cellNotImported", Joiner.on("\n").join(notImportedCellIds)); + } + } + return resultText; + } + protected void createEsduCellData(String suffix, Cell cell, Map<String, DataMetadata> dataMetadatas, @@ -711,4 +745,8 @@ public class AcousticImportService extends AbstractImportDataService<AcousticImp return result; } + @Override + protected AcousticImportResult newImportResult(InputFile inputFile) { + return new AcousticImportResult(inputFile.getFileName()); + } } diff --git a/echobase-services/src/main/resources/i18n/echobase-services_en_GB.properties b/echobase-services/src/main/resources/i18n/echobase-services_en_GB.properties index 1be7eb2..86b2e28 100644 --- a/echobase-services/src/main/resources/i18n/echobase-services_en_GB.properties +++ b/echobase-services/src/main/resources/i18n/echobase-services_en_GB.properties @@ -1,3 +1,4 @@ +echobase.acousticImport.cellNotImported=List of not imported esdu cells \:\n%s echobase.common.biometrySampleFile=BiometrySample file echobase.common.cellMapsFile=Map cells file echobase.common.cellPositionReference.end=End diff --git a/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties b/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties index d204869..d7b28bb 100644 --- a/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties +++ b/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties @@ -1,3 +1,4 @@ +echobase.acousticImport.cellNotImported=Liste des cellules ESDU non importées \:\n%s echobase.common.biometrySampleFile=Fichier de biométries (BiometrySample) echobase.common.cellMapsFile=Fichier des cellules Cartes echobase.common.cellPositionReference.end=Fin -- 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 develop in repository echobase. See http://git.codelutin.com/echobase.git commit 8ff27cb07aa85357b363dbace02bb47ff3ef62d8 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Dec 8 14:37:53 2014 +0100 fixes #6056: Impossible d'exporter une table depuis le menu "modifier données" d'Echobase --- .../ifremer/echobase/ui/actions/dbeditor/ExportTable.java | 13 ++++++++++--- .../ui/actions/exportQuery/DownloadExportQueryResult.java | 5 +++-- .../echobase/ui/actions/workingDb/DownloadDriver.java | 3 +-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java index 5b0514d..539b264 100644 --- a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java @@ -95,15 +95,22 @@ public class ExportTable extends EchoBaseActionSupport { public String execute() throws Exception { TableMeta<EchoBaseUserEntityEnum> table = dbEditorService.getTableMeta(entityType); + if (log.isInfoEnabled()) { + log.info("Will generate content to export to file: " + exportFileName); + } String content = exportService.exportData(table, exportAsSeen); if (log.isDebugEnabled()) { log.debug("file to export " + content); } - //FIXME tchemit 2012-01-05 : use the double size to be sure to have the correct length :( find out which caracters are not unicode aware in baracouda datas - contentLength = content.length() * 2; + byte[] bytes = content.getBytes(); + contentLength = bytes.length; + if (log.isDebugEnabled()) { + log.debug("Export content length: " + contentLength); + } contentType = "text/csv"; - inputStream = new ByteArrayInputStream(content.getBytes()); + + inputStream = new ByteArrayInputStream(bytes); return SUCCESS; } diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/DownloadExportQueryResult.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/DownloadExportQueryResult.java index 78c74a5..09367ba 100644 --- a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/DownloadExportQueryResult.java +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/DownloadExportQueryResult.java @@ -87,8 +87,9 @@ public class DownloadExportQueryResult extends EchoBaseActionSupport { contentType = "text/csv"; String content = exportQueryService.createCsvFileContent(queryId); - contentLength = content.length(); - inputStream = new ByteArrayInputStream(content.getBytes()); + byte[] bytes = content.getBytes(); + contentLength = bytes.length; + inputStream = new ByteArrayInputStream(bytes); return SUCCESS; } diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/DownloadDriver.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/DownloadDriver.java index cbe0560..d60ab23 100644 --- a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/DownloadDriver.java +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/DownloadDriver.java @@ -81,8 +81,7 @@ public class DownloadDriver extends EchoBaseActionSupport { JdbcConfiguration dbConfiguration = getEchoBaseSession().getWorkingDbConfiguration(); - fileName = - dbConfiguration.getDriverType().getPilotFileName(configuration); + fileName = dbConfiguration.getDriverType().getPilotFileName(configuration); File file = new File(configuration.getLibDirectory(), fileName); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm