[Suiviobsmer-commits] r1341 - in trunk: wao-business/src/main/java/fr/ifremer/wao/io/csv2/models wao-business/src/main/java/fr/ifremer/wao/service wao-business/src/main/resources/i18n wao-business/src/main/xmi wao-business/src/test/java/fr/ifremer/wao/business wao-business/src/test/java/fr/ifremer/wao/business/fixtures wao-business/src/test/resources/import wao-ui/src/main/java/fr/ifremer/wao/ui/pages wao-ui/src/main/resources/i18n wao-ui/src/main/webapp
Author: bleny Date: 2011-06-16 13:30:19 +0000 (Thu, 16 Jun 2011) New Revision: 1341 Log: split importing of boat groups and importing of boats Added: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatGroupImportModel.java trunk/wao-business/src/test/resources/import/strates.csv Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatImportExportModel.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceBoatImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceReferentialImpl.java trunk/wao-business/src/main/resources/i18n/wao-business_en_GB.properties trunk/wao-business/src/main/resources/i18n/wao-business_fr_FR.properties trunk/wao-business/src/main/xmi/wao.zargo trunk/wao-business/src/test/java/fr/ifremer/wao/business/ObsDebPhoneTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/business/fixtures/ObsDebFixtures.java trunk/wao-business/src/test/resources/import/navires.csv trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java trunk/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties trunk/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties trunk/wao-ui/src/main/webapp/Administration.tml Added: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatGroupImportModel.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatGroupImportModel.java (rev 0) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatGroupImportModel.java 2011-06-16 13:30:19 UTC (rev 1341) @@ -0,0 +1,145 @@ +package fr.ifremer.wao.io.csv2.models; + +import fr.ifremer.wao.entity.Boat; +import fr.ifremer.wao.entity.BoatGroupImpl; +import fr.ifremer.wao.entity.BoatImpl; +import fr.ifremer.wao.io.csv2.ExportableColumn; +import fr.ifremer.wao.io.csv2.ImportModel; +import fr.ifremer.wao.io.csv2.ImportableColumn; +import fr.ifremer.wao.io.csv2.ModelBuilder; +import fr.ifremer.wao.io.csv2.ValueGetterSetter; +import fr.ifremer.wao.io.csv2.models.operations.BoatImmatriculationParserFormatter; +import org.apache.commons.lang.StringUtils; + +import java.util.Collection; +import java.util.List; + +public class BoatGroupImportModel implements ImportModel<Boat> { + + protected ModelBuilder<Boat> modelBuilder; + + protected void buildModel() { + modelBuilder = new ModelBuilder<Boat>(); + modelBuilder.newColumnForImportExport( + "NAVIRE_IMMATRICULATION", + Boat.PROPERTY_IMMATRICULATION, + new BoatImmatriculationParserFormatter()); + + // boat group + modelBuilder.newColumnForImportExport( + "STRATE_CODE", + new ValueGetterSetter<Boat, String>() { + @Override + public String get(Boat boat) throws Exception { + String boatGroupCode = ""; + if (boat.getBoatGroup() != null) { + boatGroupCode = boat.getBoatGroup().getCode(); + } + return boatGroupCode; + } + + @Override + public void set(Boat boat, String code) throws Exception { + if (StringUtils.isNotBlank(code)) { + boat.getBoatGroup().setCode(code); + } + } + }); + + modelBuilder.newColumnForImportExport( + "STRATE_CLASSE_LONGUEUR", + new ValueGetterSetter<Boat, String>() { + @Override + public String get(Boat boat) throws Exception { + String value = ""; + if (boat.getBoatGroup() != null) { + value = boat.getBoatGroup().getLengthGroup(); + } + return value; + } + + @Override + public void set(Boat boat, String value) throws Exception { + boat.getBoatGroup().setLengthGroup(value); + } + }); + modelBuilder.newColumnForImportExport( + "STRATE_CLASSE_EFFECTIF", + new ValueGetterSetter<Boat, String>() { + @Override + public String get(Boat boat) throws Exception { + String value = ""; + if (boat.getBoatGroup() != null) { + value = boat.getBoatGroup().getStaffSizeGroup(); + } + return value; + } + + @Override + public void set(Boat boat, String value) throws Exception { + boat.getBoatGroup().setStaffSizeGroup(value); + } + }); + modelBuilder.newColumnForImportExport( + "STRATE_COMMUNE", + new ValueGetterSetter<Boat, String>() { + @Override + public String get(Boat boat) throws Exception { + String value = ""; + if (boat.getBoatGroup() != null) { + value = boat.getBoatGroup().getCommune(); + } + return value; + } + + @Override + public void set(Boat boat, String value) throws Exception { + boat.getBoatGroup().setCommune(value); + } + }); + modelBuilder.newColumnForImportExport( + "STRATE_SECTEUR_GEOGRAPHIQUE", + new ValueGetterSetter<Boat, String>() { + @Override + public String get(Boat boat) throws Exception { + String value = ""; + if (boat.getBoatGroup() != null) { + value = boat.getBoatGroup().getSector(); + } + return value; + } + + @Override + public void set(Boat boat, String value) throws Exception { + boat.getBoatGroup().setSector(value); + } + }); + + } + + @Override + public char getSeparator() { + return ';'; + } + + @Override + public void pushCsvHeaderNames(List<String> headerNames) { + // nothing to do + } + + @Override + public Boat newEmptyInstance() { + Boat emptyInstance = new BoatImpl(); + emptyInstance.setBoatGroup(new BoatGroupImpl()); + return emptyInstance; + } + + @Override + public Collection<ImportableColumn> getColumnsForImport() { + if (modelBuilder == null) { + buildModel(); + } + return modelBuilder.getColumnsForImport(); + } + +} Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatImportExportModel.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatImportExportModel.java 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatImportExportModel.java 2011-06-16 13:30:19 UTC (rev 1341) @@ -198,96 +198,6 @@ } }); - // boat group - modelBuilder.newColumnForImportExport( - "STRATE_CODE", - new ValueGetterSetter<Boat, String>() { - @Override - public String get(Boat boat) throws Exception { - String boatGroupCode = ""; - if (boat.getBoatGroup() != null) { - boatGroupCode = boat.getBoatGroup().getCode(); - } - return boatGroupCode; - } - - @Override - public void set(Boat boat, String code) throws Exception { - if (StringUtils.isNotBlank(code)) { - boat.getBoatGroup().setCode(code); - } - } - }); - - modelBuilder.newColumnForImportExport( - "STRATE_CLASSE_LONGUEUR", - new ValueGetterSetter<Boat, String>() { - @Override - public String get(Boat boat) throws Exception { - String value = ""; - if (boat.getBoatGroup() != null) { - value = boat.getBoatGroup().getLengthGroup(); - } - return value; - } - - @Override - public void set(Boat boat, String value) throws Exception { - boat.getBoatGroup().setLengthGroup(value); - } - }); - modelBuilder.newColumnForImportExport( - "STRATE_CLASSE_EFFECTIF", - new ValueGetterSetter<Boat, String>() { - @Override - public String get(Boat boat) throws Exception { - String value = ""; - if (boat.getBoatGroup() != null) { - value = boat.getBoatGroup().getStaffSizeGroup(); - } - return value; - } - - @Override - public void set(Boat boat, String value) throws Exception { - boat.getBoatGroup().setStaffSizeGroup(value); - } - }); - modelBuilder.newColumnForImportExport( - "STRATE_COMMUNE", - new ValueGetterSetter<Boat, String>() { - @Override - public String get(Boat boat) throws Exception { - String value = ""; - if (boat.getBoatGroup() != null) { - value = boat.getBoatGroup().getCommune(); - } - return value; - } - - @Override - public void set(Boat boat, String value) throws Exception { - boat.getBoatGroup().setCommune(value); - } - }); - modelBuilder.newColumnForImportExport( - "STRATE_SECTEUR_GEOGRAPHIQUE", - new ValueGetterSetter<Boat, String>() { - @Override - public String get(Boat boat) throws Exception { - String value = ""; - if (boat.getBoatGroup() != null) { - value = boat.getBoatGroup().getSector(); - } - return value; - } - - @Override - public void set(Boat boat, String value) throws Exception { - boat.getBoatGroup().setSector(value); - } - }); - } @Override @@ -305,7 +215,6 @@ Boat emptyInstance = new BoatImpl(); emptyInstance.setShipOwner(new ShipOwnerImpl()); emptyInstance.setBoatDistrict(new BoatDistrictImpl()); - emptyInstance.setBoatGroup(new BoatGroupImpl()); emptyInstance.setFleet(new FleetImpl()); return emptyInstance; } Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceBoatImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceBoatImpl.java 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceBoatImpl.java 2011-06-16 13:30:19 UTC (rev 1341) @@ -72,7 +72,7 @@ import fr.ifremer.wao.io.ImportResultsImpl; import fr.ifremer.wao.io.csv2.Export; import fr.ifremer.wao.io.csv2.Import; -import fr.ifremer.wao.io.csv2.models.BoatImportExportModel; +import fr.ifremer.wao.io.csv2.models.BoatGroupImportModel;import fr.ifremer.wao.io.csv2.models.BoatImportExportModel; import org.apache.commons.lang.StringUtils; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; @@ -435,7 +435,6 @@ BoatDAO boatDAO = WaoDAOHelper.getBoatDAO(transaction); ShipOwnerDAO shipOwnerDAO = WaoDAOHelper.getShipOwnerDAO(transaction); BoatDistrictDAO boatDistrictDAO = WaoDAOHelper.getBoatDistrictDAO(transaction); - BoatGroupDAO boatGroupDAO = WaoDAOHelper.getBoatGroupDAO(transaction); FleetDAO fleetDAO = WaoDAOHelper.getFleetDAO(transaction); // load data that will be linked to the boat @@ -451,10 +450,6 @@ WaoUtils.projectPropertyUnique( fleetDAO.findAll(), Fleet.PROPERTY_CODE); - Map<String, BoatGroup> boatGroups = - WaoUtils.projectPropertyUnique( - boatGroupDAO.findAll(), - BoatGroup.PROPERTY_CODE); // init the counts to be returned ImportResults importResults = new ImportResultsImpl(); @@ -499,19 +494,6 @@ boat.setFleet(fleet); } - // fourth, the group - String boatGroupCode = boat.getBoatGroup().getCode(); - if (boatGroupCode == null) { - boat.setBoatGroup(null); - } else { - BoatGroup boatGroup = boatGroups.get(boatGroupCode); - if (boatGroup == null) { - boatGroup = boatGroupDAO.create(boat.getBoatGroup()); - boatGroups.put(boatGroupCode, boatGroup); - } - boat.setBoatGroup(boatGroup); - } - // now boat object is ready Boat existingBoat = boatDAO.findByImmatriculation(boat.getImmatriculation()); if (existingBoat == null) { @@ -526,7 +508,6 @@ existingBoat.setShipOwner(boat.getShipOwner()); existingBoat.setBoatDistrict(boat.getBoatDistrict()); existingBoat.setPortOfRegistry(boat.getPortOfRegistry()); - existingBoat.setBoatGroup(boat.getBoatGroup()); existingBoat.setFleet(boat.getFleet()); boatDAO.update(existingBoat); } @@ -565,6 +546,59 @@ } @Override + protected ImportResults executeImportBoatGroups(TopiaContext transaction, InputStream input) throws Exception { + // Building the model, providing ports + BoatGroupImportModel model = new BoatGroupImportModel(); + Import<Boat> boatImport = new Import<Boat>(model, input); + + // Getting some DAOs + BoatDAO boatDAO = WaoDAOHelper.getBoatDAO(transaction); + BoatGroupDAO boatGroupDAO = WaoDAOHelper.getBoatGroupDAO(transaction); + + Map<String, BoatGroup> boatGroups = + WaoUtils.projectPropertyUnique( + boatGroupDAO.findAll(), + BoatGroup.PROPERTY_CODE); + + // init the counts to be returned + ImportResults importResults = new ImportResultsImpl(); + + // now iterating over the lines of the CSV + Iterator<Boat> it = boatImport.startImport(); + while (it.hasNext()) { + Boat boat = it.next(); + + // fourth, the group + String boatGroupCode = boat.getBoatGroup().getCode(); + if (boatGroupCode == null) { + boat.setBoatGroup(null); + } else { + BoatGroup boatGroup = boatGroups.get(boatGroupCode); + if (boatGroup == null) { + boatGroup = boatGroupDAO.create(boat.getBoatGroup()); + boatGroups.put(boatGroupCode, boatGroup); + } + boat.setBoatGroup(boatGroup); + } + + // now boat object is ready + Boat existingBoat = boatDAO.findByImmatriculation(boat.getImmatriculation()); + if (existingBoat == null) { + throw new IllegalArgumentException(WaoUtils._("wao.import.contact.failure.wrongBoat", String.valueOf(boat.getImmatriculation()))); + } else { + // copy new values in found entity and save changes + existingBoat.setBoatGroup(boat.getBoatGroup()); + boatDAO.update(existingBoat); + } + + importResults.incNbImported(); + } + + transaction.commitTransaction(); + return importResults; + } + + @Override public void executeImportActivityCalendarCsv(InputStream input) throws IOException { if (!context.isActivityCalendarImportRun()) { Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceReferentialImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceReferentialImpl.java 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceReferentialImpl.java 2011-06-16 13:30:19 UTC (rev 1341) @@ -241,7 +241,7 @@ * @param input a CVS file with terrestrial locations */ @Override - protected void executeImportTerrestrialLocations(TopiaContext transaction, InputStream input) throws Exception { + protected ImportResults executeImportTerrestrialLocations(TopiaContext transaction, InputStream input) throws Exception { TerrestrialLocationDAO dao = WaoDAOHelper.getTerrestrialLocationDAO(transaction); @@ -387,6 +387,11 @@ } transaction.commitTransaction(); + + ImportResults importResults = new ImportResultsImpl(); + importResults.setNbRowsImported(locationAdded + locationUpdated); + importResults.setNbRowsImportedNew(locationAdded); + return importResults; } @Override @@ -502,7 +507,7 @@ } @Override - protected void executeImportTerrestrialDivisions(TopiaContext transaction, InputStream input) throws Exception { + protected ImportResults executeImportTerrestrialDivisions(TopiaContext transaction, InputStream input) throws Exception { TerrestrialLocationDAOImpl terrestrialLocationDAO = WaoDAOHelper.getTerrestrialLocationDAO(transaction); @@ -516,6 +521,8 @@ log.debug(ports.size() + " ports, " + regions.size() + " regions"); } + ImportResults importResults = new ImportResultsImpl(); + // the import itself ImportModel<TerrestrialDivision> importModel = new TerrestrialDivisionImportModel(ports, regions); Import<TerrestrialDivision> terrestrialDivisionImport = new Import<TerrestrialDivision>(importModel, input); @@ -532,12 +539,14 @@ if (existingTerrestrialDivision == null) { // add as new dao.create(terrestrialDivision); + importResults.incNbImportedNew(); } else { // update the old one terrestrialDivisionBinder.copyExcluding(terrestrialDivision, existingTerrestrialDivision, TopiaEntity.TOPIA_ID, TopiaEntity.TOPIA_CREATE_DATE, TopiaEntity.TOPIA_VERSION); dao.update(existingTerrestrialDivision); } + importResults.incNbImported(); TerrestrialDivision observationUnit = new TerrestrialDivisionImpl(); terrestrialDivisionBinder.copyExcluding( @@ -573,6 +582,7 @@ log.debug(dao.count() + " terrestrial divisions in database"); } + return importResults; } @Override Modified: trunk/wao-business/src/main/resources/i18n/wao-business_en_GB.properties =================================================================== --- trunk/wao-business/src/main/resources/i18n/wao-business_en_GB.properties 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-business/src/main/resources/i18n/wao-business_en_GB.properties 2011-06-16 13:30:19 UTC (rev 1341) @@ -165,6 +165,7 @@ wao.error.serviceBoat.getShipOwnerNamesContains= wao.error.serviceBoat.importActivityCalendarCsv= wao.error.serviceBoat.importBoatCsv= +wao.error.serviceBoat.importBoatGroups= wao.error.serviceBoat.newBoatFilter= wao.error.serviceCartography.exportContactMotifsStatisticsKml= wao.error.serviceCartography.exportContactStatisticsKml= Modified: trunk/wao-business/src/main/resources/i18n/wao-business_fr_FR.properties =================================================================== --- trunk/wao-business/src/main/resources/i18n/wao-business_fr_FR.properties 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-business/src/main/resources/i18n/wao-business_fr_FR.properties 2011-06-16 13:30:19 UTC (rev 1341) @@ -165,6 +165,7 @@ wao.error.serviceBoat.getShipOwnerNamesContains= wao.error.serviceBoat.importActivityCalendarCsv=Problème d'import du fichier CSV des calendriers d'activité wao.error.serviceBoat.importBoatCsv=Problème d'import du fichier CSV. Vérifiez l'en-tête du fichier. +wao.error.serviceBoat.importBoatGroups= wao.error.serviceBoat.newBoatFilter= wao.error.serviceCartography.exportContactMotifsStatisticsKml= wao.error.serviceCartography.exportContactStatisticsKml= Modified: trunk/wao-business/src/main/xmi/wao.zargo =================================================================== (Binary files differ) Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/business/ObsDebPhoneTest.java =================================================================== --- trunk/wao-business/src/test/java/fr/ifremer/wao/business/ObsDebPhoneTest.java 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-business/src/test/java/fr/ifremer/wao/business/ObsDebPhoneTest.java 2011-06-16 13:30:19 UTC (rev 1341) @@ -34,15 +34,35 @@ protected ObsDebFixtures fixtures = new ObsDebFixtures(manager); @Test - public void adminCanImportPhoneSamplingPlan() throws WaoBusinessException { + public void adminCanImportBoatGroups() throws WaoBusinessException { manager.setCurrentDate(2, 1, 2010); + fixtures.boats(); + + InputStream input = null; + try { + input = getClass().getResourceAsStream("/import/strates.csv"); + ImportResults importResults = serviceBoat.importBoatGroups(input); + Assert.assertEquals(6, importResults.getNbRowsImported()); + Assert.assertEquals(0, importResults.getNbRowsRefused()); + Assert.assertNotNull(serviceBoat.getBoat(fixtures.samourai().getImmatriculation()).getBoatGroup()); + Assert.assertNull(serviceBoat.getBoat(fixtures.bisounours().getImmatriculation()).getBoatGroup()); + } finally { + IOUtils.closeQuietly(input); + } + + } + + @Test + public void adminCanImportPhoneSamplingPlan() throws WaoBusinessException { + fixtures.ifremer(); fixtures.codeLutin(); - fixtures.boats(); manager.setCurrentDate(3, 1, 2010); + adminCanImportBoatGroups(); + InputStream input = IOUtils.toInputStream(PHONE_SAMPLING_PLAN_CSV); ImportResults importResults = serviceSampling.importSamplingPlanCsv(input, fixtures.joshAsAdministrator()); Assert.assertEquals(1, importResults.getNbRowsImported()); Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/business/fixtures/ObsDebFixtures.java =================================================================== --- trunk/wao-business/src/test/java/fr/ifremer/wao/business/fixtures/ObsDebFixtures.java 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-business/src/test/java/fr/ifremer/wao/business/fixtures/ObsDebFixtures.java 2011-06-16 13:30:19 UTC (rev 1341) @@ -4,6 +4,7 @@ import fr.ifremer.wao.bean.ConnectedUser; import fr.ifremer.wao.bean.ObsProgram; import fr.ifremer.wao.bean.UserRole; +import fr.ifremer.wao.entity.Boat; import fr.ifremer.wao.entity.Company; import fr.ifremer.wao.entity.WaoUser; @@ -46,4 +47,8 @@ protected void importSamplingPlan() { throw new UnsupportedOperationException("not yet implemented"); } + + public Boat bisounours() { + return getBoat(978419); + } } Modified: trunk/wao-business/src/test/resources/import/navires.csv =================================================================== --- trunk/wao-business/src/test/resources/import/navires.csv 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-business/src/test/resources/import/navires.csv 2011-06-16 13:30:19 UTC (rev 1341) @@ -1,7 +1,7 @@ -"NAVIRE_IMMATRICULATION";"NAVIRE_NOM";"NAVIRE_LONGUEUR";"NAVIRE_ANNEE";"NAVIRE_EFFECTIF";"QUARTIER_CODE";"ARMATEUR_CODE";"ARMATEUR_NOM";"ARMATEUR_PRENOM";"NAVIRE_ACTIF";"PORT_CODE";"FLOTILLE_CODE";"FLOTILLE_NOM";"SOUS_FLOTILLE_NOM";"SOUS_SOUS_FLOTILLE_NOM";"STRATE_CODE";"STRATE_CLASSE_LONGUEUR";"STRATE_CLASSE_EFFECTIF";"STRATE_COMMUNE";"STRATE_SECTEUR_GEOGRAPHIQUE" -273129;"MOISE";7;1992;3;"UX";19771564;"BEURRE ";"JEAN CLAUDE";"Y";"MP3";"FLOTILLE0";"Les colons";"Les colons";"Les colons";"STRATE1";"<10 mètres";"< 5 marins";"Ici";"Les bermudes" -174258;"SAMOURAI KING";9;1982;3;"UN";19744130;"MARIE";"JEAN PHILIPPE";"Y";"MP6";"FLOTILLE1";"Ma première flotille";"Ma première flotille";"Ma première flotille";"STRATE1";"<10 mètres";"< 5 marins";"Ailleurs";"Les bermudes" -177474;"MAYFLOWERS";10;1983;3;"UN";19784252;"MOSELLE";"ALAIN RENE";"N";"XSN";"FLOTILLE0";"Les colons";"Les colons";"Les colons";"STRATE0";">= 10 mètres";"< 5 marins";"Autre-part";"Les bermudes" -174592;"FIFITOU";8;1975;7;"UN";18854131;"POUTRE";"JEAN PIERRE";"Y";"XSN";"FLOTILLE1";"Ma première flotille";"Ma première flotille";"Ma première flotille";"STRATE1";"<10 mètres";">= 5 marins";"Loin";"Les bermudes" -284595;"A MA LOUTRE";8;1973;9;"UN";"SPR3965";"BECANAUD";"NA";"Y";"LP3";"FLOTILLE1";"Ma première flotille";"Ma première flotille";"Ma première flotille";"STRATE2";"<10 mètres";">= 5 marins";"Pas si loin";"Les bermudes" -978419;"BISOUNOURS";11;2002;8;"CI";18854131;"POUTRE ";"JEAN PIERRE";"Y";"MP6";;;;;;;;; +"NAVIRE_IMMATRICULATION";"NAVIRE_NOM";"NAVIRE_LONGUEUR";"NAVIRE_ANNEE";"NAVIRE_EFFECTIF";"QUARTIER_CODE";"ARMATEUR_CODE";"ARMATEUR_NOM";"ARMATEUR_PRENOM";"NAVIRE_ACTIF";"PORT_CODE";"FLOTILLE_CODE";"FLOTILLE_NOM";"SOUS_FLOTILLE_NOM";"SOUS_SOUS_FLOTILLE_NOM" +273129;"MOISE";7;1992;3;"UX";19771564;"BEURRE ";"JEAN CLAUDE";"Y";"MP3";"FLOTILLE0";"Les colons";"Les colons";"Les colons" +174258;"SAMOURAI KING";9;1982;3;"UN";19744130;"MARIE";"JEAN PHILIPPE";"Y";"MP6";"FLOTILLE1";"Ma première flotille";"Ma première flotille";"Ma première flotille" +177474;"MAYFLOWERS";10;1983;3;"UN";19784252;"MOSELLE";"ALAIN RENE";"N";"XSN";"FLOTILLE0";"Les colons";"Les colons";"Les colons" +174592;"FIFITOU";8;1975;7;"UN";18854131;"POUTRE";"JEAN PIERRE";"Y";"XSN";"FLOTILLE1";"Ma première flotille";"Ma première flotille";"Ma première flotille" +284595;"A MA LOUTRE";8;1973;9;"UN";"SPR3965";"BECANAUD";"NA";"Y";"LP3";"FLOTILLE1";"Ma première flotille";"Ma première flotille";"Ma première flotille" +978419;"BISOUNOURS";11;2002;8;"CI";18854131;"POUTRE ";"JEAN PIERRE";"Y";"MP6";;;; Added: trunk/wao-business/src/test/resources/import/strates.csv =================================================================== --- trunk/wao-business/src/test/resources/import/strates.csv (rev 0) +++ trunk/wao-business/src/test/resources/import/strates.csv 2011-06-16 13:30:19 UTC (rev 1341) @@ -0,0 +1,7 @@ +"NAVIRE_IMMATRICULATION";"STRATE_CODE";"STRATE_CLASSE_LONGUEUR";"STRATE_CLASSE_EFFECTIF";"STRATE_COMMUNE";"STRATE_SECTEUR_GEOGRAPHIQUE" +273129;"STRATE1";"<10 mètres";"< 5 marins";"Ici";"Les bermudes" +174258;"STRATE1";"<10 mètres";"< 5 marins";"Ailleurs";"Les bermudes" +177474;"STRATE0";">= 10 mètres";"< 5 marins";"Autre-part";"Les bermudes" +174592;"STRATE1";"<10 mètres";">= 5 marins";"Loin";"Les bermudes" +284595;"STRATE2";"<10 mètres";">= 5 marins";"Pas si loin";"Les bermudes" +978419;;;;; Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2011-06-16 13:30:19 UTC (rev 1341) @@ -248,8 +248,8 @@ @Override public ImportResults execute(InputStream input) throws WaoException, WaoBusinessException { - serviceReferential.importTerrestrialLocations(input); - return null; + ImportResults importResults = serviceReferential.importTerrestrialLocations(input); + return importResults; } }; } @@ -260,8 +260,8 @@ @Override public ImportResults execute(InputStream input) throws WaoException, WaoBusinessException { - serviceReferential.importTerrestrialDivisions(input); - return null; + ImportResults importResults = serviceReferential.importTerrestrialDivisions(input); + return importResults; } }; } @@ -286,6 +286,16 @@ }; } + public ImportEngine getBoatGroupsImportEngine() { + return new ImportEngine() { + @Override + public ImportResults execute(InputStream input) throws WaoException, WaoBusinessException { + ImportResults results = serviceBoat.importBoatGroups(input); + return results; + } + }; + } + public InputStream getActivityCalendarLogFile() { return getActivityCalendarLogFile(WaoProperty.FILENAME_LOG_ACTIVITY_IMPORT); } Modified: trunk/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties =================================================================== --- trunk/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties 2011-06-16 13:30:19 UTC (rev 1341) @@ -195,6 +195,7 @@ wao.ui.import.activityCalendarLabel=of the activity calendars wao.ui.import.activityCalendarUserAccessesLabel=of user accesses to the activity calendars wao.ui.import.boatDistrictLabel=of the coordinates of boat districts +wao.ui.import.boatGroupsLabel= wao.ui.import.boatsLabel=of boats wao.ui.import.contactStateMotivesLabel=of the contact state motives wao.ui.import.description=File %s %s \: Modified: trunk/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties =================================================================== --- trunk/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties 2011-06-16 13:30:19 UTC (rev 1341) @@ -194,6 +194,7 @@ wao.ui.import.activityCalendarLabel=des calendriers d'activité wao.ui.import.activityCalendarUserAccessesLabel=des accès utilisateurs aux calendriers d'activité wao.ui.import.boatDistrictLabel=des coordonnées des quartiers des navires +wao.ui.import.boatGroupsLabel= wao.ui.import.boatsLabel=des navires wao.ui.import.contactStateMotivesLabel=des motifs de refus wao.ui.import.description=Fichier %s %s \: Modified: trunk/wao-ui/src/main/webapp/Administration.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Administration.tml 2011-06-16 09:29:27 UTC (rev 1340) +++ trunk/wao-ui/src/main/webapp/Administration.tml 2011-06-16 13:30:19 UTC (rev 1341) @@ -186,6 +186,7 @@ <t:if test="currentUser.obsDeb"> <t:importFieldSet t:label="${message:wao.ui.import.terrestrialDivisionsLabel}" t:engine="terrestrialDivisionsImportEngine" /> <t:importFieldSet t:label="${message:wao.ui.import.obsDebCodesLabel}" t:engine="obsDebCodesImportEngine" /> + <t:importFieldSet t:label="${message:wao.ui.import.boatGroupsLabel}" t:engine="boatGroupsEngine" /> </t:if> </t:if>
participants (1)
-
bleny@users.labs.libre-entreprise.org