[Suiviobsmer-commits] r924 - in trunk/wao-business/src/main/java/fr/ifremer/wao: bean service
Author: bleny Date: 2011-01-18 18:10:05 +0000 (Tue, 18 Jan 2011) New Revision: 924 Log: cut sampling plan by terrestrial locations for ObsVente Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/FacadeRowImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/FacadeRowImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/FacadeRowImpl.java 2011-01-18 15:34:17 UTC (rev 923) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/FacadeRowImpl.java 2011-01-18 18:10:05 UTC (rev 924) @@ -50,8 +50,16 @@ @Override public void addRow(SampleRow row) { - String facade = row.getFacade(); - String sectors = row.getSectors(); + String facade = null; + String sectors = null; + if (row.getObsProgram() == ObsProgram.OBSMER) { + facade = row.getFacade(); + sectors = row.getSectors(); + } else if (row.getObsProgram() == ObsProgram.OBSVENTE) { + facade = row.getTerrestrialLocation().getCoastFAOName(); + sectors = row.getTerrestrialLocation().getCountryName(); + } + // Prepare sectors Map Map<String, List<SampleRow>> sectorMap = getData().get(facade); if (sectorMap == null) { Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2011-01-18 15:34:17 UTC (rev 923) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2011-01-18 18:10:05 UTC (rev 924) @@ -441,9 +441,6 @@ WaoQueryHelper.SampleRowProperty sampleRowProperty = builder.initializeForSampleRow(true); - WaoQueryHelper.FishingZoneProperty fishingZoneProperty = - builder.getFishingZoneProperty(); - // new WaoQueryBuilder(SampleRow.class); // // // Set fishingZoneProperty : we want to control this association @@ -454,8 +451,13 @@ // Add join for FishingZone TopiaQuery query = builder.applySamplingFilter(filter). - addDistinct(). - setSelect(sampleRowProperty.$alias(), + addDistinct(); + + if (filter.getObsProgram() == ObsProgram.OBSMER) { + WaoQueryHelper.FishingZoneProperty fishingZoneProperty = + builder.getFishingZoneProperty(); + + query.setSelect(sampleRowProperty.$alias(), fishingZoneProperty.facadeName(), fishingZoneProperty.sectorName(), fishingZoneProperty.districtCode()). @@ -466,7 +468,21 @@ fishingZoneProperty.sectorName(), fishingZoneProperty.districtCode(), sampleRowProperty.code()); + } else { + WaoQueryHelper.TerrestrialLocationProperty terrestrialLocationProperty = + WaoQueryHelper.newTerrestrialLocationProperty(); + query.setSelect(sampleRowProperty.$alias(), + terrestrialLocationProperty.coastFAOName(), + terrestrialLocationProperty.countryName()). + addLeftJoin(sampleRowProperty.terrestrialLocation(), terrestrialLocationProperty.$alias(), false). + addLeftJoin(sampleRowProperty.dCF5Code(), dcf5CodeProperty.$alias(), false). + // Order By facade, sector, districtCode, sampleRowCode + addOrder(terrestrialLocationProperty.coastFAOName(), + terrestrialLocationProperty.countryName(), + sampleRowProperty.code()); + } + if (log.isDebugEnabled()) { log.debug("Query : " + query); }
participants (1)
-
bleny@users.labs.libre-entreprise.org