Wao-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- 2352 discussions
[Suiviobsmer-commits] r803 - trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages
by bleny@users.labs.libre-entreprise.org 26 Nov '10
by bleny@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: bleny
Date: 2010-11-26 12:44:45 +0000 (Fri, 26 Nov 2010)
New Revision: 803
Log:
fix sample row form to allow profession selection ; add DCF5 codes validation
Modified:
trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java 2010-11-26 10:11:05 UTC (rev 802)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java 2010-11-26 12:44:45 UTC (rev 803)
@@ -27,16 +27,20 @@
import fr.ifremer.wao.WaoBusinessException;
import fr.ifremer.wao.WaoException;
import fr.ifremer.wao.bean.ConnectedUser;
+import fr.ifremer.wao.bean.SamplingFilter;
+import fr.ifremer.wao.bean.SamplingFilterImpl;
import fr.ifremer.wao.bean.UserRole;
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.Company;
import fr.ifremer.wao.entity.DCF5Code;
+import fr.ifremer.wao.entity.FishingGearDCF;
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.Profession;
import fr.ifremer.wao.entity.ProfessionImpl;
import fr.ifremer.wao.entity.SampleMonth;
import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.entity.SampleRowLog;
+import fr.ifremer.wao.entity.TargetSpeciesDCF;
import fr.ifremer.wao.service.ServiceBoat;
import fr.ifremer.wao.service.ServiceReferential;
import fr.ifremer.wao.service.ServiceSampling;
@@ -74,6 +78,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
+import java.util.LinkedList;
import java.util.List;
/**
@@ -162,9 +167,9 @@
/** Select model which contains all professions **/
@Persist
- private GenericSelectModel<Profession> professionSelectModel;
+ private GenericSelectModel<SampleRow> professionSelectModel;
- /** The current selected professionId **/
+ /** The current selected professionId, this is actually a sample row topia Id **/
@Property
private String professionId;
@@ -182,11 +187,11 @@
* @return a GenericSelectModel<Profession>
* @throws WaoException
*/
- public GenericSelectModel<Profession> getProfessionSelectModel() throws WaoException {
+ public GenericSelectModel<SampleRow> getProfessionSelectModel() throws WaoException {
if (professionSelectModel == null) {
- List<Profession> professions = serviceReferential.getProfessions();
- professionSelectModel = new GenericSelectModel<Profession>(professions, Profession.class,
- "code", "topiaId", propertyAccess);
+ List<SampleRow> professions = serviceSampling.getSampleRowsByFilter(new SamplingFilterImpl());
+ professionSelectModel = new GenericSelectModel<SampleRow>(professions, SampleRow.class,
+ "professionDescription", SampleRow.TOPIA_ID, propertyAccess);
}
return professionSelectModel;
}
@@ -207,12 +212,15 @@
*/
void onSelectedFromAddNewProfession() throws WaoException {
Profession profession = new ProfessionImpl();
- if (!StringUtils.isEmpty(professionId)) {
- Profession professionSelected = getProfessionSelectModel().findObject(professionId);
+ if ( ! StringUtils.isEmpty(professionId)) {
+ SampleRow professionSelected = getProfessionSelectModel().findObject(professionId);
if (log.isDebugEnabled()) {
- log.debug("Add new profession from : " + professionSelected);
+ log.debug("add new profession from : " + professionSelected);
}
- profession = serviceSampling.getNewProfession(professionSelected);
+ profession = serviceSampling.getNewProfession(professionSelected.getProfession());
+
+ getSampleRow().setDCF5Code(professionSelected.getDCF5Code());
+ dcf5codes = null;
}
getSampleRow().setProfession(profession);
edited = true;
@@ -582,6 +590,35 @@
"Vous devez choisir un programme existant ou en créer un nouveau");
}
+ // validate DCF5 codes
+ getSampleRow().setDCF5Code(getDcf5codes(), ", ");
+ if (CollectionUtils.isEmpty(getSampleRow().getDCF5Code())) {
+ sampleRowForm.recordError("Vous devez associer au moins un code DCF5");
+ } else {
+ // check that codes exist in the reference
+ SamplingFilter noFilter = new SamplingFilterImpl();
+ List<String> existingFishingGearCodes = new LinkedList<String>();
+ // filling existingFishingGearCodes
+ for (FishingGearDCF dcfGear : serviceSampling.getDCFGears(noFilter)) {
+ existingFishingGearCodes.add(dcfGear.getCode());
+ }
+ List<String> existingTargetSpeciesCodes = new LinkedList<String>();
+ for (TargetSpeciesDCF dcfSpecies : serviceSampling.getDCFSpecies(noFilter)) {
+ existingTargetSpeciesCodes.add(dcfSpecies.getCode());
+ }
+
+
+ for (DCF5Code code : getSampleRow().getDCF5Code()) {
+ if ( ! existingFishingGearCodes.contains(code.getFishingGearCode())) {
+ sampleRowForm.recordError(code.getFishingGearCode() + " n'est pas un code d'engin valide");
+ }
+ if (code.getTargetSpeciesCode() != null &&
+ ! existingTargetSpeciesCodes.contains(code.getTargetSpeciesCode())) {
+ sampleRowForm.recordError(code.getTargetSpeciesCode() + " n'est pas un code d'espèces cibles valide");
+ }
+ }
+ }
+
Date periodBegin = getSampleRow().getPeriodBegin();
Date periodEnd = getSampleRow().getPeriodEnd();
1
0
[Suiviobsmer-commits] r802 - 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/base wao-ui/src/main/webapp
by bleny@users.labs.libre-entreprise.org 26 Nov '10
by bleny@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: bleny
Date: 2010-11-26 10:11:05 +0000 (Fri, 26 Nov 2010)
New Revision: 802
Log:
update filters in sampling plan
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.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/base/AbstractFilteredPage.java
trunk/wao-ui/src/main/webapp/SamplingPlan.tml
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java 2010-11-25 15:30:03 UTC (rev 801)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java 2010-11-26 10:11:05 UTC (rev 802)
@@ -40,12 +40,16 @@
@Override
public String getFishingGearDescription() {
- return _("DCF.gear." + getFishingGearDCF());
+ return getFishingGearDCF().getDescription();
}
@Override
public String getTargetSpeciesDescription() {
- return _("DCF.species." + getTargetSpeciesDCF());
+ String description = null;
+ if (getTargetSpeciesDCF() != null) {
+ description = getTargetSpeciesDCF().getDescription();
+ }
+ return description;
}
@Override
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java 2010-11-25 15:30:03 UTC (rev 801)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java 2010-11-26 10:11:05 UTC (rev 802)
@@ -1,5 +1,7 @@
package fr.ifremer.wao.entity;
+import static org.nuiton.i18n.I18n._;
+
/**
* @author bleny
*/
@@ -14,4 +16,8 @@
setCode(code);
}
+ @Override
+ public String getDescription() {
+ return _(FishingGearDCF.class.getName() + "." + getCode());
+ }
}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java 2010-11-25 15:30:03 UTC (rev 801)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java 2010-11-26 10:11:05 UTC (rev 802)
@@ -1,5 +1,7 @@
package fr.ifremer.wao.entity;
+import static org.nuiton.i18n.I18n._;
+
/**
* @author bleny
*/
@@ -13,4 +15,9 @@
super();
setCode(code);
}
+
+ @Override
+ public String getDescription() {
+ return _(TargetSpeciesDCF.class.getName() + "." + getCode());
+ }
}
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 2010-11-25 15:30:03 UTC (rev 801)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2010-11-26 10:11:05 UTC (rev 802)
@@ -103,7 +103,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
/**
* ServiceSamplingImpl
@@ -441,30 +440,6 @@
SampleRowDAO dao = WaoDAOHelper.getSampleRowDAO(transaction);
-// // FishingZone properties
-// String fishingZoneAlias = "Z";
-// String fishingZoneFacadeProperty =
-// TopiaQuery.getProperty(fishingZoneAlias, FishingZone.FACADE_NAME);
-// String fishingZoneSectorProperty =
-// TopiaQuery.getProperty(fishingZoneAlias, FishingZone.SECTOR_NAME);
-// String fishingZoneDistrictProperty =
-// TopiaQuery.getProperty(fishingZoneAlias, FishingZone.DISTRICT_CODE);
-// String fishingZoneSampleRowProperty =
-// TopiaQuery.getProperty(fishingZoneAlias, FishingZone.SAMPLE_ROW);
-//
-// // SampleRow properties
-// String sampleRowAlias = "S";
-// String sampleRowCodeProperty =
-// TopiaQuery.getProperty(sampleRowAlias, SampleRow.CODE);
-//
-// // Query
-// TopiaQuery query = dao.createQuery(sampleRowAlias).addDistinct().
-// addFrom(FishingZone.class, fishingZoneAlias).
-// // TODO-fdesbois-2010-06-07 for ToPIA 2.4 : replace this statement by addInElements
-// add(sampleRowAlias + " IN elements(" + fishingZoneSampleRowProperty + ")");
-//
-// filter.prepareQueryForSampling(query, sampleRowAlias, fishingZoneAlias);
-
WaoQueryBuilder builder = context.newQueryBuilder();
WaoQueryHelper.SampleRowProperty sampleRowProperty =
@@ -1165,12 +1140,61 @@
}
@Override
- protected Set<String> executeGetDCFGears(TopiaContext transaction, SamplingFilter filter) throws Exception {
- throw new UnsupportedOperationException();
+ protected List<FishingGearDCF> executeGetDCFGears(TopiaContext transaction, SamplingFilter filter) throws Exception {
+
+ // return all distinct fishing gear DCF codes used in sample-rows filtered by filter
+
+ WaoQueryBuilder builder = context.newQueryBuilder();
+
+ WaoQueryHelper.SampleRowProperty sampleRowProperty =
+ builder.initializeForSampleRow(true);
+
+ WaoQueryHelper.FishingZoneProperty fishingZoneProperty = WaoQueryHelper.newFishingZoneProperty();
+ WaoQueryHelper.DCF5CodeProperty dcf5CodeProperty = WaoQueryHelper.newDCF5CodeProperty();
+ WaoQueryHelper.FishingGearDCFProperty fishingGearDCFProperty = WaoQueryHelper.newFishingGearDCFProperty();
+
+ TopiaQuery query = builder.applySamplingFilter(filter).
+ addDistinct().
+ setSelect(fishingGearDCFProperty.$alias()).
+ addJoin(sampleRowProperty.fishingZone(), fishingZoneProperty.$alias(), false).
+ addJoin(sampleRowProperty.dCF5Code(), dcf5CodeProperty.$alias(), false).
+ addJoin(dcf5CodeProperty.fishingGearDCF(), fishingGearDCFProperty.$alias(), false).
+ addOrder(fishingGearDCFProperty.code());
+
+ if (log.isDebugEnabled()) {
+ log.debug("query to get distinct DCF fishing gears : " + query);
+ }
+
+ List<FishingGearDCF> dcfGears = transaction.findByQuery(query);
+ return dcfGears;
}
@Override
- protected Set<String> executeGetDCFSpecies(TopiaContext transaction, SamplingFilter filter) throws Exception {
- throw new UnsupportedOperationException();
+ protected List<TargetSpeciesDCF> executeGetDCFSpecies(TopiaContext transaction, SamplingFilter filter) throws Exception {
+
+ // return all distinct target species DCF codes used in sample-rows filtered by filter
+
+ WaoQueryBuilder builder = context.newQueryBuilder();
+
+ WaoQueryHelper.SampleRowProperty sampleRowProperty = builder.initializeForSampleRow(true);
+
+ WaoQueryHelper.FishingZoneProperty fishingZoneProperty = WaoQueryHelper.newFishingZoneProperty();
+ WaoQueryHelper.DCF5CodeProperty dcf5CodeProperty = WaoQueryHelper.newDCF5CodeProperty();
+ WaoQueryHelper.TargetSpeciesDCFProperty targetSpeciesDCFProperty = WaoQueryHelper.newTargetSpeciesDCFProperty();
+
+ TopiaQuery query = builder.applySamplingFilter(filter).
+ addDistinct().
+ setSelect(targetSpeciesDCFProperty.$alias()).
+ addJoin(sampleRowProperty.fishingZone(), fishingZoneProperty.$alias(), false).
+ addJoin(sampleRowProperty.dCF5Code(), dcf5CodeProperty.$alias(), false).
+ addJoin(dcf5CodeProperty.targetSpeciesDCF(), targetSpeciesDCFProperty.$alias(), false).
+ addOrder(targetSpeciesDCFProperty.code());
+
+ if (log.isDebugEnabled()) {
+ log.debug("query to get distinct DCF target species : " + query);
+ }
+
+ List<TargetSpeciesDCF> dcfSpecies = transaction.findByQuery(query);
+ return dcfSpecies;
}
}
Modified: trunk/wao-business/src/main/xmi/wao.zargo
===================================================================
(Binary files differ)
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/AbstractFilteredPage.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/AbstractFilteredPage.java 2010-11-25 15:30:03 UTC (rev 801)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/AbstractFilteredPage.java 2010-11-26 10:11:05 UTC (rev 802)
@@ -28,7 +28,9 @@
import fr.ifremer.wao.bean.ConnectedUser;
import fr.ifremer.wao.bean.SamplingFilter;
import fr.ifremer.wao.entity.Company;
+import fr.ifremer.wao.entity.FishingGearDCF;
import fr.ifremer.wao.entity.SampleRow;
+import fr.ifremer.wao.entity.TargetSpeciesDCF;
import fr.ifremer.wao.entity.WaoUser;
import fr.ifremer.wao.service.ServiceBoat;
import fr.ifremer.wao.service.ServiceReferential;
@@ -50,8 +52,6 @@
import java.util.ArrayList;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
-
/**
* AbstractFilteredPage
*
@@ -312,7 +312,7 @@
getFilter().setSampleRows(rowsFiltered);
sampleRowSelectModel = new GenericSelectModel<SampleRow>(sampleRows, SampleRow.class,
- "code", "topiaId", propertyAccess);
+ SampleRow.CODE, SampleRow.TOPIA_ID, propertyAccess);
}
return sampleRowSelectModel;
}
@@ -329,7 +329,7 @@
if (companySelectModel == null) {
List<Company> companies = serviceUser.getCompanies(isAvailableDataForFiltersOnly());
companySelectModel = new GenericSelectModel<Company>(companies,Company.class,
- "name","topiaId",propertyAccess);
+ Company.NAME, Company.TOPIA_ID, propertyAccess);
}
return companySelectModel;
}
@@ -348,7 +348,7 @@
serviceUser.getObservers(getFilter().getCompany(),
isAvailableDataForFiltersOnly());
observerSelectModel = new GenericSelectModel<WaoUser>(observers,WaoUser.class,
- "fullName","topiaId",propertyAccess);
+ "fullName", "topiaId", propertyAccess);
}
return observerSelectModel;
}
@@ -371,30 +371,42 @@
return programSelectModel;
}
- private SelectModel dcfGearSelectModel;
+ @Property
+ @Persist
+ private String fishingGearDCFId;
- public SelectModel getDcfGearSelectModel() throws WaoException {
+ private GenericSelectModel<FishingGearDCF> dcfGearSelectModel;
+
+ public GenericSelectModel<FishingGearDCF> getDcfGearSelectModel() throws WaoException {
if (dcfGearSelectModel == null) {
- List<OptionModel> options = new ArrayList<OptionModel>();
- for (String dcfGear : serviceSampling.getDCFGears(getFilter())) {
- options.add(new OptionModelImpl(dcfGear + " - " +
- _("DCF.gear." + dcfGear), dcfGear));
- }
- dcfGearSelectModel = new SelectModelImpl(null, options);
+ // don't filter with already defined DCFs
+ FishingGearDCF keptFishingGearDCF = getFilter().getFishingGearDCF();
+ getFilter().setFishingGearDCF(null);
+ List<FishingGearDCF> fishingGearDCFs = serviceSampling.getDCFGears(getFilter());
+ getFilter().setFishingGearDCF(keptFishingGearDCF);
+
+ dcfGearSelectModel = new GenericSelectModel<FishingGearDCF>(fishingGearDCFs, FishingGearDCF.class,
+ FishingGearDCF.CODE, FishingGearDCF.TOPIA_ID, propertyAccess);
}
return dcfGearSelectModel;
}
- private SelectModel dcfSpeciesSelectModel;
+ @Property
+ @Persist
+ private String targetSpeciesDCFId;
- public SelectModel getDcfSpeciesSelectModel() throws WaoException {
+ private GenericSelectModel<TargetSpeciesDCF> dcfSpeciesSelectModel;
+
+ public GenericSelectModel<TargetSpeciesDCF> getDcfSpeciesSelectModel() throws WaoException {
if (dcfSpeciesSelectModel == null) {
- List<OptionModel> options = new ArrayList<OptionModel>();
- for (String dcfSpecies : serviceSampling.getDCFSpecies(getFilter())) {
- options.add(new OptionModelImpl(dcfSpecies + " - " +
- _("DCF.species." + dcfSpecies), dcfSpecies));
- }
- dcfSpeciesSelectModel = new SelectModelImpl(null, options);
+ // don't filter with already defined DCFs
+ TargetSpeciesDCF keptTargetSpeciesDCF = getFilter().getTargetSpeciesDCF();
+ getFilter().setTargetSpeciesDCF(null);
+ List<TargetSpeciesDCF> targetSpeciesDCFs = serviceSampling.getDCFSpecies(getFilter());
+ getFilter().setTargetSpeciesDCF(keptTargetSpeciesDCF);
+
+ dcfSpeciesSelectModel = new GenericSelectModel<TargetSpeciesDCF>(targetSpeciesDCFs, TargetSpeciesDCF.class,
+ TargetSpeciesDCF.CODE, TargetSpeciesDCF.TOPIA_ID, propertyAccess);
}
return dcfSpeciesSelectModel;
}
@@ -441,6 +453,15 @@
}
getFilter().setObserver(observer);
}
+
+ if (fishingGearDCFId != null) {
+ FishingGearDCF fishingGearDCF = getDcfGearSelectModel().findObject(fishingGearDCFId);
+ getFilter().setFishingGearDCF(fishingGearDCF);
+ }
+ if (targetSpeciesDCFId != null) {
+ TargetSpeciesDCF targetSpeciesDCF = getDcfSpeciesSelectModel().findObject(targetSpeciesDCFId);
+ getFilter().setTargetSpeciesDCF(targetSpeciesDCF);
+ }
}
private boolean edited;
Modified: trunk/wao-ui/src/main/webapp/SamplingPlan.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2010-11-25 15:30:03 UTC (rev 801)
+++ trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2010-11-26 10:11:05 UTC (rev 802)
@@ -124,9 +124,9 @@
</div>
<div>
<t:label t:for="fishingGearDCF" /> :
- <input t:type="select" t:id="fishingGearDCF" t:model="dcfGearSelectModel" value="filter.fishingGearDCF"/>
+ <input t:type="select" t:id="fishingGearDCF" t:model="dcfGearSelectModel" value="fishingGearDCFId"/>
<t:label t:for="targetSpeciesDCF" /> :
- <input t:type="select" t:id="targetSpeciesDCF" t:model="dcfSpeciesSelectModel" value="filter.targetSpeciesDCF"/>
+ <input t:type="select" t:id="targetSpeciesDCF" t:model="dcfSpeciesSelectModel" value="targetSpeciesDCFId"/>
</div>
<div class="t-beaneditor-row aright">
<input t:type="submit" class="ico search-32px" t:id="search" value="Search" title="Rechercher les lignes du plan correspondants aux filtres saisies" />
1
0
25 Nov '10
Author: bleny
Date: 2010-11-25 15:30:03 +0000 (Thu, 25 Nov 2010)
New Revision: 801
Log:
refactor DCF5 codes + migration + impact in code and tests
Added:
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java
Removed:
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCFFiveCodeImpl.java
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java
trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java
trunk/wao-business/src/main/java/fr/ifremer/wao/WaoQueryBuilder.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/ProfessionImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv/ImportHelper.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/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java
trunk/wao-business/src/main/xmi/wao.properties
trunk/wao-business/src/main/xmi/wao.zargo
trunk/wao-business/src/test/java/fr/ifremer/wao/WaoMigrationCallBackTest.java
trunk/wao-business/src/test/java/fr/ifremer/wao/entity/BoatImplTest.java
trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java
trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java
trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.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/java/fr/ifremer/wao/ui/services/WaoManager.java
trunk/wao-ui/src/main/webapp/SamplingPlan.tml
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -26,7 +26,6 @@
import fr.ifremer.wao.bean.ContactState;
import fr.ifremer.wao.bean.SynthesisId;
-import fr.ifremer.wao.entity.DCFFiveCode;
import org.hibernate.SQLQuery;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImplementor;
@@ -443,36 +442,101 @@
@Override
protected void createTablesForDCF5Code_1_6(List<String> queries) {
- // create table IndicatorLog with author FK
- queries.add("CREATE TABLE DCFFiveCode (" +
+ // create table FishingGearDCF
+ queries.add("CREATE TABLE FishingGearDCF (" +
"topiaId CHARACTER VARYING(255) PRIMARY KEY," +
"topiaVersion BIGINT NOT NULL," +
"topiaCreateDate TIMESTAMP WITHOUT TIME ZONE NOT NULL," +
- "fishingGearDCF CHARACTER VARYING(10) NOT NULL," +
- "targetSpeciesDCF CHARACTER VARYING(10)," +
+ "code CHARACTER VARYING(10) NOT NULL," +
+ "UNIQUE (code));");
+ queries.add("CREATE TABLE TargetSpeciesDCF (" +
+ "topiaId CHARACTER VARYING(255) PRIMARY KEY," +
+ "topiaVersion BIGINT NOT NULL," +
+ "topiaCreateDate TIMESTAMP WITHOUT TIME ZONE NOT NULL," +
+ "code CHARACTER VARYING(10) NOT NULL," +
+ "UNIQUE (code));");
+
+ queries.add("CREATE TABLE DCF5Code (" +
+ "topiaId CHARACTER VARYING(255) PRIMARY KEY," +
+ "topiaVersion BIGINT NOT NULL," +
+ "topiaCreateDate TIMESTAMP WITHOUT TIME ZONE NOT NULL," +
+ "FishingGearDCF CHARACTER VARYING(255) NOT NULL," +
+ "TargetSpeciesDCF CHARACTER VARYING(255)," +
+ "CONSTRAINT FishingGearDCF_fkey FOREIGN KEY (FishingGearDCF) " +
+ "REFERENCES FishingGearDCF (topiaid) MATCH SIMPLE " +
+ "ON UPDATE NO ACTION ON DELETE NO ACTION," +
+ "CONSTRAINT TargetSpeciesDCF_fkey FOREIGN KEY (TargetSpeciesDCF) " +
+ "REFERENCES TargetSpeciesDCF (topiaid) MATCH SIMPLE " +
+ "ON UPDATE NO ACTION ON DELETE NO ACTION," +
"UNIQUE (fishingGearDCF, targetSpeciesDCF));");
- // *..* relation need an intermediate table
- queries.add("CREATE TABLE dcf5code_profession (" +
- "dcf5code character varying(255) NOT NULL," +
- "Profession character varying(255) NOT NULL," +
- "CONSTRAINT profession_fkey FOREIGN KEY (profession) " +
- "REFERENCES Profession (topiaid) MATCH SIMPLE " +
+ // *..* relation need an intermediate table between sampleRow and dcf5code
+ queries.add("CREATE TABLE DCF5Code_SampleRow (" +
+ "DCF5Code character varying(255) NOT NULL," +
+ "SampleRow character varying(255) NOT NULL," +
+ "CONSTRAINT DCF5Code_fkey FOREIGN KEY (DCF5Code) " +
+ "REFERENCES DCF5Code (topiaid) MATCH SIMPLE " +
"ON UPDATE NO ACTION ON DELETE NO ACTION," +
- "CONSTRAINT dcffivecode_fkey FOREIGN KEY (dcf5code) " +
- "REFERENCES DCFFiveCode (topiaid) MATCH SIMPLE " +
+ "CONSTRAINT SampleRow_fkey FOREIGN KEY (SampleRow) " +
+ "REFERENCES SampleRow (topiaid) MATCH SIMPLE " +
"ON UPDATE NO ACTION ON DELETE NO ACTION);");
}
- /** get Data to migrate. key is the topiaId of the profession (to be
- * used as a foreign key) and value is the value of the field to split)
- */
+ @Override
+ protected Map<String, String> insertFishingGearDCF_1_6(List<String> queries) {
+ String topiaIdPrefix = "fr.ifremer.wao.entities.FishingGearDCF#1289321129111#798260963";
+ int topiaVersion = 0;
+ String topiaCreateDateValue = "DATE '2010-11-24'";
+
+ Map<String, String> result = new HashMap<String, String>();
+
+ for (String code : gearCodesBase) {
+ String topiaId = topiaIdPrefix + code;
+ String sql = String.format("INSERT INTO FishingGearDCF (topiaId, topiaVersion, topiaCreateDate, code) " +
+ "VALUES ('%s', %s, %s, '%s');",
+ topiaId,
+ topiaVersion,
+ topiaCreateDateValue,
+ code);
+ queries.add(sql);
+
+ result.put(code, topiaId);
+ }
+
+ return result;
+ }
+
+ @Override
+ protected Map<String, String> insertTargetSpeciesDCF_1_6(List<String> queries) {
+ String topiaIdPrefix = "fr.ifremer.wao.entities.TargetSpeciesDCF#1289321129111#798260963";
+ int topiaVersion = 0;
+ String topiaCreateDateValue = "DATE '2010-11-24'";
+
+ Map<String, String> result = new HashMap<String, String>();
+
+ for (String code : speciesCodesBase) {
+ String topiaId = topiaIdPrefix + code;
+ String sql = String.format("INSERT INTO TargetSpeciesDCF (topiaId, topiaVersion, topiaCreateDate, code) " +
+ "VALUES ('%s', %s, %s, '%s');",
+ topiaId,
+ topiaVersion,
+ topiaCreateDateValue,
+ code);
+ queries.add(sql);
+
+ result.put(code, topiaId);
+ }
+
+ return result;
+ }
+
protected Map<String, String> getCodeDCF5ForMigration_1_6(TopiaContextImplementor tx) throws TopiaException {
final Map<String, String> result = new HashMap<String, String>();
SQLQuery query = tx.getHibernate().
- createSQLQuery("SELECT topiaid, codedcf5 FROM Profession;");
+ createSQLQuery("SELECT sr.topiaId, codedcf5 " +
+ "FROM SampleRow sr join Profession p on sr.profession = p.topiaId;");
List<Object[]> results = query.list();
@@ -485,29 +549,28 @@
return result;
}
+ @Override
+ protected void insertDCFFiveCode_1_6(String codeTopiaId, String gearTopiaId, String speciesTopiaId, List<String> queries) {
- @Override
- protected void insertDCFFiveCode_1_6(String codeTopiaId, DCFFiveCode code, List<String> queries) {
int topiaVersion = 0;
String topiaCreateDateValue = "DATE '2010-11-09'";
- String sql = String.format("INSERT INTO DCFFiveCode (topiaId, topiaVersion, topiaCreateDate, fishingGearDCF, targetSpeciesDCF) " +
+ String sql = String.format("INSERT INTO DCF5Code (topiaId, topiaVersion, topiaCreateDate, fishingGearDCF, targetSpeciesDCF) " +
"VALUES ('%s', %s, %s, '%s', %s);",
codeTopiaId,
topiaVersion,
topiaCreateDateValue,
- code.getFishingGearDCF(),
- code.getTargetSpeciesDCF() == null ? "NULL" : "'" + code.getTargetSpeciesDCF() + "'");
+ gearTopiaId,
+ speciesTopiaId == null ? "NULL" : "'" + speciesTopiaId + "'");
queries.add(sql);
+
}
@Override
- protected void insertSplitCodes_1_6(String professionTopiaId,
- String codeTopiaId,
- List<String> queries) {
- String sql = String.format("INSERT INTO dcf5code_profession (Profession, dcf5code) " +
+ protected void insertSplitCodes_1_6(String sampleRowTopiaId, String codeTopiaId, List<String> queries) {
+ String sql = String.format("INSERT INTO DCF5Code_SampleRow (SampleRow, DCF5Code) " +
"VALUES ('%s', '%s');",
- professionTopiaId, codeTopiaId);
+ sampleRowTopiaId, codeTopiaId);
queries.add(sql);
}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -24,8 +24,6 @@
package fr.ifremer.wao;
-import fr.ifremer.wao.entity.DCFFiveCode;
-import fr.ifremer.wao.entity.DCFFiveCodeImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaException;
@@ -35,6 +33,7 @@
import org.nuiton.util.VersionUtil;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -90,11 +89,17 @@
protected abstract void createTablesForDCF5Code_1_6(List<String> queries);
+ protected abstract Map<String, String> insertFishingGearDCF_1_6(List<String> queries);
+ protected abstract Map<String, String> insertTargetSpeciesDCF_1_6(List<String> queries);
+
+ /** get Data to migrate. key is the topiaId of the sample row (to be
+ * used as a foreign key) and value is the value of the field to split)
+ */
protected abstract Map<String, String> getCodeDCF5ForMigration_1_6(TopiaContextImplementor tx) throws TopiaException;
- protected abstract void insertDCFFiveCode_1_6(String codeTopiaId, DCFFiveCode code, List<String> queries);
+ protected abstract void insertDCFFiveCode_1_6(String codeTopiaId, String gearTopiaId, String speciesTopiaId, List<String> queries);
- protected abstract void insertSplitCodes_1_6(String professionTopiaId, String codeTopiaId, List<String> queries);
+ protected abstract void insertSplitCodes_1_6(String sampleRowTopiaId, String codeTopiaId, List<String> queries);
protected abstract void removeCodeDCF5columnFromProfession_1_6(List<String> queries);
@@ -238,6 +243,16 @@
executeSQL(tx, showSql, showProgression, strings);
}
+ protected final String[] gearCodesBase = {"DRB", "DRH", "FAR", "FCN", "FG",
+ "FIX", "FPN", "FPO", "FSN", "FWR", "FYK", "GEN", "GES", "GN", "GNC",
+ "GND", "GNF", "GNS", "GT", "GTN", "GTR", "HAR", "HMD", "HMP", "HMX",
+ "LA", "LHM", "LHP", "LL", "LLD", "LLS", "LN", "LNB", "LNP", "LNS",
+ "LTL", "LX", "MIS", "NK", "OT", "OTB", "OTM", "OTT", "PS", "PS1",
+ "PS2", "PT", "PTB", "PTM", "RG", "SB", "SDN", "SPR", "SSC", "SV",
+ "SW", "TB", "TBB", "TBN", "TBS", "TM", "TMS", "TX"};
+ protected final String[] speciesCodesBase = {"ALG", "CAT", "CRU", "CSJ",
+ "DEF", "DWS", "FIN", "LPF", "MOL", "SPF"};
+
/** creates Indicator, IndicatorLevel, IndicatorLog tables and inserts
* initial values.
*/
@@ -258,20 +273,32 @@
createTablesForDCF5Code_1_6(queries);
+ // map code to TopiaId
+ Map<String, String> gearCodes = insertFishingGearDCF_1_6(queries);
+ Map<String, String> speciesCodes = insertTargetSpeciesDCF_1_6(queries);
+
Map<String, String> codesDCF5ForMigration = getCodeDCF5ForMigration_1_6(tx);
Set<String> insertedDCFFiveCode = new HashSet<String>();
for (Map.Entry<String, String> codeToMigrate : codesDCF5ForMigration.entrySet()) {
// split the code String in multiple codes
- List<DCFFiveCode> codes = splitCodeDCF5_1_6(codeToMigrate.getValue());
+ List<String[]> codes = splitCodeDCF5_1_6(codeToMigrate.getValue());
// first, do the insert if needed
- for (DCFFiveCode code : codes) {
- String codeTopiaId = "fr.ifremer.wao.entities.DCFFiveCode#1289320029000#798260963"
- + code.getFishingGearDCF() + code.getTargetSpeciesDCF();
+ for (String[] code : codes) {
+ String codeTopiaId = "fr.ifremer.wao.entities.DCF5Code#1289320029000#798260963"
+ + code[0];
+ if (code.length == 2) {
+ codeTopiaId += code[1];
+ }
if ( ! insertedDCFFiveCode.contains(codeTopiaId)) {
- insertDCFFiveCode_1_6(codeTopiaId, code, queries);
+ String gearTopiaId = gearCodes.get(code[0]);
+ String speciesTopiaId = null;
+ if (code.length == 2) {
+ speciesTopiaId = speciesCodes.get(code[1]);
+ }
+ insertDCFFiveCode_1_6(codeTopiaId, gearTopiaId, speciesTopiaId, queries);
insertedDCFFiveCode.add(codeTopiaId);
}
@@ -292,26 +319,41 @@
}
/** given "XXX_YYY et ZZZ_", will split with " et " and with "_" to extract
- * some DCFFiveCode entities
+ * some array like ["XXX", "YYY"], ["ZZZ"]
*/
- protected List<DCFFiveCode> splitCodeDCF5_1_6(String dcf5Code) {
+ protected List<String[]> splitCodeDCF5_1_6(String dcf5Code) {
String codes[] = dcf5Code.split(" et ");
- List<DCFFiveCode> result = new ArrayList<DCFFiveCode>();
+ List<String[]> result = new ArrayList<String[]>();
for (String code : codes) {
- String codeParts[] = code.split("_");
- DCFFiveCode dcfFiveCode = new DCFFiveCodeImpl();
- dcfFiveCode.setFishingGearDCF(codeParts[0]);
- if (codeParts.length == 2 && ! codeParts[1].isEmpty()) {
- dcfFiveCode.setTargetSpeciesDCF(codeParts[1]);
+ // code may be a bad legacy data, replace it to make valid code
+ String actualCode = code;
+ if (code.equals("GT?")) {
+ actualCode = "GT";
+ } else if (code.equals("GN?")) {
+ actualCode = "GN";
+ } else if (code.equals("DRBCJ")) {
+ actualCode = "DRB_CJ";
}
+
+ String codeParts[] = actualCode.split("_");
+ String[] dcfFiveCode;
+ if (codeParts.length == 1 || codeParts[1].isEmpty()) {
+ dcfFiveCode = new String[1];
+ } else {
+ dcfFiveCode = new String[2];
+ dcfFiveCode[1] = codeParts[1];
+ }
+ dcfFiveCode[0] = codeParts[0];
result.add(dcfFiveCode);
}
if (log.isInfoEnabled()) {
- log.info(String.format("line %s will be migrated to",
- dcf5Code, result));
+ log.info(String.format("line %s will be migrated to", dcf5Code));
+ for (String[] code : result) {
+ log.info(Arrays.toString(code));
+ }
}
return result;
}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoQueryBuilder.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoQueryBuilder.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoQueryBuilder.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -334,12 +334,12 @@
}
if (filter.getFishingGearDCF() != null) {
- query.addEquals(WaoQueryHelper.newDCFFiveCodeProperty().fishingGearDCF(),
+ query.addEquals(WaoQueryHelper.newDCF5CodeProperty().fishingGearDCF(),
filter.getFishingGearDCF());
}
if (filter.getTargetSpeciesDCF() != null) {
- query.addEquals(WaoQueryHelper.newDCFFiveCodeProperty().targetSpeciesDCF(),
+ query.addEquals(WaoQueryHelper.newDCF5CodeProperty().targetSpeciesDCF(),
filter.getTargetSpeciesDCF());
}
Copied: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java (from rev 799, trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCFFiveCodeImpl.java)
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java (rev 0)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.entity;
+
+import static org.nuiton.i18n.I18n._;
+
+public class DCF5CodeImpl extends DCF5CodeAbstract {
+
+ @Override
+ public String getFishingGearCode() {
+ return getFishingGearDCF().getCode();
+ }
+
+ @Override
+ public String getTargetSpeciesCode() {
+ String code = null;
+ if (getTargetSpeciesDCF() != null) {
+ code = getTargetSpeciesDCF().getCode();
+ }
+ return code;
+ }
+
+ @Override
+ public String getFishingGearDescription() {
+ return _("DCF.gear." + getFishingGearDCF());
+ }
+
+ @Override
+ public String getTargetSpeciesDescription() {
+ return _("DCF.species." + getTargetSpeciesDCF());
+ }
+
+ @Override
+ public String toString() {
+ String toString = getFishingGearCode();
+ if (getTargetSpeciesDCF() != null) {
+ toString += "_" + getTargetSpeciesCode();
+ }
+ return toString;
+ }
+}
Deleted: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCFFiveCodeImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCFFiveCodeImpl.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCFFiveCodeImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -1,46 +0,0 @@
-/*
- * #%L
- * Wao :: Business
- * %%
- * Copyright (C) 2009 - 2010 Ifremer
- * %%
- * 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.wao.entity;
-
-import static org.nuiton.i18n.I18n._;
-
-public class DCFFiveCodeImpl extends DCFFiveCodeAbstract {
-
-
- @Override
- public String getFishingGearDCFDescription() {
- return _("DCF.gear." + getFishingGearDCF());
- }
-
- @Override
- public String getTargetSpeciesDCFDescription() {
- return _("DCF.species." + getTargetSpeciesDCF());
- }
-
- @Override
- public String toString() {
- String toString = getFishingGearDCF();
- if (getTargetSpeciesDCF() != null) {
- toString += "_" + getTargetSpeciesDCF();
- }
- return toString;
- }
-}
Added: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java (rev 0)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -0,0 +1,17 @@
+package fr.ifremer.wao.entity;
+
+/**
+ * @author bleny
+ */
+public class FishingGearDCFImpl extends FishingGearDCFAbstract {
+
+ public FishingGearDCFImpl() {
+ super();
+ }
+
+ public FishingGearDCFImpl(String code) {
+ super();
+ setCode(code);
+ }
+
+}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/ProfessionImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/ProfessionImpl.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/ProfessionImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -44,44 +44,4 @@
private static final Logger log = LoggerFactory.getLogger(ProfessionImpl.class);
private static final long serialVersionUID = 1L;
-
- @Override
- public String getCode() {
- String code = StringUtils.join(getDcf5code(), ", ");
- code += getCodeWithoutDCF5();
- return code;
- }
-
- @Override
- public String getCodeWithoutDCF5() {
- String code = "";
- if (!StringUtils.isEmpty(getMeshSize())) {
- code += " " + getMeshSize();
- }
- if (!StringUtils.isEmpty(getSize())) {
- code += " " + getSize();
- }
- if (!StringUtils.isEmpty(getOther())) {
- code += " " + getOther();
- }
- return code;
- }
-
- @Override
- public void setDcf5code(String codes, String separatorRegex) {
- String[] splitCodes = codes.split(separatorRegex);
- List<DCFFiveCode> dcfFives = new ArrayList<DCFFiveCode>(splitCodes.length);
- for (String code : splitCodes) {
- String[] codeParts = code.split("_");
- DCFFiveCode dcfFive = new DCFFiveCodeImpl();
-
- dcfFive.setFishingGearDCF(codeParts[0]);
- if (codeParts.length == 2) {
- dcfFive.setTargetSpeciesDCF(codeParts[1]);
- }
-
- dcfFives.add(dcfFive);
- }
- setDcf5code(dcfFives);
- }
}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -25,9 +25,9 @@
package fr.ifremer.wao.entity;
import fr.ifremer.wao.WaoUtils;
-import fr.ifremer.wao.bean.DataReliability;
import fr.ifremer.wao.service.ServiceSampling;
import org.apache.commons.lang.BooleanUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DurationFormatUtils;
import org.nuiton.util.DateUtil;
import org.nuiton.util.PeriodDates;
@@ -379,4 +379,46 @@
// }
// }
+
+
+ @Override
+ public String getProfessionDescription() {
+ String code = StringUtils.join(getDCF5Code(), ", ");
+ code += getProfessionDescriptionWithoutDCF5();
+ return code;
+ }
+
+ @Override
+ public String getProfessionDescriptionWithoutDCF5() {
+ String code = "";
+ if (!StringUtils.isEmpty(getProfession().getMeshSize())) {
+ code += " " + getProfession().getMeshSize();
+ }
+ if (!StringUtils.isEmpty(getProfession().getSize())) {
+ code += " " + getProfession().getSize();
+ }
+ if (!StringUtils.isEmpty(getProfession().getOther())) {
+ code += " " + getProfession().getOther();
+ }
+ return code;
+ }
+
+ @Override
+ public void setDCF5Code(String codes, String separatorRegex) {
+ String[] splitCodes = codes.split(separatorRegex);
+ List<DCF5Code> dcfFives = new ArrayList<DCF5Code>(splitCodes.length);
+ for (String code : splitCodes) {
+ String[] codeParts = code.split("_");
+ DCF5Code dcfFive = new DCF5CodeImpl();
+
+ dcfFive.setFishingGearDCF(new FishingGearDCFImpl(codeParts[0]));
+ if (codeParts.length == 2) {
+ dcfFive.setTargetSpeciesDCF(new TargetSpeciesDCFImpl(codeParts[1]));
+ }
+
+ dcfFives.add(dcfFive);
+ }
+ setDCF5Code(dcfFives);
+ }
+
}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -56,9 +56,11 @@
}
@Override
- public void addChangeProfession(Profession oldProfession, Profession newProfession) {
- if (oldProfession == null) {
- addChange("Le métier de la ligne est " + newProfession.getCode());
+ public void addChangeProfession(SampleRow oldSampleRow, SampleRow newSampleRow) {
+ Profession newProfession = newSampleRow.getProfession();
+
+ if (oldSampleRow == null) {
+ addChange("Le métier de la ligne est " + newSampleRow.getProfessionDescription());
if (newProfession.getLibelle() != null) {
addChange("Le libelle du métier est " + newProfession.getLibelle());
}
@@ -68,9 +70,12 @@
return;
}
- if (!nvl(oldProfession.getCode()).equals(nvl(newProfession.getCode()))) {
- addChange("Le métier de la ligne est passé de " + oldProfession.getCode() + " à " + newProfession.getCode());
+ if (!nvl(oldSampleRow.getProfessionDescription()).equals(nvl(newSampleRow.getProfessionDescription()))) {
+ addChange("Le métier de la ligne est passé de " + oldSampleRow.getProfessionDescription()
+ + " à " + newSampleRow.getProfessionDescription());
}
+
+ Profession oldProfession = oldSampleRow.getProfession();
if (newProfession.getLibelle() != null && !nvl(oldProfession.getLibelle()).equals(nvl(newProfession.getLibelle()))) {
addChange("Le libellé du métier est passé de " + oldProfession.getLibelle() + " à " + newProfession.getLibelle());
}
Added: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java (rev 0)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -0,0 +1,16 @@
+package fr.ifremer.wao.entity;
+
+/**
+ * @author bleny
+ */
+public class TargetSpeciesDCFImpl extends TargetSpeciesDCFAbstract {
+
+ public TargetSpeciesDCFImpl() {
+ super();
+ }
+
+ public TargetSpeciesDCFImpl(String code) {
+ super();
+ setCode(code);
+ }
+}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv/ImportHelper.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv/ImportHelper.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv/ImportHelper.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -28,8 +28,10 @@
import fr.ifremer.wao.WaoBusinessException;
import fr.ifremer.wao.WaoContext;
import fr.ifremer.wao.WaoException;
-import fr.ifremer.wao.entity.DCFFiveCode;
-import fr.ifremer.wao.entity.DCFFiveCodeImpl;
+import fr.ifremer.wao.entity.DCF5Code;
+import fr.ifremer.wao.entity.DCF5CodeImpl;
+import fr.ifremer.wao.entity.FishingGearDCFImpl;
+import fr.ifremer.wao.entity.TargetSpeciesDCFImpl;
import fr.ifremer.wao.io.csv.WaoCsvHeader.ACTIVITY_CALENDAR;
import fr.ifremer.wao.io.csv.WaoCsvHeader.CONTACT;
import fr.ifremer.wao.io.csv.WaoCsvHeader.DatedHeader;
@@ -132,17 +134,17 @@
return context.prepareSampleRowCode(code);
}
- public static Collection<DCFFiveCode> readDCF5Codes(CsvReader reader) throws IOException {
- Collection<DCFFiveCode> result = new ArrayList<DCFFiveCode>();
+ public static Collection<DCF5Code> readDCF5Codes(CsvReader reader) throws IOException {
+ Collection<DCF5Code> result = new ArrayList<DCF5Code>();
String codesString = read(reader, SAMPLING.METIER_CODE_DCF5);
// codeString is something like "AAA_BBB CCC", let's break it
String[] codes = codesString.split(" et ");
for (String codeString : codes) {
String[] codeParts = codeString.split("_");
- DCFFiveCode code = new DCFFiveCodeImpl();
- code.setFishingGearDCF(codeParts[0]);
+ DCF5Code code = new DCF5CodeImpl();
+ code.setFishingGearDCF(new FishingGearDCFImpl(codeParts[0]));
if (codeParts.length == 2) {
- code.setTargetSpeciesDCF(codeParts[1]);
+ code.setTargetSpeciesDCF(new TargetSpeciesDCFImpl(codeParts[1]));
}
result.add(code);
}
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 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -471,7 +471,7 @@
Profession profession = row.getProfession();
// export.record(SAMPLING.METIER_CODE_DCF5, profession.getCodeDCF5());
- export.record(SAMPLING.METIER_CODE_DCF5, StringUtil.join(profession.getDcf5code(), " et ", true));
+ export.record(SAMPLING.METIER_CODE_DCF5, StringUtil.join(row.getDCF5Code(), " et ", true));
export.record(SAMPLING.METIER_MAILLAGE,
profession.getMeshSize());
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 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -45,10 +45,11 @@
import fr.ifremer.wao.entity.CompanyDAO;
import fr.ifremer.wao.entity.Contact;
import fr.ifremer.wao.entity.ContactDAO;
-import fr.ifremer.wao.entity.DCFFiveCode;
-import fr.ifremer.wao.entity.DCFFiveCodeDAO;
+import fr.ifremer.wao.entity.DCF5Code;
+import fr.ifremer.wao.entity.DCF5CodeDAO;
import fr.ifremer.wao.entity.ElligibleBoat;
import fr.ifremer.wao.entity.ElligibleBoatDAO;
+import fr.ifremer.wao.entity.FishingGearDCF;
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.FishingZoneDAO;
import fr.ifremer.wao.entity.Profession;
@@ -63,6 +64,7 @@
import fr.ifremer.wao.entity.SampleRowLog;
import fr.ifremer.wao.entity.SampleRowLogDAO;
import fr.ifremer.wao.entity.SampleRowLogImpl;
+import fr.ifremer.wao.entity.TargetSpeciesDCF;
import fr.ifremer.wao.entity.WaoUser;
import fr.ifremer.wao.io.ImportResults;
import fr.ifremer.wao.io.ImportResultsImpl;
@@ -98,7 +100,6 @@
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -149,25 +150,43 @@
* The method, insert all new codes in database, the others are already
* inserted so we reference them, so they will be used as foreign key.
*/
- protected Collection<DCFFiveCode> insertOrSelect(TopiaContext transaction,
- Collection<DCFFiveCode> codes) throws TopiaException {
- Collection<DCFFiveCode> result = new LinkedList<DCFFiveCode>();
+ protected Collection<DCF5Code> insertOrSelect(TopiaContext transaction,
+ Collection<DCF5Code> codes) throws TopiaException, WaoBusinessException {
+ Collection<DCF5Code> result = new LinkedList<DCF5Code>();
- for (DCFFiveCode code : codes) {
+ for (DCF5Code code : codes) {
+ FishingGearDCF foundGearCode = WaoDAOHelper.getFishingGearDCFDAO(transaction).
+ findByCode(code.getFishingGearCode());
+ if (foundGearCode == null) {
+ throw new WaoBusinessException(String.format(
+ "%s is not a valid fishing gear code", code.getFishingGearCode()));
+ }
+
+ TargetSpeciesDCF foundSpeciesCode = null;
+ if (code.getTargetSpeciesCode() != null) {
+ foundSpeciesCode = WaoDAOHelper.getTargetSpeciesDCFDAO(transaction).
+ findByCode(code.getTargetSpeciesCode());
+
+ if (foundSpeciesCode == null) {
+ throw new WaoBusinessException(String.format(
+ "%s is not a valid target species code", code.getTargetSpeciesCode()));
+ }
+ }
+
// try do find code in stored entities
- DCFFiveCodeDAO dao = WaoDAOHelper.getDCFFiveCodeDAO(transaction);
+ DCF5CodeDAO dao = WaoDAOHelper.getDCF5CodeDAO(transaction);
// both fishingGear and targetSpecies code have to be equals for
// DCF5 code to be considered equals. targetSpecies as to be null
// if asked
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(DCFFiveCode.FISHING_GEAR_DCF, code.getFishingGearDCF());
+ TopiaQuery query = dao.createQuery()
+ .addEquals(DCF5Code.FISHING_GEAR_DCF, foundGearCode)
- // next line may result in a "IS NULL", exactly what we want
- properties.put(DCFFiveCode.TARGET_SPECIES_DCF, code.getTargetSpeciesDCF());
+ // next line may result in a "IS NULL", exactly what we want
+ .addEquals(DCF5Code.TARGET_SPECIES_DCF, foundSpeciesCode);
- DCFFiveCode foundCode = dao.findByProperties(properties);
+ DCF5Code foundCode = dao.findByQuery(query);
if (log.isDebugEnabled()) {
log.debug("foundCode = " + foundCode);
@@ -178,6 +197,10 @@
log.debug(code + " is not already in DB, inserting");
}
+ // re-use codes already in database
+ code.setFishingGearDCF(foundGearCode);
+ code.setTargetSpeciesDCF(foundSpeciesCode);
+
// not found, let's insert a new row in database for this code
dao.create(code);
// add this new row in the result
@@ -262,16 +285,14 @@
rowLog.addChangePeriod(oldPeriod, newPeriod, pattern);
// before saving profession
- if (row.getProfession().getDcf5code() != null) {
- row.getProfession().setDcf5code(
- insertOrSelect(transaction,
- row.getProfession().getDcf5code()));
+ if (row.getDCF5Code() != null) {
+ row.setDCF5Code(insertOrSelect(transaction, row.getDCF5Code()));
}
// Save Profession
ProfessionDAO professionDAO = WaoDAOHelper.getProfessionDAO(transaction);
context.prepareTopiaId(Profession.class, row.getProfession());
- rowLog.addChangeProfession(oldProfession, row.getProfession());
+ rowLog.addChangeProfession(oldRow, row);
professionDAO.update(row.getProfession());
// Save sampleMonth
@@ -458,7 +479,7 @@
// builder.setFishingZoneProperty(fishingZoneProperty);
// builder.applySamplingFilter(filter);
- WaoQueryHelper.DCFFiveCodeProperty dcf5CodeProperty = WaoQueryHelper.newDCFFiveCodeProperty();
+ WaoQueryHelper.DCF5CodeProperty dcf5CodeProperty = WaoQueryHelper.newDCF5CodeProperty();
// Add join for FishingZone
TopiaQuery query = builder.applySamplingFilter(filter).
@@ -468,7 +489,7 @@
fishingZoneProperty.sectorName(),
fishingZoneProperty.districtCode()).
addLeftJoin(sampleRowProperty.fishingZone(), fishingZoneProperty.$alias(), false).
- addLeftJoin(sampleRowProperty.professionProperty().dcf5code(), dcf5CodeProperty.$alias(), false).
+ addLeftJoin(sampleRowProperty.dCF5Code(), dcf5CodeProperty.$alias(), false).
// Order By facade, sector, districtCode, sampleRowCode
addOrder(fishingZoneProperty.facadeName(),
fishingZoneProperty.sectorName(),
@@ -532,13 +553,13 @@
WaoQueryHelper.SampleRowProperty sampleRowProperty =
builder.initializeForSampleRow(false);
- WaoQueryHelper.DCFFiveCodeProperty dcf5CodeProperty =
- WaoQueryHelper.newDCFFiveCodeProperty();
+ WaoQueryHelper.DCF5CodeProperty dcf5CodeProperty =
+ WaoQueryHelper.newDCF5CodeProperty();
TopiaQuery query = builder.applySamplingFilter(filter).
addDistinct().
setSelect(sampleRowProperty.$alias()).
- addLeftJoin(sampleRowProperty.professionProperty().dcf5code(),
+ addLeftJoin(sampleRowProperty.dCF5Code(),
dcf5CodeProperty.$alias(), false).
addOrder(sampleRowProperty.code());
@@ -828,7 +849,7 @@
Profession profession = row.getProfession();
// export.record(SAMPLING.METIER_CODE_DCF5, profession.getCodeDCF5());
- export.record(SAMPLING.METIER_CODE_DCF5, StringUtil.join(profession.getDcf5code(), " et ", true));
+ export.record(SAMPLING.METIER_CODE_DCF5, StringUtil.join(row.getDCF5Code(), " et ", true));
export.record(SAMPLING.METIER_MAILLAGE, profession.getMeshSize());
export.record(SAMPLING.METIER_TAILLE, profession.getSize());
@@ -914,8 +935,7 @@
errorArgs.set(0, currRow);
errorArgs.set(1, code);
- String districts = ImportHelper.read(reader,
- FISHING_ZONE.PECHE_DIVISION);
+ String districts = ImportHelper.read(reader, FISHING_ZONE.PECHE_DIVISION);
row = dao.findByCode(code);
// Refuse existing SampleRow
@@ -1009,9 +1029,6 @@
profession.setLibelle(libelle);
profession.setSpecies(especes);
- // profession.setCodeDCF5(codeDCF5);
- profession.setDcf5code(insertOrSelect(transaction, ImportHelper.readDCF5Codes(reader)));
-
return profession;
}
@@ -1149,22 +1166,11 @@
@Override
protected Set<String> executeGetDCFGears(TopiaContext transaction, SamplingFilter filter) throws Exception {
- TopiaQuery query = WaoDAOHelper.getDCFFiveCodeDAO(transaction).createQuery();
- query.setSelect(DCFFiveCode.FISHING_GEAR_DCF);
- query.addDistinct();
- List<String> dcfGears = transaction.findByQuery(query);
- Set<String> result = new HashSet<String>(dcfGears);
- return result;
+ throw new UnsupportedOperationException();
}
@Override
protected Set<String> executeGetDCFSpecies(TopiaContext transaction, SamplingFilter filter) throws Exception {
- TopiaQuery query = WaoDAOHelper.getDCFFiveCodeDAO(transaction).createQuery();
- query.setSelect(DCFFiveCode.TARGET_SPECIES_DCF)
- .addNotNull(DCFFiveCode.TARGET_SPECIES_DCF)
- .addDistinct();
- List<String> dcfGears = transaction.findByQuery(query);
- Set<String> result = new HashSet<String>(dcfGears);
- return result;
+ throw new UnsupportedOperationException();
}
}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -54,7 +54,6 @@
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.Company;
import fr.ifremer.wao.entity.Contact;
-import fr.ifremer.wao.entity.ContactDAO;
import fr.ifremer.wao.entity.Indicator;
import fr.ifremer.wao.entity.IndicatorDAO;
import fr.ifremer.wao.entity.IndicatorLevel;
@@ -393,9 +392,6 @@
// only if there is no unfinished sampleRow or no contact done
Map<String, Double> results = new HashMap<String, Double>();
- ContactDAO dao = WaoDAOHelper.getContactDAO(transaction);
-
-
WaoQueryBuilder builder = context.newQueryBuilder();
ContactProperty contactProperty = builder.initializeForContact();
TopiaQuery query = builder.applySamplingFilter(filter).
@@ -602,10 +598,6 @@
Map<String, ContactAverageReactivity> results = new HashMap<String, ContactAverageReactivity>();
- ContactDAO dao = WaoDAOHelper.getContactDAO(transaction);
-
- //TopiaQuery query = dao.createQueryDoneContactsFromDate(null, period.getFromDate());
-
String contactAlias = query.getMainAlias();
String companyProperty =
TopiaQuery.getProperty(contactAlias, Contact.OBSERVER, WaoUser.COMPANY);
Modified: trunk/wao-business/src/main/xmi/wao.properties
===================================================================
--- trunk/wao-business/src/main/xmi/wao.properties 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/main/xmi/wao.properties 2010-11-25 15:30:03 UTC (rev 801)
@@ -14,7 +14,9 @@
fr.ifremer.wao.entity.SampleRow.attribute.fishingZone.tagvalue.orderBy=facadeName,sectorName,districtCode
fr.ifremer.wao.entity.SampleRow.attribute.company.tagvalue.lazy=false
fr.ifremer.wao.entity.SampleRow.attribute.profession.tagvalue.lazy=false
-fr.ifremer.wao.entity.Profession.attribute.dcf5code.tagvalue.lazy=false
+fr.ifremer.wao.entity.SampleRow.attribute.dCF5Code.tagvalue.lazy=false
+fr.ifremer.wao.entity.DCF5Code.attribute.fishingGearDCF.tagvalue.lazy=false
+fr.ifremer.wao.entity.DCF5Code.attribute.targetSpeciesDCF.tagvalue.lazy=false
#fr.ifremer.wao.entity.SampleRow.attribute.elligibleBoat.tagvalue.lazy=false
fr.ifremer.wao.entity.SampleRow.attribute.elligibleBoat.tagvalue.orderBy=companyActive
#fr.ifremer.wao.entity.SampleRow.attribute.sampleRowLog.tagvalue.lazy=false
Modified: trunk/wao-business/src/main/xmi/wao.zargo
===================================================================
(Binary files differ)
Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/WaoMigrationCallBackTest.java
===================================================================
--- trunk/wao-business/src/test/java/fr/ifremer/wao/WaoMigrationCallBackTest.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/test/java/fr/ifremer/wao/WaoMigrationCallBackTest.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -20,17 +20,12 @@
*/
package fr.ifremer.wao;
-import fr.ifremer.wao.entity.DCFFiveCode;
import org.junit.Test;
import org.mockito.Mockito;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
import java.util.List;
-import java.util.Map;
import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNull;
public class WaoMigrationCallBackTest {
@@ -44,23 +39,23 @@
Mockito.when(migration.splitCodeDCF5_1_6(code)).thenCallRealMethod();
// now, the split
- List<DCFFiveCode> codes = migration.splitCodeDCF5_1_6(code);
+ List<String[]> codes = migration.splitCodeDCF5_1_6(code);
// first code
- assertEquals("AAA", codes.get(0).getFishingGearDCF());
- assertEquals("BBB", codes.get(0).getTargetSpeciesDCF());
+ assertEquals("AAA", codes.get(0)[0]);
+ assertEquals("BBB", codes.get(0)[1]);
// second code
- assertEquals("CCC", codes.get(1).getFishingGearDCF());
- assertEquals("DDD", codes.get(1).getTargetSpeciesDCF());
+ assertEquals("CCC", codes.get(1)[0]);
+ assertEquals("DDD", codes.get(1)[1]);
// third code
- assertEquals("EEE", codes.get(2).getFishingGearDCF());
- assertNull(codes.get(2).getTargetSpeciesDCF());
+ assertEquals("EEE", codes.get(2)[0]);
+ assertEquals(1, codes.get(2).length);
// last code
- assertEquals("FFF", codes.get(3).getFishingGearDCF());
- assertNull(codes.get(3).getTargetSpeciesDCF());
+ assertEquals("FFF", codes.get(3)[0]);
+ assertEquals(1, codes.get(2).length);
}
Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/entity/BoatImplTest.java
===================================================================
--- trunk/wao-business/src/test/java/fr/ifremer/wao/entity/BoatImplTest.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/test/java/fr/ifremer/wao/entity/BoatImplTest.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -122,7 +122,7 @@
SampleRowDAO rowDAO = WaoDAOHelper.getSampleRowDAO(transaction);
SampleRow row = rowDAO.findByCode("2010_0001");
row.getCompany();
- row.getProfession().sizeDcf5code();
+ row.getProfession();
row.sizeElligibleBoat();
row.sizeSampleMonth();
transaction.closeContext();
Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java
===================================================================
--- trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -239,11 +239,11 @@
// Get two SampleRows : 2009_3 & 2010_4
SampleRowDAO rowDAO = WaoDAOHelper.getSampleRowDAO(transaction);
SampleRow row1 = rowDAO.findByCode("2009_0003");
- row1.getProfession().sizeDcf5code();
+ row1.getProfession();
row1.sizeElligibleBoat();
row1.sizeSampleMonth();
SampleRow row2 = rowDAO.findByCode("2010_0004");
- row2.getProfession().sizeDcf5code();
+ row2.getProfession();
row2.sizeElligibleBoat();
row2.sizeSampleMonth();
Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java
===================================================================
--- trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -37,8 +37,12 @@
import fr.ifremer.wao.entity.Contact;
import fr.ifremer.wao.entity.ContactDAO;
import fr.ifremer.wao.entity.ContactImpl;
+import fr.ifremer.wao.entity.DCF5Code;
+import fr.ifremer.wao.entity.DCF5CodeImpl;
import fr.ifremer.wao.entity.ElligibleBoat;
import fr.ifremer.wao.entity.ElligibleBoatDAO;
+import fr.ifremer.wao.entity.FishingGearDCFDAO;
+import fr.ifremer.wao.entity.FishingGearDCFImpl;
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.FishingZoneDAO;
import fr.ifremer.wao.entity.Profession;
@@ -49,6 +53,7 @@
import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.entity.SampleRowDAO;
import fr.ifremer.wao.entity.SampleRowLogImpl;
+import fr.ifremer.wao.entity.TargetSpeciesDCFImpl;
import fr.ifremer.wao.entity.WaoUser;
import fr.ifremer.wao.io.ImportResults;
import org.junit.Assert;
@@ -98,6 +103,14 @@
ServiceBoatImpl serviceBoat = (ServiceBoatImpl) manager.getServiceBoat();
serviceBoat.importBoatCsv(input);
+ // add DRB, DRH and ALG as existing codes
+ FishingGearDCFDAO fishingGearDCFDAO = WaoDAOHelper.getFishingGearDCFDAO(transaction);
+ fishingGearDCFDAO.create(new FishingGearDCFImpl("DRB"));
+ fishingGearDCFDAO.create(new FishingGearDCFImpl("DRH"));
+ WaoDAOHelper.getTargetSpeciesDCFDAO(transaction).create(new TargetSpeciesDCFImpl("ALG"));
+
+ transaction.commitTransaction();
+
transaction.closeContext();
// CREATE
@@ -134,10 +147,22 @@
row.setFishingZone(zones);
row.setFishingZonesInfos("port tres loin du champ");
+ // for row, add DCF5 codes DRB_ALG, DRH
+ Collection<DCF5Code> dcf5codes = new ArrayList<DCF5Code>();
+ DCF5Code dcf5 = new DCF5CodeImpl();
+ dcf5.setFishingGearDCF(new FishingGearDCFImpl("DRB"));
+ dcf5.setTargetSpeciesDCF(new TargetSpeciesDCFImpl("ALG"));
+ dcf5codes.add(dcf5);
+ dcf5 = new DCF5CodeImpl();
+ dcf5.setFishingGearDCF(new FishingGearDCFImpl("DRH"));
+ dcf5codes.add(dcf5);
+ row.setDCF5Code(dcf5codes);
+
/** EXEC CREATE **/
List<Boat> boats = serviceBoat.getBoatsByImmatriculations("174592 978419 273129");
serviceSampling.createUpdateSampleRow(row, boats, new SampleRowLogImpl());
assertNotNull(row.getTopiaId());
+
assertNotNull(row.getProfession().getTopiaId());
SampleRow result = serviceSampling.getSampleRow(row.getTopiaId());
@@ -474,7 +499,7 @@
SampleRowDAO rowDAO = WaoDAOHelper.getSampleRowDAO(transaction);
SampleRow row = rowDAO.findByCode("2010_0001");
row.getProfession();
- row.getProfession().sizeDcf5code();
+ row.getProfession();
row.getCompany();
row.sizeSampleMonth();
row.sizeElligibleBoat();
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -30,8 +30,7 @@
import fr.ifremer.wao.bean.UserRole;
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.Company;
-import fr.ifremer.wao.entity.DCFFiveCode;
-import fr.ifremer.wao.entity.DCFFiveCodeImpl;
+import fr.ifremer.wao.entity.DCF5Code;
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.Profession;
import fr.ifremer.wao.entity.ProfessionImpl;
@@ -223,7 +222,7 @@
public String getDcf5codes() {
if (dcf5codes == null) {
- Collection<DCFFiveCode> codes = getSampleRow().getProfession().getDcf5code();
+ Collection<DCF5Code> codes = getSampleRow().getDCF5Code();
if (CollectionUtils.isEmpty(codes)) {
dcf5codes = "";
} else {
@@ -634,8 +633,7 @@
"Un commentaire est obligatoire lors d'une modification de la ligne");
}
- Profession profession = getSampleRow().getProfession();
- if (CollectionUtils.isEmpty(profession.getDcf5code())) {
+ if (CollectionUtils.isEmpty(getSampleRow().getDCF5Code())) {
sampleRowForm.recordError(
"Le métier doit obligatoirement avoir un Code DCF niveau 5");
}
@@ -681,7 +679,7 @@
getSampleRow().setSampleMonth(getSampleMonths());
// save dcf5 codes
- getSampleRow().getProfession().setDcf5code(getDcf5codes(), ", ");
+ getSampleRow().setDCF5Code(getDcf5codes(), ", ");
serviceSampling.createUpdateSampleRow(sampleRow, boats, getSampleRowLog());
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 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -30,7 +30,7 @@
import fr.ifremer.wao.bean.FacadeRow;
import fr.ifremer.wao.bean.SamplingFilter;
import fr.ifremer.wao.bean.SamplingFilterImpl;
-import fr.ifremer.wao.entity.DCFFiveCode;
+import fr.ifremer.wao.entity.DCF5Code;
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.SampleMonth;
import fr.ifremer.wao.entity.SampleRow;
@@ -247,61 +247,6 @@
return this;
}
- @Property
- private boolean refreshSampleRowCodeZone;
-
- @Property
- private int sampleRowCodeIndex;
-
- @Persist
- @Property
- private SampleRow selectedSampleRow;
-
- @InjectComponent
- private Zone sampleRowZone;
-
- public void onChangeFromSelectedSampleRow(String sampleRowCode) {
- if (sampleRowCode == null) {
- selectedSampleRow = null;
- } else {
- selectedSampleRow = getSampleRowSelectModel().findObject(sampleRowCode);
- if (logger.isDebugEnabled()) {
- logger.debug("selectedSampleRow " + selectedSampleRow.getCode());
- }
- }
- }
-
- public Object onActionFromAddSampleRowCode() {
-
- if (getFilter().getSampleRows() == null) {
- getFilter().setSampleRows(new ArrayList<SampleRow>());
- }
- getFilter().getSampleRows().add(selectedSampleRow);
-
- if (logger.isDebugEnabled()) {
- logger.debug("added filter on code " + selectedSampleRow.getCode());
- }
-
- selectedSampleRow = null;
- refreshSampleRowCodeZone = true;
- return sampleRowZone;
- }
-
- public Object onActionFromRemoveSampleRowCode(int sampleRowCodeIndex) {
-
- logger.debug("should remove " + sampleRowCodeIndex);
-
- SampleRow sampleRowToRemove = getFilter().getSampleRows().get(sampleRowCodeIndex);
-
- logger.debug("will remove " + sampleRowToRemove.getCode());
-
- boolean result = getFilter().getSampleRows().remove(sampleRowToRemove);
- logger.debug("removed " + result);
-
- refreshSampleRowCodeZone = true;
- return sampleRowZone;
- }
-
/**************************** MAIN ACTIONS ********************************/
@Persist
@@ -343,7 +288,7 @@
/* variable used in template */
@Property
- private DCFFiveCode dcf5code;
+ private DCF5Code dcf5code;
/**
* Current SampleRow from loop
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 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/ContactModelFactory.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -266,7 +266,7 @@
@Override
public Object get(Object arg0) {
Contact contact = (Contact)arg0;
- return contact.getSampleRow().getProfession().getCode();
+ return contact.getSampleRow().getProfessionDescription();
}
@Override
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/WaoManager.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/WaoManager.java 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/WaoManager.java 2010-11-25 15:30:03 UTC (rev 801)
@@ -182,7 +182,7 @@
DateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
Profession profession = row.getProfession();
result.append("<strong>Métier : </strong>").
- append(profession.getCode());
+ append(row.getProfessionDescription());
result.append(" - ").append(profession.getLibelle());
if (!StringUtils.isEmpty(profession.getSpecies())) {
result.append("\n<strong>Espèces cibles : </strong>").
@@ -231,7 +231,7 @@
if (filter.getSampleRow() != null) {
Profession profession = filter.getSampleRow().getProfession();
result.append(separator).
- append("\nMétier ").append(profession.getCode());
+ append("\nMétier ").append(filter.getSampleRow().getCode());
if (StringUtils.isNotEmpty(profession.getLibelle())) {
result.append(" - ").append(profession.getLibelle());
}
Modified: trunk/wao-ui/src/main/webapp/SamplingPlan.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2010-11-24 16:18:47 UTC (rev 800)
+++ trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2010-11-25 15:30:03 UTC (rev 801)
@@ -30,19 +30,6 @@
<t:layout t:pageTitle="Plan d'Echantillonnage" t:contentId="so-sampling"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
<div class="${mainClass}">
- <!--<t:if t:test="canImportSamplingPlan()">-->
- <!--<div class="so-import">-->
- <!--<form t:type="form" t:id="importSamplingPlan" action="post">-->
- <!--<fieldset>-->
- <!--<legend>Import d'un nouveau plan d'échantillonnage</legend>-->
- <!--<t:errors />-->
- <!--<t:label for="samplingPlanCsvFile" /> :-->
- <!--<input t:type="upload" t:id="samplingPlanCsvFile" t:validate="required" />-->
- <!--<input t:type="submit" class="ico import" value="OK" title="Importer un plan d'échantillonnage (format CSV avec encodage UTF-8)" />-->
- <!--</fieldset>-->
- <!--</form>-->
- <!--</div>-->
- <!--</t:if>-->
<div class="clearfix mbottom10">
<div class="clearfix">
<h1 class="fleft">Plan d'échantillonnage</h1>
@@ -89,17 +76,7 @@
</t:if>
</t:if>
</div>
- </div>
- <!--form t:type="form" t:id="periodForm" action="post">
- <div>
- <t:label t:for="periodBegin" /> :
- <input t:type="datefield" class="width70" t:id="periodBegin" t:value="period.fromDate" t:format="MM/yyyy" t:validate="required"/>
- <t:label t:for="periodEnd" /> :
- <input t:type="datefield" class="width70" t:id="periodEnd" t:value="period.thruDate" t:format="MM/yyyy" t:validate="required" />
- <input t:type="submit" class="ico search" value="Search" t:title="Affichage des lignes du plan couvertes par la période sélectionnée" />
- <a t:type="actionlink" t:id="showFilters" t:zone="so-sampling-filters" class="display-form">recherche avancée</a>
- </div>
- </form-->
+ </div>
<div>
Pour la pédiode du <t:output value="period.fromDate" format="dateFormat" /> au <t:output value="period.thruDate" format="dateFormat" />
<a t:type="actionlink" t:id="showFilters" t:zone="so-sampling-filters" class="display-form"><img src="${asset:context:img/search.png}" /> recherche avancée</a>
@@ -144,24 +121,6 @@
${row.code}
</li>
</ul>
- <t:zone id="so-sampling-sampleRowZone" t:id="sampleRowZone" t:update="show">
- <!--t:nuiton.subForm t:visible="refreshSampleRowCodeZone">
- <t:label t:for="selectedSampleRow" />:
- <select t:type="select" t:id="selectedSampleRow" t:value="selectedSampleRow" t:model="sampleRowSelectModel"
- t:mixins="ck/onEvent" t:event="change"/>
- <a t:type="actionlink" t:id="addSampleRowCode" title="Ajouter un code de ligne" t:zone="so-sampling-sampleRowZone">
- <img src="${asset:context:img/add-16px.png}" />
- </a>
- <ul>
- <li style="display: inline;" t:type="loop" t:source="filter.sampleRows" t:value="row" t:index="sampleRowCodeIndex" t:volatile="true">
- ${row.code}
- <a t:type="actionlink" t:id="removeSampleRowCode" t:context="sampleRowCodeIndex" title="Supprimer ce code de ligne" t:zone="so-sampling-sampleRowZone">
- <img src="${asset:context:img/remove-22px.png}" />
- </a>
- </li>
- </ul>
- </t:nuiton.subForm-->
- </t:zone>
</div>
<div>
<t:label t:for="fishingGearDCF" /> :
@@ -263,8 +222,8 @@
<td>${fishingZones}</td>
<td>${row.fishingZonesInfos}</td>
<td>
- <t:loop source="row.profession.dcf5code" value="dcf5code">
- <span t:type="ck/Tooltip" t:value="${dcf5Code.fishingGearDCF} - ${dcf5Code.fishingGearDCFDescription} ; ${dcf5Code.targetSpeciesDCF} - ${dcf5Code.targetSpeciesDCFDescription}" t:effect="appear">
+ <t:loop source="row.dcf5code" value="dcf5code">
+ <span t:type="ck/Tooltip" t:value="${dcf5Code.fishingGearCode} - ${dcf5Code.fishingGearDescription} ; ${dcf5Code.targetSpeciesCode} - ${dcf5Code.targetSpeciesDescription}" t:effect="appear">
${dcf5Code}
</span>
</t:loop>
@@ -283,12 +242,12 @@
</span>
</td>
<td>
- <t:loop source="row.profession.dcf5code" value="dcf5code">
- <span t:type="ck/Tooltip" t:value="${dcf5Code.fishingGearDCF} - ${dcf5Code.fishingGearDCFDescription} ; ${dcf5Code.targetSpeciesDCF} - ${dcf5Code.targetSpeciesDCFDescription}" t:effect="appear">
+ <t:loop source="row.dcf5code" value="dcf5code">
+ <span t:type="ck/Tooltip" t:value="${dcf5Code.fishingGearCode} - ${dcf5Code.fishingGearDescription} ; ${dcf5Code.targetSpeciesCode} - ${dcf5Code.targetSpeciesDescription}" t:effect="appear">
${dcf5Code}
</span>
</t:loop>
- ${row.profession.codeWithoutDCF5}
+ ${row.professionDescriptionWithoutDCF5}
</td>
<td class="bright">
<span t:type="ck/Tooltip" title="Infos" t:value="Espèces cibles : ${row.profession.species}" t:effect="appear">
1
0
[Suiviobsmer-commits] r800 - trunk/src/announcement
by bleny@users.labs.libre-entreprise.org 24 Nov '10
by bleny@users.labs.libre-entreprise.org 24 Nov '10
24 Nov '10
Author: bleny
Date: 2010-11-24 16:18:47 +0000 (Wed, 24 Nov 2010)
New Revision: 800
Log:
1.6 announcement mail
Added:
trunk/src/announcement/release-email-1.6.txt
Added: trunk/src/announcement/release-email-1.6.txt
===================================================================
--- trunk/src/announcement/release-email-1.6.txt (rev 0)
+++ trunk/src/announcement/release-email-1.6.txt 2010-11-24 16:18:47 UTC (rev 800)
@@ -0,0 +1,26 @@
+
+La nouvelle version 1.6 de l'applicatif Wao est disponible ! Cette version
+améliore les filtres de la synthèse, permet d'évaluer la qualité de la donnée,
+améliore le plan d'échantillonage et ajoute les indicateurs.
+
+Nouveautés :
+
+- ajout de la synthèse globale [bleny-Evo #2562]
+- factorisation des filtres de la synthèse [bleny-Evo #2561]
+- ajout du critère qualité de la donnée [bleny-Evo #2556]
+- mise en valeur des lignes modifiées dans le plan d'échantillonage [bleny-Evo #2563]
+- Amélioration cartographie des contacts [bleny-Evo #2365]
+- Décomposition code métier DCF [bleny-Evo #2353]
+
+Documentation :
+
+http://suiviobsmer.labs.libre-entreprise.org/wao/
+
+Téléchargement :
+
+https://labs.libre-entreprise.org/frs/?group_id=154
+
+Cordialement,
+
+L'équipe Wao
+
1
0
[Suiviobsmer-commits] r799 - in trunk: 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/webapp
by bleny@users.labs.libre-entreprise.org 24 Nov '10
by bleny@users.labs.libre-entreprise.org 24 Nov '10
24 Nov '10
Author: bleny
Date: 2010-11-24 11:08:19 +0000 (Wed, 24 Nov 2010)
New Revision: 799
Log:
update second synthesis
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java
trunk/wao-business/src/main/xmi/wao.zargo
trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java
trunk/wao-ui/src/main/webapp/Synthesis.tml
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-11-23 14:59:18 UTC (rev 798)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-11-24 11:08:19 UTC (rev 799)
@@ -214,10 +214,8 @@
@Override
protected BoardingResult executeGetBoardingBoats(TopiaContext transaction, SamplingFilter filter) throws Exception {
Map<String, Integer> mapBoarding = new LinkedHashMap<String, Integer>();
- Map<String, Integer> mapInvalidBoarding = new LinkedHashMap<String, Integer>();
BoardingResult result = new BoardingResultImpl();
result.setBoardings(mapBoarding);
- result.setInvalidBoarding(mapInvalidBoarding);
// Initialize max boardings and its max key value
final int MAX_BOARDINGS = 12;
@@ -225,13 +223,10 @@
// Prepare map which contains for each entry the number of boardings
// for the key and the number of boats for the value.
- mapInvalidBoarding.put(String.valueOf(0), 0);
for (int i = 1; i < MAX_BOARDINGS; i++) {
mapBoarding.put(String.valueOf(i), 0);
- mapInvalidBoarding.put(String.valueOf(i), 0);
}
mapBoarding.put(maxBoardingsKey, 0);
- mapInvalidBoarding.put(maxBoardingsKey, 0);
// The number of boardings is the number of finished contacts
// Use fromDate to filter contacts finished from this date
@@ -296,11 +291,12 @@
Date lastTideBeginDate = null;
int currentBoardingCount = 1;
- int currentInvalidBoardingCount = 0;
int maxBoardingCount = -1;
Boat maxBoardingBoat = null;
+ int invalidBoardingCount = 0;
+
// We will browse result line after line, at each line, we know what was
// in the last line. By Comparing we know if it's the same boat.
// If yes, check sample-row and date to count a possible invalid
@@ -327,7 +323,7 @@
if (sampleRowCode.equals(lastSampleRowCode) &&
DateUtil.getDifferenceInMonths(lastTideBeginDate, tideBeginDate) <= 3) {
- currentInvalidBoardingCount += 1;
+ invalidBoardingCount += 1;
}
}
@@ -367,24 +363,12 @@
Integer oldValue = mapBoarding.get(key);
mapBoarding.put(key, oldValue + 1);
- // update mapInvalidBoarding
- if (currentInvalidBoardingCount >= MAX_BOARDINGS) {
- key = maxBoardingsKey;
- } else {
- key = String.valueOf(currentInvalidBoardingCount);
- }
-
- oldValue = mapInvalidBoarding.get(key);
- mapInvalidBoarding.put(key, oldValue + 1);
-
if (log.isDebugEnabled()) {
- log.debug(lastBoatName + " made " + currentBoardingCount + " boardings and "
- + currentInvalidBoardingCount + " invalid boardings");
+ log.debug(lastBoatName + " made " + currentBoardingCount + " boardings");
}
// re-initialize values for the new boat in the lines
currentBoardingCount = 1;
- currentInvalidBoardingCount = 0;
}
lastBoatName = boatName;
@@ -394,6 +378,9 @@
result.setMaxBoardingValue(maxBoardingCount);
result.setMaxBoardingBoat(maxBoardingBoat);
+ result.setBoardingsCount(nbBoardingsByBoat.size());
+ result.setInvalidBoardingsCount(invalidBoardingCount);
+ result.setValidBoardingsCount(nbBoardingsByBoat.size() - invalidBoardingCount);
return result;
}
@@ -905,16 +892,11 @@
/** return null if 0 boarding */
protected Double getIndicatorValueForBoarding(SamplingFilter filter) {
BoardingResult boardingResult = getBoardingBoats(filter);
-
- int numberOfBoatsWithZeroInvalidBoarding = boardingResult.getInvalidBoarding().get(String.valueOf(0));
- int totalNumberOfBoarding = 0;
- for (Integer numberOfBoarding : boardingResult.getBoardings().values()) {
- totalNumberOfBoarding += numberOfBoarding;
- }
+ int boardingsCount = boardingResult.getBoardingsCount();
Double rate = null;
- if (totalNumberOfBoarding > 0) {
- rate = ((double) numberOfBoatsWithZeroInvalidBoarding /
- (double) totalNumberOfBoarding) * 100.0;
+ if (boardingsCount > 0) {
+ rate = ((double) boardingResult.getValidBoardingsCount() /
+ (double) boardingsCount) * 100.0;
}
return rate;
}
Modified: trunk/wao-business/src/main/xmi/wao.zargo
===================================================================
(Binary files differ)
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-11-23 14:59:18 UTC (rev 798)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-11-24 11:08:19 UTC (rev 799)
@@ -352,12 +352,7 @@
Map<String, Map<?, Integer>> data =
new LinkedHashMap<String, Map<?, Integer>>();
- // remove column with number of boats with 0 invalid boarding, we
- // don't want it to be showed in the graph.
- // getBoardingResult().getInvalidBoarding().remove(String.valueOf(0));
-
// put invalid first to get red color
- data.put("Nombre de navires ayant effectués x embarquements invalides", getBoardingResult().getInvalidBoarding());
data.put("Nombre de navires ayant effectués x embarquements", getBoardingResult().getBoardings());
String title = "Sollicitations des navires depuis le " +
Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-11-23 14:59:18 UTC (rev 798)
+++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-11-24 11:08:19 UTC (rev 799)
@@ -189,6 +189,9 @@
Navire le plus sollicité avec ${boardingResult.maxBoardingValue} embarquements :
<strong>${boardingResult.maxBoardingBoat.name} (${boardingResult.maxBoardingBoat.immatriculation})</strong>
</p>
+ <p>
+ Au total, ${boardingResult.invalidBoardingsCount} embarquements invalides sur ${boardingResult.boardingsCount} embarquements.
+ </p>
</t:if>
<t:if test="user.indicatorsViewer">
1
0
[Suiviobsmer-commits] r798 - in trunk: src/site/rst wao-business/src/main/java/fr/ifremer/wao/bean wao-business/src/main/java/fr/ifremer/wao/entity wao-business/src/main/java/fr/ifremer/wao/io/csv wao-business/src/main/java/fr/ifremer/wao/service wao-business/src/test/java/fr/ifremer/wao wao-business/src/test/java/fr/ifremer/wao/service wao-ui/src/main/java/fr/ifremer/wao/ui/components wao-ui/src/main/java/fr/ifremer/wao/ui/pages wao-ui/src/main/webapp/css
by bleny@users.labs.libre-entreprise.org 23 Nov '10
by bleny@users.labs.libre-entreprise.org 23 Nov '10
23 Nov '10
Author: bleny
Date: 2010-11-23 14:59:18 +0000 (Tue, 23 Nov 2010)
New Revision: 798
Log:
update file header + fix contacts CSV imports (data reliability was missing)
Modified:
trunk/src/site/rst/obsdeb.rst
trunk/wao-business/src/main/java/fr/ifremer/wao/bean/DataReliability.java
trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalIndicatorValue.java
trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisParametersImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCFFiveCodeImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv/WaoCsvHeader.java
trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java
trunk/wao-business/src/test/java/fr/ifremer/wao/WaoMigrationCallBackTest.java
trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceContactInternalTest.java
trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/IndicatorLevels.java
trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/IndicatorsHistory.java
trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java
trunk/wao-ui/src/main/webapp/css/cartography.css
trunk/wao-ui/src/main/webapp/css/synthesis-print.css
Modified: trunk/src/site/rst/obsdeb.rst
===================================================================
--- trunk/src/site/rst/obsdeb.rst 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/src/site/rst/obsdeb.rst 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+.. -
+.. * #%L
+.. * Wao
+.. * %%
+.. * Copyright (C) 2009 - 2010 Ifremer
+.. * %%
+.. * 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%
+.. -
====================================
OBSDEB : Observation au débarquement
====================================
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/DataReliability.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/DataReliability.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/DataReliability.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.bean;
import static org.nuiton.i18n.I18n._;
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalIndicatorValue.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalIndicatorValue.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalIndicatorValue.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.bean;
import static org.nuiton.i18n.I18n._;
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisParametersImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisParametersImpl.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisParametersImpl.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.bean;
import fr.ifremer.wao.entity.Indicator;
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.bean;
import fr.ifremer.wao.entity.Indicator;
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCFFiveCodeImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCFFiveCodeImpl.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/DCFFiveCodeImpl.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.entity;
import static org.nuiton.i18n.I18n._;
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.entity;
import fr.ifremer.wao.bean.SynthesisId;
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.entity;
import org.slf4j.Logger;
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv/WaoCsvHeader.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv/WaoCsvHeader.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv/WaoCsvHeader.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -331,11 +331,9 @@
/** Contact company validation **/
CONT_SOCIETE_VALID(31),
/** Contact program validation **/
- CONT_PROGRAM_VALID(32);
-// /** Contact company comment **/
-// CONT_COMMENT_SOCIETE(33),
-// /** Contact program comment **/
-// CONT_COMMENT_PROGRAM(34);
+ CONT_PROGRAM_VALID(32),
+ /** Data reliability **/
+ CONT_DATA_RELIABILITY(33);
private int contactHeader;
@@ -364,8 +362,8 @@
}
public static int getTotalHeaders() {
- // CONT_PROGRAM_VALID is the last column
- return CONT_PROGRAM_VALID.forContactCsv() + 1;
+ // CONT_DATA_RELIABILITY is the last column
+ return CONT_DATA_RELIABILITY.forContactCsv() + 1;
}
public static String formatValidation(Boolean validation) {
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 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -434,6 +434,8 @@
CONTACT.formatValidation(contact.getValidationCompany()));
export.record(CONTACT.CONT_PROGRAM_VALID,
CONTACT.formatValidation(contact.getValidationProgram()));
+ export.record(CONTACT.CONT_DATA_RELIABILITY,
+ String.valueOf(contact.getDataReliabilityOrdinal()));
// Observer part
WaoUser observer = contact.getObserver();
@@ -694,6 +696,9 @@
contactCode, createDateCsv);
contact.setTopiaCreateDate(createDate);
+
+ contact.setDataReliabilityOrdinal(
+ ImportHelper.readInt(reader, CONTACT.CONT_DATA_RELIABILITY));
}
/**
Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/WaoMigrationCallBackTest.java
===================================================================
--- trunk/wao-business/src/test/java/fr/ifremer/wao/WaoMigrationCallBackTest.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/test/java/fr/ifremer/wao/WaoMigrationCallBackTest.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao;
import fr.ifremer.wao.entity.DCFFiveCode;
Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceContactInternalTest.java
===================================================================
--- trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceContactInternalTest.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceContactInternalTest.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -574,6 +574,8 @@
String comment = "Commentaire sur le contact\nAutre ligne";
when(reader.get(CONTACT.CONT_COMMENT.name())).
thenReturn(comment);
+ when(reader.get(CONTACT.CONT_DATA_RELIABILITY.name())).
+ thenReturn("0");
when(creator.getCompany()).thenReturn(company);
when(creator.isAdmin()).thenReturn(false);
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/IndicatorLevels.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/IndicatorLevels.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/IndicatorLevels.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Web Interface
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.ui.components;
import fr.ifremer.wao.entity.Indicator;
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/IndicatorsHistory.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/IndicatorsHistory.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/IndicatorsHistory.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Web Interface
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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.wao.ui.pages;
import fr.ifremer.wao.bean.UserRole;
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-11-23 14:59:18 UTC (rev 798)
@@ -354,10 +354,11 @@
// remove column with number of boats with 0 invalid boarding, we
// don't want it to be showed in the graph.
- getBoardingResult().getInvalidBoarding().remove(String.valueOf(0));
+ // getBoardingResult().getInvalidBoarding().remove(String.valueOf(0));
+ // put invalid first to get red color
+ data.put("Nombre de navires ayant effectués x embarquements invalides", getBoardingResult().getInvalidBoarding());
data.put("Nombre de navires ayant effectués x embarquements", getBoardingResult().getBoardings());
- data.put("Nombre de navires ayant effectués x embarquements invalides", getBoardingResult().getInvalidBoarding());
String title = "Sollicitations des navires depuis le " +
getDateFormat().format(getFilter().getPeriod().getFromDate());
Modified: trunk/wao-ui/src/main/webapp/css/cartography.css
===================================================================
--- trunk/wao-ui/src/main/webapp/css/cartography.css 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-ui/src/main/webapp/css/cartography.css 2010-11-23 14:59:18 UTC (rev 798)
@@ -8,12 +8,12 @@
* 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%
@@ -86,4 +86,4 @@
#so-footer a:hover {
color: white !important;
-}
\ No newline at end of file
+}
Modified: trunk/wao-ui/src/main/webapp/css/synthesis-print.css
===================================================================
--- trunk/wao-ui/src/main/webapp/css/synthesis-print.css 2010-11-22 14:45:55 UTC (rev 797)
+++ trunk/wao-ui/src/main/webapp/css/synthesis-print.css 2010-11-23 14:59:18 UTC (rev 798)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Wao :: Web Interface
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * 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%
+ */
* {
1
0
[Suiviobsmer-commits] r797 - in trunk: src/site/resources/schemas wao-business/src/main/xmi
by bleny@users.labs.libre-entreprise.org 22 Nov '10
by bleny@users.labs.libre-entreprise.org 22 Nov '10
22 Nov '10
Author: bleny
Date: 2010-11-22 14:45:55 +0000 (Mon, 22 Nov 2010)
New Revision: 797
Log:
update model for doc ; export PNG for site
Modified:
trunk/src/site/resources/schemas/CU_WAO.png
trunk/src/site/resources/schemas/Modele_WAO.png
trunk/wao-business/src/main/xmi/wao.zargo
Modified: trunk/src/site/resources/schemas/CU_WAO.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/schemas/Modele_WAO.png
===================================================================
(Binary files differ)
Modified: trunk/wao-business/src/main/xmi/wao.zargo
===================================================================
(Binary files differ)
1
0
Author: tchemit
Date: 2010-11-21 14:25:49 +0000 (Sun, 21 Nov 2010)
New Revision: 796
Log:
Update mavenpom4labs to 2.4.1.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-11-19 19:23:04 UTC (rev 795)
+++ trunk/pom.xml 2010-11-21 14:25:49 UTC (rev 796)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4labs</artifactId>
- <version>2.4</version>
+ <version>2.4.1</version>
</parent>
<groupId>fr.ifremer</groupId>
1
0
19 Nov '10
Author: bleny
Date: 2010-11-19 19:23:04 +0000 (Fri, 19 Nov 2010)
New Revision: 795
Log:
pr?\195?\169sentation de obsdeb dans la doc
Added:
trunk/src/site/rst/obsdeb.rst
Added: trunk/src/site/rst/obsdeb.rst
===================================================================
--- trunk/src/site/rst/obsdeb.rst (rev 0)
+++ trunk/src/site/rst/obsdeb.rst 2010-11-19 19:23:04 UTC (rev 795)
@@ -0,0 +1,139 @@
+====================================
+OBSDEB : Observation au débarquement
+====================================
+
+ObsDeb est un programme (comme ObsMer ou ObsVente) qui vise à faire les
+observations au débarquement des navires au port.
+
+Définitions
+===========
+
+Zone
+ Une zone géographique de pêche (Manche, Méditerranée...).
+
+UE, UEch, Unité d'échantillonage
+ Ligne du plan d'échantillonage.
+
+UO, Unité d'observation
+ Il s'agit d'un ensemble de lieux à observer en une journée, cela
+ peut être plusieurs ports.
+
+Une UO appartient à une et une seule UE ; une UE concerne une et une
+seule zone.
+
+Utilisateurs et rôles
+=====================
+
+On a la même hiérarchie de droits que dans Wao (adminitrateur, coordinateur,
+observateur).
+
+Par contre la notion de programme intervient ici dans le sens où chaque
+utilisateur est affecté à un ou plusieurs programmes (ObsMer, ObsDeb...).
+
+Au moment de son identification, l'utilisateur doit être dirigé selon le
+programme auquel il participe. S'il participe à plusieurs programmes, il
+doit choisir à quelle interface il va accéder.
+
+Équipe
+ Un ensemble d'observateur dont un coordinateur
+
+Plan d'échantillonage
+=====================
+
+Notre objectif est de permettre aux utilisateurs WAO de définir un
+plan d'échantillonage pour les coordinateurs.
+
+Le plan est composé de trois colonnes :
+
+Équipe
+ L'équipe chargée de l'observation
+
+Date
+ Le jour de l'observation
+
+UO
+ L'unité d'observation à observer ce jour là par cette équipe
+
+Le plan d'échantillonage peut être filtré sur ces trois critères
+(sous forme d'intervalle pour les dates).
+Un coordinateur qui affiche le plan ne doit voir que les lignes
+concernant son équipe.
+
+Les données du plan seront importées par l'administrateur (CSV). Il
+serait apprécié que les fonctions d'import soient disponibles
+fin janvier 2011.
+
+Feuille de route pour l'observateur
+===================================
+
+Un observateur se voit assigner une UO par jour.
+
+La feuille de route indique où doit se rendre un observateur pour
+chaque jour d'observation.
+
+ * Semaine (de l'année)
+
+ * Jour (de la semaine) : Lundi, Mardi...
+
+ * Unité d'observation affectée
+
+WAO doit permettre à chaque observateur d'obtenir sa feuille de
+route pour les semaines à venir. Sous la forme d'une table
+ou sous le forme d'une calendrier (forme préférée).
+
+Enquêtes téléphoniques
+======================
+
+L'enquête téléphonique permet de reconstituer des marées via un entretien
+téléphonique auprès du navire après que celui-ci aie fini sa marée.
+
+C'est le référentiel « Navires » de WAO qui doit fournir les numéros de
+téléphone.
+
+Pour mener l'enquête téléphonique, on élabore des « strates ». Une strate
+est un ensemble de navires (une flotille) qui font des métiers similaires.
+Par « même similaires », on entend même engins, même longueurs, même régions.
+
+L'enquête téléphonique ne porte que sur un échantillon de la strate. On ne
+va démarcher qu'une petite partie des navires de chaque strate. Ils sont
+tirés aléatoirement dans la strate et jugés représentatifs (plus tard, les
+résultats donnera lieu à une extrapollation pour toute la strate).
+
+L'enquête porte sur une semaine : on fait le tirage, puis on appelle chaque
+navire tiré pour essayer de d'obtenir des éléments pour l'observation. Si le
+correspondant est injoiniable ou refuse l'observation, le navire n'est pas
+démarché et on tire alors un substitut (un autre navire de la même strate)
+qu'on essaye de démarché à la place.
+
+Si aucun navire de la strate ne peut être observé, la strate est
+« non-échantillonée ».
+
+Avec les informations recuillies, on rédige un compte-rendu d'observation
+indiquant si oui ou non on a pu reconstituer la marée. Le CR indique le
+navire concerné, la date et l'heure de débarquement...
+
+Compte-rendu d'observation
+==========================
+
+Un compte-rendu d'observation est rédigé par l'observateur une
+fois que celui-ci a fini son observation (rédigé en fin de semaine).
+
+Les informations contenues sont
+
+* Heure d'arrivée et de départ de l'observateur
+
+* Lieu de l'observation (quel port de l'UO ?)
+
+* Date de débarquement
+
+* Si le compte-rendu provient d'une observation au débarquement
+ ou d'une enquête téléphonique. En fait, de quel programme est issu la
+ donnée.
+
+Il est possible que ce qui a été observé ne corresponde pas à l'UO. Par exemple,
+en cas de grèves, d'intemperries ou autres, l'observateur a pu se rendre sur les
+lieux, constater qu'il ne pouvait pas observer et a finalement été voir ailleurs.
+
+Les données observées elle-même ne sont pas saisies dans WAO mais dans un
+autre logiciel (Allegro). L'objectif de WAO est d'organiser l'observation,
+pas la saisie des données.
1
0
[Suiviobsmer-commits] r794 - trunk/wao-business/src/main/java/fr/ifremer/wao/service
by bleny@users.labs.libre-entreprise.org 19 Nov '10
by bleny@users.labs.libre-entreprise.org 19 Nov '10
19 Nov '10
Author: bleny
Date: 2010-11-19 18:24:57 +0000 (Fri, 19 Nov 2010)
New Revision: 794
Log:
synthesis must consider non-validated contacts too
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-11-19 18:10:04 UTC (rev 793)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-11-19 18:24:57 UTC (rev 794)
@@ -412,8 +412,7 @@
WaoQueryBuilder builder = context.newQueryBuilder();
ContactProperty contactProperty = builder.initializeForContact();
TopiaQuery query = builder.applySamplingFilter(filter).
- addEquals(contactProperty.state(), ContactState.BOARDING_DONE.ordinal()).
- addNullOr(contactProperty.validationProgram(), Op.EQ, Boolean.TRUE);
+ addEquals(contactProperty.state(), ContactState.BOARDING_DONE.ordinal());
if (filter.getEstimatedTides()) {
query.addNullOr(contactProperty.validationCompany(), Op.EQ, Boolean.TRUE);
@@ -600,12 +599,10 @@
filter.setPeriod(PeriodDates.createMonthsPeriodFromToday(-3));
}
-
WaoQueryBuilder builder = context.newQueryBuilder();
ContactProperty contactProperty = builder.initializeForContact();
TopiaQuery query = builder.applySamplingFilter(filter).
- addEquals(contactProperty.state(), ContactState.BOARDING_DONE.ordinal()).
- addNullOr(contactProperty.validationProgram(), Op.EQ, Boolean.TRUE);
+ addEquals(contactProperty.state(), ContactState.BOARDING_DONE.ordinal());
if (filter.getEstimatedTides()) {
query.addNullOr(contactProperty.validationCompany(), Op.EQ, Boolean.TRUE);
@@ -697,10 +694,9 @@
TopiaQuery query = builder.applySamplingFilter(filter).
addEquals(contactProperty.state(), ContactState.BOARDING_DONE.ordinal()).
- addEquals(contactProperty.validationProgram(), Boolean.TRUE).
// Set the results wanted : by company, by reliability,
- // get number of each realiability level
+ // get number of each reliability level
setSelect(companyProperty.name(), contactProperty.dataReliabilityOrdinal(), "COUNT(*)").
addGroup(companyProperty.name(), contactProperty.dataReliabilityOrdinal());
1
0