[Suiviobsmer-commits] r942 - in trunk: wao-business/src/main/java/fr/ifremer/wao/entity wao-business/src/main/java/fr/ifremer/wao/service wao-business/src/main/xmi wao-ui/src/main/java/fr/ifremer/wao/ui/pages wao-ui/src/main/java/fr/ifremer/wao/ui/services wao-ui/src/main/resources/fr/ifremer/wao/ui/pages wao-ui/src/main/webapp
Author: bleny Date: 2011-01-25 14:37:48 +0000 (Tue, 25 Jan 2011) New Revision: 942 Log: add terrestrial location in SamplingPlan Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java trunk/wao-business/src/main/xmi/wao.zargo trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/ContactForm.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/ContactModelFactory.java trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/Contacts_fr.properties trunk/wao-ui/src/main/webapp/Contacts.tml trunk/wao-ui/src/main/webapp/SampleRowHistoric.tml trunk/wao-ui/src/main/webapp/SamplingPlan.tml Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java 2011-01-25 10:41:14 UTC (rev 941) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java 2011-01-25 14:37:48 UTC (rev 942) @@ -17,4 +17,34 @@ setLocationTypeOrdinal(locationType.ordinal()); } } + + public boolean isDistrict() { + boolean isDistrict = getLocationType() == null; + return isDistrict; + } + + /** Get a description of the location like « Maracaibo (Port, Venezuela) » + * + */ + public String getDescription() { + StringBuilder description = new StringBuilder(); + if (isDistrict()) { + description.append(getDistrictName()).append(" ("); + } else { + description.append(getName()).append(" (") + .append(getLocationType()).append(", "); + if ( ! getPortName().equals(getName())) { + description.append(getPortName()).append(", "); + } + } + + if (getRegionName() == null) { + description.append(getCountryName()); + } else { + description.append(getRegionName()); + } + + description.append(")"); + return description.toString(); + } } Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2011-01-25 10:41:14 UTC (rev 941) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2011-01-25 14:37:48 UTC (rev 942) @@ -190,6 +190,7 @@ for (Contact contact : results.values()) { contact.getMainObserver(); contact.sizeSecondaryObservers(); + contact.getTerrestrialLocation(); } return results; 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-25 10:41:14 UTC (rev 941) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2011-01-25 14:37:48 UTC (rev 942) @@ -263,6 +263,11 @@ if (oldRow.getAverageTideTime() != row.getAverageTideTime()) { rowLog.addChange("La durée moyenne d'une marée est passé de " + oldRow.getAverageTideTime() + " jours à " + row.getAverageTideTime()); } + + if (oldRow.getTerrestrialLocation() != row.getTerrestrialLocation()) { + rowLog.addChange("Le lieu est passé de " + oldRow.getTerrestrialLocation().getDescription() + " à " + + row.getTerrestrialLocation().getDescription()); + } } else { rowLog.addChange("Le nombre d'observateurs est " + row.getNbObservants()); rowLog.addChange("La durée moyenne d'une marée est " + row.getAverageTideTime()); Modified: trunk/wao-business/src/main/xmi/wao.zargo =================================================================== (Binary files differ) Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/ContactForm.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/ContactForm.java 2011-01-25 10:41:14 UTC (rev 941) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/ContactForm.java 2011-01-25 14:37:48 UTC (rev 942) @@ -317,7 +317,7 @@ serviceReferential.getAllTerrestrialLocations(new ContactFilterImpl(), contact.getSampleRow().getTerrestrialLocation().getDistrictCode()); terrestrialLocationSelectModel = new GenericSelectModel<TerrestrialLocation>(locations, TerrestrialLocation.class, - TerrestrialLocation.PROPERTY_NAME, TerrestrialLocation.TOPIA_ID, propertyAccess); + "description", TerrestrialLocation.TOPIA_ID, propertyAccess); } return terrestrialLocationSelectModel; } Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java 2011-01-25 10:41:14 UTC (rev 941) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java 2011-01-25 14:37:48 UTC (rev 942) @@ -570,13 +570,17 @@ } public int getNbColumnsForProfession() { - // code, program.name, fishingZone.districts, profession.code, profession.libelle + // Code ligne | Programme ou règlement rattachement | Zone + // | METIER Code | METIER Libellé int fixed = 5; if (fullView) { // company, program.periodBegin, program.periodEnd, fishingZonesInfos // profession.meshSize, profession.size, profession.other, profession.species fixed += 8; } + if (showObsVente()) { + fixed += 2; // add sampling strategy, terrestrial location + } return fixed; } @@ -586,9 +590,6 @@ public int getNbColumnsForOther() { int nbColumnsForOther = 4; - if (showObsVente()) { - nbColumnsForOther += 1; // add sampling strategy - } return nbColumnsForOther; } Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/ContactModelFactory.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/ContactModelFactory.java 2011-01-25 10:41:14 UTC (rev 941) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/ContactModelFactory.java 2011-01-25 14:37:48 UTC (rev 942) @@ -28,6 +28,7 @@ import fr.ifremer.wao.bean.UserRole; import fr.ifremer.wao.entity.Contact; import fr.ifremer.wao.entity.FishingZone; +import fr.ifremer.wao.entity.TerrestrialLocation; import fr.ifremer.wao.entity.WaoUser; import org.apache.tapestry5.ComponentResources; import org.apache.tapestry5.PropertyConduit; @@ -87,6 +88,7 @@ addNonSortableProperty("fishingZoneFacade", getFishingZoneFacadePropertyConduit()); addNonSortableProperty("fishingZoneSector", getFishingZoneSectorPropertyConduit()); addNonSortableProperty("fishingZoneDivision", getFishingZoneDivisionPropertyConduit()); + addNonSortableProperty(Contact.PROPERTY_TERRESTRIAL_LOCATION, getTerrestrialLocationPropertyConduit()); addNonSortableProperty(Contact.PROPERTY_BOAT, getBoatPropertyConduit()); addNonSortableProperty("boatImmatriculation", getBoatImmatriculationPropertyConduit()); addNonSortableProperty("boatDistrictCode", getBoatDistrictCodePropertyConduit()); @@ -112,10 +114,13 @@ if (obsProgram == ObsProgram.OBSMER) { model.exclude("expectedSamplingStrategy", "actualSamplingStrategy", - Contact.PROPERTY_COMPLETE_SAMPLING); + Contact.PROPERTY_COMPLETE_SAMPLING, + Contact.PROPERTY_TERRESTRIAL_LOCATION); } if (obsProgram == ObsProgram.OBSVENTE) { + model.exclude(Contact.PROPERTY_STATE); + model.exclude("mammals"); model.exclude("dataReliability"); } @@ -342,5 +347,20 @@ }; } + protected PropertyConduit getTerrestrialLocationPropertyConduit() { + return new ContactReaderPropertyConduit() { + @Override + public String getValue(Contact contact) { + TerrestrialLocation terrestrialLocation = contact.getTerrestrialLocation(); + String value; + if (terrestrialLocation == null) { + value = ""; + } else { + value = contact.getTerrestrialLocation().getDescription(); + } + return value; + } + }; + } } Modified: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/Contacts_fr.properties =================================================================== --- trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/Contacts_fr.properties 2011-01-25 10:41:14 UTC (rev 941) +++ trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/Contacts_fr.properties 2011-01-25 14:37:48 UTC (rev 942) @@ -38,7 +38,7 @@ boatImmatriculation-label: N\u00b0 boatDistrictCode-label: CQ mammals-label: Observations et captures accidentelles -dataInputDate-label: Saisie des donn\u00e9es dans Allegro +dataInputDate-label: Saisie des donn\u00e9es dans Allegro / Arp\u00e8ge comment-label: Commentaire observateur program-label: Programme professionCode-label: Code m\u00e9tier @@ -55,3 +55,4 @@ expectedSamplingStrategy-label: Strat\u00e9gie d'\u00e9chantillonnage attendue actualSamplingStrategy-label: Strat\u00e9gie d'\u00e9chantillonnage utilis\u00e9e completeSampling-label: \u00c9chantillonnage complet +terrestrialLocation-label: Lieu Modified: trunk/wao-ui/src/main/webapp/Contacts.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Contacts.tml 2011-01-25 10:41:14 UTC (rev 941) +++ trunk/wao-ui/src/main/webapp/Contacts.tml 2011-01-25 14:37:48 UTC (rev 942) @@ -221,6 +221,11 @@ <p:topiaCreateDateCell> <t:output value="contact.topiaCreateDate" format="dateFormat" /> </p:topiaCreateDateCell> + <p:terrestrialLocationCell> + <span t:type="ck/Tooltip" title="Infos" t:value="${contact.terrestrialLocation.description}" t:effect="appear"> + ${contact.terrestrialLocation.name} + </span> + </p:terrestrialLocationCell> <p:boatCell> <span t:type="ck/Tooltip" title="Infos" t:value="prop:boatDescription" t:effect="appear"> ${contact.boat.name} Modified: trunk/wao-ui/src/main/webapp/SampleRowHistoric.tml =================================================================== --- trunk/wao-ui/src/main/webapp/SampleRowHistoric.tml 2011-01-25 10:41:14 UTC (rev 941) +++ trunk/wao-ui/src/main/webapp/SampleRowHistoric.tml 2011-01-25 14:37:48 UTC (rev 942) @@ -29,7 +29,7 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <t:layout t:pageTitle="Historique d'une ligne du plan" t:contentId="so-samplerow-historic" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> - <h1>${format:wao.ui.sampleRowLog.title=sampleRow.code</h1> + <h1>${format:wao.ui.sampleRowLog.title=sampleRow.code}</h1> <p class="aright">${message:wao.ui.misc.createdOnF} <t:output t:format="dateFormat" t:value="sampleRow.topiaCreateDate"/></p> <hr /> <t:if t:test="canAddComment()"> Modified: trunk/wao-ui/src/main/webapp/SamplingPlan.tml =================================================================== --- trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2011-01-25 10:41:14 UTC (rev 941) +++ trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2011-01-25 14:37:48 UTC (rev 942) @@ -162,6 +162,9 @@ <td>Zone</td> <t:if t:test="fullView"> <td>Zone de pêche info</td> + <t:if test="showObsVente()"> + <td>Lieu</td> + </t:if> <td>METIER<br />Code DCF5</td> <td>METIER<br />Maillage</td> <td>METIER<br />Taille</td> @@ -169,21 +172,24 @@ <td>METIER<br />Libellé</td> <td>METIER<br />Espèces cibles</td> <td>Date de début</td> - <td class="bright">Date de fin</td> + <td>Date de fin</td> <p:else> + <t:if test="showObsVente()"> + <td>Lieu</td> + </t:if> <td>METIER<br />Code</td> - <td class="bright">METIER<br />Libellé</td> + <td>METIER<br />Libellé</td> </p:else> </t:if> + <t:if test="showObsVente()"> + <td class="width60 bright">Stratégie d'échantillonnage</td> + </t:if> <t:loop source="months" value="month"> <td class="width50"><t:output value="month" format="dateFormat" /></td> </t:loop> <td class="width50 bright">total</td> <td class="width60">Durée moyenne d'une marée (J.)</td> <td class="width60">Nb. d'observateurs</td> - <t:if test="showObsVente()"> - <td class="width60 bright">Stratégie d'échantillonnage</td> - </t:if> <td class="width60 bright">Commentaire</td> <td class="bright">Actions</td> </tr> @@ -223,6 +229,13 @@ <t:if t:test="fullView"> <td>${fishingZones}</td> <td>${row.fishingZonesInfos}</td> + <t:if test="showObsVente()"> + <td> + <span t:type="ck/Tooltip" title="Infos" t:value="${row.terrestrialLocation.description}" t:effect="appear"> + ${row.terrestrialLocation.districtName} + </span> + </td> + </t:if> <td> <t:loop source="row.dcf5code" value="dcf5code"> <span t:type="ck/Tooltip" t:value="${dcf5CodeDescription}" t:effect="appear"> @@ -236,13 +249,20 @@ <td>${row.profession.libelle}</td> <td>${row.profession.species}</td> <td><t:output value="row.periodBegin" format="dateFormat" /></td> - <td class="bright"><t:output value="row.periodEnd" format="dateFormat" /></td> + <td><t:output value="row.periodEnd" format="dateFormat" /></td> <p:else> <td> <span t:type="ck/Tooltip" title="Infos" t:value="prop:row.fishingZonesInfos" t:effect="appear"> ${fishingZones} </span> </td> + <t:if test="showObsVente()"> + <td> + <span t:type="ck/Tooltip" title="Infos" t:value="${row.terrestrialLocation.description}" t:effect="appear"> + ${row.terrestrialLocation.districtName} + </span> + </td> + </t:if> <td> <t:loop source="row.dcf5code" value="dcf5code"> <span t:type="ck/Tooltip" t:value="${dcf5CodeDescription}" t:effect="appear"> @@ -251,13 +271,18 @@ </t:loop> ${row.professionDescriptionWithoutDCF5} </td> - <td class="bright"> + <td> <span t:type="ck/Tooltip" title="Infos" t:value="Espèces cibles : ${row.profession.species}" t:effect="appear"> ${row.profession.libelle} </span> </td> </p:else> </t:if> + <t:if test="showObsVente()"> + <td class="bright"> + ${row.samplingStrategy} + </td> + </t:if> <t:loop source="months" value="month"> <td class="width50 acenter ${monthCurrentClass}"> ${nbTidesExpected} @@ -276,11 +301,6 @@ </td> <td class="width60 acenter"><t:output t:value="row.averageTideTime" t:format="numberFormat" /></td> <td class="width60 acenter">${row.nbObservants}</td> - <t:if test="showObsVente()"> - <td class="width60 acenter"> - ${row.samplingStrategy} - </td> - </t:if> <td class="width60 acenter bright"> <t:if t:test="row.comment"> <span t:type="ck/Tooltip" title="Commentaire" t:value="prop:rowComment" t:effect="appear">
participants (1)
-
bleny@users.labs.libre-entreprise.org