r1018 - in trunk: echobase-domain/src/main/java/fr/ifremer/echobase/entities/data echobase-domain/src/main/xmi echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser
Author: tchemit Date: 2014-04-22 22:25:28 +0200 (Tue, 22 Apr 2014) New Revision: 1018 Url: http://forge.codelutin.com/projects/echobase/repository/revisions/1018 Log: fixes #4821 Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/IndicatorExportModel.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/IndicatorExportRow.java Removed: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/CommunityIndicatorExportModel.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/CommunityIndicatorExportRow.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportModel.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportRow.java Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/ResultTopiaDao.java trunk/echobase-domain/src/main/xmi/echobase.properties trunk/echobase-domain/src/main/xmi/echobase.zargo trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/ExportCoserService.java Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/ResultTopiaDao.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/ResultTopiaDao.java 2014-04-22 15:47:09 UTC (rev 1017) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/ResultTopiaDao.java 2014-04-22 20:25:28 UTC (rev 1018) @@ -22,6 +22,7 @@ */ import fr.ifremer.echobase.entities.references.DataMetadata; +import fr.ifremer.echobase.entities.references.Mission; import java.util.List; import java.util.Set; @@ -31,13 +32,6 @@ public List<Result> findAllWithCategoryCellAndDataMetadata(Set<String> cellIds, DataMetadata requiredDataMetadata, List<String> categoryIds) { - -// String query = createSimpleQuery(null) + " WHERE cell.id IN :cell AND dataMetadata = :dataMetadata"; -// return findAllByQuery( -// query + " AND category.id IN :category", -// Result.PROPERTY_CELL, cellIds, -// Result.PROPERTY_DATA_METADATA, requiredDataMetadata, -// Result.PROPERTY_CATEGORY, categoryIds); return forEquals(Result.PROPERTY_DATA_METADATA, requiredDataMetadata). addTopiaIdIn(Result.PROPERTY_CELL, cellIds). addTopiaIdIn(Result.PROPERTY_CATEGORY, categoryIds). @@ -46,16 +40,15 @@ public List<Result> findAllWithNoCategoryCellAndDataMetadata(Set<String> cellIds, DataMetadata requiredDataMetadata) { - -// String query = createSimpleQuery(null) + " WHERE cell.id IN :cell AND dataMetadata = :dataMetadata"; -// return findAllByQuery( -// query + " AND category IS NULL", -// Result.PROPERTY_CELL, cellIds, -// Result.PROPERTY_DATA_METADATA, requiredDataMetadata); return forEquals(Result.PROPERTY_DATA_METADATA, requiredDataMetadata). addTopiaIdIn(Result.PROPERTY_CELL, cellIds). addNull(Result.PROPERTY_CATEGORY). findAll(); } + public List<Result> findAllWithMissionAndDatametadata(Mission mission, DataMetadata dataMetadata) { + return forEquals(Result.PROPERTY_CELL + "." + Cell.PROPERTY_VOYAGE + "." + Voyage.PROPERTY_MISSION, mission). + addEquals(Result.PROPERTY_DATA_METADATA, dataMetadata). + findAll(); + } } Modified: trunk/echobase-domain/src/main/xmi/echobase.properties =================================================================== --- trunk/echobase-domain/src/main/xmi/echobase.properties 2014-04-22 15:47:09 UTC (rev 1017) +++ trunk/echobase-domain/src/main/xmi/echobase.properties 2014-04-22 20:25:28 UTC (rev 1018) @@ -32,11 +32,11 @@ ### Ordered attributes ######################################################## ############################################################################### -fr.ifremer.echobase.entities.data.Voyage.attribute.transit.stereotype=ordered +#fr.ifremer.echobase.entities.data.Voyage.attribute.transit.stereotype=ordered fr.ifremer.echobase.entities.data.Voyage.attribute.transit.tagvalue.orderBy=startTime -fr.ifremer.echobase.entities.data.Transit.attribute.transect.stereotype=ordered +#fr.ifremer.echobase.entities.data.Transit.attribute.transect.stereotype=ordered fr.ifremer.echobase.entities.data.Transit.attribute.transect.tagvalue.orderBy=timeCoverageStart -fr.ifremer.echobase.entities.data.Transect.attribute.operation.stereotype=ordered +#fr.ifremer.echobase.entities.data.Transect.attribute.operation.stereotype=ordered fr.ifremer.echobase.entities.data.Transect.attribute.operation.tagvalue.orderBy=gearShootingStartTime ############################################################################### Modified: trunk/echobase-domain/src/main/xmi/echobase.zargo =================================================================== (Binary files differ) Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/CommunityIndicatorExportModel.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/CommunityIndicatorExportModel.java 2014-04-22 15:47:09 UTC (rev 1017) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/CommunityIndicatorExportModel.java 2014-04-22 20:25:28 UTC (rev 1018) @@ -1,47 +0,0 @@ -package fr.ifremer.echobase.services.service.exportCoser; - -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2014 Ifremer, Codelutin, Chemit Tony - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import fr.ifremer.echobase.csv.EchoBaseCsvUtil; -import org.nuiton.csv.ext.AbstractExportModel; - -/** - * Created on 3/20/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 2.6 - */ -public class CommunityIndicatorExportModel extends AbstractExportModel<CommunityIndicatorExportRow> { - - public CommunityIndicatorExportModel(char separator) { - super(separator); - newColumnForExport("Campagne", EchoBaseCsvUtil.<CommunityIndicatorExportRow, String>newBeanProperty(CommunityIndicatorExportRow.PROPERTY_MISSION_NAME)); - newColumnForExport("Indicateur", EchoBaseCsvUtil.<CommunityIndicatorExportRow, String>newBeanProperty(CommunityIndicatorExportRow.PROPERTY_INDICATOR_NAME)); - newColumnForExport("Espece", CommunityIndicatorExportRow.PROPERTY_SPECIES, EchoBaseCsvUtil.SPECIES_TO_COSER_CODE); - newColumnForExport("Strate", CommunityIndicatorExportRow.PROPERTY_STRATUM); - newColumnForExport("Annee", CommunityIndicatorExportRow.PROPERTY_DATE, EchoBaseCsvUtil.YEAR); - newColumnForExport("Estimation", CommunityIndicatorExportRow.PROPERTY_ESTIMATION); - newColumnForExport("EcartType", CommunityIndicatorExportRow.PROPERTY_STANDARD_DEVIATION); - newColumnForExport("CV", CommunityIndicatorExportRow.PROPERTY_CV); - } - -} \ No newline at end of file Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/CommunityIndicatorExportRow.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/CommunityIndicatorExportRow.java 2014-04-22 15:47:09 UTC (rev 1017) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/CommunityIndicatorExportRow.java 2014-04-22 20:25:28 UTC (rev 1018) @@ -1,127 +0,0 @@ -package fr.ifremer.echobase.services.service.exportCoser; - -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2014 Ifremer, Codelutin, Chemit Tony - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import fr.ifremer.echobase.entities.references.DataMetadata; -import fr.ifremer.echobase.entities.references.Mission; -import fr.ifremer.echobase.entities.references.Species; - -import java.util.Date; - -/** - * Created on 3/20/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 2.6 - */ -public class CommunityIndicatorExportRow { - - public static final String PROPERTY_MISSION_NAME = "mission." + Mission.PROPERTY_NAME; - - public static final String PROPERTY_INDICATOR_NAME = "indicator." + DataMetadata.PROPERTY_NAME; - - public static final String PROPERTY_SPECIES = "species"; - - public static final String PROPERTY_STRATUM = "stratum"; - - public static final String PROPERTY_DATE = "date"; - - public static final String PROPERTY_ESTIMATION = "estimation"; - - public static final String PROPERTY_STANDARD_DEVIATION = "standardDeviation"; - - public static final String PROPERTY_CV = "cv"; - - protected Mission mission; - - protected DataMetadata indicator; - - protected Species species; - - protected String stratum; - - protected Date date; - - protected float estimation; - - protected float standardDeviation; - - public Mission getMission() { - return mission; - } - - public DataMetadata getIndicator() { - return indicator; - } - - public Species getSpecies() { - return species; - } - - public String getStratum() { - return stratum; - } - - public Date getDate() { - return date; - } - - public float getEstimation() { - return estimation; - } - - public float getStandardDeviation() { - return standardDeviation; - } - - public float getCv() { - return standardDeviation / estimation; - } - - public void setMission(Mission mission) { - this.mission = mission; - } - - public void setIndicator(DataMetadata indicator) { - this.indicator = indicator; - } - - public void setSpecies(Species species) { - this.species = species; - } - - public void setStratum(String stratum) { - this.stratum = stratum; - } - - public void setDate(Date date) { - this.date = date; - } - - public void setEstimation(float estimation) { - this.estimation = estimation; - } - - public void setStandardDeviation(float standardDeviation) { - this.standardDeviation = standardDeviation; - } -} Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/ExportCoserService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/ExportCoserService.java 2014-04-22 15:47:09 UTC (rev 1017) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/ExportCoserService.java 2014-04-22 20:25:28 UTC (rev 1018) @@ -85,8 +85,8 @@ model.setNbSteps(4 + 4 + // raw data - model.getPopulationIndicator().size() + - model.getCommunityIndicator().size()); + model.getPopulationIndicator().size() + 1 + + model.getCommunityIndicator().size() + 1); Mission mission = persistenceService.getMission(model.getMissionId()); Preconditions.checkNotNull(mission); @@ -119,10 +119,10 @@ model.incrementsProgress(); // 7 - create archive - File zipFile = generateArchive(mission, - project, - tempDirectory, - echRMapsDir); + File zipFile = generateArchive( + project, + tempDirectory, + echRMapsDir); model.setExportFile(zipFile); model.incrementsProgress(); @@ -155,8 +155,7 @@ project.setAuthor("EchoBase user: " + model.getUserName()); project.setCreationDate(serviceContext.newDate()); project.setComment("Created by Echobase application (db: " + getUserDbUrl() + ")"); - //FIXME when will publish some raw data. - project.setPubliableResult(false); + project.setPubliableResult(true); project.save(); @@ -166,8 +165,7 @@ return project; } - protected File generateArchive(Mission mission, - EchoBaseProject project, + protected File generateArchive(EchoBaseProject project, File tempDirectory, File echRMapsDir) throws IOException { @@ -184,7 +182,7 @@ } //------------------------------------------------------------------------// - //--- Extract population indicators --------------------------------------// + //--- Extract indicators -------------------------------------------------// //------------------------------------------------------------------------// protected void extractPopulationIndicators(ExportCoserConfiguration model, @@ -196,15 +194,16 @@ log.info("Generate " + exportFile); } - PopulationIndicatorExportModel exportModel = new PopulationIndicatorExportModel(getCsvSeparator()); + IndicatorExportModel exportModel = new IndicatorExportModel(getCsvSeparator()); - List<PopulationIndicatorExportRow> rows = Lists.newArrayList(); + List<IndicatorExportRow> rows = Lists.newArrayList(); Set<String> indicators = model.getPopulationIndicator(); for (String indicator : indicators) { - loadPopulationIndicatorValues(mission, indicator, rows); + loadIndicatorValues(mission, indicator, rows); + model.incrementsProgress(); } - Export<PopulationIndicatorExportRow> export = Export.newExport(exportModel, rows); + Export<IndicatorExportRow> export = Export.newExport(exportModel, rows); try { export.write(exportFile, Charsets.UTF_8); } catch (Exception e) { @@ -213,60 +212,6 @@ model.incrementsProgress(); } - protected void loadPopulationIndicatorValues(Mission mission, - String indicator, - List<PopulationIndicatorExportRow> rows) { - - if (log.isInfoEnabled()) { - log.info("Extract population indicator: " + indicator); - } - DataMetadata dataMetadata = persistenceService.getDataMetadata(indicator); - DataMetadata standardDeviationDataMetadata = - persistenceService.tryToGetDataMetadataByName(dataMetadata.getName() + "_stdev"); - - Map<String, PopulationIndicatorExportRow> rowsByCellId = Maps.newTreeMap(); - - List<Result> results = persistenceService.getResultsForMissionAndDatametadata(mission, dataMetadata); - - for (Result result : results) { - // create row - PopulationIndicatorExportRow row = new PopulationIndicatorExportRow(); - row.setMission(mission); - row.setIndicator(dataMetadata); - Species species = result.getCategory().getSpeciesCategory().getSpecies(); - row.setSpecies(species); - row.setStratum("Total"); //FIXME How to find this ? - row.setDate(new Date()); //FIXME How to find back date - row.setEstimation(Float.valueOf(result.getResultValue())); - row.setStandardDeviation(0); - if (standardDeviationDataMetadata != null) { - rowsByCellId.put(result.getCell().getTopiaId(), row); - } - } - - if (standardDeviationDataMetadata != null) { - - // find standard deviation values - - Map<String, Result> deviationResults = persistenceService.getResultForCellAndMetadata( - rowsByCellId.keySet(), standardDeviationDataMetadata); - - for (Map.Entry<String, Result> entry : deviationResults.entrySet()) { - String cellId = entry.getKey(); - Result deviationResult = entry.getValue(); - if (deviationResult != null) { - PopulationIndicatorExportRow row = rowsByCellId.get(cellId); - row.setStandardDeviation(Float.valueOf(deviationResult.getResultValue())); - } - } - } - rows.addAll(rows); - } - - //------------------------------------------------------------------------// - //--- Extract community indicators ---------------------------------------// - //------------------------------------------------------------------------// - protected void extractCommunityIndicators(ExportCoserConfiguration model, EchoBaseProject echoBaseProject, Mission mission) { @@ -276,15 +221,16 @@ if (log.isInfoEnabled()) { log.info("Generate " + exportFile); } - CommunityIndicatorExportModel exportModel = new CommunityIndicatorExportModel(getCsvSeparator()); + IndicatorExportModel exportModel = new IndicatorExportModel(getCsvSeparator()); - List<CommunityIndicatorExportRow> rows = Lists.newArrayList(); + List<IndicatorExportRow> rows = Lists.newArrayList(); Set<String> indicators = model.getCommunityIndicator(); for (String indicator : indicators) { - loadCommunityIndicatorValues(mission, indicator, rows); + loadIndicatorValues(mission, indicator, rows); + model.incrementsProgress(); } - Export<CommunityIndicatorExportRow> export = Export.newExport(exportModel, rows); + Export<IndicatorExportRow> export = Export.newExport(exportModel, rows); try { export.write(exportFile, Charsets.UTF_8); } catch (Exception e) { @@ -294,55 +240,61 @@ model.incrementsProgress(); } - protected void loadCommunityIndicatorValues(Mission mission, - String indicator, - List<CommunityIndicatorExportRow> rows) { + protected void loadIndicatorValues(Mission mission, + String indicator, + List<IndicatorExportRow> rows) { + DataMetadata dataMetadata = persistenceService.getDataMetadata(indicator); if (log.isInfoEnabled()) { - log.info("Extract community indicator: " + indicator); + log.info("Extract indicator: " + dataMetadata.getName()); } - DataMetadata dataMetadata = persistenceService.getDataMetadata(indicator); DataMetadata standardDeviationDataMetadata = persistenceService.tryToGetDataMetadataByName(dataMetadata.getName() + "_stdev"); - Map<String, CommunityIndicatorExportRow> rowsByCellId = Maps.newTreeMap(); + Map<Species, IndicatorExportRow> rowsBySpecies = Maps.newHashMap(); List<Result> results = persistenceService.getResultsForMissionAndDatametadata(mission, dataMetadata); for (Result result : results) { - // create row - CommunityIndicatorExportRow row = new CommunityIndicatorExportRow(); - row.setMission(mission); - row.setIndicator(dataMetadata); Species species = result.getCategory().getSpeciesCategory().getSpecies(); - row.setSpecies(species); - row.setStratum("Total"); //FIXME How to find this ? - row.setDate(new Date()); //FIXME How to find back date - row.setEstimation(Float.valueOf(result.getResultValue())); - row.setStandardDeviation(0); - if (standardDeviationDataMetadata != null) { - rowsByCellId.put(result.getCell().getTopiaId(), row); + IndicatorExportRow row = rowsBySpecies.get(species); + if (row == null) { + row = new IndicatorExportRow(); + rowsBySpecies.put(species, row); + row.setMission(mission); + row.setIndicator(dataMetadata); + row.setSpecies(species); + row.setStratum("Total"); + row.setDate(result.getCell().getVoyage().getEndDate()); + row.setStandardDeviation(0); } + Float resultValue = Float.valueOf(result.getResultValue()); + row.setEstimation(row.getEstimation() + resultValue); } if (standardDeviationDataMetadata != null) { // find standard deviation values - Map<String, Result> deviationResults = persistenceService.getResultForCellAndMetadata( - rowsByCellId.keySet(), standardDeviationDataMetadata); + List<Result> deviationResults = persistenceService.getResultsForMissionAndDatametadata( + mission, standardDeviationDataMetadata); - for (Map.Entry<String, Result> entry : deviationResults.entrySet()) { - String cellId = entry.getKey(); - Result deviationResult = entry.getValue(); - if (deviationResult != null) { - CommunityIndicatorExportRow row = rowsByCellId.get(cellId); - row.setStandardDeviation(Float.valueOf(deviationResult.getResultValue())); + for (Result result : deviationResults) { + Species species = result.getCategory().getSpeciesCategory().getSpecies(); + IndicatorExportRow row = rowsBySpecies.get(species); + if (row == null) { + log.warn(String.format("Could not find result for meta %s / species %s", + dataMetadata.getName(), + species.getBaracoudaCode())); + continue; } + Float resultValue = Float.valueOf(result.getResultValue()); + row.setStandardDeviation(row.getStandardDeviation() + resultValue); } } - rows.addAll(rows); + + rows.addAll(rowsBySpecies.values()); } //------------------------------------------------------------------------// Copied: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/IndicatorExportModel.java (from rev 1013, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportModel.java) =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/IndicatorExportModel.java (rev 0) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/IndicatorExportModel.java 2014-04-22 20:25:28 UTC (rev 1018) @@ -0,0 +1,47 @@ +package fr.ifremer.echobase.services.service.exportCoser; + +/* + * #%L + * EchoBase :: Services + * %% + * Copyright (C) 2011 - 2014 Ifremer, Codelutin, Chemit Tony + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.echobase.csv.EchoBaseCsvUtil; +import org.nuiton.csv.ext.AbstractExportModel; + +/** + * Created on 3/20/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 2.6 + */ +public class IndicatorExportModel extends AbstractExportModel<IndicatorExportRow> { + + public IndicatorExportModel(char separator) { + super(separator); + newColumnForExport("Campagne", EchoBaseCsvUtil.<IndicatorExportRow, String>newBeanProperty(IndicatorExportRow.PROPERTY_MISSION_NAME)); + newColumnForExport("Indicateur", EchoBaseCsvUtil.<IndicatorExportRow, String>newBeanProperty(IndicatorExportRow.PROPERTY_INDICATOR_NAME)); + newColumnForExport("Espece", IndicatorExportRow.PROPERTY_SPECIES, EchoBaseCsvUtil.SPECIES_TO_COSER_CODE); + newColumnForExport("Strate", IndicatorExportRow.PROPERTY_STRATUM); + newColumnForExport("Annee", IndicatorExportRow.PROPERTY_DATE, EchoBaseCsvUtil.YEAR); + newColumnForExport("Estimation", IndicatorExportRow.PROPERTY_ESTIMATION, EchoBaseCsvUtil.FLOAT); + newColumnForExport("EcartType", IndicatorExportRow.PROPERTY_STANDARD_DEVIATION, EchoBaseCsvUtil.FLOAT); + newColumnForExport("CV", IndicatorExportRow.PROPERTY_CV, EchoBaseCsvUtil.FLOAT); + } + +} \ No newline at end of file Copied: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/IndicatorExportRow.java (from rev 1013, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportRow.java) =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/IndicatorExportRow.java (rev 0) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/IndicatorExportRow.java 2014-04-22 20:25:28 UTC (rev 1018) @@ -0,0 +1,127 @@ +package fr.ifremer.echobase.services.service.exportCoser; + +/* + * #%L + * EchoBase :: Services + * %% + * Copyright (C) 2011 - 2014 Ifremer, Codelutin, Chemit Tony + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.echobase.entities.references.DataMetadata; +import fr.ifremer.echobase.entities.references.Mission; +import fr.ifremer.echobase.entities.references.Species; + +import java.util.Date; + +/** + * Created on 3/20/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 2.6 + */ +public class IndicatorExportRow { + + public static final String PROPERTY_MISSION_NAME = "mission." + Mission.PROPERTY_NAME; + + public static final String PROPERTY_INDICATOR_NAME = "indicator." + DataMetadata.PROPERTY_NAME; + + public static final String PROPERTY_SPECIES = "species"; + + public static final String PROPERTY_STRATUM = "stratum"; + + public static final String PROPERTY_DATE = "date"; + + public static final String PROPERTY_ESTIMATION = "estimation"; + + public static final String PROPERTY_STANDARD_DEVIATION = "standardDeviation"; + + public static final String PROPERTY_CV = "cv"; + + protected Mission mission; + + protected DataMetadata indicator; + + protected Species species; + + protected String stratum; + + protected Date date; + + protected float estimation; + + protected float standardDeviation; + + public Mission getMission() { + return mission; + } + + public DataMetadata getIndicator() { + return indicator; + } + + public Species getSpecies() { + return species; + } + + public String getStratum() { + return stratum; + } + + public Date getDate() { + return date; + } + + public float getEstimation() { + return estimation; + } + + public float getStandardDeviation() { + return standardDeviation; + } + + public float getCv() { + return standardDeviation / estimation; + } + + public void setMission(Mission mission) { + this.mission = mission; + } + + public void setIndicator(DataMetadata indicator) { + this.indicator = indicator; + } + + public void setSpecies(Species species) { + this.species = species; + } + + public void setStratum(String stratum) { + this.stratum = stratum; + } + + public void setDate(Date date) { + this.date = date; + } + + public void setEstimation(float estimation) { + this.estimation = estimation; + } + + public void setStandardDeviation(float standardDeviation) { + this.standardDeviation = standardDeviation; + } +} Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportModel.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportModel.java 2014-04-22 15:47:09 UTC (rev 1017) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportModel.java 2014-04-22 20:25:28 UTC (rev 1018) @@ -1,47 +0,0 @@ -package fr.ifremer.echobase.services.service.exportCoser; - -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2014 Ifremer, Codelutin, Chemit Tony - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import fr.ifremer.echobase.csv.EchoBaseCsvUtil; -import org.nuiton.csv.ext.AbstractExportModel; - -/** - * Created on 3/20/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 2.6 - */ -public class PopulationIndicatorExportModel extends AbstractExportModel<PopulationIndicatorExportRow> { - - public PopulationIndicatorExportModel(char separator) { - super(separator); - newColumnForExport("Campagne", EchoBaseCsvUtil.<PopulationIndicatorExportRow, String>newBeanProperty(PopulationIndicatorExportRow.PROPERTY_MISSION_NAME)); - newColumnForExport("Indicateur", EchoBaseCsvUtil.<PopulationIndicatorExportRow, String>newBeanProperty(PopulationIndicatorExportRow.PROPERTY_INDICATOR_NAME)); - newColumnForExport("Espece", PopulationIndicatorExportRow.PROPERTY_SPECIES, EchoBaseCsvUtil.SPECIES_TO_COSER_CODE); - newColumnForExport("Strate", PopulationIndicatorExportRow.PROPERTY_STRATUM); - newColumnForExport("Annee", PopulationIndicatorExportRow.PROPERTY_DATE, EchoBaseCsvUtil.YEAR); - newColumnForExport("Estimation", PopulationIndicatorExportRow.PROPERTY_ESTIMATION); - newColumnForExport("EcartType", PopulationIndicatorExportRow.PROPERTY_STANDARD_DEVIATION); - newColumnForExport("CV", PopulationIndicatorExportRow.PROPERTY_CV); - } - -} \ No newline at end of file Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportRow.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportRow.java 2014-04-22 15:47:09 UTC (rev 1017) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportCoser/PopulationIndicatorExportRow.java 2014-04-22 20:25:28 UTC (rev 1018) @@ -1,127 +0,0 @@ -package fr.ifremer.echobase.services.service.exportCoser; - -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2014 Ifremer, Codelutin, Chemit Tony - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import fr.ifremer.echobase.entities.references.DataMetadata; -import fr.ifremer.echobase.entities.references.Mission; -import fr.ifremer.echobase.entities.references.Species; - -import java.util.Date; - -/** - * Created on 3/20/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 2.6 - */ -public class PopulationIndicatorExportRow { - - public static final String PROPERTY_MISSION_NAME = "mission." + Mission.PROPERTY_NAME; - - public static final String PROPERTY_INDICATOR_NAME = "indicator." + DataMetadata.PROPERTY_NAME; - - public static final String PROPERTY_SPECIES = "species"; - - public static final String PROPERTY_STRATUM = "stratum"; - - public static final String PROPERTY_DATE = "date"; - - public static final String PROPERTY_ESTIMATION = "estimation"; - - public static final String PROPERTY_STANDARD_DEVIATION = "standardDeviation"; - - public static final String PROPERTY_CV = "cv"; - - protected Mission mission; - - protected DataMetadata indicator; - - protected Species species; - - protected String stratum; - - protected Date date; - - protected float estimation; - - protected float standardDeviation; - - public Mission getMission() { - return mission; - } - - public DataMetadata getIndicator() { - return indicator; - } - - public Species getSpecies() { - return species; - } - - public String getStratum() { - return stratum; - } - - public Date getDate() { - return date; - } - - public float getEstimation() { - return estimation; - } - - public float getStandardDeviation() { - return standardDeviation; - } - - public float getCv() { - return standardDeviation / estimation; - } - - public void setMission(Mission mission) { - this.mission = mission; - } - - public void setIndicator(DataMetadata indicator) { - this.indicator = indicator; - } - - public void setSpecies(Species species) { - this.species = species; - } - - public void setStratum(String stratum) { - this.stratum = stratum; - } - - public void setDate(Date date) { - this.date = date; - } - - public void setEstimation(float estimation) { - this.estimation = estimation; - } - - public void setStandardDeviation(float standardDeviation) { - this.standardDeviation = standardDeviation; - } -}
participants (1)
-
tchemit@users.forge.codelutin.com