Echobase-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- 1820 discussions
r295 - trunk/echobase-services/src/main/java/fr/ifremer/echobase/services
by tchemit@users.forge.codelutin.com 26 Jan '12
by tchemit@users.forge.codelutin.com 26 Jan '12
26 Jan '12
Author: tchemit
Date: 2012-01-26 16:35:06 +0100 (Thu, 26 Jan 2012)
New Revision: 295
Url: http://forge.codelutin.com/repositories/revision/echobase/295
Log:
use new csv api (charset safe api)
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportService.java
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java 2012-01-26 15:34:47 UTC (rev 294)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java 2012-01-26 15:35:06 UTC (rev 295)
@@ -23,6 +23,7 @@
*/
package fr.ifremer.echobase.services;
+import com.google.common.base.Charsets;
import fr.ifremer.echobase.EchoBaseTechnicalException;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.ExportQuery;
@@ -159,7 +160,7 @@
ExportQueryCsvModel csvModel = sqlQuery.generateCsvModel(csvSeparator);
Export<Map<String, Object>> exporter = Export.newExport(csvModel, rows);
try {
- String content = exporter.startExportAsString();
+ String content = exporter.toString(Charsets.UTF_8);
return content;
} catch (Exception eee) {
throw new EchoBaseTechnicalException("Could not export sql", eee);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportService.java 2012-01-26 15:34:47 UTC (rev 294)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportService.java 2012-01-26 15:35:06 UTC (rev 295)
@@ -23,6 +23,7 @@
*/
package fr.ifremer.echobase.services;
+import com.google.common.base.Charsets;
import fr.ifremer.echobase.EchoBaseTechnicalException;
import fr.ifremer.echobase.entities.meta.AssociationMeta;
import fr.ifremer.echobase.entities.meta.ColumnMeta;
@@ -88,7 +89,7 @@
Export<TopiaEntity> export = prepareExport(tableMeta);
try {
- return export.startExportAsString();
+ return export.toString(Charsets.UTF_8);
} catch (Exception eee) {
throw new EchoBaseTechnicalException("Can not export datas", eee);
}
@@ -104,7 +105,7 @@
TIME_LOG.log(s1, "exportDatas::prepareExport");
long s2 = TimeLog.getTime();
try {
- export.exportToFile(file);
+ export.write(file, Charsets.UTF_8);
} catch (Exception eee) {
throw new EchoBaseTechnicalException("Can not export datas", eee);
}
@@ -122,7 +123,7 @@
long s2 = TimeLog.getTime();
try {
- export.exportToFile(file);
+ export.write(file, Charsets.UTF_8);
} catch (Exception eee) {
throw new EchoBaseTechnicalException("Can not export datas", eee);
}
1
0
r294 - trunk/echobase-entities/src/main/resources/i18n
by tchemit@users.forge.codelutin.com 26 Jan '12
by tchemit@users.forge.codelutin.com 26 Jan '12
26 Jan '12
Author: tchemit
Date: 2012-01-26 16:34:47 +0100 (Thu, 26 Jan 2012)
New Revision: 294
Url: http://forge.codelutin.com/repositories/revision/echobase/294
Log:
clean i18n
Modified:
trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties
Modified: trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties
===================================================================
--- trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties 2012-01-26 10:54:27 UTC (rev 293)
+++ trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties 2012-01-26 15:34:47 UTC (rev 294)
@@ -28,7 +28,7 @@
echobase.common.binSizeRangeAxis=
echobase.common.binUnitsPingAxis=
echobase.common.calendar=
-echobase.common.calibration=calibration
+echobase.common.calibration=Calibration
echobase.common.callsign=
echobase.common.casinoGearName=
echobase.common.category=
@@ -36,7 +36,7 @@
echobase.common.categoryRef=
echobase.common.categoryType=
echobase.common.categoryValue=
-echobase.common.cell=cell
+echobase.common.cell=Cell
echobase.common.cellMethod=
echobase.common.cellType=
echobase.common.childs=
@@ -46,22 +46,22 @@
echobase.common.codeMemo=
echobase.common.codePerm=
echobase.common.comment=
-echobase.common.data=data
-echobase.common.dataAcquisition=dataAcquisition
+echobase.common.data=Data
+echobase.common.dataAcquisition=DataAcquisition
echobase.common.dataCentre=Centre de données
echobase.common.dataCentreEmail=Courriel du centre de données
echobase.common.dataLabel=
echobase.common.dataMetadata=
-echobase.common.dataProcessing=dataProcessing
+echobase.common.dataProcessing=DataProcessing
echobase.common.dataProtocol=
-echobase.common.dataQuality=dataQuality
+echobase.common.dataQuality=DataQuality
echobase.common.dataType=
echobase.common.dataValue=
echobase.common.date=
echobase.common.dateCreated=
-echobase.common.datum=datum
+echobase.common.datum=Datum
echobase.common.datumType=
-echobase.common.depthStratum=depthStratum
+echobase.common.depthStratum=DepthStratum
echobase.common.description=Description
echobase.common.dielPeriod=
echobase.common.digitThreshold=
@@ -141,7 +141,7 @@
echobase.common.measurementBinSize=
echobase.common.measurementMetadata=
echobase.common.measurementUnit=
-echobase.common.metadata=metadata
+echobase.common.metadata=Metadata
echobase.common.metadataGroup=
echobase.common.method=
echobase.common.midHauleLatitude=
@@ -150,7 +150,7 @@
echobase.common.minFishLength=
echobase.common.minLatitude=
echobase.common.minLongitude=
-echobase.common.mission=mission
+echobase.common.mission=Mission
echobase.common.missionAbstract=Résumé de la mission
echobase.common.modificationDate=Date de modification
echobase.common.modificationText=Modification
@@ -185,7 +185,7 @@
echobase.common.qualityDataFlagValues=
echobase.common.r2=
echobase.common.raptriBiometryDataType=
-echobase.common.referenceDatum=referenceDatum
+echobase.common.referenceDatum=ReferenceDatum
echobase.common.referenceDatumType=
echobase.common.referencingMethod=
echobase.common.relatedActivity=
@@ -204,12 +204,12 @@
echobase.common.soundSpeedCalculations=
echobase.common.sounderConstant=
echobase.common.source=Source
-echobase.common.species=espèce
+echobase.common.species=Espèce
echobase.common.speciesCategory=
echobase.common.speciesCode=
echobase.common.speciesCommonName=
echobase.common.speciesTSGroup=
-echobase.common.sqlQuery=requête SQL
+echobase.common.sqlQuery=Requête SQL
echobase.common.standardName=
echobase.common.startDate=
echobase.common.startLocality=
@@ -258,9 +258,9 @@
echobase.common.transducerProcessingBeamAngleAthwartship=
echobase.common.transducerProcessingPsi=
echobase.common.transducerSerial=
-echobase.common.transect=transect
+echobase.common.transect=Transect
echobase.common.transectAbstract=
-echobase.common.transit=transit
+echobase.common.transit=Transit
echobase.common.type=
echobase.common.unit=
echobase.common.units=
@@ -272,3 +272,6 @@
echobase.common.vesselType=
echobase.common.voyage=Campagne
echobase.config.data.directory.description=Chemin de l'application
+echobase.error.import.acousticDensityUnit.required=acousticDensityUnit non renseigné
+echobase.error.import.digitThreshold.required=digitThreshold non renseigné
+echobase.error.import.processingDescription.required=processingDescription non renseigné
1
0
r293 - in trunk: echobase-entities/src/main/java/fr/ifremer/echobase echobase-services/src/main/java/fr/ifremer/echobase/services echobase-services/src/main/java/fr/ifremer/echobase/services/configurations echobase-services/src/main/java/fr/ifremer/echobase/services/csv echobase-ui/src/main/resources/i18n echobase-ui/src/main/webapp/WEB-INF/jsp/importData
by tchemit@users.forge.codelutin.com 26 Jan '12
by tchemit@users.forge.codelutin.com 26 Jan '12
26 Jan '12
Author: tchemit
Date: 2012-01-26 11:54:27 +0100 (Thu, 26 Jan 2012)
New Revision: 293
Url: http://forge.codelutin.com/repositories/revision/echobase/293
Log:
- improve csv model api
- finalize acousticData import (service side)
- improve comma data import (use real bean instead of a Map)
Added:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModelRow.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModelRow.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModelRow.java
Removed:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/models/
Modified:
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AccousticDataImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataCompleteImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataFromTransectImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/AccousticDataImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityAssociationExportModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityAssociationImportModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityCsvModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/ExportQueryCsvModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/VoyageImportModel.java
trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/importData/configureAccousticData.jsp
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -30,6 +30,8 @@
import fr.ifremer.echobase.entities.references.AcousticInstrument;
import fr.ifremer.echobase.entities.references.AreaOfOperation;
import fr.ifremer.echobase.entities.references.CellMethod;
+import fr.ifremer.echobase.entities.references.CellType;
+import fr.ifremer.echobase.entities.references.DataMetadata;
import fr.ifremer.echobase.entities.references.DataQuality;
import fr.ifremer.echobase.entities.references.DataType;
import fr.ifremer.echobase.entities.references.DepthStratum;
@@ -88,6 +90,13 @@
}
};
+ public static final Function<CellType, String> CELL_TYPE_ID = new Function<CellType, String>() {
+ @Override
+ public String apply(CellType input) {
+ return input.getId();
+ }
+ };
+
public static final Function<DepthStratum, String> DEPTH_STRATUM_ID = new Function<DepthStratum, String>() {
@Override
public String apply(DepthStratum input) {
@@ -129,18 +138,21 @@
return input.getName();
}
};
+
public static final Function<DataType, String> DATA_TYPE_NAME = new Function<DataType, String>() {
@Override
public String apply(DataType input) {
return input.getName();
}
};
+
public static final Function<CellMethod, String> CELL_METHOD_NAME = new Function<CellMethod, String>() {
@Override
public String apply(CellMethod input) {
return input.getName();
}
};
+
public static final Function<DataProcessing, String> DATA_PROCESSING_ID = new Function<DataProcessing, String>() {
@Override
public String apply(DataProcessing input) {
@@ -154,6 +166,7 @@
return input.getQualityDataFlagValues();
}
};
+
public static final Function<TopiaEntity, String> TO_TOPIAID = new Function<TopiaEntity, String>() {
@Override
@@ -161,12 +174,14 @@
return input.getTopiaId();
}
};
+
public static final Function<File, String> FILE_NAME = new Function<File, String>() {
@Override
public String apply(File input) {
return input.getName();
}
};
+
public static final Function<SampleDataType, String> SAMPLE_DATA_TYPE_RAPTRI_CODE = new Function<SampleDataType, String>() {
@Override
public String apply(SampleDataType input) {
@@ -180,6 +195,7 @@
return input.getName();
}
};
+
public static final Function<Gear, String> GEAR_CASINO_GEAR_NAME = new Function<Gear, String>() {
@Override
public String apply(Gear input) {
@@ -195,6 +211,7 @@
return input.getId();
}
};
+
public static final Function<SizeCategory, String> SIZE_CATEGORY_NAME = new Function<SizeCategory, String>() {
@Override
public String apply(SizeCategory input) {
@@ -216,7 +233,14 @@
}
};
- public static String getSpeciesCategoryKey(Species species, SizeCategory sizeCategory,SexCategory sexCategory) {
+ public static final Function<DataMetadata, String> DATA_METADATA_NAME = new Function<DataMetadata, String>() {
+ @Override
+ public String apply(DataMetadata input) {
+ return input.getName();
+ }
+ };
+
+ public static String getSpeciesCategoryKey(Species species, SizeCategory sizeCategory, SexCategory sexCategory) {
String key = species.getBaracoudaCode();
if (sizeCategory != null) {
key += "_" + sizeCategory.getName();
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AccousticDataImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AccousticDataImportService.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AccousticDataImportService.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -23,11 +23,39 @@
*/
package fr.ifremer.echobase.services;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
+import fr.ifremer.echobase.EchoBaseFunctions;
import fr.ifremer.echobase.InputFile;
import fr.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.entities.data.Cell;
+import fr.ifremer.echobase.entities.data.CellDAO;
+import fr.ifremer.echobase.entities.data.Data;
+import fr.ifremer.echobase.entities.data.DataAcquisition;
+import fr.ifremer.echobase.entities.data.DataAcquisitionDAO;
+import fr.ifremer.echobase.entities.data.DataDAO;
+import fr.ifremer.echobase.entities.data.DataProcessing;
+import fr.ifremer.echobase.entities.data.DataProcessingDAO;
+import fr.ifremer.echobase.entities.data.Transect;
+import fr.ifremer.echobase.entities.data.Transit;
+import fr.ifremer.echobase.entities.references.AcousticInstrument;
+import fr.ifremer.echobase.entities.references.CellType;
+import fr.ifremer.echobase.entities.references.DataMetadata;
+import fr.ifremer.echobase.entities.references.Vessel;
import fr.ifremer.echobase.services.configurations.AccousticDataImportConfiguration;
+import fr.ifremer.echobase.services.csv.AcousticDataImportModel;
+import fr.ifremer.echobase.services.csv.AcousticDataImportModelRow;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.util.csv.Import;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
import java.util.Map;
/**
@@ -40,14 +68,409 @@
@Override
public Map<InputFile, CsvImportResult> startImport(AccousticDataImportConfiguration configuration,
- EchoBaseUser user) {
+ EchoBaseUser user) throws IOException, TopiaException {
Map<InputFile, CsvImportResult> result = Maps.newHashMap();
- char csvSeparator = serviceContext.getConfiguration().getCsvSeparator();
- importMoviesFile(configuration.getMoviesFile(), csvSeparator);
+
+ Transit transit = getEntityById(Transit.class, configuration.getTransitId());
+ Vessel vessel = getEntityById(Vessel.class, configuration.getVesselId());
+
+ // find out the correct transect to use
+ Transect transect = transit.getTransect(vessel);
+
+ List<AcousticInstrument> acousticInstruments = getEntities(AcousticInstrument.class);
+ Map<String, AcousticInstrument> acousticInstrumentsById = Maps.uniqueIndex(
+ acousticInstruments, EchoBaseFunctions.ACOUSTIC_INSTRUMENT_ID);
+
+ List<CellType> cellTypes = getEntities(CellType.class);
+ Map<String, CellType> cellTypesById = Maps.uniqueIndex(
+ cellTypes, EchoBaseFunctions.CELL_TYPE_ID);
+
+ List<DataMetadata> dataMetadatas = getEntities(DataMetadata.class);
+ Map<String, DataMetadata> dataMetadatasByName = Maps.uniqueIndex(
+ dataMetadatas, EchoBaseFunctions.DATA_METADATA_NAME);
+
+ CellType esduCellType = cellTypesById.get("Esdu");
+ Preconditions.checkNotNull(esduCellType);
+
+ CellType elementaryCellType = cellTypesById.get("Elementary");
+ Preconditions.checkNotNull(elementaryCellType);
+
+ importMoviesFile(transect,
+ acousticInstrumentsById,
+ dataMetadatasByName,
+ esduCellType,
+ elementaryCellType,
+ configuration,
+ configuration.getMoviesFile());
return result;
}
- private void importMoviesFile(InputFile inputFile, char csvSeparator) {
+ private final DateFormat cellDateFormat =
+ new SimpleDateFormat("yyyy-MM-dd hh:mm:ss'Z'");
+
+ private void importMoviesFile(Transect transect,
+ Map<String, AcousticInstrument> instrumentsById,
+ Map<String, DataMetadata> dataMetadatasByName,
+ CellType esduCellType,
+ CellType elementaryCellType,
+ AccousticDataImportConfiguration configuration,
+ InputFile inputFile) throws TopiaException, IOException {
+
+ AcousticDataImportModel csvModel = new AcousticDataImportModel(serviceContext.getConfiguration().getCsvSeparator());
+
+ DataAcquisitionDAO dataAcquisitionDAO =
+ (DataAcquisitionDAO) getDAO(DataAcquisition.class);
+ DataProcessingDAO dataProcessingDAO =
+ (DataProcessingDAO) getDAO(DataProcessing.class);
+ CellDAO cellDAO = (CellDAO) getDAO(Cell.class);
+ DataDAO dataDAO = (DataDAO) getDAO(Data.class);
+
+ Reader reader = new BufferedReader(new FileReader(inputFile.getFile()));
+ try {
+ Import<AcousticDataImportModelRow> importer = Import.newImport(csvModel, reader);
+ DataAcquisition dataAcquisition = null;
+ DataProcessing dataProcessing = null;
+ Cell esduCell = null;
+ Cell elementaryCell = null;
+ for (AcousticDataImportModelRow row : importer) {
+
+ // Build the row acoustic instrument
+ String sndname = row.getSndName();
+ String channelName = row.getChannelName();
+ String instrumentId = sndname + channelName;
+ AcousticInstrument instrument = instrumentsById.get(instrumentId);
+
+ if (dataAcquisition == null ||
+ !instrument.equals(dataAcquisition.getAcousticInstrument())) {
+
+ // first dataAcquisition or new instrument
+
+ String softwareVersion =
+ getSoftwareVersion(configuration, instrument);
+ String soundSpeedCalculations =
+ getSoundSpeedCalculations(configuration, instrument);
+
+ // create dataAcquisiton
+ dataAcquisition = createDataAcquisition(
+ configuration,
+ instrument,
+ softwareVersion,
+ soundSpeedCalculations,
+ row,
+ dataAcquisitionDAO
+ );
+
+ transect.addDataAcquisition(dataAcquisition);
+
+ // create data processing
+ dataProcessing = createDataProcessing(
+ configuration,
+ softwareVersion,
+ soundSpeedCalculations,
+ row,
+ dataProcessingDAO
+ );
+
+ dataAcquisition.addDataProcessing(dataProcessing);
+
+ // must start a fresh new esdu cell
+ esduCell = null;
+ }
+
+ Date startDate = row.getEsduCellStartDate();
+ String esduCellId = cellDateFormat.format(startDate);
+
+ if (esduCell == null || !esduCellId.equals(esduCell.getName())) {
+
+ // create esdu cell
+ esduCell = cellDAO.create(
+ Cell.PROPERTY_CELL_TYPE, esduCellType,
+ Cell.PROPERTY_NAME, esduCellId
+ );
+
+ dataProcessing.addCell(esduCell);
+
+ // create esdu cell data
+ createEsduCellData(configuration,
+ esduCell,
+ dataMetadatasByName,
+ row,
+ dataDAO);
+
+ // force to create a new elementary cell
+ elementaryCell = null;
+ }
+
+ int cellNum = row.getElementaryCellNum();
+
+ String elementaryCellId = esduCellId + "_" + cellNum;
+
+ if (elementaryCell == null ||
+ !elementaryCellId.equals(elementaryCell.getName())) {
+
+ // create the elementary cell
+
+ elementaryCell = cellDAO.create(
+ Cell.PROPERTY_CELL_TYPE, elementaryCellType,
+ Cell.PROPERTY_NAME, elementaryCellId
+ );
+ esduCell.addChilds(elementaryCell);
+ }
+
+ // create datas of the elementary cell
+ createElementaryCellData(configuration,
+ elementaryCell,
+ dataMetadatasByName,
+ row,
+ dataDAO);
+ }
+
+ } finally {
+ reader.close();
+ }
}
+ private void createEsduCellData(AccousticDataImportConfiguration configuration,
+ Cell cell,
+ Map<String, DataMetadata> dataMetadatasByName,
+ AcousticDataImportModelRow row,
+ DataDAO dao) throws TopiaException {
+
+ DataMetadata dataMetadata;
+ Data data;
+ String dataValue;
+
+ // create Latitude data
+ dataMetadata = dataMetadatasByName.get("LatitudeStart");
+ dataValue = row.getEsduCellDataLatitude();
+ data = dao.create(Data.PROPERTY_DATA_METADATA, dataMetadata);
+ data.setDataValue(dataValue);
+ cell.addData(data);
+
+ // create Longitude data
+ dataMetadata = dataMetadatasByName.get("LongitudeStart");
+ dataValue = row.getEsduCellDataLongitude();
+ data = dao.create(Data.PROPERTY_DATA_METADATA, dataMetadata);
+ data.setDataValue(dataValue);
+ cell.addData(data);
+
+ // create Depth data
+ dataMetadata = dataMetadatasByName.get("DepthRefSurfaceStart");
+ dataValue = row.getEsduCellDataDepth();
+ data = dao.create(Data.PROPERTY_DATA_METADATA, dataMetadata);
+ data.setDataValue(dataValue);
+ cell.addData(data);
+
+ // create Time data
+ dataMetadata = dataMetadatasByName.get("TimeStart");
+ dataValue = row.getEsduCellDataTime();
+ data = dao.create(Data.PROPERTY_DATA_METADATA, dataMetadata);
+ data.setDataValue(dataValue);
+ cell.addData(data);
+
+ // create AcousticDensity data
+ dataMetadata = dataMetadatasByName.get("sa");
+ dataValue = row.getEsduCellDataAcousticDensity();
+ data = dao.create(Data.PROPERTY_DATA_METADATA, dataMetadata);
+ data.setDataValue(dataValue);
+ cell.addData(data);
+ }
+
+ private void createElementaryCellData(AccousticDataImportConfiguration configuration,
+ Cell cell,
+ Map<String, DataMetadata> dataMetadatasByName,
+ AcousticDataImportModelRow row,
+ DataDAO dao) throws TopiaException {
+
+ DataMetadata dataMetadata;
+ Data data;
+ String dataValue;
+
+ int cellType = row.getElementaryCellType();
+
+ String startMeta;
+ String endMeta;
+
+ if (cellType == 0) {
+
+ // surface
+
+ startMeta = "DepthRefSurfaceStart";
+ endMeta = "DepthRefSurfaceEnd";
+
+ } else {
+
+ // bottom
+
+ startMeta = "DepthRefBottomStart";
+ endMeta = "DepthRefBottomEnd";
+
+
+ }
+
+ // create depth start data
+ dataMetadata = dataMetadatasByName.get(startMeta);
+ dataValue = row.getElementaryCellDataDepthStart();
+ data = dao.create(Data.PROPERTY_DATA_METADATA, dataMetadata);
+ data.setDataValue(dataValue);
+ cell.addData(data);
+
+ // create depth end data
+ dataMetadata = dataMetadatasByName.get(endMeta);
+ dataValue = row.getElementaryCellDataDepthEnd();
+ data = dao.create(Data.PROPERTY_DATA_METADATA, dataMetadata);
+ data.setDataValue(dataValue);
+ cell.addData(data);
+
+ // create acoustic density data
+ dataMetadata = dataMetadatasByName.get("sa");
+ dataValue = row.getElementaryCellDataAcousticDensity();
+ data = dao.create(Data.PROPERTY_DATA_METADATA, dataMetadata);
+ data.setDataValue(dataValue);
+ cell.addData(data);
+
+ }
+
+ private DataAcquisition createDataAcquisition(AccousticDataImportConfiguration configuration,
+ AcousticInstrument instrument,
+ String softwareVersion,
+ String soundSpeedCalculations,
+ AcousticDataImportModelRow row,
+ DataAcquisitionDAO dataAcquisitionDAO) throws TopiaException {
+
+ String transceiverAcquisitionAbsorptionDescription =
+ configuration.getTransceiverAcquisitionAbsorptionDescription();
+ String loggedDataFormat = configuration.getLoggedDataFormat();
+ String loggedDataDatatype = configuration.getLoggedDataDatatype();
+ String pingDutyCycle = configuration.getPingDutyCycle();
+ String echosounderSoundSpeed = configuration.getEchosounderSoundSpeed();
+
+ DataAcquisition dataAcquisition = dataAcquisitionDAO.create();
+
+ // fill from manual configuration
+ dataAcquisition.setAcousticInstrument(instrument);
+ dataAcquisition.setTransceiverAcquisitionAbsorptionDescription(transceiverAcquisitionAbsorptionDescription);
+ dataAcquisition.setAcquisitionSoftwareVersion(softwareVersion);
+ dataAcquisition.setLoggedDataFormat(loggedDataFormat);
+ dataAcquisition.setLoggedDataDatatype(loggedDataDatatype);
+ dataAcquisition.setPingDutyCycle(pingDutyCycle);
+ dataAcquisition.setEchosounderSoundSpeed(echosounderSoundSpeed);
+ 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(AccousticDataImportConfiguration configuration,
+ String softwareVersion,
+ String soundSpeedCalculations,
+ AcousticDataImportModelRow row,
+ DataProcessingDAO dataProcessingDAO) throws TopiaException {
+
+ String transceiverAcquisitionAbsorptionDescription =
+ configuration.getTransceiverAcquisitionAbsorptionDescription();
+ String echosounderSoundSpeed = configuration.getEchosounderSoundSpeed();
+ String processingTemplate = configuration.getProcessingTemplate();
+ String processingDescription = configuration.getProcessingDescription();
+ Float sounderConstant = configuration.getSounderConstant();
+ float digitThreshold = configuration.getDigitThreshold();
+ String acousticDensityUnit = configuration.getAcousticDensityUnit();
+ String notes = configuration.getNotes();
+
+ DataProcessing dataProcessing = dataProcessingDAO.create();
+
+ // fill from manual configuration
+ dataProcessing.setProcessingTemplate(processingTemplate);
+ dataProcessing.setProcessingDescription(processingDescription);
+ dataProcessing.setSounderConstant(sounderConstant);
+ dataProcessing.setDigitThreshold(digitThreshold);
+ dataProcessing.setAcousticDensityUnit(acousticDensityUnit);
+ dataProcessing.setNotes(notes);
+ dataProcessing.setProcessingSoftwareVersion(softwareVersion);
+ dataProcessing.setTransceiverProcessingAbsorptionDescription(transceiverAcquisitionAbsorptionDescription);
+ dataProcessing.setEchosounderSoundSpeed(echosounderSoundSpeed);
+ 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();
+ Float eIThreshold = row.getEiThreshold();
+
+ dataProcessing.setEiThreshold(eIThreshold);
+ dataProcessing.setTransceiverProcessingSacorrection(transceiverAcquisitionSacorrection);
+ dataProcessing.setTransceiverProcessingAbsorption(transceiverAcquisitionAbsorption);
+ dataProcessing.setTransceiverProcessingGain(transceiverAcquisitionGain);
+ dataProcessing.setTransducerProcessingPsi(transducerAcquisitionPsi);
+ dataProcessing.setTransducerProcessingBeamAngleAthwartship(transducerAcquisitionBeamAngleAthwartship);
+ dataProcessing.setTransducerProcessingBeamAngleAlongship(transducerAcquisitionBeamAngleAlongship);
+
+
+ return dataProcessing;
+ }
+
+ private String getSoftwareVersion(AccousticDataImportConfiguration configuration,
+ AcousticInstrument instrument) {
+ String softwareVersionER60 = configuration.getAcquisitionSoftwareVersionER60();
+ String softwareVersionME70 = configuration.getAcquisitionSoftwareVersionME70();
+ String transceiverModel = instrument.getTransceiverModel();
+ String result = softwareVersionER60;
+
+ //FIXME Finish this algorithm
+ if (transceiverModel.equals("ME70")) {
+ result = softwareVersionME70;
+ }
+ return result;
+ }
+
+ private String getSoundSpeedCalculations(AccousticDataImportConfiguration configuration,
+ AcousticInstrument instrument) {
+ String speedCalculationsER60 = configuration.getSoundSpeedCalculationsER60();
+ String speedCalculationsME70 = configuration.getSoundSpeedCalculationsME70();
+ String transceiverModel = instrument.getTransceiverModel();
+ String result = speedCalculationsER60;
+ //FIXME Finish this algorithm
+ if (transceiverModel.equals("ME70")) {
+ result = speedCalculationsME70;
+ }
+ return result;
+ }
+
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataCompleteImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataCompleteImportService.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataCompleteImportService.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -36,13 +36,14 @@
import fr.ifremer.echobase.entities.references.Vessel;
import fr.ifremer.echobase.services.configurations.CommonDataCompleteImportConfiguration;
import fr.ifremer.echobase.services.csv.TransectImportModel;
+import fr.ifremer.echobase.services.csv.TransectImportModelRow;
import fr.ifremer.echobase.services.csv.TransitImportModel;
+import fr.ifremer.echobase.services.csv.TransitImportModelRow;
import fr.ifremer.echobase.services.csv.VoyageImportModel;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.util.csv.Import;
import org.nuiton.util.csv.ImportModel;
-import org.nuiton.util.csv.ImportToMap;
import java.io.BufferedReader;
import java.io.FileReader;
@@ -66,17 +67,19 @@
Map<InputFile, CsvImportResult> result = Maps.newHashMap();
- char csvSeparator = serviceContext.getConfiguration().getCsvSeparator();
- Mission mission = getEntityById(Mission.class, configuration.getMissionId());
- AreaOfOperation areaOfOperation = getEntityById(AreaOfOperation.class, configuration.getAreaOfOperationId());
- Vessel vessel = getEntityById(Vessel.class, configuration.getVesselId());
+ Mission mission = getEntityById(Mission.class,
+ configuration.getMissionId());
+ AreaOfOperation areaOfOperation =
+ getEntityById(AreaOfOperation.class,
+ configuration.getAreaOfOperationId());
+ Vessel vessel = getEntityById(Vessel.class,
+ configuration.getVesselId());
importVoyageFile(configuration.getVoyageFile(),
mission,
areaOfOperation,
configuration.getVoyageDescription(),
- configuration.getDatum(),
- csvSeparator);
+ configuration.getDatum());
List<Voyage> allVoyages = getEntities(Voyage.class);
Map<String, Voyage> voyageMap = Maps.uniqueIndex(
@@ -84,8 +87,7 @@
importTransitFile(configuration.getTransitFile(),
voyageMap,
- configuration.getTransitRelatedActivity(),
- csvSeparator);
+ configuration.getTransitRelatedActivity());
importTransectFile(configuration.getTransectFile(),
vessel,
@@ -93,10 +95,9 @@
configuration.getDatum(),
configuration.getTransectLicence(),
configuration.getTransectGeospatialVerticalPositive(),
- configuration.getTransectBinUnitsPingAxis(),
- csvSeparator);
+ configuration.getTransectBinUnitsPingAxis());
- importEchotypeFile(configuration.getEchotypeFile(), csvSeparator);
+ importEchotypeFile(configuration.getEchotypeFile());
commitTransaction("Could not commit transaction of common data import");
return result;
@@ -117,11 +118,10 @@
Mission mission,
AreaOfOperation areaOfOperation,
String voyageDescription,
- String datum,
- char csvSeparator) throws IOException, TopiaException {
+ String datum) throws IOException, TopiaException {
- ImportModel<Voyage> csvModel = new VoyageImportModel(csvSeparator);
+ ImportModel<Voyage> csvModel = new VoyageImportModel(serviceContext.getConfiguration().getCsvSeparator());
TopiaDAO<Voyage> dao = getDAO(Voyage.class);
Reader reader = new BufferedReader(new FileReader(inputFile.getFile()));
@@ -142,27 +142,26 @@
protected void importTransitFile(InputFile inputFile,
Map<String, Voyage> voyageMap,
- String relatedActivity,
- char csvSeparator) throws TopiaException, IOException {
- TransitImportModel csvModel = new TransitImportModel(csvSeparator, voyageMap);
+ String relatedActivity) throws TopiaException, IOException {
+ TransitImportModel csvModel = new TransitImportModel(serviceContext.getConfiguration().getCsvSeparator(), voyageMap);
TopiaDAO<Transit> dao = getDAO(Transit.class);
Reader reader = new BufferedReader(new FileReader(inputFile.getFile()));
try {
- ImportToMap importer = ImportToMap.newImport(csvModel, reader);
- for (Map<String, Object> row : importer) {
+ Import<TransitImportModelRow> importer = Import.newImport(csvModel, reader);
+ for (TransitImportModelRow row : importer) {
- Voyage voyage = (Voyage) row.get(TransitImportModel.TRANSIT_VoyageId);
+ Voyage voyage = row.getVoyage();
Transit transit = dao.create();
- transit.setDescription((String) row.get(Transit.PROPERTY_DESCRIPTION));
- transit.setStartLocality((String) row.get(Transit.PROPERTY_START_LOCALITY));
- transit.setEndLocality((String) row.get(Transit.PROPERTY_END_LOCALITY));
+ transit.setDescription(row.getDescription());
+ transit.setStartLocality(row.getStartLocality());
+ transit.setEndLocality(row.getEndLocality());
- transit.setStartTime((Date) row.get(Transit.PROPERTY_START_TIME));
- transit.setEndTime((Date) row.get(Transit.PROPERTY_END_TIME));
+ transit.setStartTime(row.getStartTime());
+ transit.setEndTime(row.getEndTime());
transit.setRelatedActivity(relatedActivity);
voyage.addTransit(transit);
}
@@ -178,23 +177,23 @@
String datum,
String license,
String geospatialVerticalPositive,
- String binUnitsPingAxis,
- char csvSeparator
+ String binUnitsPingAxis
) throws TopiaException, IOException {
- TransectImportModel csvModel = new TransectImportModel(csvSeparator, voyageMap);
+ TransectImportModel csvModel = new TransectImportModel(serviceContext.getConfiguration().getCsvSeparator(), voyageMap);
TopiaDAO<Transect> dao = getDAO(Transect.class);
Reader reader = new BufferedReader(new FileReader(inputFile.getFile()));
try {
- ImportToMap importer = ImportToMap.newImport(csvModel, reader);
- for (Map<String, Object> row : importer) {
+ Import<TransectImportModelRow> importer =
+ Import.newImport(csvModel, reader);
+ for (TransectImportModelRow row : importer) {
- Voyage voyage = (Voyage) row.get(TransectImportModel.TRANSECT_VoyageId);
+ Voyage voyage = row.getVoyage();
- Date timeCoverageStart = (Date) row.get(Transect.PROPERTY_TIME_COVERAGE_START);
- Date timeCoverageEnd = (Date) row.get(Transect.PROPERTY_TIME_COVERAGE_END);
+ Date timeCoverageStart = row.getTimeCoverageStart();
+ Date timeCoverageEnd = row.getTimeCoverageEnd();
Transit transit = voyage.getTransit(timeCoverageStart, timeCoverageEnd);
if (transit == null) {
@@ -206,29 +205,28 @@
Transect.PROPERTY_VESSEL, vessel
);
- transect.setTitle((String) row.get(Transect.PROPERTY_TITLE));
- transect.setTransectAbstract((String) row.get(Transect.PROPERTY_TRANSECT_ABSTRACT));
- transect.setComment((String) row.get(Transect.PROPERTY_COMMENT));
+ transect.setTitle(row.getTitle());
+ transect.setTransectAbstract(row.getTransectAbstract());
+ transect.setComment(row.getComment());
transect.setDatum(datum);
transect.setLicence(license);
transect.setGeospatialVerticalPositive(geospatialVerticalPositive);
transect.setBinUnitsPingAxis(binUnitsPingAxis);
- transect.setDateCreated((Date) row.get(Transect.PROPERTY_DATE_CREATED));
+ transect.setDateCreated(row.getDateCreated());
transect.setTimeCoverageStart(timeCoverageStart);
transect.setTimeCoverageEnd(timeCoverageEnd);
- transect.setGeospatialLatMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LAT_MIN));
- transect.setGeospatialLonMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LON_MIN));
- transect.setGeospatialVerticalMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MIN));
+ transect.setGeospatialLatMin(row.getGeospatialLatMin());
+ transect.setGeospatialLonMin(row.getGeospatialLonMin());
+ transect.setGeospatialVerticalMin(row.getGeospatialVerticalMin());
- transect.setGeospatialLatMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LAT_MAX));
- transect.setGeospatialLonMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LON_MAX));
- transect.setGeospatialVerticalMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX));
- transect.setLinestring((String) row.get(Transect.PROPERTY_LINESTRING));
-
+ transect.setGeospatialLatMax(row.getGeospatialLatMax());
+ transect.setGeospatialLonMax(row.getGeospatialLonMax());
+ transect.setGeospatialVerticalMax(row.getGeospatialVerticalMax());
+ transect.setLinestring(row.getLinestring());
transit.addTransect(transect);
}
@@ -237,7 +235,7 @@
}
}
- private void importEchotypeFile(InputFile inputFile, char csvSeparator) {
+ private void importEchotypeFile(InputFile inputFile) {
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataFromTransectImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataFromTransectImportService.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataFromTransectImportService.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -34,9 +34,10 @@
import fr.ifremer.echobase.entities.references.Vessel;
import fr.ifremer.echobase.services.configurations.CommonDataFromTransectImportConfiguration;
import fr.ifremer.echobase.services.csv.TransectImportModel;
+import fr.ifremer.echobase.services.csv.TransectImportModelRow;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaDAO;
-import org.nuiton.util.csv.ImportToMap;
+import org.nuiton.util.csv.Import;
import java.io.BufferedReader;
import java.io.FileReader;
@@ -59,7 +60,6 @@
EchoBaseUser user) throws IOException, TopiaException {
Map<InputFile, CsvImportResult> result = Maps.newHashMap();
- char csvSeparator = serviceContext.getConfiguration().getCsvSeparator();
Voyage voyage = getEntityById(Voyage.class, configuration.getVoyageId());
Vessel vessel = getEntityById(Vessel.class, configuration.getVesselId());
@@ -71,11 +71,7 @@
voyage,
voyageMap,
vessel,
- configuration.getDatum(),
- configuration.getTransectLicence(),
- configuration.getTransectGeospatialVerticalPositive(),
- configuration.getTransectBinUnitsPingAxis(),
- csvSeparator);
+ configuration);
return result;
}
@@ -83,24 +79,26 @@
Voyage voyage,
Map<String, Voyage> voyageMap,
Vessel vessel,
- String datum,
- String license,
- String geospatialVerticalPositive,
- String binUnitsPingAxis,
- char csvSeparator
+ CommonDataFromTransectImportConfiguration configuration
) throws TopiaException, IOException {
- TransectImportModel csvModel = new TransectImportModel(csvSeparator, voyageMap);
+ String datum = configuration.getDatum();
+ String license = configuration.getTransectLicence();
+ String geospatialVerticalPositive = configuration.getTransectGeospatialVerticalPositive();
+ String binUnitsPingAxis = configuration.getTransectBinUnitsPingAxis();
+ TransectImportModel csvModel = new TransectImportModel(serviceContext.getConfiguration().getCsvSeparator(),
+ voyageMap);
+
TopiaDAO<Transect> dao = getDAO(Transect.class);
Reader reader = new BufferedReader(new FileReader(inputFile.getFile()));
try {
- ImportToMap importer = ImportToMap.newImport(csvModel, reader);
- for (Map<String, Object> row : importer) {
+ Import<TransectImportModelRow> importer = Import.newImport(csvModel, reader);
+ for (TransectImportModelRow row : importer) {
- Date timeCoverageStart = (Date) row.get(Transect.PROPERTY_TIME_COVERAGE_START);
- Date timeCoverageEnd = (Date) row.get(Transect.PROPERTY_TIME_COVERAGE_END);
+ Date timeCoverageStart = row.getTimeCoverageStart();
+ Date timeCoverageEnd = row.getTimeCoverageEnd();
Transit transit = voyage.getTransit(timeCoverageStart, timeCoverageEnd);
if (transit == null) {
@@ -109,31 +107,30 @@
voyage.getName() + " between " + timeCoverageStart + " and " + timeCoverageEnd);
}
- Transect transect = dao.create(
- Transect.PROPERTY_VESSEL, vessel
- );
+ Transect transect =
+ dao.create(Transect.PROPERTY_VESSEL, vessel);
- transect.setTitle((String) row.get(Transect.PROPERTY_TITLE));
- transect.setTransectAbstract((String) row.get(Transect.PROPERTY_TRANSECT_ABSTRACT));
- transect.setComment((String) row.get(Transect.PROPERTY_COMMENT));
+ transect.setTitle(row.getTitle());
+ transect.setTransectAbstract(row.getTransectAbstract());
+ transect.setComment(row.getComment());
transect.setDatum(datum);
transect.setLicence(license);
transect.setGeospatialVerticalPositive(geospatialVerticalPositive);
transect.setBinUnitsPingAxis(binUnitsPingAxis);
- transect.setDateCreated((Date) row.get(Transect.PROPERTY_DATE_CREATED));
+ transect.setDateCreated(row.getDateCreated());
transect.setTimeCoverageStart(timeCoverageStart);
transect.setTimeCoverageEnd(timeCoverageEnd);
- transect.setGeospatialLatMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LAT_MIN));
- transect.setGeospatialLonMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LON_MIN));
- transect.setGeospatialVerticalMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MIN));
+ transect.setGeospatialLatMin(row.getGeospatialLatMin());
+ transect.setGeospatialLonMin(row.getGeospatialLonMin());
+ transect.setGeospatialVerticalMin(row.getGeospatialVerticalMin());
- transect.setGeospatialLatMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LAT_MAX));
- transect.setGeospatialLonMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LON_MAX));
- transect.setGeospatialVerticalMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX));
- transect.setLinestring((String) row.get(Transect.PROPERTY_LINESTRING));
+ transect.setGeospatialLatMax(row.getGeospatialLatMax());
+ transect.setGeospatialLonMax(row.getGeospatialLonMax());
+ transect.setGeospatialVerticalMax(row.getGeospatialVerticalMax());
+ transect.setLinestring(row.getLinestring());
transit.addTransect(transect);
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/AccousticDataImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/AccousticDataImportConfiguration.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/AccousticDataImportConfiguration.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -42,24 +42,61 @@
/** Selected voyage id where to import datas. */
protected String voyageId;
+ /** Selected transit id where to import datas. */
+ protected String transitId;
+
/** Selected vessel id to find out transect where to import datas. */
protected String vesselId;
+ /** 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 echosounderSoundSpeed. */
protected String echosounderSoundSpeed = "Variable";
- /** Manual soundSpeedCalculations. */
- protected String soundSpeedCalculations = "SVProbe";
+ /** Manual soundSpeedCalculations (ER60 instrument). */
+ protected String soundSpeedCalculationsER60 = "(i) Equation: Mackenzie (1980), (ii) CTD, (iii) nominal value for entire data set";
- /** Manual pingDutyCycle. */
- protected String pingDutyCycle = "ME70Table";
+ /** 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 Float sounderConstant;
+
+ /** 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;
/** Movies file to import. */
protected final InputFile moviesFile;
+
public AccousticDataImportConfiguration(Locale locale) {
moviesFile = InputFile.newFile(l_(locale, "echobase.common.moviesFile"));
}
@@ -72,6 +109,15 @@
this.voyageId = voyageId;
}
+
+ public String getTransitId() {
+ return transitId;
+ }
+
+ public void setTransitId(String transitId) {
+ this.transitId = transitId;
+ }
+
public String getVesselId() {
return vesselId;
}
@@ -80,22 +126,46 @@
this.vesselId = vesselId;
}
- public String getEchosounderSoundSpeed() {
- return echosounderSoundSpeed;
+ public String getTransceiverAcquisitionAbsorptionDescription() {
+ return transceiverAcquisitionAbsorptionDescription;
}
- public void setEchosounderSoundSpeed(String echosounderSoundSpeed) {
- this.echosounderSoundSpeed = echosounderSoundSpeed;
+ public void setTransceiverAcquisitionAbsorptionDescription(String transceiverAcquisitionAbsorptionDescription) {
+ this.transceiverAcquisitionAbsorptionDescription = transceiverAcquisitionAbsorptionDescription;
}
- public String getSoundSpeedCalculations() {
- return soundSpeedCalculations;
+ public String getAcquisitionSoftwareVersionER60() {
+ return acquisitionSoftwareVersionER60;
}
- public void setSoundSpeedCalculations(String soundSpeedCalculations) {
- this.soundSpeedCalculations = soundSpeedCalculations;
+ 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;
}
@@ -104,6 +174,54 @@
this.pingDutyCycle = pingDutyCycle;
}
+ public String getEchosounderSoundSpeed() {
+ return echosounderSoundSpeed;
+ }
+
+ public void setEchosounderSoundSpeed(String echosounderSoundSpeed) {
+ this.echosounderSoundSpeed = echosounderSoundSpeed;
+ }
+
+ 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 Float getSounderConstant() {
+ return sounderConstant;
+ }
+
+ public void setSounderConstant(Float 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;
}
@@ -116,6 +234,22 @@
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;
+ }
+
@Override
public InputFile[] getInputFiles() {
return new InputFile[]{moviesFile};
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModel.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModel.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -0,0 +1,139 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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.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;
+
+/**
+ * To import acoustic datas (says {@link DataAcquisition},
+ * {@link DataProcessing}, {@link Cell} and {@link Data}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class AcousticDataImportModel extends CsvModelUtil.AbstractImportModel<AcousticDataImportModelRow> {
+
+ public AcousticDataImportModel(char separator) {
+ super(separator);
+ newIgnoredColumn("MOVIES_EILayer");//A
+ newIgnoredColumn("MOVIES_EILayer\\sndset");//B
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\sndname", AcousticDataImportModelRow.PROPERTY_SNDNAME);//C
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\sndident");//D
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\softChannelId");//E
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\channelName", AcousticDataImportModelRow.PROPERTY_CHANNEL_NAME);//F
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\dataType");//G
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\beamType");//H
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\acousticFrequency");//I
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\startSample");//J
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAlongSteeringAngle");//K
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\mainBeamAthwartSteeringAngle");//L
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\absorptionCoef", AcousticDataImportModelRow.PROPERTY_TRANSCEIVER_ACQUISITION_ABSORPTION, CsvModelUtil.FLOAT);//M
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\transmissionPower", AcousticDataImportModelRow.PROPERTY_TRANSCEIVER_ACQUISITION_POWER, CsvModelUtil.INTEGER);//N
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\beamAlongAngleSensitivity", AcousticDataImportModelRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ALONGSHIP, CsvModelUtil.FLOAT);//O
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\beamAthwartAngleSensitivity", AcousticDataImportModelRow.PROPERTY_TRANSDUCER_ACQUISITION_BEAM_ANGLE_ATHWARTSHIP, CsvModelUtil.FLOAT);//P
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAlong");//Q
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\beam3dBWidthAthwart");//R
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\beamEquTwoWayAngle", AcousticDataImportModelRow.PROPERTY_TRANSDUCER_ACQUISITION_PSI, CsvModelUtil.FLOAT);//S
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\beamGain", AcousticDataImportModelRow.PROPERTY_TRANSCEIVER_ACQUISITION_GAIN, CsvModelUtil.FLOAT);//T
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\beamSACorrection", AcousticDataImportModelRow.PROPERTY_TRANSCEIVER_ACQUISITION_SACORRECTION, CsvModelUtil.FLOAT);//U
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinDepth");//V
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMaxDepth");//W
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\bottomDetectionMinLevel");//X
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\AlongTXRXWeightId");//Y
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\AthwartTXRXWeightId");//Z
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\splitBeamAlongTXRXWeightId");//AA
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\splitBeamAthwartTXRXWeightId");//AB
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\bandWidth");//AC
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgminrange");//AD
+ newIgnoredColumn("MOVIES_EILayer\\sndset\\tvgmaxrange");//AE
+ newMandatoryColumn("MOVIES_EILayer\\sndset\\pulseduration", AcousticDataImportModelRow.PROPERTY_TRANSCEIVER_ACQUISITION_PULSE_LENGTH, CsvModelUtil.FLOAT);//AF
+ newIgnoredColumn("MOVIES_EILayer\\shipnav");//AG
+ newMandatoryColumn("MOVIES_EILayer\\shipnav\\lat", AcousticDataImportModelRow.PROPERTY_ESDU_CELL_DATA_LATITUDE);//AH
+ newMandatoryColumn("MOVIES_EILayer\\shipnav\\long", AcousticDataImportModelRow.PROPERTY_ESDU_CELL_DATA_LONGITUDE);//AI
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\alt");//AJ
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\gndspeed");//AK
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\gndcourse");//AL
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\surfspeed");//AM
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\surfcourse");//AN
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\driftspeed");//AO
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\driftcourse");//AP
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\heading");//AQ
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\roll");//AR
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\pitch");//AS
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\heave");//AT
+ newMandatoryColumn("MOVIES_EILayer\\shipnav\\depth", AcousticDataImportModelRow.PROPERTY_ESDU_CELL_DATA_DEPTH);//AU
+ newIgnoredColumn("MOVIES_EILayer\\shipnav\\draught");//AV
+
+ // Cell elementary Datas
+ newIgnoredColumn("MOVIES_EILayer\\cellset");//AW
+ newMandatoryColumn("MOVIES_EILayer\\cellset\\cellnum", AcousticDataImportModelRow.PROPERTY_ELEMENTARY_CELL_NUM, CsvModelUtil.INTEGER);//AX
+ newMandatoryColumn("MOVIES_EILayer\\cellset\\celltype", AcousticDataImportModelRow.PROPERTY_ELEMENTARY_CELL_TYPE, CsvModelUtil.INTEGER);//AY
+ newMandatoryColumn("MOVIES_EILayer\\cellset\\depthstart", AcousticDataImportModelRow.PROPERTY_ELEMENTARY_CELL_DATA_DEPTH_START);//AZ
+ newMandatoryColumn("MOVIES_EILayer\\cellset\\depthend", AcousticDataImportModelRow.PROPERTY_ELEMENTARY_CELL_DATA_DEPTHEND);//BA
+ newIgnoredColumn("MOVIES_EILayer\\cellset\\indexstart");//BB
+ newIgnoredColumn("MOVIES_EILayer\\cellset\\indexend");//BC
+ newMandatoryColumn("MOVIES_EILayer\\cellset\\datestart", AcousticDataImportModelRow.PROPERTY_ESDU_CELL_START_DATE, CsvModelUtil.IMPORT_DAY_TIME3);//BD
+ newIgnoredColumn("MOVIES_EILayer\\cellset\\dateend");//BE
+ newIgnoredColumn("MOVIES_EILayer\\cellset\\diststart");//BF
+ newIgnoredColumn("MOVIES_EILayer\\cellset\\distend");//BG
+ newMandatoryColumn("MOVIES_EILayer\\cellset\\thresholdup", AcousticDataImportModelRow.PROPERTY_EI_THRESHOLD, CsvModelUtil.INTEGER);//BH
+ newIgnoredColumn("MOVIES_EILayer\\cellset\\thresholdlow");//BI
+ newIgnoredColumn("MOVIES_EILayer\\eilayer");//BJ
+ newMandatoryColumn("MOVIES_EILayer\\eilayer\\sa", AcousticDataImportModelRow.PROPERTY_ELEMENTARY_CELL_DATA_ACOUSTIC_DENSITY);//BK
+ newIgnoredColumn("MOVIES_EILayer\\eilayer\\sv");//BL
+ newIgnoredColumn("MOVIES_EILayer\\eilayer\\ni");//BM
+ newIgnoredColumn("MOVIES_EILayer\\eilayer\\nt");//BN
+
+ // Cell ESDU Datas
+ newIgnoredColumn("MOVIES_EILayer\\cellset2");//BO
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\cellnum");//BP
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\celltype");//BQ
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\depthstart");//BR
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\depthend");//BS
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\indexstart");//BT
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\indexend");//BU
+ newMandatoryColumn("MOVIES_EILayer\\cellset2\\datestart", AcousticDataImportModelRow.PROPERTY_ESDU_CELL_DATA_TIME);//BV
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\dateend");//BW
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\diststart");//BX
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\distend");//BY
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\thresholdup");//BZ
+ newIgnoredColumn("MOVIES_EILayer\\cellset2\\thresholdlow");//CA
+ newIgnoredColumn("MOVIES_EILayer\\eilayer2");//CB
+ newMandatoryColumn("MOVIES_EILayer\\eilayer2\\sa", AcousticDataImportModelRow.PROPERTY_ESDU_CELL_DATA_ACOUSTIC_DENSITY);//CC
+ newIgnoredColumn("MOVIES_EILayer\\eilayer2\\sv");//CD
+ newIgnoredColumn("MOVIES_EILayer\\eilayer2\\ni");//CE
+ newIgnoredColumn("MOVIES_EILayer\\eilayer2\\nt");//CF
+ newIgnoredColumn("MOVIES_EILayer\\boterr");//CG
+ newIgnoredColumn("MOVIES_EILayer\\boterr\\sa");//CH
+ newIgnoredColumn("MOVIES_EILayer\\boterr\\ni");//CI
+ }
+
+ @Override
+ public AcousticDataImportModelRow newEmptyInstance() {
+ return new AcousticDataImportModelRow();
+ }
+}
\ No newline at end of file
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModelRow.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModelRow.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModelRow.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -0,0 +1,299 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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.csv;
+
+import java.util.Date;
+
+/**
+ * Bean of a row for {@link AcousticDataImportModel} import.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class AcousticDataImportModelRow {
+
+ public static final String PROPERTY_CHANNEL_NAME = "channelName";
+
+ public static final String PROPERTY_SNDNAME = "sndname";
+
+ public static final String PROPERTY_ESDU_CELL_START_DATE = "esduCellStartDate";
+
+ public static final String PROPERTY_ELEMENTARY_CELL_TYPE = "elementaryCellType";
+
+ public static final String PROPERTY_ELEMENTARY_CELL_NUM = "elementaryCellNum";
+
+ public static final String PROPERTY_ESDU_CELL_DATA_LATITUDE = "esduCellDataLatitude";
+
+ public static final String PROPERTY_ESDU_CELL_DATA_LONGITUDE = "esduCellDataLongitude";
+
+ public static final String PROPERTY_ESDU_CELL_DATA_DEPTH = "esduCellDataDepth";
+
+ public static final String PROPERTY_ESDU_CELL_DATA_TIME = "esduCellDataTime";
+
+ public static final String PROPERTY_ESDU_CELL_DATA_ACOUSTIC_DENSITY = "esduCellDataAcousticDensity";
+
+ public static final String PROPERTY_ELEMENTARY_CELL_DATA_DEPTH_START = "elementaryCellDataDepthStart";
+
+ public static final String PROPERTY_ELEMENTARY_CELL_DATA_DEPTHEND = "elementaryCellDataDepthend";
+
+ public static final String PROPERTY_ELEMENTARY_CELL_DATA_ACOUSTIC_DENSITY = "elementaryCellDataAcousticDensity";
+
+ 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_EI_THRESHOLD = "eiThreshold";
+
+ protected String sndName;
+
+ protected String channelName;
+
+ protected Date esduCellStartDate;
+
+ protected String esduCellDataLatitude;
+
+ protected String esduCellDataLongitude;
+
+ protected String esduCellDataDepth;
+
+ protected String esduCellDataAcousticDensity;
+
+ protected int elementaryCellType;
+
+ protected int elementaryCellNum;
+
+ protected String elementaryCellDataDepthStart;
+
+ protected String elementaryCellDataDepthEnd;
+
+ protected String elementaryCellDataAcousticDensity;
+
+ 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 float eiThreshold;
+
+ private String esduCellDataTime;
+
+ public String getSndName() {
+ return sndName;
+ }
+
+ public void setSndName(String sndName) {
+ this.sndName = sndName;
+ }
+
+ public String getChannelName() {
+ return channelName;
+ }
+
+ public void setChannelName(String channelName) {
+ this.channelName = channelName;
+ }
+
+ public Date getEsduCellStartDate() {
+ return esduCellStartDate;
+ }
+
+ public void setEsduCellStartDate(Date esduCellStartDate) {
+ this.esduCellStartDate = esduCellStartDate;
+ }
+
+ public int getElementaryCellType() {
+ return elementaryCellType;
+ }
+
+ public void setElementaryCellType(int elementaryCellType) {
+ this.elementaryCellType = elementaryCellType;
+ }
+
+ public int getElementaryCellNum() {
+ return elementaryCellNum;
+ }
+
+ public void setElementaryCellNum(int elementaryCellNum) {
+ this.elementaryCellNum = elementaryCellNum;
+ }
+
+ public String getEsduCellDataLatitude() {
+ return esduCellDataLatitude;
+ }
+
+ public void setEsduCellDataLatitude(String esduCellDataLatitude) {
+ this.esduCellDataLatitude = esduCellDataLatitude;
+ }
+
+ public String getEsduCellDataLongitude() {
+ return esduCellDataLongitude;
+ }
+
+ public void setEsduCellDataLongitude(String esduCellDataLongitude) {
+ this.esduCellDataLongitude = esduCellDataLongitude;
+ }
+
+ public String getEsduCellDataDepth() {
+ return esduCellDataDepth;
+ }
+
+ public void setEsduCellDataDepth(String esduCellDataDepth) {
+ this.esduCellDataDepth = esduCellDataDepth;
+ }
+
+ public String getEsduCellDataAcousticDensity() {
+ return esduCellDataAcousticDensity;
+ }
+
+ public void setEsduCellDataAcousticDensity(String esduCellDataAcousticDensity) {
+ this.esduCellDataAcousticDensity = esduCellDataAcousticDensity;
+ }
+
+ public String getElementaryCellDataDepthStart() {
+ return elementaryCellDataDepthStart;
+ }
+
+ public void setElementaryCellDataDepthStart(String elementaryCellDataDepthStart) {
+ this.elementaryCellDataDepthStart = elementaryCellDataDepthStart;
+ }
+
+ public String getElementaryCellDataDepthEnd() {
+ return elementaryCellDataDepthEnd;
+ }
+
+ public void setElementaryCellDataDepthEnd(String elementaryCellDataDepthEnd) {
+ this.elementaryCellDataDepthEnd = elementaryCellDataDepthEnd;
+ }
+
+ public String getElementaryCellDataAcousticDensity() {
+ return elementaryCellDataAcousticDensity;
+ }
+
+ public void setElementaryCellDataAcousticDensity(String elementaryCellDataAcousticDensity) {
+ this.elementaryCellDataAcousticDensity = elementaryCellDataAcousticDensity;
+ }
+
+ 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 getEiThreshold() {
+ return eiThreshold;
+ }
+
+ public void setEiThreshold(float eiThreshold) {
+ this.eiThreshold = eiThreshold;
+ }
+
+ public String getEsduCellDataTime() {
+ return esduCellDataTime;
+ }
+
+ public void setEsduCellDataTime(String esduCellDataTime) {
+ this.esduCellDataTime = esduCellDataTime;
+ }
+}
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/AcousticDataImportModelRow.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -39,10 +39,14 @@
import org.nuiton.util.csv.ImportExportModel;
import org.nuiton.util.csv.ImportModel;
import org.nuiton.util.csv.ImportableColumn;
+import org.nuiton.util.csv.ImportableExportableColumn;
import org.nuiton.util.csv.ModelBuilder;
import org.nuiton.util.csv.ValueFormatter;
+import org.nuiton.util.csv.ValueGetter;
+import org.nuiton.util.csv.ValueGetterSetter;
import org.nuiton.util.csv.ValueParser;
import org.nuiton.util.csv.ValueParserFormatter;
+import org.nuiton.util.csv.ValueSetter;
import java.sql.Timestamp;
import java.text.ParseException;
@@ -116,6 +120,8 @@
public static final ValueParser<Date> IMPORT_DAY_TIME2 = new DateValue("dd-MM-yy HH:mm:ss");
+ public static final ValueParser<Date> IMPORT_DAY_TIME3 = new DateValue("dd-MM-yy HH:mm aa");
+
public static final ValueParser<Boolean> INT_TO_BOOLEAN_PARSER = new ValueParser<Boolean>() {
@Override
@@ -323,6 +329,34 @@
public final Iterable<ImportableColumn<E, Object>> getColumnsForImport() {
return (Iterable) modelBuilder.getColumnsForImport();
}
+
+ public <T> ImportableColumn<E, T> newIgnoredColumn(String headerName) {
+ return modelBuilder.newIgnoredColumn(headerName);
+ }
+
+ public ImportableColumn<E, String> newMandatoryColumn(String headerName) {
+ return modelBuilder.newMandatoryColumn(headerName, headerName);
+ }
+
+ public ImportableColumn<E, String> newMandatoryColumn(String headerName, String propertyName) {
+ return modelBuilder.newMandatoryColumn(headerName, propertyName);
+ }
+
+ public <T> ImportableColumn<E, T> newMandatoryColumn(String headerName, ValueParser<T> valueParser) {
+ return modelBuilder.newMandatoryColumn(headerName, headerName, valueParser);
+ }
+
+ public <T> ImportableColumn<E, T> newMandatoryColumn(String headerName, String propertyName, ValueParser<T> valueParser) {
+ return modelBuilder.newMandatoryColumn(headerName, propertyName, valueParser);
+ }
+
+ public ImportableColumn<E, String> newMandatoryColumn(String headerName, ValueSetter<E, String> eStringValueSetter) {
+ return modelBuilder.newMandatoryColumn(headerName, eStringValueSetter);
+ }
+
+ public <T> ImportableColumn<E, T> newMandatoryColumn(String headerName, ValueParser<T> valueParser, ValueSetter<E, T> etValueSetter) {
+ return modelBuilder.newMandatoryColumn(headerName, valueParser, etValueSetter);
+ }
}
public static abstract class AbstractImportExportModel<E> implements ImportExportModel<E> {
@@ -354,6 +388,82 @@
public final Iterable<ImportableColumn<E, Object>> getColumnsForImport() {
return (Iterable) modelBuilder.getColumnsForImport();
}
+
+ public <T> ImportableColumn<E, T> newIgnoredColumn(String headerName) {
+ return modelBuilder.newIgnoredColumn(headerName);
+ }
+
+ public ImportableColumn<E, String> newMandatoryColumn(String headerName) {
+ return modelBuilder.newMandatoryColumn(headerName, headerName);
+ }
+
+ public ImportableColumn<E, String> newMandatoryColumn(String headerName, String propertyName) {
+ return modelBuilder.newMandatoryColumn(headerName, propertyName);
+ }
+
+ public <T> ImportableColumn<E, T> newMandatoryColumn(String headerName, ValueParser<T> valueParser) {
+ return modelBuilder.newMandatoryColumn(headerName, headerName, valueParser);
+ }
+
+ public <T> ImportableColumn<E, T> newMandatoryColumn(String headerName, String propertyName, ValueParser<T> valueParser) {
+ return modelBuilder.newMandatoryColumn(headerName, propertyName, valueParser);
+ }
+
+ public ImportableColumn<E, String> newMandatoryColumn(String headerName, ValueSetter<E, String> eStringValueSetter) {
+ return modelBuilder.newMandatoryColumn(headerName, eStringValueSetter);
+ }
+
+ public <T> ImportableColumn<E, T> newMandatoryColumn(String headerName, ValueParser<T> valueParser, ValueSetter<E, T> etValueSetter) {
+ return modelBuilder.newMandatoryColumn(headerName, valueParser, etValueSetter);
+ }
+
+ public ExportableColumn<E, String> newColumnForExport(String headerName) {
+ return modelBuilder.newColumnForExport(headerName, headerName);
+ }
+
+ public ExportableColumn<E, String> newColumnForExport(String headerName, String propertyName) {
+ return modelBuilder.newColumnForExport(headerName, propertyName);
+ }
+
+ public ExportableColumn<E, String> newColumnForExport(String headerName, ValueGetter<E, String> eStringValueGetter) {
+ return modelBuilder.newColumnForExport(headerName, eStringValueGetter);
+ }
+
+ public <T> ExportableColumn<E, T> newColumnForExport(String headerName, ValueFormatter<T> valueFormatter) {
+ return modelBuilder.newColumnForExport(headerName, headerName, valueFormatter);
+ }
+
+ public <T> ExportableColumn<E, T> newColumnForExport(String headerName, String propertyName, ValueFormatter<T> valueFormatter) {
+ return modelBuilder.newColumnForExport(headerName, propertyName, valueFormatter);
+ }
+
+ public <T> ExportableColumn<E, T> newColumnForExport(String headerName, ValueGetter<E, T> etValueGetter, ValueFormatter<T> valueFormatter) {
+ return modelBuilder.newColumnForExport(headerName, etValueGetter, valueFormatter);
+ }
+
+ public ImportableExportableColumn<E, String> newColumnForImportExport(String headerName) {
+ return modelBuilder.newColumnForImportExport(headerName, headerName);
+ }
+
+ public ImportableExportableColumn<E, String> newColumnForImportExport(String headerName, String propertyName) {
+ return modelBuilder.newColumnForImportExport(headerName, propertyName);
+ }
+
+ public ImportableExportableColumn<E, String> newColumnForImportExport(String headerName, ValueGetterSetter<E, String> eStringValueGetterSetter) {
+ return modelBuilder.newColumnForImportExport(headerName, eStringValueGetterSetter);
+ }
+
+ public <T> ImportableExportableColumn<E, T> newColumnForImportExport(String headerName, ValueParserFormatter<T> valueParserFormatter) {
+ return modelBuilder.newColumnForImportExport(headerName, headerName, valueParserFormatter);
+ }
+
+ public <T> ImportableExportableColumn<E, T> newColumnForImportExport(String headerName, String propertyName, ValueParserFormatter<T> valueParserFormatter) {
+ return modelBuilder.newColumnForImportExport(headerName, propertyName, valueParserFormatter);
+ }
+
+ public <T> ImportableExportableColumn<E, T> newColumnForImportExport(String headerName, ValueGetterSetter<E, T> etValueGetterSetter, ValueParserFormatter<T> valueParserFormatter) {
+ return modelBuilder.newColumnForImportExport(headerName, etValueGetterSetter, valueParserFormatter);
+ }
}
public static abstract class AbstractExportModel<E> implements ExportModel<E> {
@@ -377,5 +487,28 @@
return (Iterable) modelBuilder.getColumnsForExport();
}
+ public ExportableColumn<E, String> newColumnForExport(String headerName) {
+ return modelBuilder.newColumnForExport(headerName, headerName);
+ }
+
+ public ExportableColumn<E, String> newColumnForExport(String headerName, String propertyName) {
+ return modelBuilder.newColumnForExport(headerName, propertyName);
+ }
+
+ public ExportableColumn<E, String> newColumnForExport(String headerName, ValueGetter<E, String> eStringValueGetter) {
+ return modelBuilder.newColumnForExport(headerName, eStringValueGetter);
+ }
+
+ public <T> ExportableColumn<E, T> newColumnForExport(String headerName, ValueFormatter<T> valueFormatter) {
+ return modelBuilder.newColumnForExport(headerName, headerName, valueFormatter);
+ }
+
+ public <T> ExportableColumn<E, T> newColumnForExport(String headerName, String propertyName, ValueFormatter<T> valueFormatter) {
+ return modelBuilder.newColumnForExport(headerName, propertyName, valueFormatter);
+ }
+
+ public <T> ExportableColumn<E, T> newColumnForExport(String headerName, ValueGetter<E, T> etValueGetter, ValueFormatter<T> valueFormatter) {
+ return modelBuilder.newColumnForExport(headerName, etValueGetter, valueFormatter);
+ }
}
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityAssociationExportModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityAssociationExportModel.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityAssociationExportModel.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -45,14 +45,12 @@
meta);
// topiaId <-> topiaId
- model.modelBuilder.newColumnForExport(
- TopiaEntity.TOPIA_ID,
+ model.newColumnForExport(
TopiaEntity.TOPIA_ID
);
- model.modelBuilder.newColumnForExport(
+ model.newColumnForExport(
meta.getName(),
- meta.getName(),
CsvModelUtil.newAssociationValueFormatter()
);
return model;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityAssociationImportModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityAssociationImportModel.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityAssociationImportModel.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -46,13 +46,13 @@
separator, meta);
// topiaId <-> topiaId
- model.modelBuilder.newMandatoryColumn(
+ model.newMandatoryColumn(
TopiaEntity.TOPIA_ID,
CsvModelUtil.<Map<String, Object>, String>newMapProperty(TopiaEntity.TOPIA_ID)
);
// add association -> target
- model.modelBuilder.newMandatoryColumn(
+ model.newMandatoryColumn(
meta.getName(),
CsvModelUtil.ASSOCIATION_VALUE_PARSER,
CsvModelUtil.<Map<String, Object>, String[]>newMapProperty("target")
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityCsvModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityCsvModel.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/EntityCsvModel.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -26,8 +26,6 @@
import com.google.common.base.Function;
import fr.ifremer.echobase.entities.meta.TableMeta;
import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.util.csv.ImportableColumn;
-import org.nuiton.util.csv.ValueParser;
import java.util.Collection;
import java.util.Date;
@@ -57,10 +55,6 @@
return new EntityCsvModel<E>(separator, tableMeta, idHeader);
}
- public <T> ImportableColumn<E, T> newIgnoredColumn(String headerName) {
- return modelBuilder.newIgnoredColumn(headerName);
- }
-
@Override
public E newEmptyInstance() {
return (E) tableMeta.newEntity();
@@ -69,9 +63,8 @@
public void addForeignKeyForExport(String propertyName,
Class<TopiaEntity> entityType) {
- modelBuilder.newColumnForExport(
+ newColumnForExport(
propertyName,
- propertyName,
CsvModelUtil.newForeignKeyValue(entityType)
);
}
@@ -82,7 +75,7 @@
Collection<E> universe,
Function<E, String> transform) {
- modelBuilder.newMandatoryColumn(
+ newMandatoryColumn(
headerName,
propertyName,
CsvModelUtil.newForeignKeyValue(entityType, universe, transform)
@@ -95,7 +88,7 @@
Collection<E> universe,
Function<E, String> transform) {
- modelBuilder.newMandatoryColumn(
+ newMandatoryColumn(
headerName,
propertyName,
CsvModelUtil.newForeignKeyValueAssociation(entityType, universe, transform)
@@ -106,9 +99,8 @@
Class<E> entityType,
Collection<E> universe) {
- modelBuilder.newMandatoryColumn(
+ newMandatoryColumn(
propertyName,
- propertyName,
CsvModelUtil.newForeignKeyValue(entityType, universe)
);
}
@@ -116,7 +108,7 @@
public void addNewColumnForExport(String headerName,
String propertyName,
CsvModelUtil.ForeignKeyDecoratedValue<TopiaEntity> topiaEntityForeignKeyDecoratedValue) {
- modelBuilder.newColumnForExport(
+ newColumnForExport(
headerName,
propertyName,
topiaEntityForeignKeyDecoratedValue
@@ -133,67 +125,67 @@
Class<?> type) {
if (Date.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.DAY_TIME_SECOND_WITH_TIMESTAMP
);
} else if (double.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.DOUBLE_PRIMITIVE
);
} else if (Double.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.DOUBLE
);
} else if (long.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.PRIMITIVE_LONG
);
} else if (Long.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.LONG
);
} else if (float.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.PRIMITIVE_FLOAT
);
} else if (Float.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.FLOAT
);
} else if (int.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.PRIMITIVE_INTEGER
);
} else if (Integer.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.INTEGER
);
} else if (boolean.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.PRIMITIVE_BOOLEAN
);
} else if (Boolean.class.equals(type)) {
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName,
CsvModelUtil.BOOLEAN
@@ -201,26 +193,26 @@
} else {
// string
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
headerName,
propertyName
);
}
}
- public ImportableColumn<E, String> newMandatoryColumn(String headerName,
- String propertyName) {
- return modelBuilder.newMandatoryColumn(headerName, propertyName);
- }
+// public ImportableColumn<E, String> newMandatoryColumn(String headerName,
+// String propertyName) {
+// return modelBuilder.newMandatoryColumn(headerName, propertyName);
+// }
+//
+// public ImportableColumn<E, String> newMandatoryColumn(String headerName) {
+// return modelBuilder.newMandatoryColumn(headerName, headerName);
+// }
+//
+// public <T> ImportableColumn<E, T> newMandatoryColumn(String headerName, String propertyName, ValueParser<T> valueParser) {
+// return modelBuilder.newMandatoryColumn(headerName, valueParser, CsvModelUtil.<E, T>newBeanProperty(propertyName));
+// }
- public ImportableColumn<E, String> newMandatoryColumn(String headerName) {
- return modelBuilder.newMandatoryColumn(headerName, headerName);
- }
-
- public <T> ImportableColumn<E, T> newMandatoryColumn(String headerName, String propertyName, ValueParser<T> valueParser) {
- return modelBuilder.newMandatoryColumn(headerName, valueParser, CsvModelUtil.<E, T>newBeanProperty(propertyName));
- }
-
protected EntityCsvModel(char separator,
TableMeta tableMeta) {
super(separator);
@@ -231,7 +223,7 @@
TableMeta tableMeta,
String idHeader) {
this(separator, tableMeta);
- modelBuilder.newColumnForImportExport(
+ newColumnForImportExport(
idHeader,
TopiaEntity.TOPIA_ID
);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/ExportQueryCsvModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/ExportQueryCsvModel.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/ExportQueryCsvModel.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -39,9 +39,8 @@
public ExportQueryCsvModel(char separator, String[] columnHeaders) {
super(separator);
for (String columnHeader : columnHeaders) {
- modelBuilder.newColumnForExport(
+ newColumnForExport(
columnHeader,
- columnHeader,
CsvModelUtil.TO_STRING_FORMATTER
);
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModel.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModel.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -23,7 +23,6 @@
*/
package fr.ifremer.echobase.services.csv;
-import fr.ifremer.echobase.entities.data.Transect;
import fr.ifremer.echobase.entities.data.Voyage;
import java.util.Map;
@@ -34,38 +33,36 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-public class TransectImportModel extends CsvModelUtil.AbstractImportModel<Map<String, Object>> {
+public class TransectImportModel extends CsvModelUtil.AbstractImportModel<TransectImportModelRow> {
- public static final String TRANSECT_VoyageId = "voyageName";
-
protected final Map<String, Voyage> voyageMap;
public TransectImportModel(char separator,
Map<String, Voyage> voyageMap) {
super(separator);
this.voyageMap = voyageMap;
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_TITLE, Transect.PROPERTY_TITLE);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_TRANSECT_ABSTRACT, Transect.PROPERTY_TRANSECT_ABSTRACT);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_STRATUM, Transect.PROPERTY_STRATUM);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_COMMENT, Transect.PROPERTY_COMMENT);
- modelBuilder.newMandatoryColumn(TRANSECT_VoyageId, TRANSECT_VoyageId, CsvModelUtil.newForeignKeyValue(Voyage.class, voyageMap));
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_TITLE);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_TRANSECT_ABSTRACT);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_STRATUM);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_COMMENT);
+ newMandatoryColumn("voyageName", TransectImportModelRow.PROPERTY_VOYAGE, CsvModelUtil.newForeignKeyValue(Voyage.class, voyageMap));
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_DATE_CREATED, Transect.PROPERTY_DATE_CREATED, CsvModelUtil.IMPORT_DAY_TIME2);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_TIME_COVERAGE_START, Transect.PROPERTY_TIME_COVERAGE_START, CsvModelUtil.IMPORT_DAY_TIME2);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_TIME_COVERAGE_END, Transect.PROPERTY_TIME_COVERAGE_END, CsvModelUtil.IMPORT_DAY_TIME2);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_DATE_CREATED, CsvModelUtil.IMPORT_DAY_TIME2);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_TIME_COVERAGE_START, CsvModelUtil.IMPORT_DAY_TIME2);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_TIME_COVERAGE_END, CsvModelUtil.IMPORT_DAY_TIME2);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_LON_MIN, Transect.PROPERTY_GEOSPATIAL_LON_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_LAT_MIN, Transect.PROPERTY_GEOSPATIAL_LAT_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MIN, Transect.PROPERTY_GEOSPATIAL_VERTICAL_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_LON_MAX, Transect.PROPERTY_GEOSPATIAL_LON_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_LAT_MAX, Transect.PROPERTY_GEOSPATIAL_LAT_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX, Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn(Transect.PROPERTY_LINESTRING, Transect.PROPERTY_LINESTRING);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_GEOSPATIAL_LON_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_GEOSPATIAL_LAT_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_GEOSPATIAL_VERTICAL_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_GEOSPATIAL_LON_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_GEOSPATIAL_LAT_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_GEOSPATIAL_VERTICAL_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
+ newMandatoryColumn(TransectImportModelRow.PROPERTY_LINESTRING);
}
@Override
- public Map<String, Object> newEmptyInstance() {
- return null;
+ public TransectImportModelRow newEmptyInstance() {
+ return new TransectImportModelRow();
}
}
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModelRow.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModelRow.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModelRow.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -0,0 +1,220 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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.csv;
+
+import fr.ifremer.echobase.entities.data.Voyage;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Bean used as a row for import of {@link TransectImportModel}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class TransectImportModelRow implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_VOYAGE = "voyage";
+
+ public static final String PROPERTY_TITLE = "title";
+
+ public static final String PROPERTY_TRANSECT_ABSTRACT = "transectAbstract";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_DATE_CREATED = "dateCreated";
+
+ public static final String PROPERTY_GEOSPATIAL_LON_MIN = "geospatialLonMin";
+
+ public static final String PROPERTY_GEOSPATIAL_LON_MAX = "geospatialLonMax";
+
+ public static final String PROPERTY_GEOSPATIAL_LAT_MIN = "geospatialLatMin";
+
+ public static final String PROPERTY_GEOSPATIAL_LAT_MAX = "geospatialLatMax";
+
+ public static final String PROPERTY_LINESTRING = "linestring";
+
+ public static final String PROPERTY_GEOSPATIAL_VERTICAL_MIN = "geospatialVerticalMin";
+
+ public static final String PROPERTY_GEOSPATIAL_VERTICAL_MAX = "geospatialVerticalMax";
+
+ public static final String PROPERTY_TIME_COVERAGE_START = "timeCoverageStart";
+
+ public static final String PROPERTY_TIME_COVERAGE_END = "timeCoverageEnd";
+
+ public static final String PROPERTY_STRATUM = "stratum";
+
+ protected String title;
+
+ protected String transectAbstract;
+
+ protected String stratum;
+
+ protected String comment;
+
+ protected String linestring;
+
+ protected Voyage voyage;
+
+ protected Date dateCreated;
+
+ protected Date timeCoverageStart;
+
+ protected Date timeCoverageEnd;
+
+ protected float geospatialLonMin;
+
+ protected float geospatialLonMax;
+
+ protected float geospatialLatMin;
+
+ protected float geospatialLatMax;
+
+ protected float geospatialVerticalMin;
+
+ protected float geospatialVerticalMax;
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getTransectAbstract() {
+ return transectAbstract;
+ }
+
+ public void setTransectAbstract(String transectAbstract) {
+ this.transectAbstract = transectAbstract;
+ }
+
+ public String getStratum() {
+ return stratum;
+ }
+
+ public void setStratum(String stratum) {
+ this.stratum = stratum;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ public String getLinestring() {
+ return linestring;
+ }
+
+ public void setLinestring(String linestring) {
+ this.linestring = linestring;
+ }
+
+ public Voyage getVoyage() {
+ return voyage;
+ }
+
+ public void setVoyage(Voyage voyage) {
+ this.voyage = voyage;
+ }
+
+ public Date getDateCreated() {
+ return dateCreated;
+ }
+
+ public void setDateCreated(Date dateCreated) {
+ this.dateCreated = dateCreated;
+ }
+
+ public Date getTimeCoverageStart() {
+ return timeCoverageStart;
+ }
+
+ public void setTimeCoverageStart(Date timeCoverageStart) {
+ this.timeCoverageStart = timeCoverageStart;
+ }
+
+ public Date getTimeCoverageEnd() {
+ return timeCoverageEnd;
+ }
+
+ public void setTimeCoverageEnd(Date timeCoverageEnd) {
+ this.timeCoverageEnd = timeCoverageEnd;
+ }
+
+ public float getGeospatialLonMin() {
+ return geospatialLonMin;
+ }
+
+ public void setGeospatialLonMin(float geospatialLonMin) {
+ this.geospatialLonMin = geospatialLonMin;
+ }
+
+ public float getGeospatialLonMax() {
+ return geospatialLonMax;
+ }
+
+ public void setGeospatialLonMax(float geospatialLonMax) {
+ this.geospatialLonMax = geospatialLonMax;
+ }
+
+ public float getGeospatialLatMin() {
+ return geospatialLatMin;
+ }
+
+ public void setGeospatialLatMin(float geospatialLatMin) {
+ this.geospatialLatMin = geospatialLatMin;
+ }
+
+ public float getGeospatialLatMax() {
+ return geospatialLatMax;
+ }
+
+ public void setGeospatialLatMax(float geospatialLatMax) {
+ this.geospatialLatMax = geospatialLatMax;
+ }
+
+ public float getGeospatialVerticalMin() {
+ return geospatialVerticalMin;
+ }
+
+ public void setGeospatialVerticalMin(float geospatialVerticalMin) {
+ this.geospatialVerticalMin = geospatialVerticalMin;
+ }
+
+ public float getGeospatialVerticalMax() {
+ return geospatialVerticalMax;
+ }
+
+ public void setGeospatialVerticalMax(float geospatialVerticalMax) {
+ this.geospatialVerticalMax = geospatialVerticalMax;
+ }
+}
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModelRow.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModel.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModel.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -23,7 +23,6 @@
*/
package fr.ifremer.echobase.services.csv;
-import fr.ifremer.echobase.entities.data.Transit;
import fr.ifremer.echobase.entities.data.Voyage;
import java.util.Map;
@@ -34,7 +33,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-public class TransitImportModel extends CsvModelUtil.AbstractImportModel<Map<String, Object>> {
+public class TransitImportModel extends CsvModelUtil.AbstractImportModel<TransitImportModelRow> {
public static final String TRANSIT_VoyageId = "voyageName";
@@ -44,16 +43,16 @@
Map<String, Voyage> voyageMap) {
super(separator);
this.voyageMap = voyageMap;
- modelBuilder.newMandatoryColumn(TRANSIT_VoyageId, TRANSIT_VoyageId, CsvModelUtil.newForeignKeyValue(Voyage.class, voyageMap));
- modelBuilder.newMandatoryColumn(Transit.PROPERTY_DESCRIPTION, Transit.PROPERTY_DESCRIPTION);
- modelBuilder.newMandatoryColumn(Transit.PROPERTY_START_TIME, Transit.PROPERTY_START_TIME, CsvModelUtil.DAY_TIME);
- modelBuilder.newMandatoryColumn(Transit.PROPERTY_END_TIME, Transit.PROPERTY_END_TIME, CsvModelUtil.DAY_TIME);
- modelBuilder.newMandatoryColumn(Transit.PROPERTY_START_LOCALITY, Transit.PROPERTY_START_LOCALITY);
- modelBuilder.newMandatoryColumn(Transit.PROPERTY_END_LOCALITY, Transit.PROPERTY_END_LOCALITY);
+ newMandatoryColumn("voyageName", TransitImportModelRow.PROPERTY_VOYAGE, CsvModelUtil.newForeignKeyValue(Voyage.class, voyageMap));
+ newMandatoryColumn(TransitImportModelRow.PROPERTY_DESCRIPTION);
+ newMandatoryColumn(TransitImportModelRow.PROPERTY_START_TIME, CsvModelUtil.DAY_TIME);
+ newMandatoryColumn(TransitImportModelRow.PROPERTY_END_TIME, CsvModelUtil.DAY_TIME);
+ newMandatoryColumn(TransitImportModelRow.PROPERTY_START_LOCALITY);
+ newMandatoryColumn(TransitImportModelRow.PROPERTY_END_LOCALITY);
}
@Override
- public Map<String, Object> newEmptyInstance() {
- return null;
+ public TransitImportModelRow newEmptyInstance() {
+ return new TransitImportModelRow();
}
}
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModelRow.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModelRow.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModelRow.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -0,0 +1,120 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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.csv;
+
+import fr.ifremer.echobase.entities.data.Transit;
+import fr.ifremer.echobase.entities.data.Voyage;
+
+import java.util.Date;
+
+/**
+* Bean used as a row for import of {@link TransitImportModel}.
+*
+* @author tchemit <chemit(a)codelutin.com>
+* @since 0.3
+*/
+public class TransitImportModelRow {
+
+ public static final String PROPERTY_VOYAGE = "voyage";
+
+ public static final String PROPERTY_DESCRIPTION = Transit.PROPERTY_DESCRIPTION;
+
+ public static final String PROPERTY_START_TIME = Transit.PROPERTY_START_TIME;
+
+ public static final String PROPERTY_END_TIME = Transit.PROPERTY_END_TIME;
+
+ public static final String PROPERTY_START_LOCALITY = Transit.PROPERTY_START_LOCALITY;
+
+ public static final String PROPERTY_END_LOCALITY = Transit.PROPERTY_END_LOCALITY;
+
+ protected Voyage voyage;
+
+ protected String description;
+
+ protected String relatedActivity;
+
+ protected Date startTime;
+
+ protected Date endTime;
+
+ protected String startLocality;
+
+ protected String endLocality;
+
+ public Voyage getVoyage() {
+ return voyage;
+ }
+
+ public void setVoyage(Voyage voyage) {
+ this.voyage = voyage;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getRelatedActivity() {
+ return relatedActivity;
+ }
+
+ public void setRelatedActivity(String relatedActivity) {
+ this.relatedActivity = relatedActivity;
+ }
+
+ public Date getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(Date startTime) {
+ this.startTime = startTime;
+ }
+
+ public Date getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(Date endTime) {
+ this.endTime = endTime;
+ }
+
+ public String getStartLocality() {
+ return startLocality;
+ }
+
+ public void setStartLocality(String startLocality) {
+ this.startLocality = startLocality;
+ }
+
+ public String getEndLocality() {
+ return endLocality;
+ }
+
+ public void setEndLocality(String endLocality) {
+ this.endLocality = endLocality;
+ }
+}
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModelRow.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/VoyageImportModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/VoyageImportModel.java 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/VoyageImportModel.java 2012-01-26 10:54:27 UTC (rev 293)
@@ -36,11 +36,11 @@
public VoyageImportModel(char separator) {
super(separator);
- modelBuilder.newMandatoryColumn(Voyage.PROPERTY_NAME, Voyage.PROPERTY_NAME);
- modelBuilder.newMandatoryColumn(Voyage.PROPERTY_START_DATE, Voyage.PROPERTY_START_DATE, CsvModelUtil.DAY);
- modelBuilder.newMandatoryColumn(Voyage.PROPERTY_END_DATE, Voyage.PROPERTY_END_DATE, CsvModelUtil.DAY);
- modelBuilder.newMandatoryColumn(Voyage.PROPERTY_START_PORT, Voyage.PROPERTY_START_PORT);
- modelBuilder.newMandatoryColumn(Voyage.PROPERTY_END_PORT, Voyage.PROPERTY_END_PORT);
+ newMandatoryColumn(Voyage.PROPERTY_NAME);
+ newMandatoryColumn(Voyage.PROPERTY_START_DATE, CsvModelUtil.DAY);
+ newMandatoryColumn(Voyage.PROPERTY_END_DATE, CsvModelUtil.DAY);
+ newMandatoryColumn(Voyage.PROPERTY_START_PORT);
+ newMandatoryColumn(Voyage.PROPERTY_END_PORT);
}
@Override
Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2012-01-26 10:54:27 UTC (rev 293)
@@ -21,7 +21,11 @@
echobase.action.return=Retour
echobase.action.save=Sauvegarder
echobase.action.saveSqlQuery=Enregistrer la requête
+echobase.common.acousticDensityUnit=acousticDensityUnit
+echobase.common.acquisitionSoftwareVersionER60=acquisitionSoftwareVersion (ER60 instrument)
+echobase.common.acquisitionSoftwareVersionME70=acquisitionSoftwareVersion (ME70 instrument)
echobase.common.admin=Administrateur
+echobase.common.digitThreshold=digitThreshold
echobase.common.echosounderSoundSpeed=echosounderSoundSpeed
echobase.common.email=Email
echobase.common.entityType=Type d'entité
@@ -34,10 +38,15 @@
echobase.common.jdbcLogin=Login de connexion
echobase.common.jdbcPassword=Mot de passe
echobase.common.jdbcUrl=Url de connexion
+echobase.common.loggedDataDatatype=loggedDataDatatype
+echobase.common.loggedDataFormat=loggedDataFormat
echobase.common.notes=notes
echobase.common.password=Mot de passe
echobase.common.pingDutyCycle=pingDutyCycle
echobase.common.soundSpeedCalculations=soundSpeedCalculations
+echobase.common.soundSpeedCalculationsER60=soundSpeedCalculations (ER60 instrument)
+echobase.common.soundSpeedCalculationsME70=soundSpeedCalculations (ME70 instrument)
+echobase.common.sounderConstant=sounderConstant
echobase.common.transectBinUnitsPingAxis=BinUnitsPingAxis (transect)
echobase.common.transectGeospatialVerticalPositive=GeospatialVerticalPositive (transect)
echobase.common.transectLicence=Licence (transect)
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/importData/configureAccousticData.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/importData/configureAccousticData.jsp 2012-01-26 10:52:23 UTC (rev 292)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/importData/configureAccousticData.jsp 2012-01-26 10:54:27 UTC (rev 293)
@@ -45,19 +45,56 @@
label='%{getText("echobase.common.voyage")}'
list="voyages" headerKey="" headerValue=""/>
+ <s:select name="model.transitId" value="''" required="true"
+ label='%{getText("echobase.common.transit")}'
+ list="transits" headerKey="" headerValue=""/>
+
<s:select name="model.vesselId" value="''" required="true"
label='%{getText("echobase.common.vessel")}'
list="vessels" headerKey="" headerValue=""/>
- <s:textfield key="model.echosounderSoundSpeed" size="40" required="true"
- label='%{getText("echobase.common.echosounderSoundSpeed")}'/>
+ <s:textfield key="model.transceiverAcquisitionAbsorptionDescription" size="40" required="true"
+ label='%{getText("echobase.common.transceiverAcquisitionAbsorptionDescription")}'/>
- <s:textfield key="model.soundSpeedCalculations" size="40" required="true"
- label='%{getText("echobase.common.soundSpeedCalculations")}'/>
+ <s:textfield key="model.acquisitionSoftwareVersionER60" size="40" required="true"
+ label='%{getText("echobase.common.acquisitionSoftwareVersionER60")}'/>
+ <s:textfield key="model.acquisitionSoftwareVersionME70" size="40" required="true"
+ label='%{getText("echobase.common.acquisitionSoftwareVersionME70")}'/>
+
+ <s:textfield key="model.loggedDataFormat" size="40" required="true"
+ label='%{getText("echobase.common.loggedDataFormat")}'/>
+
+ <s:textfield key="model.loggedDataDatatype" size="40" required="true"
+ label='%{getText("echobase.common.loggedDataDatatype")}'/>
+
<s:textfield key="model.pingDutyCycle" size="40" required="true"
label='%{getText("echobase.common.pingDutyCycle")}'/>
+ <s:textfield key="model.echosounderSoundSpeed" size="40" required="true"
+ label='%{getText("echobase.common.echosounderSoundSpeed")}'/>
+
+ <s:textfield key="model.soundSpeedCalculationsER60" size="40" required="true"
+ label='%{getText("echobase.common.soundSpeedCalculationsER60")}'/>
+
+ <s:textfield key="model.soundSpeedCalculationsME70" size="40" required="true"
+ label='%{getText("echobase.common.soundSpeedCalculationsME70")}'/>
+
+ <s:textfield key="model.sounderConstant" size="40" required="true"
+ label='%{getText("echobase.common.sounderConstant")}'/>
+
+ <s:textfield key="model.processingTemplate" size="40" required="true"
+ label='%{getText("echobase.common.processingTemplate")}'/>
+
+ <s:textfield key="model.processingDescription" size="40" required="true"
+ label='%{getText("echobase.common.processingDescription")}'/>
+
+ <s:textfield key="model.digitThreshold" size="40" required="true"
+ label='%{getText("echobase.common.digitThreshold")}'/>
+
+ <s:textfield key="model.acousticDensityUnit" size="40" required="true"
+ label='%{getText("echobase.common.acousticDensityUnit")}'/>
+
<s:textfield key="model.notes" size="40" required="true"
label='%{getText("echobase.common.notes")}'/>
1
0
r292 - in trunk/echobase-entities/src/main: java/fr/ifremer/echobase/entities/data xmi
by tchemit@users.forge.codelutin.com 26 Jan '12
by tchemit@users.forge.codelutin.com 26 Jan '12
26 Jan '12
Author: tchemit
Date: 2012-01-26 11:52:23 +0100 (Thu, 26 Jan 2012)
New Revision: 292
Url: http://forge.codelutin.com/repositories/revision/echobase/292
Log:
add some usefull methods on Voyage and Transit
Added:
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java
Modified:
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java
trunk/echobase-entities/src/main/xmi/echobase.zargo
Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java 2012-01-26 10:52:23 UTC (rev 292)
@@ -0,0 +1,47 @@
+/*
+ * #%L
+ * EchoBase :: Entities
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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.entities.data;
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.echobase.entities.references.Vessel;
+
+public class TransitImpl extends TransitAbstract {
+
+ private static final long serialVersionUID = 3775200869632533299L;
+
+ @Override
+ public Transect getTransect(Vessel vessel) {
+ Preconditions.checkNotNull(vessel);
+ Transect result = null;
+ if (!isTransectEmpty()) {
+ for (Transect t : transect) {
+ if (vessel.equals(t.getVessel())) {
+ result = t;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+} //TransitImpl
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java 2012-01-25 10:53:18 UTC (rev 291)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java 2012-01-26 10:52:23 UTC (rev 292)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.entities.data;
-import org.apache.commons.collections.CollectionUtils;
+import com.google.common.base.Preconditions;
import java.util.Date;
@@ -40,8 +40,10 @@
@Override
public Transit getTransit(Date startTime, Date endDate) {
+ Preconditions.checkNotNull(startTime);
+ Preconditions.checkNotNull(endDate);
Transit result = null;
- if (CollectionUtils.isNotEmpty(getTransit())) {
+ if (!isTransitEmpty()) {
for (Transit t : getTransit()) {
Date transitStartTime = t.getStartTime();
Date transitEndTime = t.getEndTime();
Modified: trunk/echobase-entities/src/main/xmi/echobase.zargo
===================================================================
(Binary files differ)
1
0
r291 - in trunk: . echobase-tools/src/test/java/fr/ifremer/echobase/tools echobase-ui/src/main/java/fr/ifremer/echobase/ui echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData
by tchemit@users.forge.codelutin.com 25 Jan '12
by tchemit@users.forge.codelutin.com 25 Jan '12
25 Jan '12
Author: tchemit
Date: 2012-01-25 11:53:18 +0100 (Wed, 25 Jan 2012)
New Revision: 291
Url: http://forge.codelutin.com/repositories/revision/echobase/291
Log:
update struts2 version, add pom name + update svn properties + usage of rename EchoBaseTopiaRootContextFactory
Modified:
trunk/
trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/AbstractToolTest.java
trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticData-validation.xml
trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticRegionData-validation.xml
trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesData-validation.xml
trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesIndividualData-validation.xml
trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesReference-validation.xml
trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonDataFromTransect-validation.xml
trunk/pom.xml
Property changes on: trunk
___________________________________________________________________
Modified: svn:ignore
- target
*.ipr
*.iws
*.iml
*.log
+ target
*.ipr
*.iws
*.iml
*.log
.idea
Modified: trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/AbstractToolTest.java
===================================================================
--- trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/AbstractToolTest.java 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/AbstractToolTest.java 2012-01-25 10:53:18 UTC (rev 291)
@@ -25,9 +25,8 @@
import com.google.common.base.Supplier;
import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextSupplierFactory;
+import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
-import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.meta.DbMeta;
import fr.ifremer.echobase.services.EchoBaseService;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
@@ -89,8 +88,8 @@
log.debug("Test directory = " + testdir);
}
- EchoBaseTopiaRootContextSupplierFactory factory =
- new EchoBaseTopiaRootContextSupplierFactory();
+ EchoBaseTopiaRootContextFactory factory =
+ new EchoBaseTopiaRootContextFactory();
topiaContextSupplier = factory.newEmbeddedDatabase(testdir);
Modified: trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java
===================================================================
--- trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java 2012-01-25 10:53:18 UTC (rev 291)
@@ -24,7 +24,7 @@
package fr.ifremer.echobase.tools;
import com.google.common.base.Supplier;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextSupplierFactory;
+import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
@@ -96,8 +96,8 @@
}
public static TopiaContext getRootContext(File dbDir) {
- EchoBaseTopiaRootContextSupplierFactory factory =
- new EchoBaseTopiaRootContextSupplierFactory();
+ EchoBaseTopiaRootContextFactory factory =
+ new EchoBaseTopiaRootContextFactory();
Supplier<TopiaContext> topiaContextSupplier =
factory.newEmbeddedDatabase(dbDir);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-01-25 10:53:18 UTC (rev 291)
@@ -26,7 +26,7 @@
import com.google.common.base.Supplier;
import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.EchoBaseTechnicalException;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextSupplierFactory;
+import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EchoBaseUserImpl;
import fr.ifremer.echobase.entities.meta.DbMeta;
@@ -98,8 +98,8 @@
if (log.isInfoEnabled()) {
log.info("Initializing RootContextSupplier...");
}
- EchoBaseTopiaRootContextSupplierFactory factory =
- new EchoBaseTopiaRootContextSupplierFactory();
+ EchoBaseTopiaRootContextFactory factory =
+ new EchoBaseTopiaRootContextFactory();
rootContextSupplier = factory.newDatabaseFromConfig(configuration);
applicationContext.setRootContextSupplier(rootContextSupplier);
DbMeta dbMeta = DbMeta.newDbMeta();
@@ -161,8 +161,8 @@
dbConf.put("hibernate.hbm2ddl.auto", isCreated?"update": "create");
- EchoBaseTopiaRootContextSupplierFactory factory =
- new EchoBaseTopiaRootContextSupplierFactory();
+ EchoBaseTopiaRootContextFactory factory =
+ new EchoBaseTopiaRootContextFactory();
Supplier<TopiaContext> topiaContextSupplier =
factory.newDatabaseFromProperties(dbConf);
Modified: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticData-validation.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticData-validation.xml 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticData-validation.xml 2012-01-25 10:53:18 UTC (rev 291)
@@ -2,8 +2,8 @@
#%L
EchoBase :: UI
- $Id: ConfigureFiles-validation.xml 136 2011-11-27 10:09:45Z tchemit $
- $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/reso… $
+ $Id$
+ $HeadURL$
%%
Copyright (C) 2011 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticData-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticRegionData-validation.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticRegionData-validation.xml 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticRegionData-validation.xml 2012-01-25 10:53:18 UTC (rev 291)
@@ -2,8 +2,8 @@
#%L
EchoBase :: UI
- $Id: ConfigureFiles-validation.xml 136 2011-11-27 10:09:45Z tchemit $
- $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/reso… $
+ $Id$
+ $HeadURL$
%%
Copyright (C) 2011 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureAccousticRegionData-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesData-validation.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesData-validation.xml 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesData-validation.xml 2012-01-25 10:53:18 UTC (rev 291)
@@ -2,8 +2,8 @@
#%L
EchoBase :: UI
- $Id: ConfigureFiles-validation.xml 136 2011-11-27 10:09:45Z tchemit $
- $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/reso… $
+ $Id$
+ $HeadURL$
%%
Copyright (C) 2011 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesData-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesIndividualData-validation.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesIndividualData-validation.xml 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesIndividualData-validation.xml 2012-01-25 10:53:18 UTC (rev 291)
@@ -2,8 +2,8 @@
#%L
EchoBase :: UI
- $Id: ConfigureFiles-validation.xml 136 2011-11-27 10:09:45Z tchemit $
- $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/reso… $
+ $Id$
+ $HeadURL$
%%
Copyright (C) 2011 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesIndividualData-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesReference-validation.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesReference-validation.xml 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesReference-validation.xml 2012-01-25 10:53:18 UTC (rev 291)
@@ -2,8 +2,8 @@
#%L
EchoBase :: UI
- $Id: ConfigureFiles-validation.xml 136 2011-11-27 10:09:45Z tchemit $
- $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/reso… $
+ $Id$
+ $HeadURL$
%%
Copyright (C) 2011 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesReference-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonDataFromTransect-validation.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonDataFromTransect-validation.xml 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonDataFromTransect-validation.xml 2012-01-25 10:53:18 UTC (rev 291)
@@ -2,8 +2,8 @@
#%L
EchoBase :: UI
- $Id: ConfigureFiles-validation.xml 136 2011-11-27 10:09:45Z tchemit $
- $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/reso… $
+ $Id$
+ $HeadURL$
%%
Copyright (C) 2011 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonDataFromTransect-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-01-25 10:51:42 UTC (rev 290)
+++ trunk/pom.xml 2012-01-25 10:53:18 UTC (rev 291)
@@ -28,6 +28,7 @@
<!-- *** Project Information ************************************* -->
<!-- ************************************************************* -->
+ <name>EchoBase</name>
<description>Projet EchoBase</description>
<inceptionYear>2011</inceptionYear>
<url>http://maven-site.forge.codelutin.com/echobase</url>
@@ -113,7 +114,7 @@
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<nuitonWebVersion>1.9.1</nuitonWebVersion>
<msaccessImporterVersion>1.4.1</msaccessImporterVersion>
- <struts2Version>2.3.1.1</struts2Version>
+ <struts2Version>2.3.1.2</struts2Version>
<jqueryPluginVersion>3.2.1</jqueryPluginVersion>
<seleniumVersion>2.16.1</seleniumVersion>
<h2Version>1.3.163</h2Version>
1
0
r290 - in trunk/echobase-services/src: main/java/fr/ifremer/echobase/services main/java/fr/ifremer/echobase/services/configurations main/java/fr/ifremer/echobase/services/csv test/java/fr/ifremer/echobase test/java/fr/ifremer/echobase/services
by tchemit@users.forge.codelutin.com 25 Jan '12
by tchemit@users.forge.codelutin.com 25 Jan '12
25 Jan '12
Author: tchemit
Date: 2012-01-25 11:51:42 +0100 (Wed, 25 Jan 2012)
New Revision: 290
Url: http://forge.codelutin.com/repositories/revision/echobase/290
Log:
- finalize common data import
- reformat + imports
- usage of renames EchoBaseTopiaRootContextFactory
Added:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/VoyageImportModel.java
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataCompleteImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataFromTransectImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CsvImportResult.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EmbeddedApplicationService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ImportDbService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/CatchesDataImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/CommonDataCompleteImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/TestHelper.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/AbstractEchoBaseServiceTest.java
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataCompleteImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataCompleteImportService.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataCompleteImportService.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -31,13 +31,13 @@
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.data.VoyageImpl;
import fr.ifremer.echobase.entities.references.AreaOfOperation;
import fr.ifremer.echobase.entities.references.Mission;
import fr.ifremer.echobase.entities.references.Vessel;
import fr.ifremer.echobase.services.configurations.CommonDataCompleteImportConfiguration;
-import fr.ifremer.echobase.services.csv.CsvModelUtil;
-import org.apache.commons.collections.CollectionUtils;
+import fr.ifremer.echobase.services.csv.TransectImportModel;
+import fr.ifremer.echobase.services.csv.TransitImportModel;
+import fr.ifremer.echobase.services.csv.VoyageImportModel;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.util.csv.Import;
@@ -106,7 +106,7 @@
try {
Mission result = getDAO(Mission.class).create(mission);
commitTransaction("Could not create mission " +
- mission.getName());
+ mission.getName());
return result;
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
@@ -186,18 +186,22 @@
TopiaDAO<Transect> dao = getDAO(Transect.class);
- /*
- modelBuilder.newMandatoryColumn(TRANSECT_stratum, TRANSECT_stratum);
- modelBuilder.newMandatoryColumn(TRANSECT_datef, TRANSECT_datef, CsvModelUtil.DAY);
- modelBuilder.newMandatoryColumn(TRANSECT_heuref, TRANSECT_heuref, CsvModelUtil.TIME);
- */
Reader reader = new BufferedReader(new FileReader(inputFile.getFile()));
try {
ImportToMap importer = ImportToMap.newImport(csvModel, reader);
for (Map<String, Object> row : importer) {
- Voyage voyage = (Voyage) row.get(TransectImportModel.TRANSECT_VoyageID);
+ Voyage voyage = (Voyage) row.get(TransectImportModel.TRANSECT_VoyageId);
+ Date timeCoverageStart = (Date) row.get(Transect.PROPERTY_TIME_COVERAGE_START);
+ Date timeCoverageEnd = (Date) row.get(Transect.PROPERTY_TIME_COVERAGE_END);
+
+ Transit transit = voyage.getTransit(timeCoverageStart, timeCoverageEnd);
+ if (transit == null) {
+ throw new EchoBaseTechnicalException(
+ "Could not find transit for voyage " + voyage.getName() + " between " + timeCoverageStart + " and " + timeCoverageEnd);
+ }
+
Transect transect = dao.create(
Transect.PROPERTY_VESSEL, vessel
);
@@ -212,9 +216,9 @@
transect.setBinUnitsPingAxis(binUnitsPingAxis);
transect.setDateCreated((Date) row.get(Transect.PROPERTY_DATE_CREATED));
- transect.setTimeCoverageStart((Date) row.get(Transect.PROPERTY_TIME_COVERAGE_START));
- transect.setTimeCoverageEnd((Date) row.get(Transect.PROPERTY_TIME_COVERAGE_END));
+ transect.setTimeCoverageStart(timeCoverageStart);
+ transect.setTimeCoverageEnd(timeCoverageEnd);
transect.setGeospatialLatMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LAT_MIN));
transect.setGeospatialLonMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LON_MIN));
@@ -223,24 +227,8 @@
transect.setGeospatialLatMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LAT_MAX));
transect.setGeospatialLonMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LON_MAX));
transect.setGeospatialVerticalMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX));
+ transect.setLinestring((String) row.get(Transect.PROPERTY_LINESTRING));
- // find out the transit where to reattach the transect
- List<Transit> transits = voyage.getTransit();
-
- Transit transit = null;
-
- if (CollectionUtils.isNotEmpty(transits)) {
- for (Transit aTransit : transits) {
- transit = aTransit;
- break;
- }
- }
- if (transit == null) {
- throw new EchoBaseTechnicalException(
- "Could not find transit to reattach transect " +
- transect.getTitle());
- }
-
transit.addTransect(transect);
}
@@ -253,84 +241,4 @@
}
- protected static class VoyageImportModel extends CsvModelUtil.AbstractImportModel<Voyage> {
-
- public VoyageImportModel(char separator) {
- super(separator);
- modelBuilder.newMandatoryColumn("VoyageName", Voyage.PROPERTY_NAME);
- modelBuilder.newMandatoryColumn("VoyageStartDate", Voyage.PROPERTY_START_DATE, CsvModelUtil.DAY);
- modelBuilder.newMandatoryColumn("VoyageEndDate", Voyage.PROPERTY_END_DATE, CsvModelUtil.DAY);
- modelBuilder.newMandatoryColumn("StartPort", Voyage.PROPERTY_START_PORT);
- modelBuilder.newMandatoryColumn("EndPort", Voyage.PROPERTY_END_PORT);
- }
-
- @Override
- public Voyage newEmptyInstance() {
- return new VoyageImpl();
- }
- }
-
- protected static class TransitImportModel extends CsvModelUtil.AbstractImportModel<Map<String, Object>> {
-
- public static final String TRANSIT_VoyageId = "VoyageId";
-
- protected final Map<String, Voyage> voyageMap;
-
- public TransitImportModel(char separator,
- Map<String, Voyage> voyageMap) {
- super(separator);
- this.voyageMap = voyageMap;
- modelBuilder.newMandatoryColumn(TRANSIT_VoyageId, TRANSIT_VoyageId, CsvModelUtil.newForeignKeyValue(Voyage.class, voyageMap));
- modelBuilder.newMandatoryColumn("TransitName", Transit.PROPERTY_DESCRIPTION);
- modelBuilder.newMandatoryColumn("StartTime", Transit.PROPERTY_START_TIME, CsvModelUtil.DAY_TIME);
- modelBuilder.newMandatoryColumn("EndTime", Transit.PROPERTY_END_TIME, CsvModelUtil.DAY_TIME);
- modelBuilder.newMandatoryColumn("StartLocality", Transit.PROPERTY_START_LOCALITY);
- modelBuilder.newMandatoryColumn("EndLocality", Transit.PROPERTY_END_LOCALITY);
- }
-
- @Override
- public Map<String, Object> newEmptyInstance() {
- return null;
- }
- }
-
- protected static class TransectImportModel extends CsvModelUtil.AbstractImportModel<Map<String, Object>> {
-
- public static final String TRANSECT_stratum = "stratum";
- public static final String TRANSECT_VoyageID = "VoyageID";
- public static final String TRANSECT_datef = "datef";
- public static final String TRANSECT_heuref = "heuref";
-
- protected final Map<String, Voyage> voyageMap;
-
- public TransectImportModel(char separator,
- Map<String, Voyage> voyageMap) {
- super(separator);
- this.voyageMap = voyageMap;
-
- modelBuilder.newMandatoryColumn("Title", Transect.PROPERTY_TITLE);
- modelBuilder.newMandatoryColumn("abstract", Transect.PROPERTY_TRANSECT_ABSTRACT);
- modelBuilder.newMandatoryColumn(TRANSECT_stratum, TRANSECT_stratum);
- modelBuilder.newMandatoryColumn("comment", Transect.PROPERTY_COMMENT);
- modelBuilder.newMandatoryColumn(TRANSECT_VoyageID, TRANSECT_VoyageID, CsvModelUtil.newForeignKeyValue(Voyage.class, voyageMap));
- modelBuilder.newMandatoryColumn(TRANSECT_datef, TRANSECT_datef, CsvModelUtil.DAY);
- modelBuilder.newMandatoryColumn(TRANSECT_heuref, TRANSECT_heuref, CsvModelUtil.TIME);
-
- modelBuilder.newMandatoryColumn("DateCreated", Transect.PROPERTY_DATE_CREATED, CsvModelUtil.IMPORT_DAY2);
- modelBuilder.newMandatoryColumn("TimeCoverageStart", Transect.PROPERTY_TIME_COVERAGE_START, CsvModelUtil.TIME);
- modelBuilder.newMandatoryColumn("TimeCoverageEnd", Transect.PROPERTY_TIME_COVERAGE_END, CsvModelUtil.TIME);
- modelBuilder.newMandatoryColumn("GeospatialLonMin", Transect.PROPERTY_GEOSPATIAL_LON_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialLatMin", Transect.PROPERTY_GEOSPATIAL_LAT_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialVerticalMin", Transect.PROPERTY_GEOSPATIAL_VERTICAL_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialLonMax", Transect.PROPERTY_GEOSPATIAL_LON_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialLatMax", Transect.PROPERTY_GEOSPATIAL_LAT_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialVerticalMax", Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
- }
-
- @Override
- public Map<String, Object> newEmptyInstance() {
- return null;
- }
-
- }
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataFromTransectImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataFromTransectImportService.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CommonDataFromTransectImportService.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -24,6 +24,7 @@
package fr.ifremer.echobase.services;
import com.google.common.collect.Maps;
+import fr.ifremer.echobase.EchoBaseFunctions;
import fr.ifremer.echobase.EchoBaseTechnicalException;
import fr.ifremer.echobase.InputFile;
import fr.ifremer.echobase.entities.EchoBaseUser;
@@ -32,8 +33,7 @@
import fr.ifremer.echobase.entities.data.Voyage;
import fr.ifremer.echobase.entities.references.Vessel;
import fr.ifremer.echobase.services.configurations.CommonDataFromTransectImportConfiguration;
-import fr.ifremer.echobase.services.csv.CsvModelUtil;
-import org.apache.commons.collections.CollectionUtils;
+import fr.ifremer.echobase.services.csv.TransectImportModel;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.util.csv.ImportToMap;
@@ -63,8 +63,13 @@
Voyage voyage = getEntityById(Voyage.class, configuration.getVoyageId());
Vessel vessel = getEntityById(Vessel.class, configuration.getVesselId());
+ List<Voyage> allVoyages = getEntities(Voyage.class);
+ Map<String, Voyage> voyageMap = Maps.uniqueIndex(
+ allVoyages, EchoBaseFunctions.VOYAGE_NAME);
+
importTransectFile(configuration.getTransectFile(),
voyage,
+ voyageMap,
vessel,
configuration.getDatum(),
configuration.getTransectLicence(),
@@ -76,6 +81,7 @@
private void importTransectFile(InputFile inputFile,
Voyage voyage,
+ Map<String, Voyage> voyageMap,
Vessel vessel,
String datum,
String license,
@@ -84,21 +90,25 @@
char csvSeparator
) throws TopiaException, IOException {
- TransectImportModel csvModel = new TransectImportModel(csvSeparator);
+ TransectImportModel csvModel = new TransectImportModel(csvSeparator, voyageMap);
TopiaDAO<Transect> dao = getDAO(Transect.class);
- /*
- modelBuilder.newMandatoryColumn(TRANSECT_stratum, TRANSECT_stratum);
- modelBuilder.newMandatoryColumn(TRANSECT_datef, TRANSECT_datef, CsvModelUtil.DAY);
- modelBuilder.newMandatoryColumn(TRANSECT_heuref, TRANSECT_heuref, CsvModelUtil.TIME);
- */
Reader reader = new BufferedReader(new FileReader(inputFile.getFile()));
try {
ImportToMap importer = ImportToMap.newImport(csvModel, reader);
for (Map<String, Object> row : importer) {
+ Date timeCoverageStart = (Date) row.get(Transect.PROPERTY_TIME_COVERAGE_START);
+ Date timeCoverageEnd = (Date) row.get(Transect.PROPERTY_TIME_COVERAGE_END);
+ Transit transit = voyage.getTransit(timeCoverageStart, timeCoverageEnd);
+ if (transit == null) {
+ throw new EchoBaseTechnicalException(
+ "Could not find transit for voyage " +
+ voyage.getName() + " between " + timeCoverageStart + " and " + timeCoverageEnd);
+ }
+
Transect transect = dao.create(
Transect.PROPERTY_VESSEL, vessel
);
@@ -113,10 +123,9 @@
transect.setBinUnitsPingAxis(binUnitsPingAxis);
transect.setDateCreated((Date) row.get(Transect.PROPERTY_DATE_CREATED));
- transect.setTimeCoverageStart((Date) row.get(Transect.PROPERTY_TIME_COVERAGE_START));
- transect.setTimeCoverageEnd((Date) row.get(Transect.PROPERTY_TIME_COVERAGE_END));
+ transect.setTimeCoverageStart(timeCoverageStart);
+ transect.setTimeCoverageEnd(timeCoverageEnd);
-
transect.setGeospatialLatMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LAT_MIN));
transect.setGeospatialLonMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LON_MIN));
transect.setGeospatialVerticalMin((Float) row.get(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MIN));
@@ -124,24 +133,7 @@
transect.setGeospatialLatMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LAT_MAX));
transect.setGeospatialLonMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_LON_MAX));
transect.setGeospatialVerticalMax((Float) row.get(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX));
-
- // find out the transit where to reattach the transect
- List<Transit> transits = voyage.getTransit();
-
- Transit transit = null;
-
- if (CollectionUtils.isNotEmpty(transits)) {
- for (Transit aTransit : transits) {
- transit = aTransit;
- break;
- }
- }
- if (transit == null) {
- throw new EchoBaseTechnicalException(
- "Could not find transit to reattach transect " +
- transect.getTitle());
- }
-
+ transect.setLinestring((String) row.get(Transect.PROPERTY_LINESTRING));
transit.addTransect(transect);
}
@@ -150,38 +142,4 @@
}
}
- protected static class TransectImportModel extends CsvModelUtil.AbstractImportModel<Map<String, Object>> {
-
- public static final String TRANSECT_stratum = "stratum";
- public static final String TRANSECT_VoyageID = "VoyageID";
- public static final String TRANSECT_datef = "datef";
- public static final String TRANSECT_heuref = "heuref";
-
- public TransectImportModel(char separator) {
- super(separator);
-
- modelBuilder.newMandatoryColumn("Title", Transect.PROPERTY_TITLE);
- modelBuilder.newMandatoryColumn("abstract", Transect.PROPERTY_TRANSECT_ABSTRACT);
- modelBuilder.newMandatoryColumn(TRANSECT_stratum, TRANSECT_stratum);
- modelBuilder.newMandatoryColumn("comment", Transect.PROPERTY_COMMENT);
- modelBuilder.newMandatoryColumn(TRANSECT_datef, TRANSECT_datef, CsvModelUtil.DAY);
- modelBuilder.newMandatoryColumn(TRANSECT_heuref, TRANSECT_heuref, CsvModelUtil.TIME);
-
- modelBuilder.newMandatoryColumn("DateCreated", Transect.PROPERTY_DATE_CREATED, CsvModelUtil.IMPORT_DAY2);
- modelBuilder.newMandatoryColumn("TimeCoverageStart", Transect.PROPERTY_TIME_COVERAGE_START, CsvModelUtil.TIME);
- modelBuilder.newMandatoryColumn("TimeCoverageEnd", Transect.PROPERTY_TIME_COVERAGE_END, CsvModelUtil.TIME);
- modelBuilder.newMandatoryColumn("GeospatialLonMin", Transect.PROPERTY_GEOSPATIAL_LON_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialLatMin", Transect.PROPERTY_GEOSPATIAL_LAT_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialVerticalMin", Transect.PROPERTY_GEOSPATIAL_VERTICAL_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialLonMax", Transect.PROPERTY_GEOSPATIAL_LON_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialLatMax", Transect.PROPERTY_GEOSPATIAL_LAT_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
- modelBuilder.newMandatoryColumn("GeospatialVerticalMax", Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
- }
-
- @Override
- public Map<String, Object> newEmptyInstance() {
- return null;
- }
-
- }
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CsvImportResult.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CsvImportResult.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/CsvImportResult.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -57,7 +57,7 @@
String importFileName,
boolean createIfNotFound) {
CsvImportResult result = new CsvImportResult(entityType, importFileName,
- createIfNotFound);
+ createIfNotFound);
return result;
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -381,7 +381,7 @@
} catch (Exception eee) {
throw new EchoBaseTechnicalException(
"Could not obtain property [" + propertyName +
- "] value from entity " + entity.getTopiaId(), eee);
+ "] value from entity " + entity.getTopiaId(), eee);
}
String formatedValue;
try {
@@ -389,8 +389,8 @@
} catch (Exception eee) {
throw new EchoBaseTechnicalException(
"Could not format property [" + propertyName +
- "] from value [" + value +
- "] from entity " + entity.getTopiaId(), eee);
+ "] from value [" + value +
+ "] from entity " + entity.getTopiaId(), eee);
}
row.put(propertyName, formatedValue);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -61,7 +61,7 @@
Preconditions.checkNotNull(
decorator,
"Could not find decorator for type " + type +
- " and context " + context
+ " and context " + context
);
return decorator;
}
@@ -104,7 +104,7 @@
Preconditions.checkNotNull(
decorator,
"Could not find decorator for type " + object.getClass() +
- " and context " + context
+ " and context " + context
);
DecoratorUtil.sort((JXPathDecorator<O>) decorator, list, 0);
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -54,10 +54,10 @@
EchoBaseServiceContext serviceContext,
TopiaContext transaction) {
return newContext(serviceContext.getLocale(),
- transaction,
- serviceContext.getConfiguration(),
- serviceContext.getDbMeta(),
- serviceContext.getServiceFactory()
+ transaction,
+ serviceContext.getConfiguration(),
+ serviceContext.getDbMeta(),
+ serviceContext.getServiceFactory()
);
}
@@ -68,10 +68,10 @@
DbMeta dbMeta,
EchoBaseServiceFactory serviceFactory) throws TopiaException {
return newContext(locale,
- topiaContextSupplier.get().beginTransaction(),
- configuration,
- dbMeta,
- serviceFactory);
+ topiaContextSupplier.get().beginTransaction(),
+ configuration,
+ dbMeta,
+ serviceFactory);
}
public static EchoBaseServiceContext newContext(
@@ -81,10 +81,10 @@
DbMeta dbMeta,
EchoBaseServiceFactory serviceFactory) {
return new EchoBaseServiceContextImpl(locale,
- transaction,
- configuration,
- dbMeta,
- serviceFactory);
+ transaction,
+ configuration,
+ dbMeta,
+ serviceFactory);
}
protected EchoBaseServiceContextImpl(Locale locale,
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -83,7 +83,7 @@
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(
"Could not obtain data of id [" + id + "] for type " +
- entityType, eee);
+ entityType, eee);
}
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EmbeddedApplicationService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EmbeddedApplicationService.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EmbeddedApplicationService.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -28,7 +28,7 @@
import com.google.common.base.Supplier;
import fr.ifremer.echobase.EchoBaseIOUtil;
import fr.ifremer.echobase.EchoBaseTechnicalException;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextSupplierFactory;
+import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EntitiesUtil;
@@ -73,6 +73,7 @@
START_SH("startEchobase.bat", "startEchobase.bat");
protected final String inputFileName;
+
protected final String outputFileName;
EmbeddedFile(String inputFileName, String outputFileName) {
@@ -134,7 +135,7 @@
} catch (Exception eee) {
throw new EchoBaseTechnicalException(
"Could not create zip structure at location " +
- dir, eee);
+ dir, eee);
}
EchoBaseIOUtil.compressZipFile(zipFile, dir);
@@ -176,7 +177,7 @@
// create new h2 db
Supplier<TopiaContext> topiaContextSupplier =
- new EchoBaseTopiaRootContextSupplierFactory().newEmbeddedDatabase(zipDirectory);
+ new EchoBaseTopiaRootContextFactory().newEmbeddedDatabase(zipDirectory);
TopiaContext rootContext = topiaContextSupplier.get();
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -238,7 +238,7 @@
// get row number (getRow() begins at 1)
int rowNumber = set.getRow() - 1;
if (rowNumber < pager.getRecordStartIndex() ||
- rowNumber >= pager.getRecordEndIndex()) {
+ rowNumber >= pager.getRecordEndIndex()) {
// out of pager bound, by returning null
// result will not be take in account
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ImportDbService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ImportDbService.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ImportDbService.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -155,7 +155,7 @@
}
if (!missingEntries.isEmpty() && log.isWarnEnabled()) {
log.warn("There is " + missingEntries.size() + " missing files " +
- " in import " + file + "\n" + StringUtil.join(missingEntries, "\n", false));
+ " in import " + file + "\n" + StringUtil.join(missingEntries, "\n", false));
}
return result;
@@ -265,8 +265,8 @@
String sourceTableName = source.getContract().getSimpleName();
String table = targetTableName;
if (source == EchoBaseEntityEnum.Voyage && target == EchoBaseEntityEnum.Echotype ||
- source == EchoBaseEntityEnum.Echotype && target == EchoBaseEntityEnum.Species ||
- source == EchoBaseEntityEnum.Voyage && target == EchoBaseEntityEnum.Strata) {
+ source == EchoBaseEntityEnum.Echotype && target == EchoBaseEntityEnum.Species ||
+ source == EchoBaseEntityEnum.Voyage && target == EchoBaseEntityEnum.Strata) {
// relation *-*
table = getNormalizedTableName(sourceTableName, targetTableName);
updateString = "INSERT INTO " + table + " (" + sourceTableName + "," + targetTableName + ") VALUES('%s','%s');";
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/CatchesDataImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/CatchesDataImportConfiguration.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/CatchesDataImportConfiguration.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -92,6 +92,6 @@
@Override
public InputFile[] getInputFiles() {
return new InputFile[]{tlbeStationFile, xtblTriFile,
- tblMensurationFile, tblMensurationClasseFile};
+ tblMensurationFile, tblMensurationClasseFile};
}
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/CommonDataCompleteImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/CommonDataCompleteImportConfiguration.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/configurations/CommonDataCompleteImportConfiguration.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -180,6 +180,6 @@
@Override
public InputFile[] getInputFiles() {
return new InputFile[]{voyageFile, transitFile,
- transectFile, echotypeFile};
+ transectFile, echotypeFile};
}
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -107,15 +107,14 @@
return new AssociationValueParserFormatter<E>(null, null);
}
- public static <E extends TopiaEntity> AssociationValueParserFormatter<E> newAssociationValueParserFormatter(Class<E> entityType,
- Map<String, E> universe) {
- return new AssociationValueParserFormatter<E>(entityType, universe);
- }
+// public static <E extends TopiaEntity> AssociationValueParserFormatter<E> newAssociationValueParserFormatter(Class<E> entityType,
+// Map<String, E> universe) {
+// return new AssociationValueParserFormatter<E>(entityType, universe);
+// }
public static final ValueParser<Date> IMPORT_DAY = new DateValue("dd/MM/yy");
- public static final ValueParser<Date> IMPORT_DAY2 = new DateValue("dd-MM-yy");
- public static final ValueParser<Date> TIME = new DateValue("HH:mm:ss");
+ public static final ValueParser<Date> IMPORT_DAY_TIME2 = new DateValue("dd-MM-yy HH:mm:ss");
public static final ValueParser<Boolean> INT_TO_BOOLEAN_PARSER = new ValueParser<Boolean>() {
@@ -129,10 +128,11 @@
@Override
protected Float parseNoneEmptyValue(String value) {
- if ("NA".equals(value)) {
- return null;
+ Float result = null;
+ if (!"NA".equals(value)) {
+ result = super.parseNoneEmptyValue(value);
}
- return super.parseNoneEmptyValue(value);
+ return result;
}
};
@@ -167,14 +167,17 @@
@Override
public String format(Collection<E> e) {
+
+ String value;
if (CollectionUtils.isEmpty(e)) {
- return "";
+ value = "";
+ } else {
+ Collection<String> ids = Lists.newArrayList();
+ for (E e1 : e) {
+ ids.add(e1.getTopiaId());
+ }
+ value = StringUtil.join(ids, "|", true);
}
- Collection<String> ids = Lists.newArrayList();
- for (E e1 : e) {
- ids.add(e1.getTopiaId());
- }
- String value = StringUtil.join(ids, "|", true);
return value;
}
}
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModel.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModel.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -0,0 +1,71 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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.csv;
+
+import fr.ifremer.echobase.entities.data.Transect;
+import fr.ifremer.echobase.entities.data.Voyage;
+
+import java.util.Map;
+
+/**
+ * Model to import transects.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class TransectImportModel extends CsvModelUtil.AbstractImportModel<Map<String, Object>> {
+
+ public static final String TRANSECT_VoyageId = "voyageName";
+
+ protected final Map<String, Voyage> voyageMap;
+
+ public TransectImportModel(char separator,
+ Map<String, Voyage> voyageMap) {
+ super(separator);
+ this.voyageMap = voyageMap;
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_TITLE, Transect.PROPERTY_TITLE);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_TRANSECT_ABSTRACT, Transect.PROPERTY_TRANSECT_ABSTRACT);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_STRATUM, Transect.PROPERTY_STRATUM);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_COMMENT, Transect.PROPERTY_COMMENT);
+ modelBuilder.newMandatoryColumn(TRANSECT_VoyageId, TRANSECT_VoyageId, CsvModelUtil.newForeignKeyValue(Voyage.class, voyageMap));
+
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_DATE_CREATED, Transect.PROPERTY_DATE_CREATED, CsvModelUtil.IMPORT_DAY_TIME2);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_TIME_COVERAGE_START, Transect.PROPERTY_TIME_COVERAGE_START, CsvModelUtil.IMPORT_DAY_TIME2);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_TIME_COVERAGE_END, Transect.PROPERTY_TIME_COVERAGE_END, CsvModelUtil.IMPORT_DAY_TIME2);
+
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_LON_MIN, Transect.PROPERTY_GEOSPATIAL_LON_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_LAT_MIN, Transect.PROPERTY_GEOSPATIAL_LAT_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MIN, Transect.PROPERTY_GEOSPATIAL_VERTICAL_MIN, CsvModelUtil.PRIMITIVE_FLOAT);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_LON_MAX, Transect.PROPERTY_GEOSPATIAL_LON_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_LAT_MAX, Transect.PROPERTY_GEOSPATIAL_LAT_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX, Transect.PROPERTY_GEOSPATIAL_VERTICAL_MAX, CsvModelUtil.PRIMITIVE_FLOAT);
+ modelBuilder.newMandatoryColumn(Transect.PROPERTY_LINESTRING, Transect.PROPERTY_LINESTRING);
+ }
+
+ @Override
+ public Map<String, Object> newEmptyInstance() {
+ return null;
+ }
+
+}
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransectImportModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModel.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModel.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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.csv;
+
+import fr.ifremer.echobase.entities.data.Transit;
+import fr.ifremer.echobase.entities.data.Voyage;
+
+import java.util.Map;
+
+/**
+ * Model to import Transits.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class TransitImportModel extends CsvModelUtil.AbstractImportModel<Map<String, Object>> {
+
+ public static final String TRANSIT_VoyageId = "voyageName";
+
+ protected final Map<String, Voyage> voyageMap;
+
+ public TransitImportModel(char separator,
+ Map<String, Voyage> voyageMap) {
+ super(separator);
+ this.voyageMap = voyageMap;
+ modelBuilder.newMandatoryColumn(TRANSIT_VoyageId, TRANSIT_VoyageId, CsvModelUtil.newForeignKeyValue(Voyage.class, voyageMap));
+ modelBuilder.newMandatoryColumn(Transit.PROPERTY_DESCRIPTION, Transit.PROPERTY_DESCRIPTION);
+ modelBuilder.newMandatoryColumn(Transit.PROPERTY_START_TIME, Transit.PROPERTY_START_TIME, CsvModelUtil.DAY_TIME);
+ modelBuilder.newMandatoryColumn(Transit.PROPERTY_END_TIME, Transit.PROPERTY_END_TIME, CsvModelUtil.DAY_TIME);
+ modelBuilder.newMandatoryColumn(Transit.PROPERTY_START_LOCALITY, Transit.PROPERTY_START_LOCALITY);
+ modelBuilder.newMandatoryColumn(Transit.PROPERTY_END_LOCALITY, Transit.PROPERTY_END_LOCALITY);
+ }
+
+ @Override
+ public Map<String, Object> newEmptyInstance() {
+ return null;
+ }
+}
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/TransitImportModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/VoyageImportModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/VoyageImportModel.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/VoyageImportModel.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -0,0 +1,50 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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.csv;
+
+import fr.ifremer.echobase.entities.data.Voyage;
+import fr.ifremer.echobase.entities.data.VoyageImpl;
+
+/**
+ * Model to import Voyages.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class VoyageImportModel extends CsvModelUtil.AbstractImportModel<Voyage> {
+
+ public VoyageImportModel(char separator) {
+ super(separator);
+ modelBuilder.newMandatoryColumn(Voyage.PROPERTY_NAME, Voyage.PROPERTY_NAME);
+ modelBuilder.newMandatoryColumn(Voyage.PROPERTY_START_DATE, Voyage.PROPERTY_START_DATE, CsvModelUtil.DAY);
+ modelBuilder.newMandatoryColumn(Voyage.PROPERTY_END_DATE, Voyage.PROPERTY_END_DATE, CsvModelUtil.DAY);
+ modelBuilder.newMandatoryColumn(Voyage.PROPERTY_START_PORT, Voyage.PROPERTY_START_PORT);
+ modelBuilder.newMandatoryColumn(Voyage.PROPERTY_END_PORT, Voyage.PROPERTY_END_PORT);
+ }
+
+ @Override
+ public Voyage newEmptyInstance() {
+ return new VoyageImpl();
+ }
+}
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/VoyageImportModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/TestHelper.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/TestHelper.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/TestHelper.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -67,8 +67,8 @@
}
public static TopiaContext getRootContext(File dbDir) {
- EchoBaseTopiaRootContextSupplierFactory factory =
- new EchoBaseTopiaRootContextSupplierFactory();
+ EchoBaseTopiaRootContextFactory factory =
+ new EchoBaseTopiaRootContextFactory();
Supplier<TopiaContext> topiaContextSupplier =
factory.newEmbeddedDatabase(dbDir);
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/AbstractEchoBaseServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/AbstractEchoBaseServiceTest.java 2012-01-25 10:50:25 UTC (rev 289)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/AbstractEchoBaseServiceTest.java 2012-01-25 10:51:42 UTC (rev 290)
@@ -24,11 +24,9 @@
package fr.ifremer.echobase.services;
import com.google.common.base.Supplier;
-import com.google.common.collect.Lists;
import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextSupplierFactory;
+import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
import fr.ifremer.echobase.TestHelper;
-import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.MockEntityVisitorCreator;
import fr.ifremer.echobase.entities.meta.DbMeta;
import junit.framework.Assert;
@@ -38,7 +36,6 @@
import org.nuiton.topia.persistence.TopiaEntity;
import java.io.File;
-import java.util.List;
import java.util.Locale;
/**
@@ -66,8 +63,8 @@
public TopiaContext getTransaction() throws Exception {
if (transaction == null || transaction.isClosed()) {
- EchoBaseTopiaRootContextSupplierFactory factory =
- new EchoBaseTopiaRootContextSupplierFactory();
+ EchoBaseTopiaRootContextFactory factory =
+ new EchoBaseTopiaRootContextFactory();
File basedir = TestHelper.getBasedir();
File target = new File(basedir, "/target");
Supplier<TopiaContext> topiaContextSupplier = factory.newEmbeddedDatabase(target);
1
0
r289 - in trunk/echobase-entities/src/main: java/fr/ifremer/echobase java/fr/ifremer/echobase/entities java/fr/ifremer/echobase/entities/data resources/i18n xmi
by tchemit@users.forge.codelutin.com 25 Jan '12
by tchemit@users.forge.codelutin.com 25 Jan '12
25 Jan '12
Author: tchemit
Date: 2012-01-25 11:50:25 +0100 (Wed, 25 Jan 2012)
New Revision: 289
Url: http://forge.codelutin.com/repositories/revision/echobase/289
Log:
rename EchoBaseTopiaRootContextSupplierFactory to EchoBaseTopiaRootContextFactory, introduce getTransit method on Voyage, add Transect#stratum field
Added:
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextFactory.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java
Removed:
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java
Modified:
trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties
trunk/echobase-entities/src/main/xmi/echobase.zargo
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextFactory.java (from rev 288, trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextFactory.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextFactory.java 2012-01-25 10:50:25 UTC (rev 289)
@@ -0,0 +1,148 @@
+/*
+ * #%L
+ * Extranet NF-Logement :: Entities
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Cerqual
+ * %%
+ * 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;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.Sets;
+import com.google.common.io.Closeables;
+import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.topia.TopiaRuntimeException;
+import org.nuiton.topia.replication.TopiaReplicationService;
+import org.nuiton.topia.replication.TopiaReplicationServiceImpl;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EchoBaseTopiaRootContextFactory {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EchoBaseTopiaRootContextFactory.class);
+
+ protected static class EchoBaseTopiaRootContextSupplier implements Supplier<TopiaContext> {
+
+ protected TopiaContext rootContext;
+
+ public EchoBaseTopiaRootContextSupplier(TopiaContext rootContext) {
+ this.rootContext = rootContext;
+ }
+
+ @Override
+ public TopiaContext get() {
+ return rootContext;
+ }
+ }
+
+ public Supplier<TopiaContext> newEmbeddedDatabase(File dir) {
+
+ File databaseFile = new File(dir, "db");
+
+ String databaseAbsolutePath = databaseFile.getAbsolutePath();
+
+ // prepare call to topia-context factory
+ Properties properties = new Properties();
+ InputStream input = null;
+ try {
+ input = getClass().getResourceAsStream("/topia-h2.properties");
+ properties.load(input);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ Closeables.closeQuietly(input);
+ }
+ properties.setProperty(
+ TopiaContextFactory.CONFIG_URL,
+ "jdbc:h2:file:" + databaseAbsolutePath + "/echobase");
+
+ // add entities to the context
+ properties.setProperty(
+ TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
+ EchoBaseDAOHelper.getImplementationClassesAsString());
+
+ // add topiaReplicationService in the context
+ properties.setProperty(TopiaReplicationService.TOPIA_SERVICE_NAME,
+ TopiaReplicationServiceImpl.class.getName());
+
+ TopiaContext rootContext;
+ try {
+ rootContext = TopiaContextFactory.getContext(properties);
+ } catch (TopiaNotFoundException e) {
+ throw new TopiaRuntimeException(e);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("will output database in " + databaseAbsolutePath);
+ }
+
+ return new EchoBaseTopiaRootContextSupplier(rootContext);
+ }
+
+ public Supplier<TopiaContext> newDatabaseFromConfig(EchoBaseConfiguration config) {
+
+ Properties properties = config.getProperties();
+
+ return newDatabaseFromProperties(properties);
+ }
+
+ public Supplier<TopiaContext> newDatabaseFromProperties(Properties properties) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Database settings are :");
+ Set<String> keysToDisplay = Sets.newHashSet(
+ "hibernate.dialect",
+ "hibernate.connection.driver_class",
+ "hibernate.connection.url",
+ "hibernate.connection.username");
+ for (String key : keysToDisplay) {
+ log.debug(String.format("%s=%s", key, properties.getProperty(key)));
+ }
+ }
+
+ // add entities to the context
+ String classesKey = TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES;
+ String classesValue = EchoBaseDAOHelper.getImplementationClassesAsString();
+ properties.setProperty(classesKey, classesValue);
+
+ TopiaContext rootContext;
+ try {
+ rootContext = TopiaContextFactory.getContext(properties);
+ } catch (TopiaNotFoundException e) {
+ throw new TopiaRuntimeException(e);
+ }
+
+ return new EchoBaseTopiaRootContextSupplier(rootContext);
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextFactory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java 2012-01-17 18:00:35 UTC (rev 288)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java 2012-01-25 10:50:25 UTC (rev 289)
@@ -1,148 +0,0 @@
-/*
- * #%L
- * Extranet NF-Logement :: Entities
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Cerqual
- * %%
- * 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;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Sets;
-import com.google.common.io.Closeables;
-import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaContextFactory;
-import org.nuiton.topia.TopiaNotFoundException;
-import org.nuiton.topia.TopiaRuntimeException;
-import org.nuiton.topia.replication.TopiaReplicationService;
-import org.nuiton.topia.replication.TopiaReplicationServiceImpl;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EchoBaseTopiaRootContextSupplierFactory {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EchoBaseTopiaRootContextSupplierFactory.class);
-
- protected static class EchoBaseTopiaRootContextSupplier implements Supplier<TopiaContext> {
-
- protected TopiaContext rootContext;
-
- public EchoBaseTopiaRootContextSupplier(TopiaContext rootContext) {
- this.rootContext = rootContext;
- }
-
- @Override
- public TopiaContext get() {
- return rootContext;
- }
- }
-
- public Supplier<TopiaContext> newEmbeddedDatabase(File dir) {
-
- File databaseFile = new File(dir, "db");
-
- String databaseAbsolutePath = databaseFile.getAbsolutePath();
-
- // prepare call to topia-context factory
- Properties properties = new Properties();
- InputStream input = null;
- try {
- input = getClass().getResourceAsStream("/topia-h2.properties");
- properties.load(input);
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- Closeables.closeQuietly(input);
- }
- properties.setProperty(
- TopiaContextFactory.CONFIG_URL,
- "jdbc:h2:file:" + databaseAbsolutePath + "/echobase");
-
- // add entities to the context
- properties.setProperty(
- TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
- EchoBaseDAOHelper.getImplementationClassesAsString());
-
- // add topiaReplicationService in the context
- properties.setProperty(TopiaReplicationService.TOPIA_SERVICE_NAME,
- TopiaReplicationServiceImpl.class.getName());
-
- TopiaContext rootContext;
- try {
- rootContext = TopiaContextFactory.getContext(properties);
- } catch (TopiaNotFoundException e) {
- throw new TopiaRuntimeException(e);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("will output database in " + databaseAbsolutePath);
- }
-
- return new EchoBaseTopiaRootContextSupplier(rootContext);
- }
-
- public Supplier<TopiaContext> newDatabaseFromConfig(EchoBaseConfiguration config) {
-
- Properties properties = config.getProperties();
-
- return newDatabaseFromProperties(properties);
- }
-
- public Supplier<TopiaContext> newDatabaseFromProperties(Properties properties) {
-
- if (log.isDebugEnabled()) {
- log.debug("Database settings are :");
- Set<String> keysToDisplay = Sets.newHashSet(
- "hibernate.dialect",
- "hibernate.connection.driver_class",
- "hibernate.connection.url",
- "hibernate.connection.username");
- for (String key : keysToDisplay) {
- log.debug(String.format("%s=%s", key, properties.getProperty(key)));
- }
- }
-
- // add entities to the context
- String classesKey = TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES;
- String classesValue = EchoBaseDAOHelper.getImplementationClassesAsString();
- properties.setProperty(classesKey, classesValue);
-
- TopiaContext rootContext;
- try {
- rootContext = TopiaContextFactory.getContext(properties);
- } catch (TopiaNotFoundException e) {
- throw new TopiaRuntimeException(e);
- }
-
- return new EchoBaseTopiaRootContextSupplier(rootContext);
- }
-}
Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java 2012-01-25 10:50:25 UTC (rev 289)
@@ -0,0 +1,65 @@
+/*
+ * #%L
+ * EchoBase :: Entities
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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.entities.data;
+
+import org.apache.commons.collections.CollectionUtils;
+
+import java.util.Date;
+
+/**
+ * Default implementation of {@link Voyage}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class VoyageImpl extends VoyageAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Transit getTransit(Date startTime, Date endDate) {
+
+ Transit result = null;
+ if (CollectionUtils.isNotEmpty(getTransit())) {
+ for (Transit t : getTransit()) {
+ Date transitStartTime = t.getStartTime();
+ Date transitEndTime = t.getEndTime();
+ if (transitEndTime.before(startTime)) {
+ // transit before required range
+ continue;
+ }
+ if (transitStartTime.after(endDate)) {
+
+ // transit after required range
+ continue;
+ }
+
+ // ok transit contains required range
+ result = t;
+ break;
+ }
+ }
+ return result;
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties
===================================================================
--- trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties 2012-01-17 18:00:35 UTC (rev 288)
+++ trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties 2012-01-25 10:50:25 UTC (rev 289)
@@ -217,6 +217,7 @@
echobase.common.startTime=
echobase.common.status=
echobase.common.strata=
+echobase.common.stratum=
echobase.common.swimbladder=
echobase.common.swimbladderType=
echobase.common.taxonCode=
Modified: trunk/echobase-entities/src/main/xmi/echobase.zargo
===================================================================
(Binary files differ)
1
0
r288 - in trunk: echobase-services/src/main/java/fr/ifremer/echobase/services echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user
by tchemit@users.forge.codelutin.com 17 Jan '12
by tchemit@users.forge.codelutin.com 17 Jan '12
17 Jan '12
Author: tchemit
Date: 2012-01-17 19:00:35 +0100 (Tue, 17 Jan 2012)
New Revision: 288
Url: http://forge.codelutin.com/repositories/revision/echobase/288
Log:
use PagerBean dfrom nuiton-utils
Removed:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/Pager.java
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractJSONPaginedAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/GetExportQueryResult.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2012-01-17 17:56:39 UTC (rev 287)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2012-01-17 18:00:35 UTC (rev 288)
@@ -41,8 +41,10 @@
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.util.PagerUtil;
import org.nuiton.util.beans.BeanMonitor;
import org.nuiton.util.beans.PropertyDiff;
+import org.nuiton.util.csv.ExportModel;
import org.nuiton.util.csv.ExportableColumn;
import org.nuiton.util.csv.ImportExportModel;
import org.nuiton.util.csv.ImportableColumn;
@@ -86,7 +88,7 @@
//TODO Use an object to filter datas
public Map<?, ?>[] getDatas(EchoBaseEntityEnum entityType,
- Pager pager,
+ PagerUtil.PagerBean pager,
String sidx,
Boolean ascendantOrder) {
@@ -113,7 +115,7 @@
}
public <E extends TopiaEntity> List<E> getEntities(TableMeta tableMeta,
- Pager pager,
+ PagerUtil.PagerBean pager,
String sidx,
Boolean ascendantOrder,
String extraWhereQuery) {
@@ -132,18 +134,18 @@
if (pager != null) {
pager.setRecords(count);
- pager.computeIndexesAndPageCount();
+ PagerUtil.computeRecordIndexesAndPagesNumber(pager);
- int from = pager.getStartIndex();
- int to = pager.getEndIndex();
+ int from = pager.getRecordStartIndex();
+ int to = pager.getRecordEndIndex();
if (log.isDebugEnabled()) {
log.debug("Count = " + count);
- log.debug("page = " + pager.getPageNumber());
+ log.debug("page = " + pager.getPageIndex());
log.debug("pageSize = " + pager.getPageSize());
log.debug("from = " + from);
log.debug("to = " + to);
- log.debug("pageCount= " + pager.getPageCount());
+ log.debug("pageCount= " + pager.getPagesNumber());
}
if (StringUtils.isNotEmpty(sidx)) {
@@ -176,7 +178,7 @@
try {
TopiaDAO<?> dao = getDAO(entityEnum.getContract());
TopiaEntity entity = dao.findByTopiaId(topiaId);
- ImportExportModel<TopiaEntity> model = buildForLoad(tableMeta, TopiaEntity.TOPIA_ID, true);
+ ExportModel<TopiaEntity> model = buildForLoad(tableMeta, TopiaEntity.TOPIA_ID, true);
return loadRow(entity, model);
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException("Could not obtain data", eee);
@@ -364,7 +366,7 @@
protected <E extends TopiaEntity> Map<String, Object> loadRow(
E entity,
- ImportExportModel<E> loadModel) {
+ ExportModel<E> loadModel) {
Map<String, Object> row = Maps.newLinkedHashMap();
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java 2012-01-17 17:56:39 UTC (rev 287)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportQueryService.java 2012-01-17 18:00:35 UTC (rev 288)
@@ -36,6 +36,7 @@
import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.framework.TopiaSQLQuery;
import org.nuiton.topia.persistence.TopiaDAO;
+import org.nuiton.util.PagerUtil;
import org.nuiton.util.csv.Export;
import java.sql.Connection;
@@ -108,7 +109,7 @@
}
}
- public Map<String, Object>[] executeSql(String sql, Pager pager) {
+ public Map<String, Object>[] executeSql(String sql, PagerUtil.PagerBean pager) {
// get a query to count all rows for the request
GenericSQLQuery sqlQuery = new GenericSQLQuery(sql, pager);
@@ -171,9 +172,9 @@
private final String sql;
- private final Pager pager;
+ private final PagerUtil.PagerBean pager;
- public GenericSQLQuery(String sql, Pager pager) {
+ public GenericSQLQuery(String sql, PagerUtil.PagerBean pager) {
this.sql = sql;
this.pager = pager;
}
@@ -225,7 +226,7 @@
log.info("For request " + sql + ", nb rows = " + nbRows);
}
pager.setRecords(nbRows);
- pager.computeIndexesAndPageCount();
+ PagerUtil.computeRecordIndexesAndPagesNumber(pager);
}
}
@@ -236,8 +237,8 @@
// get row number (getRow() begins at 1)
int rowNumber = set.getRow() - 1;
- if (rowNumber < pager.getStartIndex() ||
- rowNumber >= pager.getEndIndex()) {
+ if (rowNumber < pager.getRecordStartIndex() ||
+ rowNumber >= pager.getRecordEndIndex()) {
// out of pager bound, by returning null
// result will not be take in account
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/Pager.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/Pager.java 2012-01-17 17:56:39 UTC (rev 287)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/Pager.java 2012-01-17 18:00:35 UTC (rev 288)
@@ -1,109 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 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;
-
-import org.apache.commons.lang3.tuple.Pair;
-import org.nuiton.util.PagerUtil;
-
-import java.io.Serializable;
-
-/**
- * A simple pager bean.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class Pager implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- protected int records;
-
- protected int startIndex;
-
- protected int endIndex;
-
- protected int pageNumber;
-
- protected int pageSize;
-
- protected int pageCount;
-
- public int getRecords() {
- return records;
- }
-
- public int getStartIndex() {
- return startIndex;
- }
-
- public int getEndIndex() {
- return endIndex;
- }
-
- public int getPageNumber() {
- return pageNumber;
- }
-
- public int getPageSize() {
- return pageSize;
- }
-
- public int getPageCount() {
- return pageCount;
- }
-
- public void setRecords(int records) {
- this.records = records;
- }
-
- public void setStartIndex(int startIndex) {
- this.startIndex = startIndex;
- }
-
- public void setEndIndex(int endIndex) {
- this.endIndex = endIndex;
- }
-
- public void setPageNumber(int pageNumber) {
- this.pageNumber = pageNumber;
- }
-
- public void setPageSize(int pageSize) {
- this.pageSize = pageSize;
- }
-
- public void setPageCount(int pageCount) {
- this.pageCount = pageCount;
- }
-
- public void computeIndexesAndPageCount() {
- Pair<Integer, Integer> pageBound =
- PagerUtil.getPageBound(records, pageNumber, pageSize);
- startIndex = pageBound.getLeft();
- endIndex = pageBound.getRight();
- pageCount = PagerUtil.getTotalPage(records, pageSize);
- }
-
-}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2012-01-17 17:56:39 UTC (rev 287)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2012-01-17 18:00:35 UTC (rev 288)
@@ -32,6 +32,7 @@
import org.apache.commons.lang3.StringUtils;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.util.PagerUtil;
import org.nuiton.util.StringUtil;
import java.util.List;
@@ -54,7 +55,7 @@
return getUsers(null);
}
- public List<EchoBaseUser> getUsers(Pager pager) {
+ public List<EchoBaseUser> getUsers(PagerUtil.PagerBean pager) {
try {
List<EchoBaseUser> users;
@@ -67,9 +68,9 @@
// get user count
long count = dao.count();
pager.setRecords((int) count);
- pager.computeIndexesAndPageCount();
+ PagerUtil.computeRecordIndexesAndPagesNumber(pager);
TopiaQuery query = dao.createQuery("e");
- query.setLimit(pager.getStartIndex(), pager.getEndIndex() - 1);
+ query.setLimit(pager.getRecordStartIndex(), pager.getRecordEndIndex() - 1);
users = dao.findAllByQuery(query);
}
return users;
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractJSONPaginedAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractJSONPaginedAction.java 2012-01-17 17:56:39 UTC (rev 287)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractJSONPaginedAction.java 2012-01-17 18:00:35 UTC (rev 288)
@@ -23,10 +23,10 @@
*/
package fr.ifremer.echobase.ui.actions;
-import fr.ifremer.echobase.services.Pager;
import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.json.JSONException;
import org.apache.struts2.json.JSONUtil;
+import org.nuiton.util.PagerUtil;
/**
* Abstract JSON action with pagination support.
@@ -46,7 +46,7 @@
public abstract Integer getRecords();
- protected Pager pager = new Pager();
+ protected PagerUtil.PagerBean pager = PagerUtil.newPagerBean();
// sorting order - asc or desc
protected String sord;
@@ -61,7 +61,7 @@
}
public void setPage(Integer page) {
- pager.setPageNumber(page);
+ pager.setPageIndex(page);
}
public String getSord() {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2012-01-17 17:56:39 UTC (rev 287)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2012-01-17 18:00:35 UTC (rev 288)
@@ -65,12 +65,12 @@
@Override
public Integer getPage() {
- return pager.getPageNumber();
+ return pager.getPageIndex();
}
@Override
public Integer getTotal() {
- return pager.getPageCount();
+ return pager.getPagesNumber();
}
@Override
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/GetExportQueryResult.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/GetExportQueryResult.java 2012-01-17 17:56:39 UTC (rev 287)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/GetExportQueryResult.java 2012-01-17 18:00:35 UTC (rev 288)
@@ -59,12 +59,12 @@
@Override
public Integer getPage() {
- return pager.getPageNumber();
+ return pager.getPageIndex();
}
@Override
public Integer getTotal() {
- return pager.getPageCount();
+ return pager.getPagesNumber();
}
@Override
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java 2012-01-17 17:56:39 UTC (rev 287)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java 2012-01-17 18:00:35 UTC (rev 288)
@@ -54,12 +54,12 @@
@Override
public Integer getPage() {
- return pager.getPageNumber();
+ return pager.getPageIndex();
}
@Override
public Integer getTotal() {
- return pager.getPageCount();
+ return pager.getPagesNumber();
}
@Override
1
0
Author: tchemit
Date: 2012-01-17 18:56:39 +0100 (Tue, 17 Jan 2012)
New Revision: 287
Url: http://forge.codelutin.com/repositories/revision/echobase/287
Log:
add plugin in pom
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-01-17 17:55:41 UTC (rev 286)
+++ trunk/pom.xml 2012-01-17 17:56:39 UTC (rev 287)
@@ -109,7 +109,7 @@
<eugenePluginVersion>2.4.2</eugenePluginVersion>
<topiaVersion>2.6.6</topiaVersion>
- <nuitonUtilsVersion>2.4.2</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.4.4</nuitonUtilsVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<nuitonWebVersion>1.9.1</nuitonWebVersion>
<msaccessImporterVersion>1.4.1</msaccessImporterVersion>
@@ -416,12 +416,6 @@
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>wagon-maven-plugin</artifactId>
- <version>${wagonPluginVersion}</version>
- </plugin>
-
- <plugin>
<groupId>org.nuiton.eugene</groupId>
<artifactId>maven-eugene-plugin</artifactId>
<version>${eugenePluginVersion}</version>
@@ -435,11 +429,25 @@
<!-- remove this when using mavenpom 3.1 -->
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>wagon-maven-plugin</artifactId>
+ <version>${wagonPluginVersion}</version>
+ </plugin>
+
+ <!-- remove this when using mavenpom 3.1 -->
+ <plugin>
<groupId>org.nuiton</groupId>
<artifactId>helper-maven-plugin</artifactId>
<version>1.4</version>
</plugin>
+ <!-- remove this when using mavenpom 3.1 -->
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>${jettyPluginVersion}</version>
+ </plugin>
+
</plugins>
</pluginManagement>
1
0
r286 - trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv
by tchemit@users.forge.codelutin.com 17 Jan '12
by tchemit@users.forge.codelutin.com 17 Jan '12
17 Jan '12
Author: tchemit
Date: 2012-01-17 18:55:41 +0100 (Tue, 17 Jan 2012)
New Revision: 286
Url: http://forge.codelutin.com/repositories/revision/echobase/286
Log:
fix import/export
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java 2012-01-15 22:12:51 UTC (rev 285)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CsvModelUtil.java 2012-01-17 17:55:41 UTC (rev 286)
@@ -344,7 +344,7 @@
@Override
public final Iterable<ExportableColumn<E, Object>> getColumnsForExport() {
- return (Iterable) modelBuilder.getColumnsForImport();
+ return (Iterable) modelBuilder.getColumnsForExport();
}
@Override
@@ -371,7 +371,7 @@
@Override
public final Iterable<ExportableColumn<E, Object>> getColumnsForExport() {
- return (Iterable) modelBuilder.getColumnsForImport();
+ return (Iterable) modelBuilder.getColumnsForExport();
}
}
1
0