r172 - in trunk/echobase-entities/src/main: java/fr/ifremer/echobase resources/i18n xmi
Author: tchemit Date: 2011-12-13 14:25:38 +0100 (Tue, 13 Dec 2011) New Revision: 172 Url: http://forge.codelutin.com/repositories/revision/echobase/172 Log: fix property names move functions to this package Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java Modified: trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties trunk/echobase-entities/src/main/xmi/echobase.zargo Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java =================================================================== --- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java (rev 0) +++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java 2011-12-13 13:25:38 UTC (rev 172) @@ -0,0 +1,190 @@ +/* + * #%L + * EchoBase :: Entities + * + * $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; + +import com.google.common.base.Function; +import fr.ifremer.echobase.entities.data.DataProcessing; +import fr.ifremer.echobase.entities.data.Voyage; +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.DataQuality; +import fr.ifremer.echobase.entities.references.DataType; +import fr.ifremer.echobase.entities.references.DepthStratum; +import fr.ifremer.echobase.entities.references.EchotypeCategory; +import fr.ifremer.echobase.entities.references.Mission; +import fr.ifremer.echobase.entities.references.ReferenceDatum; +import fr.ifremer.echobase.entities.references.ReferenceDatumType; +import fr.ifremer.echobase.entities.references.Species; +import fr.ifremer.echobase.entities.references.Vessel; +import org.nuiton.topia.persistence.TopiaEntity; + +import java.io.File; +import java.util.Map; + +/** + * Define some usefull function used by application. + * + * @author tchemit <chemit@codelutin.com> + * @see Function + * @since 0.2 + */ +public class EchoBaseFunctions { + + public static final Function<Voyage, String> VOYAGE_NAME = new Function<Voyage, String>() { + @Override + public String apply(Voyage input) { + return input.getName().toLowerCase(); + } + }; + + public static final Function<Species, String> SPECIES_BARACOUDA_CODE = new Function<Species, String>() { + @Override + public String apply(Species input) { + return input.getBaracoudaCode(); + } + }; + + public static final Function<Vessel, String> VESSEL_NAME = new Function<Vessel, String>() { + @Override + public String apply(Vessel input) { + return input.getName().toLowerCase(); + } + }; + + public static final Function<AcousticInstrument, String> ACOUSTIC_INSTRUMENT_ID = new Function<AcousticInstrument, String>() { + @Override + public String apply(AcousticInstrument input) { + return input.getId().toLowerCase(); + } + }; + + public static final Function<DepthStratum, String> DEPTH_STRATUM_ID = new Function<DepthStratum, String>() { + @Override + public String apply(DepthStratum input) { + return input.getId(); + } + }; + + public static final Function<EchotypeCategory, String> ECHO_TYPE_CATEGORY_NAME = new Function<EchotypeCategory, String>() { + @Override + public String apply(EchotypeCategory input) { + return input.getName(); + } + }; + + public static final Function<ReferenceDatumType, String> REFERENCE_DATUM_TYPE_NAME = new Function<ReferenceDatumType, String>() { + @Override + public String apply(ReferenceDatumType input) { + return input.getName().toLowerCase(); + } + }; + + public static final Function<ReferenceDatum, String> REFERENCE_DATUM_ID = new Function<ReferenceDatum, String>() { + @Override + public String apply(ReferenceDatum input) { + return input.getId().toLowerCase(); + } + }; + + public static final Function<Mission, String> MISSION_NAME = new Function<Mission, String>() { + @Override + public String apply(Mission input) { + return input.getName().toLowerCase(); + } + }; + + public static final Function<AreaOfOperation, String> AREA_OF_OPERATION_NAME = new Function<AreaOfOperation, String>() { + @Override + public String apply(AreaOfOperation input) { + return input.getName().toLowerCase(); + } + }; + public static final Function<DataType, String> DATA_TYPE_NAME = new Function<DataType, String>() { + @Override + public String apply(DataType input) { + return input.getName().toLowerCase(); + } + }; + public static final Function<CellMethod, String> CELL_METHOD_NAME = new Function<CellMethod, String>() { + @Override + public String apply(CellMethod input) { + return input.getName().toLowerCase(); + } + }; + public static final Function<DataProcessing, String> DATA_PROCESSING_ID = new Function<DataProcessing, String>() { + @Override + public String apply(DataProcessing input) { + return input.getId().toLowerCase(); + } + }; + + public static final Function<DataQuality, Integer> DATA_QUALITY_ID = new Function<DataQuality, Integer>() { + @Override + public Integer apply(DataQuality input) { + return input.getQualityDataFlagValues(); + } + }; + public static final Function<TopiaEntity, String> TO_TOPIAID = new Function<TopiaEntity, String>() { + + @Override + public String apply(TopiaEntity input) { + 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 Function<Map<String, Object>, String> newRowFunction(final String key) { + + return new Function<Map<String, Object>, String>() { + + @Override + public String apply(Map<String, Object> input) { + String id = input.get(key).toString().toLowerCase(); + return id; + } + }; + } + + public static Function<Map<String, Object>, Integer> newRowIntegerFunction(final String key) { + + return new Function<Map<String, Object>, Integer>() { + + @Override + public Integer apply(Map<String, Object> input) { + Integer id = (Integer) input.get(key); + return id; + } + }; + } + + protected EchoBaseFunctions() { + // helper don't need to be instanciate + } +} Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.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 2011-12-12 13:22:57 UTC (rev 171) +++ trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties 2011-12-13 13:25:38 UTC (rev 172) @@ -16,7 +16,7 @@ echobase.common.axis= echobase.common.b= echobase.common.baracoudaCode= -echobase.common.bathymetre= +echobase.common.bathymetry= echobase.common.binSizePingAxis= echobase.common.binSizeRangeAxis= echobase.common.binUnitsPingAxis= @@ -43,7 +43,6 @@ echobase.common.dataCentreEmail=Courriel du centre de données echobase.common.dataClass= echobase.common.dataMetadata= -echobase.common.dataName= echobase.common.dataProcessing=dataProcessing echobase.common.dataProtocol= echobase.common.dataQuality=dataQuality @@ -57,7 +56,6 @@ echobase.common.description=Description echobase.common.digitThreshold= echobase.common.distributionStatement= -echobase.common.eIThreshold= echobase.common.echoBaseUser=Utilisateur echobase.common.echoBaseUserDTO= echobase.common.echosounderSoundSpeed= Modified: trunk/echobase-entities/src/main/xmi/echobase.zargo =================================================================== (Binary files differ)
participants (1)
-
tchemit@users.forge.codelutin.com