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
October 2010
- 5 participants
- 74 discussions
Author: tchemit
Date: 2010-10-26 12:02:51 +0000 (Tue, 26 Oct 2010)
New Revision: 710
Log:
use mavenpom 2.4-SNAPSHOT
use camelCase style for version properties
use default libraries version from mavenpom
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-10-25 09:29:41 UTC (rev 709)
+++ trunk/pom.xml 2010-10-26 12:02:51 UTC (rev 710)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4labs</artifactId>
- <version>2.3.2</version>
+ <version>2.4-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer</groupId>
@@ -48,7 +48,7 @@
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
- <version>${nuitonutils.version}</version>
+ <version>${nuitonUtilsVersion}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@@ -60,23 +60,23 @@
<dependency>
<groupId>org.nuiton.web</groupId>
<artifactId>nuiton-tapestry-extra</artifactId>
- <version>${nuitonweb.version}</version>
+ <version>${nuitonWebVersion}</version>
</dependency>
<!-- ToPIA -->
<dependency>
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-persistence</artifactId>
- <version>${topia.version}</version>
+ <version>${topiaVersion}</version>
</dependency>
<dependency>
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-service-migration</artifactId>
- <version>${topia.version}</version>
+ <version>${topiaVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-core</artifactId>
- <version>${tapestry.version}</version>
+ <version>${tapestryVersion}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@@ -88,7 +88,7 @@
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-upload</artifactId>
- <version>${tapestry.version}</version>
+ <version>${tapestryVersion}</version>
</dependency>
<dependency>
<groupId>com.orientimport</groupId>
@@ -109,7 +109,7 @@
<!-- <dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-test</artifactId>
- <version>${tapestry.version}</version>
+ <version>${tapestryVersion}</version>
<scope>test</scope>
</dependency>-->
<dependency>
@@ -305,12 +305,12 @@
<labs.id>154</labs.id>
<!-- libraries version -->
- <i18n.version>1.2.2</i18n.version>
- <nuitonutils.version>1.4.2</nuitonutils.version>
- <nuitonweb.version>0.1</nuitonweb.version>
- <topia.version>2.4.3</topia.version>
- <eugene.version>2.2</eugene.version>
- <tapestry.version>5.1.0.5</tapestry.version>
+ <nuitonI18nVersion>1.2.2</nuitonI18nVersion>
+ <nuitonUtilsVersion>1.4.2</nuitonUtilsVersion>
+ <nuitonWebVersion>0.1</nuitonWebVersion>
+ <topiaVersion>2.4.3</topiaVersion>
+ <eugeneVersion>2.2</eugeneVersion>
+ <tapestryVersion>5.1.0.5</tapestryVersion>
</properties>
@@ -342,7 +342,7 @@
<dependency>
<groupId>org.nuiton.jrst</groupId>
<artifactId>doxia-module-jrst</artifactId>
- <version>${jrst.version}</version>
+ <version>${jrstPluginVersion}</version>
</dependency>
</dependencies>
</plugin>
@@ -350,7 +350,7 @@
<plugin>
<groupId>org.nuiton.eugene</groupId>
<artifactId>maven-eugene-plugin</artifactId>
- <version>${eugene.version}</version>
+ <version>${eugeneVersion}</version>
<configuration>
<inputs>zargo</inputs>
<resolver>org.nuiton.util.FasterCachedResourceResolver</resolver>
@@ -359,7 +359,7 @@
<dependency>
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-persistence</artifactId>
- <version>${topia.version}</version>
+ <version>${topiaVersion}</version>
</dependency>
</dependencies>
</plugin>
@@ -367,7 +367,7 @@
<plugin>
<groupId>org.nuiton.i18n</groupId>
<artifactId>maven-i18n-plugin</artifactId>
- <version>${i18n.version}</version>
+ <version>${nuitonI18nVersion}</version>
</plugin>
</plugins>
1
0
[Suiviobsmer-commits] r709 - in trunk: wao-business/src/main/java/fr/ifremer/wao/bean wao-ui/src/main/webapp
by bleny@users.labs.libre-entreprise.org 25 Oct '10
by bleny@users.labs.libre-entreprise.org 25 Oct '10
25 Oct '10
Author: bleny
Date: 2010-10-25 09:29:41 +0000 (Mon, 25 Oct 2010)
New Revision: 709
Log:
bugfix global synthesis average calculus
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java
trunk/wao-ui/src/main/webapp/Synthesis.tml
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-10-22 17:00:26 UTC (rev 708)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java 2010-10-25 09:29:41 UTC (rev 709)
@@ -59,19 +59,29 @@
@Override
public GlobalIndicatorValue getGlobalLevel() {
// compute an average with coefficients
- double totalValues = 0.0;
+ double totalLevels = 0.0;
double totalCoefficients = 0.0;
for (Indicator indicator : globalSynthesisParameters) {
- Double value = values.get(indicator.getSynthesisId());
- Double coefficient = indicator.getCoefficient();
+ double value = values.get(indicator.getSynthesisId());
+ double level = indicator.getLevelForValue(value).getLevel();
+ double coefficient = indicator.getCoefficient();
- totalValues += value * coefficient;
+ totalLevels += level * coefficient;
totalCoefficients += coefficient;
+
+ if (log.isDebugEnabled()) {
+ log.debug("totalLevels = " + totalLevels +
+ ", totalCoefficients = " + totalCoefficients);
+ }
}
- double value = totalValues / totalCoefficients;
+ double value = totalLevels / totalCoefficients;
+ if (log.isDebugEnabled()) {
+ log.debug("value for global indicator = " + value);
+ }
+
GlobalIndicatorValue result = null;
if (value >= 1.0 && value < 2.0) {
result = GlobalIndicatorValue.VERY_BAD;
Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-22 17:00:26 UTC (rev 708)
+++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-25 09:29:41 UTC (rev 709)
@@ -362,7 +362,7 @@
<t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" />
</t:loop>
- BILAN
+ Bilan de la synthèse globale : ${globalSynthesisResult.globalLevel}
</div>
</t:block>
</t:layout>
1
0
[Suiviobsmer-commits] r708 - in trunk: 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/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 22 Oct '10
by bleny@users.labs.libre-entreprise.org 22 Oct '10
22 Oct '10
Author: bleny
Date: 2010-10-22 17:00:26 +0000 (Fri, 22 Oct 2010)
New Revision: 708
Log:
added a page with all indicators in synthesis ; ajax is buggy
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java
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/bean/GlobalSynthesisResultImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java 2010-10-22 12:46:40 UTC (rev 707)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java 2010-10-22 17:00:26 UTC (rev 708)
@@ -15,19 +15,24 @@
protected Map<SynthesisId, Double> values;
- protected List<Indicator> indicators;
+ protected List<Indicator> globalSynthesisParameters;
public void setIndicatorValues(Map<SynthesisId, Double> indicatorValues) {
this.values = indicatorValues;
}
- public void setIndicators(List<Indicator> indicators) {
- this.indicators = indicators;
+ public void setGlobalSynthesisParameters(List<Indicator> globalSynthesisParameters) {
+ this.globalSynthesisParameters = globalSynthesisParameters;
}
+ @Override
+ public List<Indicator> getGlobalSynthesisParameters() {
+ return globalSynthesisParameters;
+ }
+
/** in the list of indicators, find the one with given synthesisId. */
protected Indicator findIndicator(SynthesisId id) {
- for (Indicator indicator : indicators) {
+ for (Indicator indicator : globalSynthesisParameters) {
if (indicator.getSynthesisId().equals(id)) {
return indicator;
}
@@ -57,7 +62,7 @@
double totalValues = 0.0;
double totalCoefficients = 0.0;
- for (Indicator indicator : indicators) {
+ for (Indicator indicator : globalSynthesisParameters) {
Double value = values.get(indicator.getSynthesisId());
Double coefficient = indicator.getCoefficient();
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-10-22 12:46:40 UTC (rev 707)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java 2010-10-22 17:00:26 UTC (rev 708)
@@ -1,7 +1,14 @@
package fr.ifremer.wao.entity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class IndicatorLevelImpl extends IndicatorLevelAbstract {
+ private static final Logger log =
+ LoggerFactory.getLogger(IndicatorLevelImpl.class);
+
+ /** the upperBound of the lower level */
protected double lowerBound;
@Override
@@ -49,6 +56,12 @@
&& value < getLowerBound();
}
}
+
+ if (log.isDebugEnabled()) {
+ log.debug(value + " is contained between " + getLowerBound() +
+ " and " + getUpperBound() + " -> " + containsValue);
+ }
+
return containsValue;
}
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-10-22 12:46:40 UTC (rev 707)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-10-22 17:00:26 UTC (rev 708)
@@ -795,7 +795,7 @@
GlobalSynthesisResultImpl result = new GlobalSynthesisResultImpl();
result.setIndicatorValues(indicatorValues);
- result.setIndicators(indicators);
+ result.setGlobalSynthesisParameters(indicators);
return result;
}
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-10-22 12:46:40 UTC (rev 707)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-10-22 17:00:26 UTC (rev 708)
@@ -139,7 +139,7 @@
public List<Indicator> getGlobalSynthesisParameters() {
if (globalSynthesisParameters == null) {
globalSynthesisParameters =
- serviceSynthesis.getGlobalSynthesisParameters();
+ getGlobalSynthesisResult().getGlobalSynthesisParameters();
}
return globalSynthesisParameters;
}
@@ -148,8 +148,6 @@
public GlobalSynthesisResult getGlobalSynthesisResult() {
if (globalSynthesisResult == null) {
- PeriodDates period = PeriodDates.createMonthsPeriodFromToday(-12);
- Company company = !user.isAdmin() ? user.getCompany() : null;
globalSynthesisResult = serviceSynthesis.getGlobalSynthesisResult(getFilter());
}
return globalSynthesisResult;
@@ -165,6 +163,11 @@
return activeIndicator;
}
+ public void setActiveIndicator(Indicator activeIndicator) {
+ this.activeIndicator = activeIndicator;
+ this.activeSynthesis = activeIndicator.getSynthesisId();
+ }
+
public IndicatorLevel getActiveIndicatorLevel() {
activeIndicatorLevel = getGlobalSynthesisResult().getLevelForIndicator(getActiveSynthesis());
return activeIndicatorLevel;
@@ -175,7 +178,14 @@
case GRAPH_SAMPLING : initSamplingBlock(); break;
case GRAPH_BOARDING : initBoardingBlock();
}
- return resources.getBlock("ind" + getActiveSynthesis().ordinal());
+
+ Block activeBlock;
+ if (showGlobalSynthesis) {
+ activeBlock = resources.getBlock("globalSynthesis");
+ } else {
+ activeBlock = resources.getBlock("ind" + getActiveSynthesis().ordinal());
+ }
+ return activeBlock;
}
public String getActionSynthesisId() {
@@ -186,6 +196,14 @@
return ChartType.class.getName();
}
+ private boolean showGlobalSynthesis;
+
+ public String getActionShowGlobalSynthesis() {
+ showGlobalSynthesis = true;
+ return "globalSynthesis";
+ }
+
+
public NumberFormat getPercentFormat() {
return NumberFormat.getPercentInstance();
}
@@ -209,6 +227,8 @@
// Change chart type for dataSampling
} else if (actionType.equals(ChartType.class.getName())) {
dataSamplingChartType = ChartType.valueOf(actionValue);
+ } else if (actionType.equals("ShowGlobalSynthesis")) {
+ return "globalSynthesis";
}
return this;
}
@@ -358,7 +378,6 @@
*/
public Map<String, Double> getComplianceBoarding() throws WaoException {
if (complianceBoarding == null) {
- Company company = !user.isAdmin() ? user.getCompany() : null;
complianceBoarding =
serviceSynthesis.getComplianceBoardingIndicator(getFilter());
}
@@ -405,7 +424,6 @@
public Collection<ContactStateStatistics> getContactStateStatistics()
throws WaoException {
if (contactStateStatistics == null) {
- Company company = !user.isAdmin() ? user.getCompany() : null;
contactStateStatistics =
serviceSynthesis.getContactStateStatistics(getFilter());
}
@@ -446,7 +464,6 @@
public Collection<ContactAverageReactivity> getAllegroReactivity()
throws WaoException {
if (allegroReactivity == null) {
- Company company = !user.isAdmin() ? user.getCompany() : null;
allegroReactivity =
serviceSynthesis.getContactDataInputDateReactivity(getFilter());
}
Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-22 12:46:40 UTC (rev 707)
+++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-22 17:00:26 UTC (rev 708)
@@ -94,40 +94,46 @@
<ul>
<li>
<a t:type="actionlink" t:context="[actionSynthesisId,'GRAPH_SAMPLING']" t:zone="so-synthesis-main">
- <img src="${asset:context:}/img/synthesis-graph-sampling.png" alt="Diagramme en bâtons"
+ <img src="${asset:context:}/img/synthesis-graph-sampling.png" alt="Graphique des données des marées (réalisé / planifié)"
title="Graphique des données des marées (réalisé / planifié)" />
</a>
</li>
<li>
<a t:type="actionlink" t:context="[actionSynthesisId,'GRAPH_BOARDING']" t:zone="so-synthesis-main">
- <img src="${asset:context:}/img/synthesis-graph-boarding.png" alt="Diagramme en bâtons"
+ <img src="${asset:context:}/img/synthesis-graph-boarding.png" alt="Graphique des sollicitations des navires"
title="Graphique des sollicitations des navires" />
</a>
</li>
<li>
<a t:type="actionlink" t:context="[actionSynthesisId,'IND_COMPLIANCE_BOARDING']" t:zone="so-synthesis-main">
- <img src="${asset:context:}/img/synthesis-ind-non-compliance-boarding.png" alt="Indicateur"
+ <img src="${asset:context:}/img/synthesis-ind-non-compliance-boarding.png" alt="Indicateur de non respect du nombre d'observateurs embarqués"
title="Indicateur de non respect du nombre d'observateurs embarqués" />
</a>
</li>
<li>
<a t:type="actionlink" t:context="[actionSynthesisId,'IND_CONTACT_STATE']" t:zone="so-synthesis-main">
- <img src="${asset:context:}/img/synthesis-ind-contact-states.png" alt="Indicateur"
+ <img src="${asset:context:}/img/synthesis-ind-contact-states.png" alt="Indicateur sur les états des contacts"
title="Indicateur sur les états des contacts" />
</a>
</li>
<li>
<a t:type="actionlink" t:context="[actionSynthesisId,'IND_ALLEGRO_REACTIVITY']" t:zone="so-synthesis-main">
- <img src="${asset:context:}/img/synthesis-ind-allegro-reactivity.png" alt="Indicateur"
+ <img src="${asset:context:}/img/synthesis-ind-allegro-reactivity.png" alt="Indicateur de réactivité sur la saisie des données dans Allegro"
title="Indicateur de réactivité sur la saisie des données dans Allegro" />
</a>
</li>
<li>
<a t:type="actionlink" t:context="[actionSynthesisId,'IND_DATA_RELIABILITY']" t:zone="so-synthesis-main">
- <img src="${asset:context:}/img/synthesis-ind-non-compliance-boarding.png" alt="Indicateur"
+ <img src="${asset:context:}/img/synthesis-ind-data-reliability.png" alt="Indicateur de la qualité des données"
title="Indicateur de la qualité des données" />
</a>
</li>
+ <li>
+ <a t:type="actionlink" t:context="[actionShowGlobalSynthesis,'']" t:zone="so-synthesis-main">
+ <img src="${asset:context:}/img/synthesis-global-synthesis.png" alt="Synthèse globale des indicateurs"
+ title="Synthèse globale des indicateurs" />
+ </a>
+ </li>
</ul>
</div>
<div t:type="zone" t:id="delegator" class="fleft" t:update="show" id="so-synthesis-main">
@@ -310,7 +316,7 @@
</t:block>
<!-- IND5 : DATA_RELIABILITY -->
<t:block t:id="ind5">
- <div class="ind-table acenter" id="so-noncomplianceboarding">
+ <div class="ind-table acenter" id="so-datareliability">
<h2>Qualité de la donnée</h2>
<br />
<t:if t:test="user.admin">
@@ -346,4 +352,17 @@
<t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" />
</div>
</t:block>
+ <!-- GLOBAL SYNTHESIS -->
+ <t:block t:id="globalSynthesis">
+ <div >
+ <h2>Synthèse globale</h2>
+ <br />
+
+ <t:loop t:source="globalSynthesisParameters" t:value="activeIndicator">
+ <t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" />
+ </t:loop>
+
+ BILAN
+ </div>
+ </t:block>
</t:layout>
1
0
[Suiviobsmer-commits] r707 - trunk/wao-ui/src/main/webapp
by bleny@users.labs.libre-entreprise.org 22 Oct '10
by bleny@users.labs.libre-entreprise.org 22 Oct '10
22 Oct '10
Author: bleny
Date: 2010-10-22 12:46:40 +0000 (Fri, 22 Oct 2010)
New Revision: 707
Log:
fix bad comment
Modified:
trunk/wao-ui/src/main/webapp/Synthesis.tml
Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-22 12:45:49 UTC (rev 706)
+++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-22 12:46:40 UTC (rev 707)
@@ -308,7 +308,7 @@
<t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" />
</div>
</t:block>
- <!-- IND1 : COMPLIANCE_BOARDING -->
+ <!-- IND5 : DATA_RELIABILITY -->
<t:block t:id="ind5">
<div class="ind-table acenter" id="so-noncomplianceboarding">
<h2>Qualité de la donnée</h2>
1
0
[Suiviobsmer-commits] r706 - in trunk: wao-business/src/main/java/fr/ifremer/wao/service wao-business/src/main/xmi wao-business/src/test/java/fr/ifremer/wao/service wao-ui/src/main/java/fr/ifremer/wao/ui/pages wao-ui/src/main/webapp
by bleny@users.labs.libre-entreprise.org 22 Oct '10
by bleny@users.labs.libre-entreprise.org 22 Oct '10
22 Oct '10
Author: bleny
Date: 2010-10-22 12:45:49 +0000 (Fri, 22 Oct 2010)
New Revision: 706
Log:
add data reliability indicator in service and UI
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java
trunk/wao-business/src/main/xmi/wao.zargo
trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java
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-10-22 10:36:47 UTC (rev 705)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-10-22 12:45:49 UTC (rev 706)
@@ -46,6 +46,7 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
@@ -515,6 +516,118 @@
}
@Override
+ protected Map<String, Double> executeGetDataReliability
+ (TopiaContext transaction, SamplingFilter filter) throws Exception {
+
+
+ WaoQueryBuilder builder = context.newQueryBuilder();
+ ContactProperty contactProperty = builder.initializeForContact();
+
+ WaoQueryHelper.CompanyProperty companyProperty =
+ contactProperty.observerProperty().companyProperty();
+
+ TopiaQuery query = builder.applySamplingFilter(filter).
+ addEquals(contactProperty.state(), ContactState.BOARDING_DONE.ordinal()).
+ addEquals(contactProperty.validationCompany(), Boolean.TRUE).
+ addEquals(contactProperty.validationProgram(), Boolean.TRUE).
+
+
+ // Set the results wanted : by company, by reliability,
+ // get number of each realiability level
+ setSelect(companyProperty.name(), contactProperty.dataReliabilityOrdinal(), "COUNT(*)").
+ addGroup(companyProperty.name(), contactProperty.dataReliabilityOrdinal());
+
+ if (log.isDebugEnabled()) {
+ log.debug("query for data reliability is " + query);
+ }
+
+ List<Object[]> queryResults = transaction.findByQuery(query);
+
+ if (log.isDebugEnabled()) {
+ for (Object[] result : queryResults) {
+ log.debug("result for data reliability contains " +
+ Arrays.toString(result));
+ }
+ }
+
+ // example results : [IMA, 0, 12]
+ // [OCEANIC DEVELOPPEMENT, 0, 94]
+ // [IFREMER, 0, 53]
+ // [YLAHE, 0, 145]
+ // [COFREPECHE, 0, 227]
+ // first column is the name of the company
+ // second column is the ordinal for DataReliability level
+ // third column is the number of contacts with this level
+
+ List<String> companies = new ArrayList<String>();
+
+ Map<String, Long> companyNumberOfReliableData = new HashMap<String, Long>();
+
+ // value is the sum of reliable, doubtful and non-reliable contacts
+ // in this sum, number of "unknown" must be ignored
+ Map<String, Long> companyNumberOfEvaluatedData = new HashMap<String, Long>();
+
+ for (Object[] row : queryResults) {
+ String rowCompanyName = (String) row[0];
+ int rowDataReliabilityOrdinal = (Integer) row[1];
+ Long rowCount = (Long) row[2];
+
+ DataReliability reliability =
+ DataReliability.valueOf(rowDataReliabilityOrdinal);
+
+ companies.add(rowCompanyName);
+
+ if (reliability == DataReliability.RELIABLE) {
+ companyNumberOfReliableData.put(rowCompanyName, rowCount);
+ }
+
+ if (reliability != DataReliability.UNKNOWN) {
+ Long oldValue = companyNumberOfEvaluatedData.get(rowCompanyName);
+ if (oldValue == null) {
+ // it's a sum, so init to 0
+ oldValue = 0L;
+ }
+ Long newValue = oldValue + rowCount;
+ companyNumberOfEvaluatedData.put(rowCompanyName, newValue);
+ }
+ }
+
+ // now compute the results (take care of zeros)
+ Map<String, Double> results = new HashMap<String, Double>();
+
+ for (String companyName : companies) {
+ Long numberOfEvaluated = companyNumberOfReliableData.get(companyName);
+
+ if (numberOfEvaluated == null) {
+ // we will not divide by 0
+
+ if (log.isTraceEnabled()) {
+ log.trace("company " + companyName + " has never been " +
+ "evaluated yet. It will not be included in results");
+ }
+
+ // company is considered trustful
+ results.put(companyName, 1.0);
+ } else {
+ Long numberOfReliable = companyNumberOfReliableData.get(companyName);
+ if (numberOfReliable == null) {
+ numberOfReliable = 0L;
+ }
+
+ Double result = (double) numberOfReliable / (double) numberOfEvaluated;
+ results.put(companyName, result);
+
+ if (log.isDebugEnabled()) {
+ log.debug("result for company " + companyName + " is " + result);
+ }
+ }
+ }
+
+ return results;
+
+ }
+
+ @Override
public Map<String, PieChartData> executeGetContactPieChartDataByBoatDistrict(
TopiaContext transaction, ContactFilter filter)
throws TopiaException {
@@ -572,19 +685,8 @@
return results;
}
- @Override
- protected Map<Company, Double> executeGetDataReliability
- (TopiaContext transaction, SamplingFilter filter) throws Exception {
+ protected Double getIndicatorValueForDataSampling(SamplingFilter filter) {
- log.debug("period " + filter.getPeriod());
-
- return null;
-
- }
-
- protected Double getIndicatorValueForDataSampling
- (TopiaContext transaction, SamplingFilter filter) {
-
List<SortedMap<Date, Integer>> res = getDataSampling(filter);
int totalNumberOfRealized = 0;
@@ -619,11 +721,8 @@
return percentRealized;
}
- protected Double getIndicatorValueForBoarding
- (TopiaContext transaction, SamplingFilter filter) {
-
+ protected Double getIndicatorValueForBoarding(SamplingFilter filter) {
BoardingResult boardingResult = getBoardingBoats(filter);
-
int numberOfBoatWithOneBoarding = boardingResult.getData().get("1");
int totalNumberOfBoarding = 0;
for (Integer numberOfBoarding : boardingResult.getData().values()) {
@@ -634,8 +733,7 @@
return rate;
}
- protected Double getIndicatorValueForComplianceBoarding
- (TopiaContext transaction, SamplingFilter filter) {
+ protected Double getIndicatorValueForComplianceBoarding(SamplingFilter filter) {
Map<String, Double> complianceBoarding = getComplianceBoardingIndicator(filter);
double total = 0.0;
int numberOfCompanies = complianceBoarding.size();
@@ -646,8 +744,7 @@
return indicatorValue;
}
- protected Double getIndicatorValueForAllegroReactivity
- (TopiaContext transaction, SamplingFilter filter) {
+ protected Double getIndicatorValueForAllegroReactivity(SamplingFilter filter) {
Collection<ContactAverageReactivity> allegroReactivity =
getContactDataInputDateReactivity(filter);
@@ -661,6 +758,17 @@
return totalAverages;
}
+ protected Double getIndicatorValueForDataReliability(SamplingFilter filter) {
+ Map<String, Double> dataReliability = getDataReliability(filter);
+ double total = 0.0;
+ int numberOfCompanies = dataReliability.size();
+ for (Double reliabilityRate : dataReliability.values()) {
+ total += reliabilityRate;
+ }
+ double indicatorValue = 100 * (total / numberOfCompanies);
+ return indicatorValue;
+ }
+
@Override
protected GlobalSynthesisResult executeGetGlobalSynthesisResult
(TopiaContext transaction, SamplingFilter filter) throws Exception {
@@ -668,20 +776,20 @@
Double value;
Map<SynthesisId, Double> indicatorValues = new HashMap<SynthesisId, Double>();
- value = getIndicatorValueForDataSampling(transaction, filter);
+ value = getIndicatorValueForDataSampling(filter);
indicatorValues.put(SynthesisId.GRAPH_SAMPLING, value);
- value = getIndicatorValueForBoarding(transaction, filter);
+ value = getIndicatorValueForBoarding(filter);
indicatorValues.put(SynthesisId.GRAPH_BOARDING, value);
- value = getIndicatorValueForComplianceBoarding(transaction, filter);
+ value = getIndicatorValueForComplianceBoarding(filter);
indicatorValues.put(SynthesisId.IND_COMPLIANCE_BOARDING, value);
- value = getIndicatorValueForAllegroReactivity(transaction, filter);
+ value = getIndicatorValueForAllegroReactivity(filter);
indicatorValues.put(SynthesisId.IND_ALLEGRO_REACTIVITY, value);
- // add data reliability indicator here
-
+ value = getIndicatorValueForDataReliability(filter);
+ indicatorValues.put(SynthesisId.IND_DATA_RELIABILITY, value);
List<Indicator> indicators = executeGetGlobalSynthesisParameters(transaction);
Modified: trunk/wao-business/src/main/xmi/wao.zargo
===================================================================
(Binary files differ)
Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java
===================================================================
--- trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java 2010-10-22 10:36:47 UTC (rev 705)
+++ trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java 2010-10-22 12:45:49 UTC (rev 706)
@@ -586,4 +586,10 @@
assertEquals(0, res.getResult(), 0.01);
}
+ @Test
+ public void testGetDataReliability() throws Exception {
+
+
+
+ }
}
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-10-22 10:36:47 UTC (rev 705)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-10-22 12:45:49 UTC (rev 706)
@@ -475,4 +475,23 @@
return "";
}
+ /********************* INDICATOR : DATA RELIABILITY ***********************/
+
+ private Map<String, Double> dataReliability;
+
+ /* variable used in template */
+ @Property
+ private Map.Entry<String, Double> dataReliabilityEntry;
+
+ public Map<String, Double> getDataReliability() {
+ if (dataReliability == null) {
+ dataReliability = serviceSynthesis.getDataReliability(getFilter());
+ }
+ return dataReliability;
+ }
+
+ public Double getDataReliabilityValue() throws WaoException {
+ return getDataReliability().get(user.getCompany());
+ }
+
}
\ No newline at end of file
Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-22 10:36:47 UTC (rev 705)
+++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-22 12:45:49 UTC (rev 706)
@@ -122,6 +122,12 @@
title="Indicateur de réactivité sur la saisie des données dans Allegro" />
</a>
</li>
+ <li>
+ <a t:type="actionlink" t:context="[actionSynthesisId,'IND_DATA_RELIABILITY']" t:zone="so-synthesis-main">
+ <img src="${asset:context:}/img/synthesis-ind-non-compliance-boarding.png" alt="Indicateur"
+ title="Indicateur de la qualité des données" />
+ </a>
+ </li>
</ul>
</div>
<div t:type="zone" t:id="delegator" class="fleft" t:update="show" id="so-synthesis-main">
@@ -302,4 +308,42 @@
<t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" />
</div>
</t:block>
+ <!-- IND1 : COMPLIANCE_BOARDING -->
+ <t:block t:id="ind5">
+ <div class="ind-table acenter" id="so-noncomplianceboarding">
+ <h2>Qualité de la donnée</h2>
+ <br />
+ <t:if t:test="user.admin">
+ <table class="t-data-grid">
+ <thead>
+ <tr>
+ <th class="company">Société</th>
+ <th>Indicateur</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr t:type="loop" t:source="dataReliability.entrySet()" t:value="dataReliabilityEntry">
+ <td class="company">${dataReliabilityEntry.key}</td>
+ <td class="number">
+ <t:output t:value="dataReliabilityEntry.value" t:format="percentFormat"/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <p:else>
+ <div class="indicator">
+ <p class="number">
+ <span t:type="output" t:value="complianceBoardingValue" t:format="percentFormat">
+ ${complianceBoardingValue}
+ </span>
+ </p>
+ </div>
+ </p:else>
+ </t:if>
+
+ <!-- now render a table with position on global synthesis -->
+ <br />
+ <t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" />
+ </div>
+ </t:block>
</t:layout>
1
0
Author: bleny
Date: 2010-10-22 10:36:47 +0000 (Fri, 22 Oct 2010)
New Revision: 705
Log:
update POM ; +bleny as developer
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-10-22 10:35:35 UTC (rev 704)
+++ trunk/pom.xml 2010-10-22 10:36:47 UTC (rev 705)
@@ -272,6 +272,17 @@
<role>Développeur</role>
</roles>
</developer>
+ <developer>
+ <name>Brendan Le Ny</name>
+ <id>bleny</id>
+ <email>bleny at codelutin.com</email>
+ <organization>CodeLutin</organization>
+ <organizationUrl>http://www.codelutin.com</organizationUrl>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </developer>
</developers>
<url>http://suiviobsmer.labs.libre-entreprise.org/suiviobsmer</url>
1
0
[Suiviobsmer-commits] r704 - trunk/wao-business/src/test/java/fr/ifremer/wao/service
by bleny@users.labs.libre-entreprise.org 22 Oct '10
by bleny@users.labs.libre-entreprise.org 22 Oct '10
22 Oct '10
Author: bleny
Date: 2010-10-22 10:35:35 +0000 (Fri, 22 Oct 2010)
New Revision: 704
Log:
fix tests ; should make build stable
Modified:
trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java
Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java
===================================================================
--- trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java 2010-10-22 09:31:53 UTC (rev 703)
+++ trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java 2010-10-22 10:35:35 UTC (rev 704)
@@ -30,6 +30,8 @@
import fr.ifremer.wao.bean.ContactAverageReactivity;
import fr.ifremer.wao.bean.ContactState;
import fr.ifremer.wao.bean.ContactStateStatistics;
+import fr.ifremer.wao.bean.SamplingFilter;
+import fr.ifremer.wao.bean.SamplingFilterImpl;
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.Company;
import fr.ifremer.wao.entity.CompanyDAO;
@@ -181,7 +183,8 @@
serviceContact.saveContact(contact3, false);
/** EXEC METHOD **/
- BoardingResult result = service.getBoardingBoats(null, null);
+ SamplingFilter filter = new SamplingFilterImpl();
+ BoardingResult result = service.getBoardingBoats(filter);
// one boat with one boarding (177474)
assertEquals(1, result.getData().get("1").intValue());
// one boat with two boardings (174258)
@@ -278,8 +281,10 @@
/** EXEC METHOD **/
// result for company TARTANPION
+ SamplingFilter filter = new SamplingFilterImpl();
+ filter.setCompany(company);
Map<String, Double> results =
- service.getComplianceBoardingIndicator(company);
+ service.getComplianceBoardingIndicator(filter);
assertEquals(1, results.size());
@@ -288,7 +293,8 @@
assertEquals(1., value, 0);
// result for company BIS using admin mode (no company filtered)
- results = service.getComplianceBoardingIndicator(null);
+ filter = new SamplingFilterImpl();
+ results = service.getComplianceBoardingIndicator(filter);
assertEquals(2, results.size());
@@ -414,8 +420,10 @@
/** EXEC METHOD **/
// result for company TARTANPION with no period
+ SamplingFilter filter = new SamplingFilterImpl();
+ filter.setCompany(company);
Collection<ContactStateStatistics> results =
- service.getContactStateStatistics(company, null);
+ service.getContactStateStatistics(filter);
assertEquals(1, results.size());
ContactStateStatistics result = (ContactStateStatistics)CollectionUtils.get(results, 0);
@@ -428,7 +436,8 @@
assertEquals(1, data.get(ContactState.BOAT_REFUSED).intValue());
// result for company BIS using admin mode
- results = service.getContactStateStatistics(null, null);
+ filter = new SamplingFilterImpl();
+ results = service.getContactStateStatistics(filter);
assertEquals(2, results.size());
result = null;
@@ -449,7 +458,10 @@
Date end = DateUtil.createDate(31, 3, 2010);
PeriodDates period = new PeriodDates(begin, end);
- results = service.getContactStateStatistics(company2, period);
+ filter = new SamplingFilterImpl();
+ filter.setCompany(company2);
+ filter.setPeriod(period);
+ results = service.getContactStateStatistics(filter);
assertEquals(1, results.size());
result = (ContactStateStatistics)CollectionUtils.get(results, 0);
@@ -460,7 +472,7 @@
assertEquals(0, data.get(ContactState.BOAT_UNAVAILABLE).intValue());
}
- /**
+ /**
* Test of getBoardingBoats method, of class ServiceSynthesisImpl.
*/
@Test
@@ -547,10 +559,13 @@
/** EXEC METHOD **/
PeriodDates period = new PeriodDates(begin, begin);
+ SamplingFilter filter = new SamplingFilterImpl();
+ filter.setCompany(company);
+ filter.setPeriod(period);
// result for company TARTANPION
Collection<ContactAverageReactivity> results =
- service.getContactDataInputDateReactivity(company, period);
+ service.getContactDataInputDateReactivity(filter);
assertEquals(1, results.size());
@@ -561,7 +576,9 @@
assertEquals(27., res.getResult(), 0.01);
// result for company BIS using admin mode (no company filtered)
- results = service.getContactDataInputDateReactivity(null, period);
+ filter = new SamplingFilterImpl();
+ filter.setPeriod(period);
+ results = service.getContactDataInputDateReactivity(filter);
// 0 days for contact3 / 1 = O days
res = (ContactAverageReactivity)CollectionUtils.get(results, 0);
1
0
[Suiviobsmer-commits] r703 - in trunk: wao-business/src/main/java/fr/ifremer/wao wao-ui/src/main/java/fr/ifremer/wao/ui/pages
by bleny@users.labs.libre-entreprise.org 22 Oct '10
by bleny@users.labs.libre-entreprise.org 22 Oct '10
22 Oct '10
Author: bleny
Date: 2010-10-22 09:31:53 +0000 (Fri, 22 Oct 2010)
New Revision: 703
Log:
hack to bugfix unability to filter when a subquery is involved ; a bug in addSubQuery ?
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/WaoQueryBuilder.java
trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoQueryBuilder.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoQueryBuilder.java 2010-10-21 16:06:37 UTC (rev 702)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoQueryBuilder.java 2010-10-22 09:31:53 UTC (rev 703)
@@ -252,8 +252,28 @@
// Apply filter for fishingZone on subQuery
applySimpleFishingZoneFilter(filter, subquery);
+ if(logger.isDebugEnabled()) {
+ logger.debug("sampling filter subquery " + subquery);
+ logger.debug("sampling filter query " + query);
+ }
+
query.addSubQuery(WaoQueryHelper.format(
"$1 IN (?)", sampleRowProperty.$alias()), subquery);
+
+ // XXX 20101022 bleny it seems that last call don't
+ // keep params of the sub-query. Thus, the :facadeName is still
+ // in the query but misses in params of the request.
+ // the next line is a work-around that copy the params of the
+ // subquery is the main query. It works but it seems that
+ // there is a bug in addSubQuery, :facadeName should have been
+ // replaced in the query and removed from params OR not replaced
+ // in the query and kept in the params but NOT not replaced in
+ // the query and removed from params
+ query.getParams().addAll(subquery.getParams());
+
+ if(logger.isDebugEnabled()) {
+ logger.debug("sampling filter query " + query);
+ }
}
}
@@ -289,6 +309,11 @@
calendar.add(Calendar.MONTH, nbMonthsFinishedFromToday);
query.addWhere(sampleRowProperty.periodEnd(), TopiaQuery.Op.GE, calendar.getTime());
}
+
+ if(logger.isDebugEnabled()) {
+ logger.debug("sampling filter query " + query);
+ }
+
return query;
}
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java 2010-10-21 16:06:37 UTC (rev 702)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java 2010-10-22 09:31:53 UTC (rev 703)
@@ -163,7 +163,7 @@
logger.debug("Init contactFilter");
}
contactFilter = new ContactFilterImpl();
- // Initialized to 12 months before the current day
+ // Initialized to 3 months before the current day
Date fromDate = DateUtil.createDateAfterToday(0, -3, 0);
contactFilter.setFromDate(fromDate);
}
1
0
[Suiviobsmer-commits] r702 - 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 21 Oct '10
by bleny@users.labs.libre-entreprise.org 21 Oct '10
21 Oct '10
Author: bleny
Date: 2010-10-21 16:06:37 +0000 (Thu, 21 Oct 2010)
New Revision: 702
Log:
added filter on all synthesis ; refactoring done (break the build)
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-10-21 14:51:31 UTC (rev 701)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-10-21 16:06:37 UTC (rev 702)
@@ -180,83 +180,7 @@
* value.
* @throws WaoException
*/
- @Deprecated
- public BoardingResult executeGetBoardingBoats(TopiaContext transaction,
- Company company,
- Date fromDate)
- throws TopiaException {
- Map<String, Integer> map = new LinkedHashMap<String, Integer>();
- BoardingResult result = new BoardingResultImpl();
- result.setData(map);
- // Initialize max boardings and its max key value
- final int maxBoardings = 12;
- final String maxBoardingsKey = maxBoardings + " +";
-
- // Prepare map which contains for each entry the number of boardings
- // for the key and the number of boats for the value.
- for (int i = 1; i < maxBoardings; i++) {
- map.put(String.valueOf(i), 0);
- }
- map.put(maxBoardingsKey, 0);
-
- ContactDAO dao = WaoDAOHelper.getContactDAO(transaction);
- // The number of boardings is the number of finished contacts
- // Use fromDate to filter contacts finished from this date
- // No need to use boat filter for this method
- TopiaQuery query = dao.createQueryDoneContactsFromDate(null, fromDate);
-
- String contact = query.getMainAlias();
- String sampleRow = contact + "." + Contact.SAMPLE_ROW;
-
- // Only for sampleRows with averageTideTime less or equals to 2 days
- query.addWhere(sampleRow + "." + SampleRow.AVERAGE_TIDE_TIME, Op.LE, 2.);
-
- // Add filter on sampleRow company if needed
- if (company != null) {
- query.addEquals(sampleRow + "." + SampleRow.COMPANY, company);
- }
-
- // Prepare aliases for mapping results in select part
- String countAlias = "nbBoardings";
- String boatAlias = "boat";
- // Use a map for each result with boat and its number of boardings
- // Order by number of boardings to easily find the max value (the
- // first result)
- query.setSelect("new map(" + contact + "." + Contact.BOAT + " as " +
- boatAlias + ", COUNT(*) as " + countAlias + ")").
- addGroup(contact + "." + Contact.BOAT).
- addOrderDesc("COUNT(*)");
-
- if (log.isTraceEnabled()) {
- log.trace("Exec query : " + query);
- }
-
- List<Map<String, Object>> nbBoardingsByBoat = transaction.findByQuery(query);
-
- if (!nbBoardingsByBoat.isEmpty()) {
- for (Map<String, Object> row : nbBoardingsByBoat) {
- Long count = (Long)row.get(countAlias);
- int intValue = count.intValue();
- String value = count.toString();
- if (intValue >= maxBoardings) {
- value = maxBoardingsKey;
- }
- // Increment the number of boats for the current number of
- // boardings
- Integer nbBoats = map.get(value);
- map.put(value, nbBoats + 1);
- }
-
- // Set the max boat and its number of boardings value
- Map<String, Object> max = nbBoardingsByBoat.get(0);
- result.setMaxBoardingBoat((Boat)max.get(boatAlias));
- Long maxValue = (Long)max.get(countAlias);
- result.setMaxBoardingValue(maxValue.intValue());
- }
- return result;
- }
-
@Override
public BoardingResult executeGetBoardingBoats(TopiaContext transaction,
SamplingFilter filter)
@@ -332,101 +256,8 @@
return result;
}
-
- @Deprecated
+ // should be merged into getComplianceBoardingIndicator
public Map<String, Double> executeGetNonComplianceBoardingIndicator(
- TopiaContext transaction, Company company) throws TopiaException {
-
- // Carefull with results, the company may not be present in the map :
- // only if there is no unfinished sampleRow or no contact done
- Map<String, Double> results = new HashMap<String, Double>();
-
- ContactDAO dao = WaoDAOHelper.getContactDAO(transaction);
-
- // Only for done contacts with no constraint
- TopiaQuery query =
- dao.createQueryDoneContactsFromDate(null, null);
-
- // Prepare properties for query
- String contactAlias = query.getMainAlias();
- String sampleRowProperty =
- TopiaQuery.getProperty(contactAlias, Contact.SAMPLE_ROW);
- String nbObservantsRealProperty =
- TopiaQuery.getProperty(contactAlias, Contact.NB_OBSERVANTS);
-
- String sampleRowEndProperty =
- TopiaQuery.getProperty(sampleRowProperty, SampleRow.PERIOD_END);
- String companyProperty =
- TopiaQuery.getProperty(sampleRowProperty, SampleRow.COMPANY);
- String nbObservantsExpectedProperty =
- TopiaQuery.getProperty(sampleRowProperty, SampleRow.NB_OBSERVANTS);
-
- String companyNameProperty =
- TopiaQuery.getProperty(companyProperty, Company.NAME);
-
- // Only for unfinished sampleRows
- query.addWhere(sampleRowEndProperty, Op.GE, context.getCurrentDate());
-
- if (company != null) {
- query.addEquals(companyProperty, company);
- }
-
- // Prepare results
- query.setSelect(companyNameProperty, "COUNT(*)").
- addGroup(companyNameProperty);
-
- if (log.isDebugEnabled()) {
- log.debug("Query for total : " + query);
- }
-
- List<Object[]> totalResults = transaction.findByQuery(query);
-
- // Use the same query and add the constraint of non compliance
- //i.e. nbObservantsReal (contact) < nbObservantsExpected (sampleRow)
-// query.addWhere(contact + "." + Contact.NB_OBSERVANTS + " < " +
-// sampleRow + "." + SampleRow.NB_OBSERVANTS);
- query.addWhere(new StringBuilder(nbObservantsRealProperty).
- append(" < ").
- append(nbObservantsExpectedProperty).
- toString()
- );
-
- if (log.isDebugEnabled()) {
- log.debug("Query for result : " + query);
- }
-
- List<Object[]> diffResults = transaction.findByQuery(query);
-
- // Use the map to set the number of non compliance results
- for (Object[] row : diffResults) {
- String rowCompanyName = (String)row[0];
- Long rowCount = (Long)row[1];
- if (log.isDebugEnabled()) {
- log.debug("result row : " + rowCompanyName + " = " + rowCount);
- }
- results.put(rowCompanyName, rowCount.doubleValue());
- }
-
- // Get the previous value from the map and make the division to have
- // the result percent of non compliance. Put 0 in the map if no
- // previous result is set
- for (Object[] row : totalResults) {
- String rowCompanyName = (String)row[0];
- Long rowCount = (Long)row[1];
- if (log.isDebugEnabled()) {
- log.debug("total row : " + rowCompanyName + " = " + rowCount);
- }
- Double value = results.get(rowCompanyName);
- if (value == null) {
- results.put(rowCompanyName, 0.);
- } else {
- results.put(rowCompanyName, value / rowCount);
- }
- }
- return results;
- }
-
- public Map<String, Double> executeGetNonComplianceBoardingIndicator(
TopiaContext transaction, SamplingFilter filter) throws TopiaException {
// Carefull with results, the company may not be present in the map :
@@ -523,24 +354,6 @@
return results;
}
- @Deprecated
- protected Map<String, Double> executeGetComplianceBoardingIndicator(
- TopiaContext transaction, Company company) throws Exception {
- // here, we need compliance, so we get non-compliance values
- // and we make the operation to switch
-
- Map<String, Double> nonCompliances = executeGetNonComplianceBoardingIndicator(transaction, company);
- Map<String, Double> compliances = new HashMap<String, Double>();
-
- // make the switch, fill compliances with data from nonCompliances
- for (Map.Entry<String, Double> nonCompliance : nonCompliances.entrySet()) {
- Double compliance = 1.0 - nonCompliance.getValue();
- compliances.put(nonCompliance.getKey(), compliance);
- }
-
- return compliances;
- }
-
@Override
protected Map<String, Double> executeGetComplianceBoardingIndicator(
TopiaContext transaction, SamplingFilter filter) throws Exception {
@@ -559,136 +372,6 @@
return compliances;
}
- @Deprecated
- public Collection<ContactStateStatistics> executeGetContactStateStatistics(
- TopiaContext transaction, Company company, PeriodDates period)
- throws TopiaException {
-
-// ContactDAO dao = WaoDAOHelper.getContactDAO(transaction);
-
- // Only for contacts not refused by the program
-// String contactAlias = "C";
-// String validationProgramProperty =
-// TopiaQuery.getProperty(contactAlias, Contact.VALIDATION_PROGRAM);
-//
-// WaoQueryHelper.ContactProperty contactProperty =
-// WaoQueryHelper.newContactProperty();
-//
-// WaoQueryHelper.CompanyProperty companyProperty =
-// contactProperty.observerProperty().companyProperty();
-//
-// TopiaQuery query = dao.createQuery(contactProperty.$alias()).
-// addWhere(WaoQueryHelper.format(
-// "$1 IS NULL OR $1 = :booleanTrue", contactProperty.validationProgram())
-// ).addParam("booleanTrue", Boolean.TRUE);
-//// addWhere(new StringBuilder(validationProgramProperty).
-//// append(" IS NULL OR ").
-//// append(validationProgramProperty).
-//// append(" = :booleanTrue").
-//// toString()
-//// ).addParam("booleanTrue", Boolean.TRUE);
-//
-//// String companyProperty =
-//// TopiaQuery.getProperty(contactAlias, Contact.OBSERVER, WaoUser.COMPANY);
-//
-// if (company != null) {
-// query.addEquals(companyProperty.$alias(), company);
-// }
-//
-// if (period != null) {
-// // Contacts include in the period
-// period.initDayOfMonthExtremities();
-//
-//// String tideBeginDateProperty =
-//// TopiaQuery.getProperty(contactAlias, Contact.TIDE_BEGIN_DATE);
-//// String createDateProperty =
-//// TopiaQuery.getProperty(contactAlias, Contact.TOPIA_CREATE_DATE);
-// query.addWhere(WaoQueryHelper.format(
-// "($1 IS NOT NULL AND $1 BETWEEN :fromDate AND :thruDate)" +
-// " OR ($1 IS NULL AND $2 BETWEEN :fromData AND :thurDate)",
-// contactProperty.tideBeginDate(),
-// contactProperty.topiaCreateDate())
-//// query.addWhere(new StringBuilder("(").
-//// append(tideBeginDateProperty).
-//// append(" IS NOT NULL AND ").
-//// append(tideBeginDateProperty).
-//// append(" BETWEEN :fromDate AND :thruDate)").
-//// append(" OR (").
-//// append(tideBeginDateProperty).
-//// append(" IS NULL AND ").
-//// append(createDateProperty).
-//// append(" BETWEEN :fromDate AND :thruDate)").
-//// toString()
-// ).addParam("fromDate", period.getFromDate()).
-// addParam("thruDate", period.getThruDate());
-// }
-//
-//// String stateProperty =
-//// TopiaQuery.getProperty(contactAlias, Contact.STATE);
-//// String companyNameProperty =
-//// TopiaQuery.getProperty(companyProperty, Company.NAME);
-//
-// query.addGroup(companyProperty.name(), contactProperty.state()).
-// addOrder(companyProperty.name()).
-// setSelect(companyProperty.name(), contactProperty.state(), "COUNT(*)");
-
- WaoQueryHelper.ContactProperty contactProperty =
- WaoQueryHelper.newContactProperty();
-
- WaoQueryHelper.CompanyProperty companyProperty =
- contactProperty.observerProperty().companyProperty();
-
- TopiaQuery query = WaoQueryHelper.createQuery(contactProperty).
- addWhere(WaoQueryHelper.format(
- "$1 IS NULL OR $1 = :booleanTrue",
- contactProperty.validationProgram())
- ).addParam("booleanTrue", Boolean.TRUE);
-
- if (company != null) {
- query.addEquals(companyProperty.$alias(), company);
- }
-
- if (period != null) {
- // Contacts include in the period
- period.initDayOfMonthExtremities();
-
- query.addWhere(WaoQueryHelper.format(
- "($1 IS NOT NULL AND $1 BETWEEN :fromDate AND :thruDate)" +
- " OR ($1 IS NULL AND $2 BETWEEN :fromDate AND :thruDate)",
- contactProperty.tideBeginDate(),
- contactProperty.topiaCreateDate())
- ).addParam("fromDate", period.getFromDate()).
- addParam("thruDate", period.getThruDate());
- }
-
- query.addGroup(companyProperty.name(), contactProperty.state()).
- addOrder(companyProperty.name()).
- setSelect(companyProperty.name(), contactProperty.state(), "COUNT(*)");
-
- Map<String, ContactStateStatistics> results = new HashMap<String, ContactStateStatistics>();
-
- List<Object[]> queryResults = transaction.findByQuery(query);
-
- for (Object[] row : queryResults) {
- String rowCompanyName = (String)row[0];
- int rowState = (Integer)row[1];
- ContactState state = ContactState.valueOf(rowState);
- Long rowCount = (Long)row[2];
- if (log.isDebugEnabled()) {
- log.debug("res : " + rowCompanyName + " _ " + state + " _ " + rowCount);
- }
- ContactStateStatistics stats = results.get(rowCompanyName);
- if (stats == null) {
- stats = new ContactStateStatisticsImpl();
- stats.setCompanyName(rowCompanyName);
- results.put(rowCompanyName, stats);
- }
- stats.addResult(state, rowCount.intValue());
- }
-
- return results.values();
- }
-
@Override
public Collection<ContactStateStatistics> executeGetContactStateStatistics
(TopiaContext transaction, SamplingFilter filter)
@@ -749,72 +432,6 @@
return results.values();
}
- @Deprecated
- public Collection<ContactAverageReactivity>
- executeGetContactDataInputDateReactivity(TopiaContext transaction,
- Company company, PeriodDates period) throws TopiaException {
- // Carefull with results, the company may not be present in the map :
- // only if there is no unfinished sampleRow or no contact done
-
- 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);
- String companyNameProperty =
- TopiaQuery.getProperty(companyProperty, Company.NAME);
- String tideBeginDateProperty =
- TopiaQuery.getProperty(contactAlias, Contact.TIDE_BEGIN_DATE);
- String dataInputProperty =
- TopiaQuery.getProperty(contactAlias, Contact.DATA_INPUT_DATE);
-
- if (company != null) {
- query.addEquals(companyProperty, company);
- }
- //period.initDayOfMonthExtremities();
-
- if (period.getThruDate() != null) {
- query.addWhere(tideBeginDateProperty, Op.LE, period.getThruDate());
- }
-
- query.setSelect(companyNameProperty, dataInputProperty, tideBeginDateProperty);
-
- if (log.isDebugEnabled()) {
- log.debug("Query : " + query);
- }
-
- List<Object[]> res = transaction.findByQuery(query);
-
- for (Object[] row : res) {
- String rowCompanyName = (String)row[0];
- Date rowDataInputDate = (Date)row[1];
- Date rowTideBeginDate = (Date)row[2];
-
- int nbDays = DateUtil.getDifferenceInDays(rowTideBeginDate, rowDataInputDate);
-
- if (log.isDebugEnabled()) {
- log.debug("Company : " + rowCompanyName);
- log.debug("tideBegin : " + rowTideBeginDate);
- log.debug("dataInput : " + rowDataInputDate);
- log.debug("nbDays : " + nbDays);
- }
-
- ContactAverageReactivity avg = results.get(rowCompanyName);
- if (avg == null) {
- avg = new ContactAverageReactivityImpl();
- avg.setCompanyName(rowCompanyName);
- results.put(rowCompanyName, avg);
- }
-
- avg.addValue(nbDays);
- }
- return results.values();
- }
-
@Override
public Collection<ContactAverageReactivity>
executeGetContactDataInputDateReactivity(TopiaContext transaction,
@@ -902,33 +519,6 @@
TopiaContext transaction, ContactFilter filter)
throws TopiaException {
- ContactDAO dao = WaoDAOHelper.getContactDAO(transaction);
-
-// WaoQueryHelper.ContactProperty contactProperty =
-// WaoQueryHelper.newContactProperty();
-//
-// WaoQueryHelper.BoatDistrictProperty boatDistrictProperty =
-// contactProperty.boatProperty().boatDistrictProperty();
-//
-// TopiaQuery query = dao.createQuery(contactProperty.$alias()).
-// // Only districts with no null coordinates
-// addNotNull(boatDistrictProperty.latitude()).
-// addNotNull(boatDistrictProperty.longitude()).
-// // Don't take contacts refused by company or program
-// addNullOr(contactProperty.validationCompany(), Op.NEQ, Boolean.FALSE).
-// addNullOr(contactProperty.validationProgram(), Op.NEQ, Boolean.FALSE);
-//
-// if (company != null) {
-// query.addEquals(contactProperty.observerProperty().company(), company);
-// }
-
-// WaoQueryBuilder builder = dao.createQueryWithBoatDistrictCoordinates(filter);
-//
-// ContactProperty contactProperty = builder.getContactProperty();
-//
-// BoatDistrictProperty boatDistrictProperty =
-// contactProperty.boatProperty().boatDistrictProperty();
-
WaoQueryBuilder builder = context.newQueryBuilder();
ContactProperty contactProperty = builder.initializeForContact();
@@ -1073,16 +663,15 @@
@Override
protected GlobalSynthesisResult executeGetGlobalSynthesisResult
- (TopiaContext transaction, Company company, PeriodDates period,
- SamplingFilter filter) throws Exception {
+ (TopiaContext transaction, SamplingFilter filter) throws Exception {
- Double value = 30.0;
+ Double value;
Map<SynthesisId, Double> indicatorValues = new HashMap<SynthesisId, Double>();
- // value = getIndicatorValueForDataSampling(transaction, samplingFilter);
+ value = getIndicatorValueForDataSampling(transaction, filter);
indicatorValues.put(SynthesisId.GRAPH_SAMPLING, value);
- // value = getIndicatorValueForBoarding(transaction, company, fromDate);
+ value = getIndicatorValueForBoarding(transaction, filter);
indicatorValues.put(SynthesisId.GRAPH_BOARDING, value);
value = getIndicatorValueForComplianceBoarding(transaction, filter);
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-10-21 14:51:31 UTC (rev 701)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-10-21 16:06:37 UTC (rev 702)
@@ -150,8 +150,7 @@
if (globalSynthesisResult == null) {
PeriodDates period = PeriodDates.createMonthsPeriodFromToday(-12);
Company company = !user.isAdmin() ? user.getCompany() : null;
- globalSynthesisResult = serviceSynthesis.getGlobalSynthesisResult(
- company, period, getFilter());
+ globalSynthesisResult = serviceSynthesis.getGlobalSynthesisResult(getFilter());
}
return globalSynthesisResult;
}
@@ -214,30 +213,18 @@
return this;
}
- /********************* DYNAMICAL GRAPH : DATA SAMPLING ********************/
+ /********************* FILTERS ********************************************/
@Persist
private SamplingFilter dataSamplingFilter;
-
- @InjectComponent
- private Zone filtersZone;
- @Persist
- private ChartType dataSamplingChartType;
-
- private boolean reset;
-
- private void initSamplingBlock() throws WaoException {
- initSelectFilters(true, false, true);
- }
-
@Override
public SamplingFilter getFilter() throws WaoException {
if (dataSamplingFilter == null) {
dataSamplingFilter = new SamplingFilterImpl();
if (!user.isAdmin()) {
dataSamplingFilter.setCompany(user.getCompany());
- }
+ }
}
return dataSamplingFilter;
}
@@ -258,6 +245,34 @@
return false;
}
+ void onSelectedFromReset() {
+ reset = true;
+ }
+
+ Object onSuccessFromFiltersForm() {
+ if (isEdited()) {
+ return filtersZone.getBody();
+ }
+ if (reset) {
+ dataSamplingFilter = null;
+ }
+ return this;
+ }
+
+ /********************* DYNAMICAL GRAPH : DATA SAMPLING ********************/
+
+ @InjectComponent
+ private Zone filtersZone;
+
+ @Persist
+ private ChartType dataSamplingChartType;
+
+ private boolean reset;
+
+ private void initSamplingBlock() throws WaoException {
+ initSelectFilters(true, false, true);
+ }
+
public JFreeChart getDataSamplingChart() throws WaoException {
List<SortedMap<Date, Integer>> res = serviceSynthesis.getDataSampling(getFilter());
Map<String, Map<?, Integer>> data = new HashMap<String, Map<?, Integer>>();
@@ -280,20 +295,6 @@
return dataSamplingChartType;
}
- void onSelectedFromReset() {
- reset = true;
- }
-
- Object onSuccessFromFiltersForm() {
- if (isEdited()) {
- return filtersZone.getBody();
- }
- if (reset) {
- dataSamplingFilter = null;
- }
- return this;
- }
-
/********************* STATIC GRAPH : BOARDING BOAT ***********************/
private BoardingResult boardingResult;
@@ -323,7 +324,7 @@
data.put("Navires", getBoardingResult().getData());
String title = "Sollicitations des navires depuis le " +
- getDateFormat().format(getFromDate());
+ getDateFormat().format(getFilter().getPeriod().getFromDate());
if (companyForBoarding != null) {
title += "\nSociété " + companyForBoarding.getName();
@@ -340,29 +341,8 @@
return boardingResult;
}
- public Company getCompanyForBoarding() {
- // Initialize only for an observer user. For admin, the company can
- // be null to search boardings for all companies.
- if (companyForBoarding == null && !user.isAdmin()) {
- companyForBoarding = user.getCompany();
- }
- if (log.isDebugEnabled()) {
- log.debug("company : " + companyForBoarding);
- }
- return companyForBoarding;
- }
+ /********************* INDICATOR : COMPLIANCE BOARDING ********************/
- public Date getFromDate() {
- return DateUtil.createDateAfterToday(0, -12, 0);
- }
-
- @Log
- void onSuccessFromFilterCompanyForBoarding() throws WaoException {
- companyForBoarding = getCompanySelectModel().findObject(companyIdForBoarding);
- }
-
- /********************* INDICATOR : NON COMPLIANCE BOARDING ****************/
-
private Map<String, Double> complianceBoarding;
@Property
@@ -382,7 +362,6 @@
complianceBoarding =
serviceSynthesis.getComplianceBoardingIndicator(getFilter());
}
-
return complianceBoarding;
}
@@ -401,9 +380,6 @@
private Collection<ContactStateStatistics> contactStateStatistics;
- @Persist
- private PeriodDates periodForContactStates;
-
@Property
private ContactStateStatistics contactStateStats;
@@ -436,13 +412,6 @@
return contactStateStatistics;
}
- public PeriodDates getPeriodForContactStates() {
- if (periodForContactStates == null) {
- periodForContactStates = PeriodDates.createMonthsPeriodFromToday(-12);
- }
- return periodForContactStates;
- }
-
/**
* Get the value for current contactStateStats in table row (by company)
* and current contactState in table column.
@@ -471,9 +440,6 @@
private Collection<ContactAverageReactivity> allegroReactivity;
- @Persist
- private PeriodDates periodForAllegroReactivity;
-
@Property
private ContactAverageReactivity allegroReactivityEntry;
@@ -487,14 +453,10 @@
return allegroReactivity;
}
- public PeriodDates getPeriodForAllegroReactivity() {
- if (periodForAllegroReactivity == null) {
- periodForAllegroReactivity = PeriodDates.createMonthsPeriodFromToday(-3);
- }
- return periodForAllegroReactivity;
- }
-
public Double getAllegroReactivityValue() throws WaoException {
+
+ // FIXME bleny 20101021 in this case, what occurs in indicator ?
+
if (!getAllegroReactivity().isEmpty()) {
ContactAverageReactivity entry = (ContactAverageReactivity)
CollectionUtils.get(getAllegroReactivity(), 0);
@@ -513,4 +475,4 @@
return "";
}
-}
+}
\ No newline at end of file
Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-21 14:51:31 UTC (rev 701)
+++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-21 16:06:37 UTC (rev 702)
@@ -86,6 +86,8 @@
</div>
</fieldset>
+ <div class="mtop30" />
+
<!-- MENU : delegator -->
<div class="clearfix">
<div class="fleft" id="so-synthesis-menu">
@@ -158,14 +160,6 @@
<br />
<p>Ces résultats ne concernent que les lignes du plan d'échantillonnage<br /> ayant une durée moyenne de marées inférieure ou égale à 48h</p>
<br />
- <t:if t:test="user.admin">
- <form t:type="form" t:id="filterCompanyForBoarding">
- <t:label t:for="companyForBoarding" />:
- <input t:type="select" t:id="companyForBoarding" t:model="companySelectModel" value="companyIdForBoarding"/>
- <input t:type="submit" class="ico search-32px" t:id="searchForBoarding" value="Search"
- title="Création du graphique pour cette société"/>
- </form>
- </t:if>
<t:chart t:width="600" t:height="400" t:chart="boardingBoatsChart" />
<t:if t:test="boardingResult.maxBoardingBoat">
<p>
@@ -235,17 +229,6 @@
ceux qui ont été refusés par le programme.
</p>
<br />
- <p>
- <form t:type="form" t:id="filterPeriodForContactStates">
- <label>Période : </label>
- <t:label t:for="periodBeginForContactStates" />
- <input t:type="datefield" class="width70" t:id="periodBeginForContactStates" t:value="periodForContactStates.fromDate" t:format="MM/yyyy" t:validate="required"/>
- <t:label t:for="periodEndForContactStates" />
- <input t:type="datefield" class="width70" t:id="periodEndForContactStates" t:value="periodForContactStates.thruDate" t:format="MM/yyyy" t:validate="required" />
- <input t:type="submit" class="ico search-32px" t:id="searchForContactStates" value="Search"
- title="Rechercher les états des contacts sur cette période"/>
- </form>
- </p>
<table class="t-data-grid">
<thead>
<tr>
@@ -288,17 +271,6 @@
Ce résultat est une moyenne du nombre de jours entre la date de saisie dans Allegro et la date de fin de la marée des contacts validés.
</p>
<br />
- <p>
- <form t:type="form" t:id="filterPeriodForAllegroReactivity">
- <label>Période : </label>
- <t:label t:for="periodBeginForAllegroReactivity" />
- <input t:type="datefield" class="width70" t:id="periodBeginForAllegroReactivity" t:value="periodForAllegroReactivity.fromDate" />
- <t:label t:for="periodEndForAllegroReactivity" />
- <input t:type="datefield" class="width70" t:id="periodEndForAllegroReactivity" t:value="periodForAllegroReactivity.thruDate" />
- <input t:type="submit" class="ico search-32px" t:id="searchForAllegroReactivity" value="Search"
- title="Calcul de la moyenne du nombre de jours entre la date de saisie dans Allegro et la date de fin de marée sur la période sélectionnée"/>
- </form>
- </p>
<t:if t:test="user.admin">
<table class="t-data-grid">
<thead>
1
0
[Suiviobsmer-commits] r701 - in trunk: wao-business/src/main/java/fr/ifremer/wao/service wao-business/src/main/resources/i18n 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 21 Oct '10
by bleny@users.labs.libre-entreprise.org 21 Oct '10
21 Oct '10
Author: bleny
Date: 2010-10-21 14:51:31 +0000 (Thu, 21 Oct 2010)
New Revision: 701
Log:
added filter on all synthesis ; saving before refactor (break the build)
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java
trunk/wao-business/src/main/resources/i18n/wao-business-en_GB.properties
trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties
trunk/wao-business/src/main/xmi/wao.zargo
trunk/wao-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-10-21 10:21:30 UTC (rev 700)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-10-21 14:51:31 UTC (rev 701)
@@ -175,22 +175,21 @@
* results since this date. For observer view, only results for his
* company is needed.
*
- * @param company the company used to filter results
- * @param fromDate the since date used to filter contact results
* @return a BoardingResult which contains the number of boats for boardings
* from 1 to {@code MAX_BOARDINGS}, the boat with the max boarding and its
* value.
* @throws WaoException
*/
- @Override
+ @Deprecated
public BoardingResult executeGetBoardingBoats(TopiaContext transaction,
- Company company, Date fromDate)
- throws TopiaException {
+ Company company,
+ Date fromDate)
+ throws TopiaException {
Map<String, Integer> map = new LinkedHashMap<String, Integer>();
BoardingResult result = new BoardingResultImpl();
result.setData(map);
- // Initialiaze max boardings and its max key value
+ // Initialize max boardings and its max key value
final int maxBoardings = 12;
final String maxBoardingsKey = maxBoardings + " +";
@@ -201,13 +200,11 @@
}
map.put(maxBoardingsKey, 0);
- ContactDAO dao =
- WaoDAOHelper.getContactDAO(transaction);
+ ContactDAO dao = WaoDAOHelper.getContactDAO(transaction);
// The number of boardings is the number of finished contacts
// Use fromDate to filter contacts finished from this date
// No need to use boat filter for this method
- TopiaQuery query =
- dao.createQueryDoneContactsFromDate(null, fromDate);
+ TopiaQuery query = dao.createQueryDoneContactsFromDate(null, fromDate);
String contact = query.getMainAlias();
String sampleRow = contact + "." + Contact.SAMPLE_ROW;
@@ -260,7 +257,83 @@
return result;
}
+ @Override
+ public BoardingResult executeGetBoardingBoats(TopiaContext transaction,
+ SamplingFilter filter)
+ throws TopiaException {
+ Map<String, Integer> map = new LinkedHashMap<String, Integer>();
+ BoardingResult result = new BoardingResultImpl();
+ result.setData(map);
+ // Initialize max boardings and its max key value
+ final int maxBoardings = 12;
+ final String maxBoardingsKey = maxBoardings + " +";
+
+ // Prepare map which contains for each entry the number of boardings
+ // for the key and the number of boats for the value.
+ for (int i = 1; i < maxBoardings; i++) {
+ map.put(String.valueOf(i), 0);
+ }
+ map.put(maxBoardingsKey, 0);
+
+ // The number of boardings is the number of finished contacts
+ // Use fromDate to filter contacts finished from this date
+ // No need to use boat filter for this method
+ WaoQueryBuilder builder = context.newQueryBuilder();
+ ContactProperty contactProperty = builder.initializeForContact();
+ TopiaQuery query = builder.applySamplingFilter(filter).
+ addEquals(contactProperty.state(), ContactState.BOARDING_DONE.ordinal()).
+ addEquals(contactProperty.validationCompany(), Boolean.TRUE).
+ addNullOr(contactProperty.validationProgram(), Op.EQ, Boolean.TRUE);
+
+ String contact = query.getMainAlias();
+ String sampleRow = contact + "." + Contact.SAMPLE_ROW;
+
+ // Only for sampleRows with averageTideTime less or equals to 2 days
+ query.addWhere(sampleRow + "." + SampleRow.AVERAGE_TIDE_TIME, Op.LE, 2.);
+
+ // Prepare aliases for mapping results in select part
+ String countAlias = "nbBoardings";
+ String boatAlias = "boat";
+ // Use a map for each result with boat and its number of boardings
+ // Order by number of boardings to easily find the max value (the
+ // first result)
+ query.setSelect("new map(" + contact + "." + Contact.BOAT + " as " +
+ boatAlias + ", COUNT(*) as " + countAlias + ")").
+ addGroup(contact + "." + Contact.BOAT).
+ addOrderDesc("COUNT(*)");
+
+ if (log.isTraceEnabled()) {
+ log.trace("Exec query : " + query);
+ }
+
+ List<Map<String, Object>> nbBoardingsByBoat = transaction.findByQuery(query);
+
+ if (!nbBoardingsByBoat.isEmpty()) {
+ for (Map<String, Object> row : nbBoardingsByBoat) {
+ Long count = (Long)row.get(countAlias);
+ int intValue = count.intValue();
+ String value = count.toString();
+ if (intValue >= maxBoardings) {
+ value = maxBoardingsKey;
+ }
+ // Increment the number of boats for the current number of
+ // boardings
+ Integer nbBoats = map.get(value);
+ map.put(value, nbBoats + 1);
+ }
+
+ // Set the max boat and its number of boardings value
+ Map<String, Object> max = nbBoardingsByBoat.get(0);
+ result.setMaxBoardingBoat((Boat)max.get(boatAlias));
+ Long maxValue = (Long)max.get(countAlias);
+ result.setMaxBoardingValue(maxValue.intValue());
+ }
+ return result;
+ }
+
+
+ @Deprecated
public Map<String, Double> executeGetNonComplianceBoardingIndicator(
TopiaContext transaction, Company company) throws TopiaException {
@@ -353,7 +426,104 @@
return results;
}
- @Override
+ public Map<String, Double> executeGetNonComplianceBoardingIndicator(
+ TopiaContext transaction, SamplingFilter filter) throws TopiaException {
+
+ // Carefull with results, the company may not be present in the map :
+ // 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).
+ addEquals(contactProperty.state(), ContactState.BOARDING_DONE.ordinal()).
+ addEquals(contactProperty.validationCompany(), Boolean.TRUE).
+ addNullOr(contactProperty.validationProgram(), Op.EQ, Boolean.TRUE);
+
+
+ // Only for done contacts with no constraint
+ // TopiaQuery query =
+ // dao.createQueryDoneContactsFromDate(null, null);
+
+ // Prepare properties for query
+ String contactAlias = query.getMainAlias();
+ String sampleRowProperty =
+ TopiaQuery.getProperty(contactAlias, Contact.SAMPLE_ROW);
+ String nbObservantsRealProperty =
+ TopiaQuery.getProperty(contactAlias, Contact.NB_OBSERVANTS);
+
+ String sampleRowEndProperty =
+ TopiaQuery.getProperty(sampleRowProperty, SampleRow.PERIOD_END);
+ String companyProperty =
+ TopiaQuery.getProperty(sampleRowProperty, SampleRow.COMPANY);
+ String nbObservantsExpectedProperty =
+ TopiaQuery.getProperty(sampleRowProperty, SampleRow.NB_OBSERVANTS);
+
+ String companyNameProperty =
+ TopiaQuery.getProperty(companyProperty, Company.NAME);
+
+ // Only for unfinished sampleRows
+ query.addWhere(sampleRowEndProperty, Op.GE, context.getCurrentDate());
+
+ // Prepare results
+ query.setSelect(companyNameProperty, "COUNT(*)").
+ addGroup(companyNameProperty);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Query for total : " + query);
+ }
+
+ List<Object[]> totalResults = transaction.findByQuery(query);
+
+ // Use the same query and add the constraint of non compliance
+ //i.e. nbObservantsReal (contact) < nbObservantsExpected (sampleRow)
+// query.addWhere(contact + "." + Contact.NB_OBSERVANTS + " < " +
+// sampleRow + "." + SampleRow.NB_OBSERVANTS);
+ query.addWhere(new StringBuilder(nbObservantsRealProperty).
+ append(" < ").
+ append(nbObservantsExpectedProperty).
+ toString()
+ );
+
+ if (log.isDebugEnabled()) {
+ log.debug("Query for result : " + query);
+ }
+
+ List<Object[]> diffResults = transaction.findByQuery(query);
+
+ // Use the map to set the number of non compliance results
+ for (Object[] row : diffResults) {
+ String rowCompanyName = (String)row[0];
+ Long rowCount = (Long)row[1];
+ if (log.isDebugEnabled()) {
+ log.debug("result row : " + rowCompanyName + " = " + rowCount);
+ }
+ results.put(rowCompanyName, rowCount.doubleValue());
+ }
+
+ // Get the previous value from the map and make the division to have
+ // the result percent of non compliance. Put 0 in the map if no
+ // previous result is set
+ for (Object[] row : totalResults) {
+ String rowCompanyName = (String)row[0];
+ Long rowCount = (Long)row[1];
+ if (log.isDebugEnabled()) {
+ log.debug("total row : " + rowCompanyName + " = " + rowCount);
+ }
+ Double value = results.get(rowCompanyName);
+ if (value == null) {
+ results.put(rowCompanyName, 0.);
+ } else {
+ results.put(rowCompanyName, value / rowCount);
+ }
+ }
+ return results;
+ }
+
+ @Deprecated
protected Map<String, Double> executeGetComplianceBoardingIndicator(
TopiaContext transaction, Company company) throws Exception {
// here, we need compliance, so we get non-compliance values
@@ -372,6 +542,24 @@
}
@Override
+ protected Map<String, Double> executeGetComplianceBoardingIndicator(
+ TopiaContext transaction, SamplingFilter filter) throws Exception {
+ // here, we need compliance, so we get non-compliance values
+ // and we make the operation to switch
+
+ Map<String, Double> nonCompliances = executeGetNonComplianceBoardingIndicator(transaction, filter);
+ Map<String, Double> compliances = new HashMap<String, Double>();
+
+ // make the switch, fill compliances with data from nonCompliances
+ for (Map.Entry<String, Double> nonCompliance : nonCompliances.entrySet()) {
+ Double compliance = 1.0 - nonCompliance.getValue();
+ compliances.put(nonCompliance.getKey(), compliance);
+ }
+
+ return compliances;
+ }
+
+ @Deprecated
public Collection<ContactStateStatistics> executeGetContactStateStatistics(
TopiaContext transaction, Company company, PeriodDates period)
throws TopiaException {
@@ -502,7 +690,67 @@
}
@Override
- public Collection<ContactAverageReactivity>
+ public Collection<ContactStateStatistics> executeGetContactStateStatistics
+ (TopiaContext transaction, SamplingFilter filter)
+ throws TopiaException {
+
+ WaoQueryBuilder builder = context.newQueryBuilder();
+ ContactProperty contactProperty = builder.initializeForContact();
+ TopiaQuery query = builder.applySamplingFilter(filter).
+ addNullOr(contactProperty.validationProgram(), Op.EQ, Boolean.TRUE);
+
+ WaoQueryHelper.CompanyProperty companyProperty =
+ contactProperty.observerProperty().companyProperty();
+
+ Company company = filter.getCompany();
+ if (company != null) {
+ query.addEquals(companyProperty.$alias(), company);
+ }
+
+ PeriodDates period = filter.getPeriod();
+ if (period != null) {
+ // Contacts include in the period
+ period.initDayOfMonthExtremities();
+
+ query.addWhere(WaoQueryHelper.format(
+ "($1 IS NOT NULL AND $1 BETWEEN :fromDate AND :thruDate)" +
+ " OR ($1 IS NULL AND $2 BETWEEN :fromDate AND :thruDate)",
+ contactProperty.tideBeginDate(),
+ contactProperty.topiaCreateDate())
+ ).addParam("fromDate", period.getFromDate()).
+ addParam("thruDate", period.getThruDate());
+ }
+
+ query.addGroup(companyProperty.name(), contactProperty.state()).
+ addOrder(companyProperty.name()).
+ setSelect(companyProperty.name(), contactProperty.state(), "COUNT(*)");
+
+ Map<String, ContactStateStatistics> results = new HashMap<String, ContactStateStatistics>();
+
+ List<Object[]> queryResults = transaction.findByQuery(query);
+
+ for (Object[] row : queryResults) {
+ String rowCompanyName = (String)row[0];
+ int rowState = (Integer)row[1];
+ ContactState state = ContactState.valueOf(rowState);
+ Long rowCount = (Long)row[2];
+ if (log.isDebugEnabled()) {
+ log.debug("res : " + rowCompanyName + " _ " + state + " _ " + rowCount);
+ }
+ ContactStateStatistics stats = results.get(rowCompanyName);
+ if (stats == null) {
+ stats = new ContactStateStatisticsImpl();
+ stats.setCompanyName(rowCompanyName);
+ results.put(rowCompanyName, stats);
+ }
+ stats.addResult(state, rowCount.intValue());
+ }
+
+ return results.values();
+ }
+
+ @Deprecated
+ public Collection<ContactAverageReactivity>
executeGetContactDataInputDateReactivity(TopiaContext transaction,
Company company, PeriodDates period) throws TopiaException {
// Carefull with results, the company may not be present in the map :
@@ -568,6 +816,88 @@
}
@Override
+ public Collection<ContactAverageReactivity>
+ executeGetContactDataInputDateReactivity(TopiaContext transaction,
+ SamplingFilter filter) throws TopiaException {
+
+ if (filter.getPeriod() == null) {
+ 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()).
+ addEquals(contactProperty.validationCompany(), Boolean.TRUE).
+ addNullOr(contactProperty.validationProgram(), Op.EQ, Boolean.TRUE);
+
+
+ // Carefull with results, the company may not be present in the map :
+ // only if there is no unfinished sampleRow or no contact done
+
+ 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);
+ String companyNameProperty =
+ TopiaQuery.getProperty(companyProperty, Company.NAME);
+ String tideBeginDateProperty =
+ TopiaQuery.getProperty(contactAlias, Contact.TIDE_BEGIN_DATE);
+ String dataInputProperty =
+ TopiaQuery.getProperty(contactAlias, Contact.DATA_INPUT_DATE);
+
+ Company company = filter.getCompany();
+ if (company != null) {
+ query.addEquals(companyProperty, company);
+ }
+ //period.initDayOfMonthExtremities();
+
+ PeriodDates period = filter.getPeriod();
+ if (period.getThruDate() != null) {
+ query.addWhere(tideBeginDateProperty, Op.LE, period.getThruDate());
+ }
+
+ query.setSelect(companyNameProperty, dataInputProperty, tideBeginDateProperty);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Query : " + query);
+ }
+
+ List<Object[]> res = transaction.findByQuery(query);
+
+ for (Object[] row : res) {
+ String rowCompanyName = (String)row[0];
+ Date rowDataInputDate = (Date)row[1];
+ Date rowTideBeginDate = (Date)row[2];
+
+ int nbDays = DateUtil.getDifferenceInDays(rowTideBeginDate, rowDataInputDate);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Company : " + rowCompanyName);
+ log.debug("tideBegin : " + rowTideBeginDate);
+ log.debug("dataInput : " + rowDataInputDate);
+ log.debug("nbDays : " + nbDays);
+ }
+
+ ContactAverageReactivity avg = results.get(rowCompanyName);
+ if (avg == null) {
+ avg = new ContactAverageReactivityImpl();
+ avg.setCompanyName(rowCompanyName);
+ results.put(rowCompanyName, avg);
+ }
+
+ avg.addValue(nbDays);
+ }
+ return results.values();
+ }
+
+ @Override
public Map<String, PieChartData> executeGetContactPieChartDataByBoatDistrict(
TopiaContext transaction, ContactFilter filter)
throws TopiaException {
@@ -652,6 +982,16 @@
return results;
}
+ @Override
+ protected Map<Company, Double> executeGetDataReliability
+ (TopiaContext transaction, SamplingFilter filter) throws Exception {
+
+ log.debug("period " + filter.getPeriod());
+
+ return null;
+
+ }
+
protected Double getIndicatorValueForDataSampling
(TopiaContext transaction, SamplingFilter filter) {
@@ -690,9 +1030,9 @@
}
protected Double getIndicatorValueForBoarding
- (TopiaContext transaction, Company company, Date fromDate) {
+ (TopiaContext transaction, SamplingFilter filter) {
- BoardingResult boardingResult = getBoardingBoats(company, fromDate);
+ BoardingResult boardingResult = getBoardingBoats(filter);
int numberOfBoatWithOneBoarding = boardingResult.getData().get("1");
int totalNumberOfBoarding = 0;
@@ -705,8 +1045,8 @@
}
protected Double getIndicatorValueForComplianceBoarding
- (TopiaContext transaction, Company company) {
- Map<String, Double> complianceBoarding = getComplianceBoardingIndicator(company);
+ (TopiaContext transaction, SamplingFilter filter) {
+ Map<String, Double> complianceBoarding = getComplianceBoardingIndicator(filter);
double total = 0.0;
int numberOfCompanies = complianceBoarding.size();
for (Double compliance : complianceBoarding.values()) {
@@ -717,8 +1057,9 @@
}
protected Double getIndicatorValueForAllegroReactivity
- (TopiaContext transaction, Company company, PeriodDates periodDates) {
- Collection<ContactAverageReactivity> allegroReactivity = getContactDataInputDateReactivity(company, periodDates);
+ (TopiaContext transaction, SamplingFilter filter) {
+ Collection<ContactAverageReactivity> allegroReactivity =
+ getContactDataInputDateReactivity(filter);
double sumAverages = 0.0;
for (ContactAverageReactivity reactivity : allegroReactivity) {
@@ -732,8 +1073,8 @@
@Override
protected GlobalSynthesisResult executeGetGlobalSynthesisResult
- (TopiaContext transaction, Company company, PeriodDates period)
- throws Exception {
+ (TopiaContext transaction, Company company, PeriodDates period,
+ SamplingFilter filter) throws Exception {
Double value = 30.0;
Map<SynthesisId, Double> indicatorValues = new HashMap<SynthesisId, Double>();
@@ -744,10 +1085,10 @@
// value = getIndicatorValueForBoarding(transaction, company, fromDate);
indicatorValues.put(SynthesisId.GRAPH_BOARDING, value);
- value = getIndicatorValueForComplianceBoarding(transaction, company);
+ value = getIndicatorValueForComplianceBoarding(transaction, filter);
indicatorValues.put(SynthesisId.IND_COMPLIANCE_BOARDING, value);
- value = getIndicatorValueForAllegroReactivity(transaction, company, period);
+ value = getIndicatorValueForAllegroReactivity(transaction, filter);
indicatorValues.put(SynthesisId.IND_ALLEGRO_REACTIVITY, value);
// add data reliability indicator here
Modified: trunk/wao-business/src/main/resources/i18n/wao-business-en_GB.properties
===================================================================
--- trunk/wao-business/src/main/resources/i18n/wao-business-en_GB.properties 2010-10-21 10:21:30 UTC (rev 700)
+++ trunk/wao-business/src/main/resources/i18n/wao-business-en_GB.properties 2010-10-21 14:51:31 UTC (rev 701)
@@ -79,6 +79,7 @@
wao.error.serviceSynthesis.getContactPieChartData=
wao.error.serviceSynthesis.getContactPieChartDataByBoatDistrict=
wao.error.serviceSynthesis.getContactStateStatistics=
+wao.error.serviceSynthesis.getDataReliability=
wao.error.serviceSynthesis.getDataSampling=
wao.error.serviceSynthesis.getGlobalSynthesisParameters=Unable to get data about global synthesis parameters
wao.error.serviceSynthesis.getGlobalSynthesisResult=
Modified: trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties
===================================================================
--- trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties 2010-10-21 10:21:30 UTC (rev 700)
+++ trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties 2010-10-21 14:51:31 UTC (rev 701)
@@ -78,6 +78,7 @@
wao.error.serviceSynthesis.getContactPieChartData=
wao.error.serviceSynthesis.getContactPieChartDataByBoatDistrict=
wao.error.serviceSynthesis.getContactStateStatistics=Impossible de r\u00E9cup\u00E9rer les statistiques sur les \u00E9tats des contacts
+wao.error.serviceSynthesis.getDataReliability=
wao.error.serviceSynthesis.getDataSampling=Impossible de r\u00E9cup\u00E9rer les donn\u00E9es pour le graphique dynamique des efforts de mar\u00E9es
wao.error.serviceSynthesis.getGlobalSynthesisParameters=Impossible de r\u00E9cup\u00E9rer les donn\u00E9es concernant les indicateurs pour la synth\u00E8se globale
wao.error.serviceSynthesis.getGlobalSynthesisResult=
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-10-21 10:21:30 UTC (rev 700)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-10-21 14:51:31 UTC (rev 701)
@@ -151,7 +151,7 @@
PeriodDates period = PeriodDates.createMonthsPeriodFromToday(-12);
Company company = !user.isAdmin() ? user.getCompany() : null;
globalSynthesisResult = serviceSynthesis.getGlobalSynthesisResult(
- company, period);
+ company, period, getFilter());
}
return globalSynthesisResult;
}
@@ -294,7 +294,7 @@
return this;
}
- /********************* STATIC GRAPH : BOARDINGBOAT ************************/
+ /********************* STATIC GRAPH : BOARDING BOAT ***********************/
private BoardingResult boardingResult;
@@ -335,8 +335,7 @@
public BoardingResult getBoardingResult() throws WaoException {
if (boardingResult == null) {
- boardingResult = serviceSynthesis.getBoardingBoats(
- getCompanyForBoarding(), getFromDate());
+ boardingResult = serviceSynthesis.getBoardingBoats(getFilter());
}
return boardingResult;
}
@@ -381,7 +380,7 @@
if (complianceBoarding == null) {
Company company = !user.isAdmin() ? user.getCompany() : null;
complianceBoarding =
- serviceSynthesis.getComplianceBoardingIndicator(company);
+ serviceSynthesis.getComplianceBoardingIndicator(getFilter());
}
return complianceBoarding;
@@ -432,7 +431,7 @@
if (contactStateStatistics == null) {
Company company = !user.isAdmin() ? user.getCompany() : null;
contactStateStatistics =
- serviceSynthesis.getContactStateStatistics(company, getPeriodForContactStates());
+ serviceSynthesis.getContactStateStatistics(getFilter());
}
return contactStateStatistics;
}
@@ -483,8 +482,7 @@
if (allegroReactivity == null) {
Company company = !user.isAdmin() ? user.getCompany() : null;
allegroReactivity =
- serviceSynthesis.getContactDataInputDateReactivity(company,
- getPeriodForAllegroReactivity());
+ serviceSynthesis.getContactDataInputDateReactivity(getFilter());
}
return allegroReactivity;
}
Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-21 10:21:30 UTC (rev 700)
+++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-21 14:51:31 UTC (rev 701)
@@ -30,6 +30,62 @@
<t:layout t:pageTitle="Synthèse et indicateurs" t:contentId="so-synthesis"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+
+ <fieldset>
+ <legend>Filtres</legend>
+ <div t:type="zone" t:id="filtersZone" class="so-filters-form" id="so-datasampling-filters">
+ <!--<div t:type="zone" t:id="dataSamplingFiltersZone" t:update="show" id="so-datasampling-filters">-->
+ <form t:type="form" t:id="filtersForm" t:zone="so-datasampling-filters">
+ <t:errors />
+ <div class="t-beaneditor">
+ <div class="filterRow">
+ <label>Période: </label>
+ <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"/>
+ </div>
+ <div>
+ <t:if t:test="user.admin">
+ <t:label t:for="company" />:
+ <input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/>
+ <input t:type="submit" class="ico22px refresh" t:id="refreshByCompany" value="Refresh"
+ title="Rafraîchir les filtres en fonction de la société sélectionnée"/>
+ </t:if>
+ <t:label t:for="programName" />:
+ <select t:type="select" t:id="programName" t:model="programSelectModel" value="filter.programName" />
+ <input t:type="submit" class="ico22px refresh" t:id="refreshByProgram" value="Refresh"
+ title="Rafraîchir les secteurs de pêche et les métiers en fonction du programme sélectionné"/>
+ </div>
+ <div class="filterRow" t:type="zone" t:id="sampleRowZone" t:update="show">
+ <t:label t:for="facadeName" />:
+ <select t:type="select" t:id="facadeName" t:model="facadeSelectModel" value="filter.facadeName" />
+ <input t:type="submit" class="ico22px refresh" t:id="refreshByFacade" value="Refresh"
+ title="Rafraîchir les zones et les métiers en fonction de la façade sélectionnée"/>
+ <t:label t:for="sectorName" />:
+ <select t:type="select" t:id="sectorName" t:model="sectorSelectModel" value="filter.sectorName" />
+ <input t:type="submit" class="ico22px refresh" t:id="refreshBySector" value="Refresh"
+ title="Rafraîchir les métiers en fonction de la zone sélectionnée"/>
+ <t:label t:for="sampleRow" />:
+ <input t:type="select" t:id="sampleRow" t:model="sampleRowSelectModel" value="sampleRowId" />
+
+ <!--<t:label t:for="program" />:
+ <input t:type="select" t:id="program" t:model="programSelectModel" value="programId" />-->
+ </div>
+ <div class="filterRow">
+ <input t:type="checkbox" t:id="estimatedTides" value="filter.estimatedTides" />
+ <t:label t:for="estimatedTides" title="L'effort d'observations estimé équivaut au nombre de contacts validés ou non par la société. Les contacts refusés par le programme ne sont pas pris en compte" />
+ </div>
+ <div class="t-beaneditor-row aright">
+ <input t:type="submit" class="ico search-32px" t:id="search" value="Search" title="Création du graphique en fonction des filtres saisies"/>
+ <input t:type="submit" class="ico undo" t:id="reset" value="Reset" title="Remettre les filtres par défaut" />
+ </div>
+ </div>
+ </form>
+ <!--</div>-->
+ </div>
+ </fieldset>
+
<!-- MENU : delegator -->
<div class="clearfix">
<div class="fleft" id="so-synthesis-menu">
@@ -75,60 +131,6 @@
<t:block t:id="ind0">
<div class="acenter" id="so-datasampling">
<h2>Données des marées (réalisé / planifié)</h2>
- <fieldset>
- <legend>Filtres</legend>
- <div t:type="zone" t:id="filtersZone" class="so-filters-form" id="so-datasampling-filters">
- <!--<div t:type="zone" t:id="dataSamplingFiltersZone" t:update="show" id="so-datasampling-filters">-->
- <form t:type="form" t:id="filtersForm" t:zone="so-datasampling-filters">
- <t:errors />
- <div class="t-beaneditor">
- <div class="filterRow">
- <label>Période: </label>
- <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"/>
- </div>
- <div>
- <t:if t:test="user.admin">
- <t:label t:for="company" />:
- <input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/>
- <input t:type="submit" class="ico22px refresh" t:id="refreshByCompany" value="Refresh"
- title="Rafraîchir les filtres en fonction de la société sélectionnée"/>
- </t:if>
- <t:label t:for="programName" />:
- <select t:type="select" t:id="programName" t:model="programSelectModel" value="filter.programName" />
- <input t:type="submit" class="ico22px refresh" t:id="refreshByProgram" value="Refresh"
- title="Rafraîchir les secteurs de pêche et les métiers en fonction du programme sélectionné"/>
- </div>
- <div class="filterRow" t:type="zone" t:id="sampleRowZone" t:update="show">
- <t:label t:for="facadeName" />:
- <select t:type="select" t:id="facadeName" t:model="facadeSelectModel" value="filter.facadeName" />
- <input t:type="submit" class="ico22px refresh" t:id="refreshByFacade" value="Refresh"
- title="Rafraîchir les zones et les métiers en fonction de la façade sélectionnée"/>
- <t:label t:for="sectorName" />:
- <select t:type="select" t:id="sectorName" t:model="sectorSelectModel" value="filter.sectorName" />
- <input t:type="submit" class="ico22px refresh" t:id="refreshBySector" value="Refresh"
- title="Rafraîchir les métiers en fonction de la zone sélectionnée"/>
- <t:label t:for="sampleRow" />:
- <input t:type="select" t:id="sampleRow" t:model="sampleRowSelectModel" value="sampleRowId" />
-
- <!--<t:label t:for="program" />:
- <input t:type="select" t:id="program" t:model="programSelectModel" value="programId" />-->
- </div>
- <div class="filterRow">
- <input t:type="checkbox" t:id="estimatedTides" value="filter.estimatedTides" />
- <t:label t:for="estimatedTides" title="L'effort d'observations estimé équivaut au nombre de contacts validés ou non par la société. Les contacts refusés par le programme ne sont pas pris en compte" />
- </div>
- <div class="t-beaneditor-row aright">
- <input t:type="submit" class="ico search-32px" t:id="search" value="Search" title="Création du graphique en fonction des filtres saisies"/>
- <input t:type="submit" class="ico undo" t:id="reset" value="Reset" title="Remettre les filtres par défaut" />
- </div>
- </div>
- </form>
- <!--</div>-->
- </div>
- </fieldset>
<p class="so-chart-types">
<a t:type="actionlink" t:context="[actionChartType,'BAR']">
<img src="${asset:context:}/img/chart-bar.png" alt="Diagramme en bâtons" title="Diagramme en bâtons" />
@@ -180,7 +182,7 @@
<!-- IND1 : COMPLIANCE_BOARDING -->
<t:block t:id="ind2">
<div class="ind-table acenter" id="so-noncomplianceboarding">
- <h2>Non respect du nombre d'observateurs embarqués</h2>
+ <h2>Respect du nombre d'observateurs embarqués</h2>
<br />
<t:if t:test="user.admin">
<p>
1
0