This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See http://git.codelutin.com/tutti.git commit f9c70c91635c4bac180c29bcf2a609719685ddc2 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Feb 3 19:13:05 2015 +0100 deplacement du code csv dabs un paquetage dédié + nettoyage code --- .../tutti/service/bigfin/BigfinDataRow.java | 145 --------------------- .../tutti/service/bigfin/BigfinDataRowModel.java | 138 -------------------- 2 files changed, 283 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/BigfinDataRow.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/BigfinDataRow.java deleted file mode 100644 index a6cfed0..0000000 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/BigfinDataRow.java +++ /dev/null @@ -1,145 +0,0 @@ -package fr.ifremer.tutti.service.bigfin; - -/* - * #%L - * Tutti :: Service - * $Id:$ - * $HeadURL:$ - * %% - * Copyright (C) 2012 - 2014 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.referential.Species; - -import java.io.Serializable; -import java.util.Date; - -/** - * @author Kevin Morin (Code Lutin) - * @since 3.8 - */ -public class BigfinDataRow implements Serializable { - - public static final String PROPERTY_RECORD_ID = "recordId"; - - public static final String PROPERTY_LENGTH = "length"; - - public static final String PROPERTY_WEIGHT = "weight"; - - public static final String PROPERTY_SPECIES = "species"; - - public static final String PROPERTY_STATION = "station"; - - public static final String PROPERTY_DT = "dt"; - - public static final String PROPERTY_SZ_CLASS = "szClass"; - - public static final String PROPERTY_GENDER = "gender"; - - public static final String PROPERTY_VRAC_HORS_VRAC = "vracHorsVrac"; - - protected String recordId; - - protected float length; - - protected Float weight; - - protected Species species; - - protected String station; - - protected Date dt; - - protected Signs szClass; - - protected Signs gender; - - protected Signs vracHorsVrac; - - public String getRecordId() { - return recordId; - } - - public void setRecordId(String recordId) { - this.recordId = recordId; - } - - public float getLength() { - return length; - } - - public void setLength(float length) { - this.length = length; - } - - public Float getWeight() { - return weight; - } - - public void setWeight(Float weight) { - this.weight = weight; - } - - public Species getSpecies() { - return species; - } - - public void setSpecies(Species species) { - this.species = species; - } - - public String getStation() { - return station; - } - - public void setStation(String station) { - this.station = station; - } - - public Date getDt() { - return dt; - } - - public void setDt(Date dt) { - this.dt = dt; - } - - public Signs getSzClass() { - return szClass; - } - - public void setSzClass(Signs szClass) { - this.szClass = szClass; - } - - public Signs getGender() { - return gender; - } - - public void setGender(Signs gender) { - this.gender = gender; - } - - public Signs getVracHorsVrac() { - return vracHorsVrac; - } - - public void setVracHorsVrac(Signs vracHorsVrac) { - this.vracHorsVrac = vracHorsVrac; - } -} diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/BigfinDataRowModel.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/BigfinDataRowModel.java deleted file mode 100644 index 4f2b8c1..0000000 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/BigfinDataRowModel.java +++ /dev/null @@ -1,138 +0,0 @@ -package fr.ifremer.tutti.service.bigfin; - -/* - * #%L - * Tutti :: Service - * $Id:$ - * $HeadURL:$ - * %% - * Copyright (C) 2012 - 2014 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.adagio.core.dao.referential.pmfm.PmfmId; -import fr.ifremer.tutti.persistence.entities.referential.Species; -import fr.ifremer.tutti.persistence.entities.referential.Speciess; -import fr.ifremer.tutti.service.TuttiCsvUtil; -import org.apache.commons.lang3.StringUtils; -import org.nuiton.csv.Common; -import org.nuiton.csv.ValueParser; - -import java.text.ParseException; -import java.util.HashMap; -import java.util.Map; - -/** - * @author Kevin Morin (Code Lutin) - * @since 3.8 - */ -public class BigfinDataRowModel extends TuttiCsvUtil.AbstractTuttiImportModel<BigfinDataRow> { - - public BigfinDataRowModel(char separator, - final Map<String, Species> speciesBySurveyCode) { - - super(separator); - - final Map<String, Species> foundSpecies = new HashMap<>(); - - newMandatoryColumn("Record_id", BigfinDataRow.PROPERTY_RECORD_ID); - newMandatoryColumn("length(mm)", BigfinDataRow.PROPERTY_LENGTH, Common.PRIMITIVE_FLOAT); - newMandatoryColumn("weight(g)", BigfinDataRow.PROPERTY_WEIGHT, Common.FLOAT); - -// code espèce = code campagne (saisie libre donc risque fort de mauvaise saisie) - newMandatoryColumn("species", BigfinDataRow.PROPERTY_SPECIES, new ValueParser<Object>() { - @Override - public Object parse(String value) throws ParseException { - Species result = null; - if (StringUtils.isNotBlank(value)) { - // if code already found - result = foundSpecies.get(value); - - //if not found, look for it in the survey codes - if (result == null) { - result = speciesBySurveyCode.get(value); - } - -// Si on ne trouve pas une espèce de code campagne XXXXXXX, on essaye alors avec le code XXXX-XXX - if (result == null) { - String alternativeSpeciesCode = value.substring(0, 4) + '-' + value.substring(4); - result = speciesBySurveyCode.get(alternativeSpeciesCode); - } - // record the code in the found codes - foundSpecies.put(value, result); - } - // if the species is not found, create a new one with the value in external code - if (result == null) { - result = Speciess.newSpecies(); - result.setExternalCode(value); - } - return result; - } - }); - -// n° de la station (non importé mais utile pour contrôle à l'import) - newMandatoryColumn("station", BigfinDataRow.PROPERTY_STATION); -// date et heure de l'enregistrement (non importé mais utile pour contrôle à l'import) - newMandatoryColumn("Dt", BigfinDataRow.PROPERTY_DT, new Common.DateValue("MM/dd/yy HH:mm")); - -// sz class : si code différents de 0 1 ou 2 alors tout bloquer et donner l'id des lignes en anomalies - newMandatoryColumn("sz class", - BigfinDataRow.PROPERTY_SZ_CLASS, - new ValueParser<Signs>() { - @Override - public Signs parse(String value) throws ParseException { - Signs result = Signs.getSign(value.toUpperCase(), PmfmId.SIZE_CATEGORY.getValue()); - return result; - } - }); - - newMandatoryColumn("gender", - BigfinDataRow.PROPERTY_GENDER, - new ValueParser<Signs>() { - @Override - public Signs parse(String value) throws ParseException { - Signs result = Signs.getSign(value.toUpperCase(), PmfmId.SEX.getValue()); - if (result == null) { - throw new ParseException("Could not parse Sign value: " + value, 0); - } - return result; - } - }); - - newMandatoryColumn("text", BigfinDataRow.PROPERTY_VRAC_HORS_VRAC, new ValueParser<Signs>() { - @Override - public Signs parse(String value) throws ParseException { -// On importe dans le Vrac par défaut, sauf si il y a le texte HV ou hv dans le champ text - Signs result = Signs.getSign(value.toUpperCase(), PmfmId.SORTED_UNSORTED.getValue()); - if (result == null) { - result = Signs.VRAC; - } - return result; - } - }); - - - newIgnoredColumn("cruise"); - newIgnoredColumn("pan"); - } - - @Override - public BigfinDataRow newEmptyInstance() { - return new BigfinDataRow(); - } - -} -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.