Author: tchemit Date: 2012-04-13 02:37:12 +0200 (Fri, 13 Apr 2012) New Revision: 533 Url: http://forge.codelutin.com/repositories/revision/echobase/533 Log: fixes #1104: ajout du DataProcessingID dans la tables Cell pour les donn?\195?\169es de 2010 Modified: trunk/echobase-tools/pom.xml trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/CellLoader.java trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/CellLoaderIT.java Modified: trunk/echobase-tools/pom.xml =================================================================== --- trunk/echobase-tools/pom.xml 2012-04-12 17:13:36 UTC (rev 532) +++ trunk/echobase-tools/pom.xml 2012-04-13 00:37:12 UTC (rev 533) @@ -211,14 +211,14 @@ <profile> <activation> <file> - <exists>src/test/private/echobase-2012-04-06</exists> + <exists>src/test/private/echobase-2012-04-12</exists> </file> </activation> <id>echobase-csv-inputs</id> <build> <testResources> <testResource> - <directory>src/test/private/echobase-2012-04-06</directory> + <directory>src/test/private/echobase-2012-04-12</directory> <includes> <include>**/*.csv</include> </includes> Modified: trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/CellLoader.java =================================================================== --- trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/CellLoader.java 2012-04-12 17:13:36 UTC (rev 532) +++ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/CellLoader.java 2012-04-13 00:37:12 UTC (rev 533) @@ -36,6 +36,8 @@ import fr.ifremer.echobase.entities.data.Cell; import fr.ifremer.echobase.entities.data.Data; import fr.ifremer.echobase.entities.data.DataProcessing; +import fr.ifremer.echobase.entities.data.Voyage; +import fr.ifremer.echobase.entities.data.VoyageDAO; import fr.ifremer.echobase.entities.meta.AssociationMeta; import fr.ifremer.echobase.entities.meta.TableMeta; import fr.ifremer.echobase.entities.references.CellMethod; @@ -132,6 +134,9 @@ exportAssociation(outputDir, targetType, getMeta().getAssociations(Cell.PROPERTY_DATA)); + + exportAssociation(outputDir, targetType, + getTable(EchoBaseEntityEnum.Voyage).getAssociations(Voyage.PROPERTY_POST_CELL)); } @Override @@ -141,7 +146,8 @@ AssociationMeta associationMeta; - TableMeta dataMeta = getTable(EchoBaseEntityEnum.Data); + TableMeta dataMeta; + dataMeta = getTable(EchoBaseEntityEnum.Data); copyAndLoadEntities(outputDir, dataMeta, false, FileType.BARACOUDA); // also export cells associations @@ -150,6 +156,11 @@ associationMeta = getMeta().getAssociations(Cell.PROPERTY_DATA); copyAndLoadEntities(outputDir, associationMeta, false, FileType.ASSOCIATION); + + dataMeta = getTable(EchoBaseEntityEnum.Voyage); + associationMeta = dataMeta.getAssociations(Voyage.PROPERTY_POST_CELL); + copyAndLoadEntities(outputDir, associationMeta, false, FileType.ASSOCIATION); + } Map<String, DataProcessing> dataProcessingsById; @@ -300,16 +311,20 @@ String longName = campagne + "_" + unitSource; if ("Sa".equals(unitSource)) { - longName ="Nautical area scattering coefficient"; + longName = "Nautical area scattering coefficient"; } else if ("m2.mV2".equals(unitSource)) { - longName ="Electrical energy received by the acoustic transceiver"; + longName = "Electrical energy received by the acoustic transceiver"; } DataMetadata acousticMetadata = dataMetadataDAO.findByLongName(longName); Preconditions.checkNotNull(acousticMetadata, "Could not find acoustic Metadata with name " + longName); dao = getDAO(); dataDao = getDAO(Data.class); + VoyageDAO voyageDao = (VoyageDAO) getDAO(Voyage.class); + Voyage voyage = voyageDao.findByName(campagne); + Preconditions.checkNotNull(voyage); + int nbRegionCells = 0; int nbEsduCells = 0; int nbElementaryCells = 0; @@ -337,13 +352,14 @@ Preconditions.checkNotNull(postStrateRow); - // there is a region for this data processing + // Create the regiosn and his data Cell regionCell = createRegionCell(dataProcessingId, postStrateRow, esduRows, acousticMetadata); - dataProcessing.addCell(regionCell); + // add postCell to voyage + voyage.addPostCell(regionCell); nbRegionCells += 1; nbRegionData += regionCell.sizeData(); @@ -363,10 +379,10 @@ esduRows, acousticMetadata ); - - dataProcessing.addAllCell(esduCells); } + dataProcessing.addAllCell(esduCells); + nbEsduCells += esduCells.size(); for (Cell esduCell : esduCells) { 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-04-12 17:13:36 UTC (rev 532) +++ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java 2012-04-13 00:37:12 UTC (rev 533) @@ -57,7 +57,7 @@ protected static final long timestamp = System.currentTimeMillis(); /** La version du jeux de données utilisé. */ - public static final String ECHOBASE_CSV_VERSION = "2012-04-06"; + public static final String ECHOBASE_CSV_VERSION = "2012-04-12"; public static File getBasedir() { if (basedir == null) { Modified: trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/CellLoaderIT.java =================================================================== --- trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/CellLoaderIT.java 2012-04-12 17:13:36 UTC (rev 532) +++ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/CellLoaderIT.java 2012-04-13 00:37:12 UTC (rev 533) @@ -31,6 +31,7 @@ import fr.ifremer.echobase.entities.EchoBaseEntityEnum; import fr.ifremer.echobase.entities.data.Cell; import fr.ifremer.echobase.entities.data.DataProcessing; +import fr.ifremer.echobase.entities.data.Voyage; import fr.ifremer.echobase.entities.meta.AssociationMeta; import fr.ifremer.echobase.entities.meta.MetaFilenameAware; import fr.ifremer.echobase.entities.meta.TableMeta; @@ -148,16 +149,19 @@ TableMeta cellMeta = lastLoader.getMeta(); TableMeta dataMeta = lastLoader.getTable(EchoBaseEntityEnum.Data); + TableMeta voyageMeta = lastLoader.getTable(EchoBaseEntityEnum.Voyage); TableMeta dataProcessingMeta = lastLoader.getTable(EchoBaseEntityEnum.DataProcessing); AssociationMeta dataProcessingToCellMetaAssociation = dataProcessingMeta.getAssociations(DataProcessing.PROPERTY_CELL); AssociationMeta cellToCellMetaAssociation = cellMeta.getAssociations(Cell.PROPERTY_CHILDS); AssociationMeta cellToDataMetaAssociation = cellMeta.getAssociations(Cell.PROPERTY_DATA); + AssociationMeta voyageToPostCellMetaAssociation = voyageMeta.getAssociations(Voyage.PROPERTY_POST_CELL); ToFileFromMeta toCellFile = new ToFileFromMeta(lastLoader, cellMeta); ToFileFromMeta toDataFile = new ToFileFromMeta(lastLoader, dataMeta); ToFileFromMeta toDataProcessingToCellFile = new ToFileFromMeta(lastLoader, dataProcessingToCellMetaAssociation); ToFileFromMeta toCellToCellFile = new ToFileFromMeta(lastLoader, cellToCellMetaAssociation); ToFileFromMeta toCellToDataFile = new ToFileFromMeta(lastLoader, cellToDataMetaAssociation); + ToFileFromMeta toPostCellFile = new ToFileFromMeta(lastLoader, voyageToPostCellMetaAssociation); if (log.isInfoEnabled()) { log.info("Will merge " + directoriesToMerge.size() + " data processing data into " + dir); @@ -168,6 +172,7 @@ mergeFile(dir, toDataProcessingToCellFile); mergeFile(dir, toCellToCellFile); mergeFile(dir, toCellToDataFile); + mergeFile(dir, toPostCellFile); } }